CRYPTO NEWS

Nifty News: Zilliqa teases Web3 gaming console, Funko teams up with Warner Bros. and more

Specifications on Zilliqa’s “user-friendly” console are yet to be revealed, but a prototype design resembling an Xbox console has been released.

Ethers.js not detecting Contract emitting event

I have contract factory that creates a new contract and it emits an event called Created when a new FundMe contract is created: contract FundFactory { // Events event Created( address indexed owner, address indexed assetAddress, address indexed fundAddress ); // Variables address public i_owner; FundMe[] public s_funds; constructor() { i_owner = msg.sender; } function::Listen

I have contract factory that creates a new contract and it emits an event called Created when a new FundMe contract is created:

contract FundFactory {     // Events     event Created(         address indexed owner,         address indexed assetAddress,         address indexed fundAddress     );      // Variables     address public i_owner;     FundMe[] public s_funds;      constructor() {         i_owner = msg.sender;     }  function createFundMe(         uint256 lockTime,         address assetAddress,         address assetAddress2,     ) public returns (address) {         FundMe fundMe = new FundMe(lockTime, assetAddress, assetAddress2);         s_funds.push(fundMe);         emit Created(msg.sender, assetAddress, address(fundMe));     } 

I’m trying to access the newly created FundMe contract, so I’m trying to get the address from the event that gets emitted. I have tried to listen for the event by using ether’s provider.on function, but I haven’t been able to get that to fire. Here is my code for that:

await deploy("FundFactory", {         from: deployer,         args: [],         log: true,         waitConfirmations: networkConfig[chainId].blockConfirmations || 1,     })      const fundFactory = await ethers.getContract("FundFactory")      const createFundTx = await fundFactory.createFundMe(         locktime,         assetAddress,         assetAddress2     )      await createFundTx.wait(1)      const filter = {         address: fundFactory.address,         topics: [utils.id("Created(address,address,address)")],     }     const provider = ethers.getDefaultProvider()     provider.on(filter, (owner, assetAddress, fundAddress) => {         console.log("hello")         console.log(owner, assetAddress, fundAddress)     }) 

The deploy goes through without erroring, but not only am I not able to print out the actual contents of the event,the console.log(hello) doesn’t even get fired… I’m really not sure what I’m doing wrong here. Could it be because I’m using the hardhat local environment yarn hardhat deploy?

Nifty News: Zilliqa teases Web3 gaming console, Funko teams up with Warner Bros. and more

Shopping cart
There are no products in the cart!
Continue shopping
0