该代码在BEP20代币书写中意味着什么

发布于 2025-02-04 09:09:29 字数 517 浏览 2 评论 0原文

我试图了解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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烂柯人 2025-02-11 09:09:29

在第一行中,他将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() and total 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 be WBNB 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() and total supply.

More information about pair on documentation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文