如何测试以下内容(松露测试或开发控制台):
await nft.transferFrom(accounts[0], accounts[1], 1);
await nft.transferFrom(accounts[1], accounts[0],1);第二行抛出
ERC721: transfer caller is not owner nor approved如果我换到
await nft.transferFrom(accounts[1], accounts[0],1,{from: accounts[1]});引发以下异常:
Ownable: caller is not the owner我如何测试从另一个帐户转帐然后是accounts[0]?
发布于 2021-03-02 11:46:05
松露支持所有调用的可选参数。您至少可以在这里看到它们(即使这是默认参数,它对于任何调用都是有效的):https://github.com/trufflesuite/truffle/tree/master/packages/contract#mycontractdefaultsnew_默认值
因此,您可以只需要一个额外的参数from,如:await nft.transferFrom(accounts[0], accounts[1], 1, { from: accounts[1] });
https://ethereum.stackexchange.com/questions/94114
复制相似问题