From e8ca67fc9a2ebd60c8ab08c9cdcf5c7ecdbd0c5d Mon Sep 17 00:00:00 2001 From: Yuriy Glukhov Date: Tue, 6 Aug 2019 11:57:45 +0300 Subject: [PATCH] Updated web3 api usage --- beacon_chain/genesis.nim | 5 ++--- beacon_chain/validator_keygen.nim | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/beacon_chain/genesis.nim b/beacon_chain/genesis.nim index b8e4f56a7..f40f96084 100644 --- a/beacon_chain/genesis.nim +++ b/beacon_chain/genesis.nim @@ -36,9 +36,8 @@ proc processDeposit(d: DepositCollector, web3: Web3): Future[BeaconState] {.asyn proc getGenesisFromEth1*(conf: BeaconNodeConf): Future[BeaconState] {.async.} = let web3 = await newWeb3(conf.depositWeb3Url) - var contractAddress = Address.fromHex(conf.depositContractAddress) - var defaultAccount: Address - var ns = web3.contractSender(DepositContract, contractAddress, defaultAccount) + let contractAddress = Address.fromHex(conf.depositContractAddress) + let ns = web3.contractSender(DepositContract, contractAddress) var deposits = DepositCollector() deposits.queue = newAsyncQueue[QueueElement]() diff --git a/beacon_chain/validator_keygen.nim b/beacon_chain/validator_keygen.nim index 216171a00..9deb4736e 100644 --- a/beacon_chain/validator_keygen.nim +++ b/beacon_chain/validator_keygen.nim @@ -62,9 +62,9 @@ proc main(totalValidators: int, outputDir: string, generateFakeKeys: bool, depos writeFile(depositFn, dp) if not web3.isNil: - let depositContract = web3.contractSender(DepositContract, contractAddress, eth1Addresses[i]) - depositContract.value = 32.u256.ethToWei - let tx = await depositContract.deposit(Bytes48(pubKey.getBytes()), Bytes32(withdrawalCredentials.data), Bytes96(dp.data.signature.getBytes())) + web3.defaultAccount = eth1Addresses[i] + let depositContract = web3.contractSender(DepositContract, contractAddress) + let tx = await depositContract.deposit(Bytes48(pubKey.getBytes()), Bytes32(withdrawalCredentials.data), Bytes96(dp.data.signature.getBytes())).send(value = 32.u256.ethToWei) if generateFakeKeys: echo "Keys generated by this tool are only for testing!"