6

有人尝试过safesun那种销毁+自动添加流动池的代币吗?根据他们的开源代码去部署,却发...

 3 years ago
source link: https://learnblockchain.cn/question/2090
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
有人尝试过safesun那种销毁+自动添加流动池的代币吗?根据他们的开源代码去部署,却发现没法交易。 | 登链社区 | 技术问答

5 有人尝试过safesun那种销毁+自动添加流动池的代币吗?根据他们的开源代码去部署,却发现没法交易。

我分析了他们在区块链浏览器上的开源代码,它的“自动添加流动性”,奥秘在_transfer的内部方法里,语句如下:

uint256 contractTokenBalance = balanceOf(address(this));

if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}

bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity;
if (
overMinTokenBalance &&
!inSwapAndLiquify &&
from != uniswapV2Pair &&
swapAndLiquifyEnabled
) {
contractTokenBalance = numTokensSellToAddToLiquidity;
//add liquidity
swapAndLiquify(contractTokenBalance);
}

这么看起来,似乎应在部署之后,转一点代币,给代币合约本身(address(this)),在代码开篇的注释里,也是这样写的

但我周围所有尝试过这套代码的朋友都反应,部署并添加流动池之后,要么是币不能买,要么是池子撤不掉。

所以,有成功尝试过这套代码的同学吗~

最佳答案 2021-05-25 14:32

使用过,没问题。

Tiny熊 - 布道者
擅长:智能合约,以太坊 | 采纳率 41% | 回答于 2021-05-25 14:32

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK