我有一个简单的代码,旨在监听 Uniswap Router V3 协议事件
import { ethers } from "ethers";
import { ALCHEMY_HTTP } from "./const";
async function main() {
const provider = new ethers.providers.JsonRpcProvider(ALCHEMY_HTTP);
const filter = {
address: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
};
provider.on(filter, (event: any) => {
console.log(event);
});
}
main();
我没有收到任何事件。如果我将地址更改为例如 Metamask 路由器或 DAI 合约,我会收到相应的事件。
我确定 Uniswap Router 版本 3 的合约地址是正确的。合约地址如下链接: https ://docs.uniswap.org/protocol/reference/deployments
而且当我检查 etherscan 时,它有很多事务和事件。 https://etherscan.io/address/0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45
智能合约在监听事件上有什么区别?!
为什么我只接收 Uniswap V3 路由器的事件?