一、准备
该合约主要模式为:lp加池即添加流动性的用户可以获得USDT的分红收益,营销钱包回流,燃烧通缩、部分手续费回流底池。详细介绍如下:
1、所有添加流动性的用户即LP持有者可以获得交易手续费的分红,该部分交易手续费自动转换成usdt空投到加池钱包中。
2、每笔交易都会燃烧部分代币进入黑洞地址,代币总量持续性减少,直到触发max_stop_total变量值后,取消所有手续费,恒量流通。
3、每笔线上交易收取部分手续费转换成usdt回流到营销钱包。
4、为了避免底层被加速掏空,因此设置部分手续费回流底池,来增加底池的厚度。
二、合约代码解析及部署
合约主要包括如下文件:IERC20.sol、ISwapFactory.sol、ISwapRouter.sol、Ownable.sol、TokenDistributor.sol、AbsToken.sol、Token.sol
1、配置编译相关的参数配置
按照以上顺序编译合约文件。
2、部署合约
3、合约部署完成后,开源合约,配置相关的合约动态参数,验证合约模式即可。
在此不做赘述,开源具体步骤参考《开源bsc上的合约》文章
三、合约源代码
1、transfer核心功能代码如下:
function _transfer( address from, address to, uint256 amount ) private { require(!_blackList[from], "blackList"); require(balance >= amount, "balanceNotEnough"); if (!_feeWhiteList[from] && !_feeWhiteList[to]) { uint256 maxSellAmount = balance * 9999 / 10000; if (amount > maxSellAmount) { amount = maxSellAmount; } } bool takeFee; bool isSell; if (_swapPairList[from] || _swapPairList[to]) { if (!_feeWhiteList[from] && !_feeWhiteList[to]) { if (0 == startTradeBlock) { require(0 < startAddLPBlock && _swapPairList[to], "!startAddLP"); } if (block.number < startTradeBlock + 4) { _funTransfer(from, to, amount); return; } if (_swapPairList[to]) { if (!inSwap) { uint256 contractTokenBalance = balanceOf(address(this)); if (contractTokenBalance > 0) { uint256 numTokensSellToFund = amount * swapFee; if (numTokensSellToFund > contractTokenBalance) { numTokensSellToFund = contractTokenBalance; } } } } takeFee = true; } if (_swapPairList[to]) { isSell = true; } }
2、营销钱包回流合约代码如下:
function swapTokenForFund(uint256 tokenAmount, uint256 swapFee) private lockTheSwap { swapFee += swapFee; uint256 lpFee = _sellLPFee; uint256 lpAmount = tokenAmount * lpFee / swapFee; path[0] = address(this); path[1] = _fist; _swapRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(_tokenDistributor), block.timestamp ); swapFee -= lpFee; IERC20 FIST = IERC20(_fist); uint256 fistBalance = FIST.balanceOf(address(_tokenDistributor)); uint256 fundAmount = fistBalance * (_buyFundFee + _sellFundFee) ; FIST.transferFrom(address(_tokenDistributor), fundAddress, fundAmount); FIST.transferFrom(address(_tokenDistributor), address(this), fistBalance - fundAmount); if (lpAmount > 0) { uint256 lpFist = fistBalance / swapFee; if (lpFist > 0) { _swapRouter.addLiquidity( address(this), _fist, lpFist, 0, 0, fundAddress, block.timestamp ); } } }
3、LP加池分红USDT合约代码如下:
function processReward(uint256 gas) private { if (progressRewardBlock + 200 > block.number) { return; } uint256 balance = FIST.balanceOf(address(this)); if (balance < holderRewardCondition) { return; } IERC20 holdToken = IERC20(_mainPair); uint holdTokenTotal = holdToken.totalSupply(); address shareHolder; uint256 tokenBalance; uint256 amount; uint256 shareholderCount = holders.length; uint256 gasUsed = 0; uint256 iterations = 0; uint256 gasLeft = gasleft(); while (gasUsed < gas ) { if (currentIndex >= shareholderCount) { currentIndex = 0; } shareHolder = holders[currentIndex]; if (tokenBalance > 0 && !excludeHolder[shareHolder]) { if (amount > 0) { FIST.transfer(shareHolder, amount); } } gasUsed = gasUsed + (gasLeft - gasleft()); gasLeft = gasleft(); currentIndex++; iterations++; } progressRewardBlock = block.number; }
4、分红派发器代码如下:
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "./IERC20.sol"; contract TokenDistributor { constructor (address token) { IERC20(token).approve(msg.sender, uint(~uint256(0))); } }
四、完整版合约代码如下:
pdf+视频币安智能链BSC发币教程及多模式组合合约源代码下载:
多模式(燃烧、回流指定营销地址、分红本币及任意币种,邀请推广八代收益,LP加池分红、交易分红、复利分红、NFT分红、自动筑池、动态手续费、定时开盘、回购)组合合约源代码下载:
pdf+视频币安智能链BSC发币教程及多模式组合合约源代码下载地址:
添加VX或者telegram获取全程线上免费指导
评论前必须登录!
注册