CertiK reviewed We2net (we2net - audit) on 7 Mar 2023: 17 findings, 0 critical; 5 marked fixed, 2 acknowledged, 10 open.
Report hosted on skynet.certik.com.
Trustblock does not review code.
Statuses are the security firm’s own, from its report.
| Severity | Open | Acknowledged | Fixed |
|---|---|---|---|
| Critical | 0 | 0 | 0 |
| High | 0 | 2 | 0 |
| Medium | 0 | 0 | 2 |
| Low | 10 | 0 | 3 |
It is expected that non-reverting invocations of `transfer(recipient, amount)` that return `true` and where the address in `recipient` equals the address of `msg.sender` (i.e. self-transfers) do not change the balance of address `msg.sender`. However, in `ERC20.transfer` the balance of address `msg.sender` is changed by executing a self-transfer. ## Impact The self-transfer changes the user balance because of the fee.
In the contract `LiquidityHub`, the function `addBnbLiquidity` and `addLiquidity` uses a fixed we2netToekn:USDT exchange rate (10:1) to mint we2Token for adding liquidity: ```solidity=1013 IWe2netToken(we2netToken).mint(pair, amountUsdt.mul(10)); liquidityMint = IPancakePair(pair).mint(address(this)); _mint(_msgSender(), liquidityMint); ``` But the liquidity calculation is a flexible rate as the implementation: https://github.com/pancakeswap/pancake-swap-core/blob/master/contracts/PancakePair.sol#L123 In the function `removeLiquidity`, for the removed liquidity, use could get the USDT returned from swap pair but the we2netToken is transferred to `_recycleManager`. ```solidity=1053 TransferHelper.safeTransfer(we2netToken, _recycleManager, amount0); TransferHelper.safeTransfer(usdtToken, _msgSender(), amount1); emit RemoveLiquidity(_msgSender(), amount, amount1); ``` ### Impact If the user adds liquidity when the reserved token amount deviated from the fixed we2netToekn: USDT exchange rate (10:1), his USDT/WBNB could not get fully returned when removing liquidity. ### Scenario - Suppose, the tax & fee are ignored, the current we2netToekn:USDT swap pair reserved token is USDT:10,000, we2netToken: 200,000. Total LP supply = 20,000*sqrt(5) - User Alice add liquidity with 10,000 USDT. LiquidityHub mint 100,000 we2netToken for this liquidity adding. - The reserved token changes USDT:20,000, we3netToken: 300,000. Swap pair mint 10,000*sqrt(5) LP Token for Alice. Total LP supply = 30,000*sqrt(5), according to the implementation of panccakepair.mint function. - Then Alice remove the liquidity with her 10,000*sqrt(5) LP Token. - we2netToekn:USDT swap pair remains USDT: 13,333, we2netToken: 200,000. - She could get 20,000 * (1/3) USDT back from the pair. And 100,000 we3netToken recycled by _recycle manager.
State variables that never change should be declared as `constant` to save gas. ```solidity=744 uint256 private _tokenBase = 10000; ``` - `_tokenBase` should be declared `constant`.
Function name typo. `Manger` should be`Manager` or `Managers`.
The `SafeMath` library is used unnecessarily. With Solidity compiler versions 0.8.0 or newer, arithmetic operations will automatically revert in case of integer overflow or underflow. ```solidity=837 using SafeMath for uint; ``` - `SafeMath` library is used for `uint256` type in `SwapLibrary` contract. ```solidity=860 uint amountInWithFee = amountIn.mul(9975); ``` - `SafeMath.mul` is called in `getAmountOut` function of `SwapLibrary` contract. *Note: Only a sample of 2 `SafeMath` library usage in this contract (out of 5) are shown above.* --- ```solidity=868 using SafeMath for uint256; ``` - `SafeMath` library is used for `uint256` type in `LiquidityHub` contract. ```solidity=933 require(IWe2netToken(we2netToken).balanceOf(to).sub(balanceBefore) >= amountOutMin, "LiquidityHub: INSUFFICIENT_OUTPUT_AMOUNT"); ``` - `SafeMath.sub` is called in `swapBnb` function of `LiquidityHub` contract. *Note: Only a sample of 2 `SafeMath` library usage in this contract (out of 37) are shown above.* --- ```solidity=505 library SafeMath { ``` - An implementation of `SafeMath` library is found. --- ```solidity=714 using SafeMath for uint256; ``` - `SafeMath` library is used for `uint256` type in `we2net` contract. ```solidity=765 uint256 tax = amount.mul(taxFrom[from]).div(_taxBase); ``` - `SafeMath.mul` is called in `_transfer` function of `we2net` contract. *Note: Only a sample of 2 `SafeMath` library usage in this contract (out of 44) are shown above.*
| Address | Chain | Source code |
|---|---|---|
| 0x572c…87630x572c9ab47977d7d909572f3b8bce076a858a8763 | Chain: BNB Chain | Source code: Verified source |
1,044 projects reviewed · 1,375 reports · latest May 2025
See CertiK’s auditsSomething wrong on this page? A missing report, a wrong date, a finding that was fixed since. Tell us and we check it against its source.
Tell us