15

erc721合约怎么接收usdt?求大佬解答

 3 years ago
source link: https://learnblockchain.cn/question/2698
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

erc721合约怎么接收usdt?求大佬解答

是这样的,我目前编写了一个区块链游戏的智能合约,用户在购买nft的时候,希望让用户先授权一定数额的usdt,再进行交易,我又看到其他的文章,使用 usdt.approve(address(this), amount);
再使用 usdt.transferFrom(fromAddr,address(this), amount);在我测试的时候,调用了授权一定数额的usdt,我的钱包里面没有usdt,也可以点击确定,然而并没有任何效果,感觉像是执行了一步什么效果都没有的操作;代码如下,不知道是不是我调用的approve方法不对,我看有的是继承的StandardToken.sol,我在openzeppelin那里也没有找到这个.png

最佳答案 2天前

让用户授权, 是需要让用户直接在前端调用 USDT 合约的approve. 而不是通过你的合约调用(通过你的合约调用approve, 那就是合约授权给合约)。

那用户如何才能调用usdt合约的approve呢?因为调用别的合约的话,是需要abi和合约地址的,这个能获取到吗?

Tiny熊 - 布道者
擅长:智能合约,以太坊 | 采纳率 39% | 回答于 2天前

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK