Skip to content

Commit

Permalink
update deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
pgherveou committed Oct 24, 2024
1 parent 8bb9db2 commit 2efc281
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions substrate/frame/revive/rpc/examples/rust/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,25 @@ async fn main() -> anyhow::Result<()> {
println!("\n\n=== Deploying contract ===\n\n");

let nonce = client.get_transaction_count(account.address(), BlockTag::Latest.into()).await?;
let hash = send_transaction(&account, &client, U256::zero(), input.into(), None).await?;
let hash =
send_transaction(&account, &client, 5_000_000_000_000u128.into(), input.into(), None)
.await?;

println!("Deploy Tx hash: {hash:?}");
let ReceiptInfo { block_number, gas_used, contract_address, .. } =
wait_for_receipt(&client, hash).await?;

let contract_address = contract_address.unwrap();
assert_eq!(contract_address, create1(&account.address(), nonce.try_into().unwrap()));

println!("Receipt:");
println!("- Block number: {block_number}");
println!("- Gas used: {gas_used}");
println!("- Contract address: {contract_address:?}");
let balance = client.get_balance(contract_address, BlockTag::Latest.into()).await?;
println!("- Contract balance: {balance:?}");

let contract_address = create1(&account.address(), nonce.try_into().unwrap());
println!("\n\n=== Calling contract ===\n\n");

let hash =
send_transaction(&account, &client, U256::zero(), Bytes::default(), Some(contract_address))
.await?;
Expand Down

0 comments on commit 2efc281

Please sign in to comment.