Fixed deposit contract deployment

This commit is contained in:
Yuriy Glukhov 2019-10-30 15:18:55 +02:00 committed by zah
parent 7fa7c8ee53
commit abbe4075fa
3 changed files with 4 additions and 5 deletions

View File

@ -39,9 +39,6 @@ type
contract(Deposit): contract(Deposit):
proc drain() proc drain()
proc getTransactionReceipt(web3: Web3, tx: TxHash): Future[ReceiptObject] {.async.} =
result = await web3.provider.eth_getTransactionReceipt(tx)
proc deployContract*(web3: Web3, code: string): Future[Address] {.async.} = proc deployContract*(web3: Web3, code: string): Future[Address] {.async.} =
var code = code var code = code
if code[1] notin {'x', 'X'}: if code[1] notin {'x', 'X'}:
@ -53,7 +50,7 @@ proc deployContract*(web3: Web3, code: string): Future[Address] {.async.} =
gasPrice: 1.some) gasPrice: 1.some)
let r = await web3.send(tr) let r = await web3.send(tr)
let receipt = await web3.getTransactionReceipt(r) let receipt = await web3.getMinedTransactionReceipt(r)
result = receipt.contractAddress.get result = receipt.contractAddress.get
proc sendEth(web3: Web3, to: string, valueEth: int): Future[TxHash] = proc sendEth(web3: Web3, to: string, valueEth: int): Future[TxHash] =

View File

@ -55,8 +55,10 @@ DOCKER_BEACON_NODE="docker run -v $DEPOSITS_DIR_ABS:/deposits_dir -v $NETWORK_DI
make deposit_contract make deposit_contract
if [ "$ETH1_PRIVATE_KEY" != "" ]; then if [ "$ETH1_PRIVATE_KEY" != "" ]; then
echo "Deploying deposit contract..."
DEPOSIT_CONTRACT_ADDRESS=$(./build/deposit_contract deploy $WEB3_URL_ARG --private-key=$ETH1_PRIVATE_KEY) DEPOSIT_CONTRACT_ADDRESS=$(./build/deposit_contract deploy $WEB3_URL_ARG --private-key=$ETH1_PRIVATE_KEY)
DEPOSIT_CONTRACT_ADDRESS_ARG="--deposit-contract=$DEPOSIT_CONTRACT_ADDRESS" DEPOSIT_CONTRACT_ADDRESS_ARG="--deposit-contract=$DEPOSIT_CONTRACT_ADDRESS"
echo "Done: $DEPOSIT_CONTRACT_ADDRESS"
fi fi
cd docker cd docker

2
vendor/nim-web3 vendored

@ -1 +1 @@
Subproject commit ecd2fb45a63f105c026fa9a8515daf288a57c13d Subproject commit 37fc46111489bc521731b59f52f42b6327fa7829