Open songtianyi opened 1 year ago
I'm running a ganache local testnet to test rust-web3 contract deployment example.
ganache --logging.verbose
And I didn't change the code logic exception the network and accounts
rust-web3 on ξ master [!?] is π¦ v0.19.0 via π¦ v1.61.0 β― git diff diff --git a/examples/contract.rs b/examples/contract.rs index c45e7aa..968b6ac 100644 --- a/examples/contract.rs +++ b/examples/contract.rs @@ -10,7 +10,8 @@ async fn main() -> web3::contract::Result<()> { let http = web3::transports::Http::new("http://localhost:8545")?; let web3 = web3::Web3::new(http); - let my_account = hex!("d028d24f16a8893bd078259d413372ac01580769").into(); + // let my_account = hex!("d028d24f16a8893bd078259d413372ac01580769").into(); + let my_account = web3.eth().accounts().await.unwrap().get(0).unwrap().clone(); // Get the contract bytecode for instance from Solidity compiler let bytecode = include_str!("./res/contract_token.code").trim_end(); // Deploying a contract @@ -18,7 +19,7 @@ async fn main() -> web3::contract::Result<()> { .confirmations(0) .options(Options::with(|opt| { opt.value = Some(5.into()); - opt.gas_price = Some(5.into()); + opt.gas_price = Some(875000000.into()); opt.gas = Some(3_000_000.into()); })) .execute(
When I run this example error happened
Transaction: 0xbec3276a41fa94f2a55a8e75f09ae17906787fb7aee8f870be4afd9dbe2d2bfb Contract created: 0xdf0a17753b9dbf6b0e7576c385462d506d38c7c6 Gas usage: 116175 Block number: 1 Block time: Tue Sep 27 2022 13:07:58 GMT+0800 (δΈε½ζ εζΆι΄) Runtime error: revert > eth_getTransactionReceipt: [ > "0xbec3276a41fa94f2a55a8e75f09ae17906787fb7aee8f870be4afd9dbe2d2bfb" > ]
I'm running a ganache local testnet to test rust-web3 contract deployment example.
And I didn't change the code logic exception the network and accounts
When I run this example error happened