Hey guys! Does anybody know how can I fetch the contract address in my abis after migration to the instance of a contract in mocha chai truffle test.js file so it wont change over the next run? I'll explain: I call the item.nft.transferFrom(address(this), msg.sender, item.tokenId) method in my main contract and as a 1st arg I use address(this), not the item.ownerOf() - a little bit paranoid about it for security reasons.
Dec 6, 2022, 5:42 PM
so when I try to call the function calling this method of transfer I got the error
Error: Returned error: VM Exception while processing transaction: revert ERC721: transfer from incorrect owner
because the address of a contract is different over every run
Error: Returned error: VM Exception while processing transaction: revert ERC721: transfer from incorrect owner
because the address of a contract is different over every run
so the function in test file tries to transfer from contract address that was migrated, stores in abis now, and this address differs from the chai mocha instance contract address
or i got it wrong :D
nevermind, there's a mistake somewhere in the test block, fails on the different function
Dec 6, 2022, 6:42 PM
Love how people solve their issues without any assistance 😂
One thing I have discovered is that, when we share our code, we tend to see our mistakes
Maybe it's because developers are lonely so no one to talk the issue with
Buy a debug ducky @DigMyCode
It really helps, to some extent 🙂
It really helps, to some extent 🙂
Dec 6, 2022, 6:46 PM
that's for sure 😄
Dec 6, 2022, 6:47 PM