-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathrun_pyramid_simple.rb
58 lines (45 loc) · 1.64 KB
/
run_pyramid_simple.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# encoding: utf-8
require 'universum'
require_relative './pyramid_simple'
###
# test contract
## setup test accounts with starter balance
Account[ '0x1111' ].balance = 1_000_000
Account[ '0xaa11' ].balance = 1_000_000
Account[ '0xaa22' ].balance = 1_000_000
Account[ '0xbb11' ].balance = 1_000_000
Account[ '0xbb22' ].balance = 1_000_000
Account[ '0xbb33' ].balance = 1_000_000
Account[ '0xbb44' ].balance = 1_000_000
Account[ '0xcc11' ].balance = 1_000_000
Account[ '0xcc22' ].balance = 1_000_000
## pretty print (pp) all known accounts with balance
pp Uni.accounts
## genesis - create contract
pyramid = Uni.send_transaction( from: '0x1111', value: 1_000_000, data: SimplePyramid ).contract
pp pyramid
## level 1
Uni.send_transaction( from: '0xaa11', to: pyramid, value: 1_000_000 )
pp pyramid
Uni.send_transaction( from: '0xaa22', to: pyramid, value: 1_000_000 )
pp pyramid
## level 2
Uni.send_transaction( from: '0xbb11', to: pyramid, value: 1_000_000 )
pp pyramid
Uni.send_transaction( from: '0xbb22', to: pyramid, value: 1_000_000 )
pp pyramid
Uni.send_transaction( from: '0xbb33', to: pyramid, value: 1_000_000 )
pp pyramid
Uni.send_transaction( from: '0xbb44', to: pyramid, value: 1_000_000 )
pp pyramid
# level 3
Uni.send_transaction( from: '0xcc11', to: pyramid, value: 1_000_000 )
pp pyramid
Uni.send_transaction( from: '0xcc22', to: pyramid, value: 1_000_000 )
pp pyramid
## pretty print (pp) all known accounts with balance
pp Uni.accounts
Uni.send_transaction( from: '0x1111', to: pyramid, data: [:withdraw] )
pp pyramid
## pretty print (pp) all known accounts with balance
pp Uni.accounts