Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth/contract: ensure address arrays support #194

Merged
merged 1 commit into from
Dec 29, 2022
Merged

Conversation

q9f
Copy link
Owner

@q9f q9f commented Dec 29, 2022

fix #143

geth = Client.create "/tmp/geth.ipc"
# => #<Eth::Client::Ipc:0x000055a8e12bccc8 @gas_limit=21000, @id=0, @max_fee_per_gas=0.4269e11, @max_priority_fee_per_gas=0.101e10, @path="/tmp/geth.ipc">
contract = Contract.from_file file: "spec/fixtures/contracts/address_storage.sol"
# => #<Eth::Contract::AddressStorage:0x000055a8e1116b30>
geth.deploy_and_wait contract
# => "0x7aD1FF3AFcA45262C22E32367fAF1B91e24A0909"
geth.call(contract, "retrieveMyAddress")
# => "0x0000000000000000000000000000000000000000"
geth.transact_and_wait(contract, "storeMyAddress", Key.new.address.to_s)
# => "0x5a6728574db598f515e2f93b872d73239efa0470672487325888ce71062835aa"
geth.call(contract, "retrieveMyAddress")
# => "0xbdc4d90b1d46353eb65eca3d0aeb968039f8aa9d"
geth.transact_and_wait(contract, "storeMyArray", [Key.new.address.to_s, Key.new.address.to_s])
# => "0x661ea3fdfdcca66832898917790ea104e54b25753eeb219a5a2b3e7f842005d5"
geth.call(contract, "retrieveMyArray", 0)
# => "0xae2cbef824c78274c6a4910461658e8a390cd9ce"
geth.call(contract, "retrieveMyArray", 1)
# => "0xdd902b8e5d69c08c914c94acc2c1115b6ed74029"

@codecov-commenter
Copy link

codecov-commenter commented Dec 29, 2022

Codecov Report

Merging #194 (b9613a5) into main (cb79fcb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #194   +/-   ##
=======================================
  Coverage   99.76%   99.76%           
=======================================
  Files          74       74           
  Lines        4321     4332   +11     
=======================================
+ Hits         4311     4322   +11     
  Misses         10       10           
Impacted Files Coverage Δ
spec/eth/contract_spec.rb 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@q9f q9f merged commit 7fb4ec6 into main Dec 29, 2022
@q9f q9f deleted the q9f/contract/arrays branch December 29, 2022 15:02
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is it possible to pass an address array to an eth contract function with transact_and_wait ?
2 participants