chore: fix examples

This commit is contained in:
Georgios Konstantopoulos 2020-06-11 09:45:14 +03:00
parent 7dbc2d4f25
commit 9cad87a879
No known key found for this signature in database
GPG Key ID: FA607837CD26EDBC
4 changed files with 8 additions and 8 deletions

View File

@ -13,7 +13,7 @@ pub(crate) fn imports() -> TokenStream {
abi::{Abi, Token, Detokenize, InvalidOutputType, Tokenizable},
types::*, // import all the types so that we can codegen for everything
},
contract::{Contract, ContractCall, Event, Lazy},
contract::{Contract, builders::{ContractCall, Event}, Lazy},
signers::{Client, Signer},
providers::JsonRpcClient,
};

View File

@ -1,7 +1,7 @@
use anyhow::Result;
use ethers::{
prelude::*,
utils::{GanacheBuilder, Solc},
utils::{Ganache, Solc},
};
use std::convert::TryFrom;
@ -23,7 +23,7 @@ async fn main() -> Result<()> {
// 2. launch ganache
let port = 8546u64;
let url = format!("http://localhost:{}", port).to_string();
let _ganache = GanacheBuilder::new().port(port)
let _ganache = Ganache::new().port(port)
.mnemonic("abstract vacuum mammal awkward pudding scene penalty purchase dinner depart evoke puzzle")
.spawn();
@ -38,7 +38,7 @@ async fn main() -> Result<()> {
let client = wallet.connect(provider);
// 6. create a factory which will be used to deploy instances of the contract
let factory = ContractFactory::new(&client, &contract.abi, &contract.bytecode);
let factory = ContractFactory::new(&contract.abi, &contract.bytecode, &client);
// 7. deploy it with the constructor arguments
let contract = factory.deploy("initial value".to_string())?.send().await?;

View File

@ -1,12 +1,12 @@
use anyhow::Result;
use ethers::{prelude::*, utils::GanacheBuilder};
use ethers::{prelude::*, utils::Ganache};
use std::convert::TryFrom;
#[tokio::main]
async fn main() -> Result<()> {
let port = 8545u64;
let url = format!("http://localhost:{}", port).to_string();
let _ganache = GanacheBuilder::new()
let _ganache = Ganache::new()
.port(port)
.mnemonic("abstract vacuum mammal awkward pudding scene penalty purchase dinner depart evoke puzzle")
.spawn();

View File

@ -1,12 +1,12 @@
use anyhow::Result;
use ethers::{prelude::*, utils::GanacheBuilder};
use ethers::{prelude::*, utils::Ganache};
use std::convert::TryFrom;
#[tokio::main]
async fn main() -> Result<()> {
let port = 8546u64;
let url = format!("http://localhost:{}", port).to_string();
let _ganache = GanacheBuilder::new().port(port).spawn();
let _ganache = Ganache::new().port(port).spawn();
// connect to the network
let provider = Provider::<Http>::try_from(url.as_str())?;