该代码在BEP20代币书写中意味着什么
我试图了解BEP20代码的这一行是什么意思,它是以坚固的
constructor () {
_rOwned[owner()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), owner(), _tTotal);
I'm trying to understand what this lines of BEP20 code mean, it is written in solidity
constructor () {
_rOwned[owner()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), owner(), _tTotal);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在第一行中,他将UnisWapv2Router实例化,将地址路由器指向Pancakeswap。这是因为,他想用他的令牌和BNB创建一个流动性池,实际上,在他称之为
createpair()
的实施操作之后,他可以在智能合约和地址weth()之间创建这对这对() 。重要: weth()是提供者部署智能合约的链条本机包装的硬币地址的功能。例如:如果我在以太坊区块链上创建一个对uniswap路由器进行实现的对,则weth()将返回有关
weth
(包装以太)地址的地址。相反,如果我将其地址呈现在二元智能链中的Uniswap路由器(因此在这种情况下是指pancakeswap),则WETH()的值将为wbnb
地址。经过这一行之后,我假设他不包括交易支付费用
lands()
地址(谁首次部署了智能合约)和智能合约本身。Finally he emitted a Transfer event passing :
address(0)
(0x0000000000000000000000000000000000000000),owner()
andtotal supply
.有关对文档的更多信息。
In the first lines, he instanciate UniswapV2Router pointing the address router to PancakeSwap. This because, he want to create a liquidity pool with his TOKEN and BNB, indeed after this instanciating operation he call
createPair()
that allows him to create this pair between his smart contract and the address WETH().IMPORTANT: WETH() is a function that provider the chain native wrapped coin address where smart contract was deployed. For example: If I create a pair instanciating Uniswap router on Ethereum blockchain then WETH() will return address about
WETH
(Wrapping Ether) address present into Etheruem. On the contrary if I instanciate Uniswap Router with its address present into binance smart chain (and so I refers to Pancakeswap in this case), the value of WETH() will beWBNB
address.After this lines of code, I assume that he excluded from paying a fee for only transactions the
owner()
address (who deployed the smart contract for the first time) and smart contract itself.Finally he emitted a Transfer event passing :
address(0)
(0x0000000000000000000000000000000000000000),owner()
andtotal supply
.More information about pair on documentation.