首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用ether请求发送busd事务

如何使用ether请求发送busd事务
EN

Ethereum用户
提问于 2022-01-15 18:09:10
回答 1查看 300关注 0票数 0

我尝试在dapp中设置一个函数,要求用户将X B美元发送到钱包中。问题是,我不知道如何让它要求BUSD而不是ETH。

代码语言:javascript
复制
    try {
        if (!window.ethereum)
            throw new Error('No ethereum provider found');
        await window.ethereum.request({method: "eth_requestAccounts"});
        const provider = new ethers.providers.Web3Provider(window.ethereum);
        const signer = await provider.getSigner();
        ethers.utils.getAddress(address);
        const tx = await signer.sendTransaction({
            to: address,
            value: ethers.utils.parseEther("0.1"),
        });
        console.log(tx);
    } catch (e) {
        console.log(e.message);
    }

这是我的代码,但我想发送BUSD,而不是ETH。

EN

回答 1

Ethereum用户

发布于 2022-01-15 19:02:04

令牌传输的工作方式非常不同。

要传输X个令牌Y,您必须调用Y的令牌契约的传输功能。因此,您将事务发送给令牌契约,而不是令牌的接收方。然后,事务数据决定谁是令牌的接收方,以及有多少令牌。

你应该研究令牌转移更多,有很多教程可以在线。

票数 0
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/119010

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档