大家好,希望一切都好吗?我需要你的帮助。
注意:我已经知道如何监控内存池了,但我说的是智能契约的功能.
作为内存池与挂起的Tx,我想做同样的,但得到挂起的函数调用从智能契约。
如果我从智能合同中调用函数“交换”或“转移”,我如何监控它?
真诚的迈克
发布于 2023-01-07 02:08:34
const AddressOfToken = '0x123aBc';
const AddressOfToken_ABI = require('./"yourABIname".json')
//File in same folder with ABI of CONTRACT
const Contract = new ethers.Contract(AddressOfToken ,AddressOfToken_ABI ,
provider);
//Need add an endpoint to provider (ETH, BSC ...)
Contract.on("Transfer",async (from, to, value, event, ) => {
const info = {
from: from,
to: to,
value: ethers.utils.formatUnits(value, "DecimalfromContractHere"),
event: event,
hash : event.transactionHash,
: event.args[1],
};
})由衷地
https://ethereum.stackexchange.com/questions/142480
复制相似问题