wise-token-contracts icon indicating copy to clipboard operation
wise-token-contracts copied to clipboard

question?

Open dulumao opened this issue 4 years ago • 3 comments

I saw in Snapshot.sol file, which the variable onUniswap.mul(200).div(totalSupply()) calculates double liquidation of wise token, can't we simplified to onUniswap.mul(100).div(totalSupply()) and compare with ratio< 30 or ratio>20 instead? Are there any other caluclations involved so that we must go for the first approach?

function liquidityGuardTrigger() public {

        (
            uint112 reserveA,
            uint112 reserveB,
            uint32 blockTimestampLast
        ) = UNISWAP_PAIR.getReserves();

        emit UniswapReserves(
            reserveA,
            reserveB,
            blockTimestampLast
        );

        uint256 onUniswap = UNISWAP_PAIR.token1() == WETH
            ? reserveA
            : reserveB;

        uint256 ratio = totalSupply() == 0
            ? 0
            : onUniswap
                .mul(200)
                .div(totalSupply());

        if (ratio < 40 && isLiquidityGuardActive == false) enableLiquidityGuard();
        if (ratio > 60 && isLiquidityGuardActive == true) disableLiquidityGuard();

        emit LiquidityGuardStatus(
            isLiquidityGuardActive
        );
    }


dulumao avatar Dec 07 '20 10:12 dulumao

@coffee-converter can tell you more why this decision was made to double the bar

vm06007 avatar Dec 07 '20 13:12 vm06007

@dulumao please mark such things accordingly as question and not a bug if you are just questioning. Thanks!

vm06007 avatar Dec 07 '20 13:12 vm06007

@vm06007 ok

dulumao avatar Dec 08 '20 02:12 dulumao