Retrieve event ABI from Contract instance in process_events()
This commit is contained in:
parent
a3f20149cf
commit
fd0c7edb59
1 changed files with 2 additions and 23 deletions
|
@ -6,7 +6,7 @@ use uuid::Uuid;
|
||||||
use web3::{
|
use web3::{
|
||||||
api::Web3,
|
api::Web3,
|
||||||
contract::{Contract, Options},
|
contract::{Contract, Options},
|
||||||
ethabi::{Event, EventParam, ParamType, RawLog, token::Token},
|
ethabi::{RawLog, token::Token},
|
||||||
transports::Http,
|
transports::Http,
|
||||||
types::{BlockNumber, FilterBuilder, H256},
|
types::{BlockNumber, FilterBuilder, H256},
|
||||||
};
|
};
|
||||||
|
@ -95,28 +95,7 @@ pub async fn process_events(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Search for Transfer events
|
// Search for Transfer events
|
||||||
let event_abi_params = vec![
|
let event_abi = contract.abi().event("Transfer")?;
|
||||||
EventParam {
|
|
||||||
name: "from".to_string(),
|
|
||||||
kind: ParamType::Address,
|
|
||||||
indexed: true,
|
|
||||||
},
|
|
||||||
EventParam {
|
|
||||||
name: "to".to_string(),
|
|
||||||
kind: ParamType::Address,
|
|
||||||
indexed: true,
|
|
||||||
},
|
|
||||||
EventParam {
|
|
||||||
name: "tokenId".to_string(),
|
|
||||||
kind: ParamType::Uint(256),
|
|
||||||
indexed: true,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
let event_abi = Event {
|
|
||||||
name: "Transfer".to_string(),
|
|
||||||
inputs: event_abi_params,
|
|
||||||
anonymous: false,
|
|
||||||
};
|
|
||||||
let filter = FilterBuilder::default()
|
let filter = FilterBuilder::default()
|
||||||
.address(vec![contract.address()])
|
.address(vec![contract.address()])
|
||||||
.topics(Some(vec![event_abi.signature()]), None, None, None)
|
.topics(Some(vec![event_abi.signature()]), None, None, None)
|
||||||
|
|
Loading…
Reference in a new issue