parent
e19440c94d
commit
0bb04f362e
@ -1,21 +0,0 @@ |
|||||||
require './lib/w3' |
|
||||||
|
|
||||||
url = "http://localhost:8545" |
|
||||||
http_client = W3::Http_Client.new(url) |
|
||||||
|
|
||||||
eth = W3::ETH.new(http_client) |
|
||||||
|
|
||||||
accounts = eth.get_accounts |
|
||||||
pp accounts |
|
||||||
|
|
||||||
puts "Block number: #{eth.get_block_number}" |
|
||||||
|
|
||||||
abi = JSON.parse(File.read(File.join(File.dirname(__FILE__), './build/ArrayTester.abi'))) |
|
||||||
array_tester = W3::Contract.new(eth, abi) |
|
||||||
|
|
||||||
bin = File.read(File.join(File.dirname(__FILE__), './build/ArrayTester.bin')) |
|
||||||
array_tester.at! array_tester.deploy!(bin, {"from" => accounts[0], "gas" => 300000}) |
|
||||||
|
|
||||||
pp array_tester.dynamic_uint([1, 2, 3, 4, 5,]) |
|
||||||
|
|
||||||
#pp array_tester.static_uint([1, 2, 3, 4, 5,]) |
|
@ -1,25 +0,0 @@ |
|||||||
require './lib/w3' |
|
||||||
|
|
||||||
url = "http://localhost:8545" |
|
||||||
http_client = W3::Http_Client.new(url) |
|
||||||
|
|
||||||
eth = W3::ETH.new(http_client) |
|
||||||
|
|
||||||
accounts = eth.get_accounts |
|
||||||
|
|
||||||
abi = JSON.parse(File.read(File.join(File.dirname(__FILE__), './build/Complex.abi'))) |
|
||||||
complex = W3::Contract.new(eth, abi) |
|
||||||
|
|
||||||
bin = File.read(File.join(File.dirname(__FILE__), './build/Complex.bin')) |
|
||||||
complex.at! complex.deploy!(bin, {"from" => accounts[0], "gas" => 300000}, 6, "foo") |
|
||||||
|
|
||||||
pp complex.address |
|
||||||
|
|
||||||
pp complex.get_both |
|
||||||
|
|
||||||
# complex.set_bar_foo! true, {"from" => accounts[0]} |
|
||||||
# pp complex.get_bar_foo |
|
||||||
|
|
||||||
# pp complex.get_foo_boo 66 |
|
||||||
|
|
||||||
# pp complex.get_bro_and_bro_bro |
|
@ -1,21 +0,0 @@ |
|||||||
require './lib/w3' |
|
||||||
|
|
||||||
url = "http://localhost:8545" |
|
||||||
http_client = W3::Http_Client.new(url) |
|
||||||
|
|
||||||
eth = W3::ETH.new(http_client) |
|
||||||
|
|
||||||
accounts = eth.get_accounts |
|
||||||
pp accounts |
|
||||||
|
|
||||||
puts "Block number: #{eth.get_block_number}" |
|
||||||
|
|
||||||
abi = JSON.parse(File.read(File.join(File.dirname(__FILE__), './build/SimpleStorage.abi'))) |
|
||||||
simple_storage = W3::Contract.new(eth, abi) |
|
||||||
|
|
||||||
bin = File.read(File.join(File.dirname(__FILE__), './build/SimpleStorage.bin')) |
|
||||||
simple_storage.at! simple_storage.deploy!(bin, {"from" => accounts[0], "gas" => 300000}) |
|
||||||
|
|
||||||
pp simple_storage.get |
|
||||||
simple_storage.set!(2, {"from" => accounts[0]}) |
|
||||||
pp simple_storage.get |
|
Loading…
Reference in new issue