we2net - audit

CertiK1 address on BNB Chain

CertiK reviewed We2net (we2net - audit) on 7 Mar 2023: 17 findings, 0 critical; 5 marked fixed, 2 acknowledged, 10 open.

No open critical findings
Open the reportOpen We2net’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings17

Statuses are the security firm’s own, from its report.

SeverityOpenAcknowledgedFixed
Critical000
High020
Medium002
Low1003
MediumFunction `transfer` & `transferFrom` of ContractFixed

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.

MediumPotential Asset Loss Caused by Different ExchangeFixed

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.

LowState Variable Should Be Declared ConstantFixed

State variables that never change should be declared as `constant` to save gas. ```solidity=744 uint256 private _tokenBase = 10000; ``` - `_tokenBase` should be declared `constant`.

LowTypoFixed

Function name typo. `Manger` should be`Manager` or `Managers`.

LowUnnecessary Use of SafeMathFixed

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.*

Contracts in scope1

AddressChainSource code
0x572c9ab47977d7d909572f3b8bce076a858a8763Chain: BNB ChainSource code: Verified source

Part of We2net’s security record

We2net
Audits1 audit by 1 firmLast audit Mar 2023, by CertiK.
Critical findingsNo open critical findingsIn 1 report.
Open We2net’s security record

Security firm

CertiK

1,044 projects reviewed · 1,375 reports · latest May 2025

See CertiK’s audits

Something 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