I have started using buidler for testing/compiling my contracts. In one test i have setup a scenario that a owner attempts to transfer a token to another wallet address.
My contract is inheriting from the Open Zeppelin ERC721.sol one. When trying to call token.safeTransferFrom(args)
it says that safeTransferFrom
is not a a function and when logging it out it shows as undefined
.
Im pretty new to solidity and smart contract coding but looking through the source I can see that the function declaration looks the same as approve
which I can call quite happily using token.approve(args)
.
Is there anything obvious that Im missing?
Best Answer
Ran into this myself as well. Are you using
ethers.js
with Buidler?The
safeTransferFrom
method is overloaded and generally withethers.js
the bare definition is the default method used.If you run
console.log( Object.keys(token) )
you'll see the methods on thetoken
and you'll likely see two definitions ofsafeTransferFrom
. Pick the one you want to use then you can call it like this: