pancakeswap swapexacttokensforeth怎么将wbnb转为bnb | 登链社区 | 技术问答
source link: https://learnblockchain.cn/question/3006
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.
5 pancakeswap swapexacttokensforeth怎么将wbnb转为bnb
用pancakeswap的 swapExactTokensForETH
来实现代币换bnb,但代码结果是换到wbnb
以下两张图分别是我代码的和pancake上换的,发现就差了一个wbnb到bnb的转换:
代码执行的:
pancake上换的:
这最后一步该怎么弄?
最佳答案 2天前
你是在 Web3 代码中实现么? 那应该调用了不同的方法:
获取 BNB 的是:swapExactTokensForETH
获取WBNB 的是:swapExactTokensForToken
在 Solidity 合约的话,可以调用 WBNB 的 withdraw(_amount) 换成 BNB
swapExactTokensForETH
和swapExactTokensForETHSupportingFeeOnTransferTokens
都试过了,我觉得应该是这行有问题:feePath = [token["address"], busdAddress, wbnbAddress]
就是替换到wbnb就没有了,是不是话要再加一个bnb的地址呢?好像又没有地址...
Recommend
-
7
HD钱包的一个问题 | 登链社区 | 技术问答 10 HD钱包的一个问题 ...
-
9
eth_sendRawTransaction发起交易返回的hash 因为某些原因被顶替了,我应该怎么确定这笔交易的新哈希呢? 5 et...
-
11
这笔eth的交易闪电贷了66万个DAI,但是看不懂具体挣了多少钱。能解释通的同学奖励100元 | 登链社区 | 技术问答
-
10
1050 在部署运行链上治理合约及前端代码的时候,无法显示协议和管理地址,请问这个怎么处理?...
-
4
怎么计算合约的 function hash 5 怎么计算合约的 function hash ...
-
47
50 请问 Web.js 钱包怎么获得 Dapp 的授权? ...
-
12
5 怎么把一个okex链上的KIP721从一个地址转入另一个地址。他这个token的合约未验证看不到代码。...
-
2
bytes 怎么传参 一直失败 205 bytes 怎么传参 一直失败 ...
-
4
5 请问怎么用eth在dapp里购买东西呢?weth是怎么转换eth的?...
-
7
EIP提案的序号是怎么定的? | 登链社区 | 技术问答 5 EIP提案的序号是怎么定的?
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK