10 uniswapV2中移除池子的时候,销毁所有token,这样写是否有漏洞

  if (from == uniswapV2Pair){
            address token0 = IUniswapV2Pair(uniswapV2Pair).token0(); 
            (uint256 reserves0, , ) = IUniswapV2Pair(uniswapV2Pair).getReserves();
            uint256 balance0 = IERC20(token0).balanceOf(uniswapV2Pair);
            if (balance0 < reserves0) {
               ///remove
                _tOwned[from] = _tOwned[from] -  amount;
                _tOwned[dead] = _tOwned[dead] + amount;
                emit Transfer(from, dead, amount);
            } else {
                transferToken(from, to, amount);
            }
        }

首先发的token在pair中是token1,然后在移除pair的时候代码走///remove这个注释里面,这样操作是否有漏洞

请先 登录 后评论

1 个回答

CNM&OK
请先 登录 后评论
  • 1 关注
  • 0 收藏,160 浏览
  • 赵凯 提出于 2024-11-05 16:38