【发布时间】:2021-09-07 01:30:38
【问题描述】:
我刚开始使用 ETH 和 BSC 构建代币,这是我在许多合约中看到的一种说法。 在 Constructor 方法中,Uniswap 路由器可能与 V2 版本无关。这个有什么用?
constructor () public {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E);
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
// set the rest of the contract variables
uniswapV2Router = _uniswapV2Router;
为什么需要这个初始化?这是什么功能?
如果有人可以提供帮助,不胜感激。
谢谢
【问题讨论】: