Eliminate toWei changes.
This commit is contained in:
parent
d990a76d33
commit
ba606292ab
|
@ -14,7 +14,7 @@ import
|
|||
../networking/network_metadata,
|
||||
web3, web3/confutils_defs, eth/keys, eth/p2p/discoveryv5/random2,
|
||||
stew/[io2, byteutils],
|
||||
../spec/[eth2_merkleization, helpers],
|
||||
../spec/eth2_merkleization,
|
||||
../spec/datatypes/base,
|
||||
../validators/keystore_management
|
||||
|
||||
|
@ -136,13 +136,16 @@ proc sendEth(web3: Web3, to: Eth1Address, valueEth: int): Future[TxHash] =
|
|||
`from`: web3.defaultAccount,
|
||||
gas: Quantity(3000000).some,
|
||||
gasPrice: Quantity(1).some,
|
||||
value: some(valueEth.toWei),
|
||||
value: some(valueEth.u256 * 1000000000000000000.u256),
|
||||
to: some(to))
|
||||
web3.send(tr)
|
||||
|
||||
type
|
||||
DelayGenerator* = proc(): chronos.Duration {.gcsafe, raises: [].}
|
||||
|
||||
proc ethToWei(eth: UInt256): UInt256 =
|
||||
eth * 1000000000000000000.u256
|
||||
|
||||
proc initWeb3(web3Url, privateKey: string): Future[Web3] {.async.} =
|
||||
result = await newWeb3(web3Url)
|
||||
if privateKey.len != 0:
|
||||
|
@ -177,7 +180,7 @@ proc sendDeposits*(deposits: seq[LaunchPadDeposit],
|
|||
SignatureBytes(@(dp.signature.toRaw())),
|
||||
FixedBytes[32](hash_tree_root(dp).data))
|
||||
|
||||
let status = await tx.send(value = 32.toWei, gasPrice = gasPrice)
|
||||
let status = await tx.send(value = 32.u256.ethToWei, gasPrice = gasPrice)
|
||||
|
||||
info "Deposit sent", tx = $status
|
||||
|
||||
|
|
|
@ -523,9 +523,3 @@ proc blockToBlockHeader*(blck: ForkyBeaconBlock): ExecutionBlockHeader =
|
|||
|
||||
proc compute_execution_block_hash*(blck: ForkyBeaconBlock): Eth2Digest =
|
||||
rlpHash blockToBlockHeader(blck)
|
||||
|
||||
func toWei*(eth: SomeInteger): UInt256 =
|
||||
eth.u256 * 1000000000000000000.u256
|
||||
|
||||
func toWei*(eth: UInt256): UInt256 =
|
||||
eth * 1000000000000000000.u256
|
||||
|
|
|
@ -15,7 +15,7 @@ import
|
|||
../beacon_chain/conf,
|
||||
../beacon_chain/el/el_manager,
|
||||
../beacon_chain/networking/eth2_network,
|
||||
../beacon_chain/spec/[eth2_merkleization, helpers],
|
||||
../beacon_chain/spec/eth2_merkleization,
|
||||
../beacon_chain/spec/datatypes/base,
|
||||
../beacon_chain/spec/eth2_apis/eth2_rest_serialization,
|
||||
../beacon_chain/validators/keystore_management,
|
||||
|
@ -518,13 +518,16 @@ proc sendEth(web3: Web3, to: Eth1Address, valueEth: int): Future[TxHash] =
|
|||
`from`: web3.defaultAccount,
|
||||
gas: Quantity(3000000).some,
|
||||
gasPrice: Quantity(1).some,
|
||||
value: some(valueEth.toWei),
|
||||
value: some(valueEth.u256 * 1000000000000000000.u256),
|
||||
to: some(to))
|
||||
web3.send(tr)
|
||||
|
||||
type
|
||||
DelayGenerator = proc(): chronos.Duration {.gcsafe, raises: [].}
|
||||
|
||||
func ethToWei(eth: UInt256): UInt256 =
|
||||
eth * 1000000000000000000.u256
|
||||
|
||||
proc initWeb3(web3Url, privateKey: string): Future[Web3] {.async.} =
|
||||
result = await newWeb3(web3Url)
|
||||
if privateKey.len != 0:
|
||||
|
@ -559,7 +562,7 @@ proc sendDeposits(deposits: seq[LaunchPadDeposit],
|
|||
SignatureBytes(@(dp.signature.toRaw())),
|
||||
FixedBytes[32](hash_tree_root(dp).data))
|
||||
|
||||
let status = await tx.send(value = 32.toWei, gasPrice = gasPrice)
|
||||
let status = await tx.send(value = 32.u256.ethToWei, gasPrice = gasPrice)
|
||||
|
||||
info "Deposit sent", tx = $status
|
||||
|
||||
|
|
Loading…
Reference in New Issue