PrimeDAO / prime-launch-dapp

https://launch.prime.xyz
6 stars 13 forks source link

Zero Invariant Error Message #704

Open BartuCulha opened 2 years ago

BartuCulha commented 2 years ago

I was able to create an LBP on Rinkeby using 10 DAI as project token and 0 WETH for funding token.

However when I try to fund and initiliaze the LBP via admin panel I am receiving Zero Variant error message

Administer-an-LBP-Launch-Prime-Launch

console log: aurelia-logging-console.js?dc89:35 WARN [Prime Launch] underflow in onOffStack warn @ aurelia-logging-console.js?dc89:35 inpage.js:1 MetaMask - RPC Error: execution reverted: BAL#311 {code: -32603, message: 'execution reverted: BAL#311', data: {…}} (anonymous) @ inpage.js:1 (anonymous) @ inpage.js:17 _runReturnHandlers @ inpage.js:17 _processRequest @ inpage.js:17 await in _processRequest (async) _handle @ inpage.js:17 handle @ inpage.js:17 _rpcRequest @ inpage.js:1 (anonymous) @ inpage.js:1 request @ inpage.js:1 eval @ web3-provider.js?da4d:65 send @ web3-provider.js?da4d:129 eval @ json-rpc-provider.js?3e80:487 eval @ json-rpc-provider.js?3e80:8 awaiter @ json-rpc-provider.js?3e80:4 perform @ json-rpc-provider.js?3e80:464 eval @ base-provider.js?bc79:1269 fulfilled @ base-provider.js?bc79:5 Promise.then (async) step @ base-provider.js?bc79:7 fulfilled @ base-provider.js?bc79:5 Promise.then (async) step @ base-provider.js?bc79:7 eval @ base-provider.js?bc79:8 awaiter @ base-provider.js?bc79:4 estimateGas @ base-provider.js?bc79:1264 sendUncheckedTransaction @ json-rpc-provider.js?3e80:159 eval @ json-rpc-provider.js?3e80:203 fulfilled @ json-rpc-provider.js?3e80:5 Promise.then (async) step @ json-rpc-provider.js?3e80:7 eval @ json-rpc-provider.js?3e80:8 awaiter @ json-rpc-provider.js?3e80:4 sendTransaction @ json-rpc-provider.js?3e80:199 eval @ index.js?f179:318 fulfilled @ index.js?f179:5 Promise.then (async) step @ index.js?f179:7 eval @ index.js?f179:8 awaiter @ index.js?f179:4 eval @ index.js?f179:307 eval @ LbpManager.ts?e718:505 send @ TransactionsService.ts?12de:23 fund @ LbpManager.ts?e718:505 fund @ dashboard.ts?f38d:93 await in fund (async) evaluate @ aurelia-binding.js?5f98:1517 callSource @ aurelia-binding.js?5f98:5241 handleEvent @ aurelia-binding.js?5f98:5250 handleEvent @ aurelia-binding.js?5f98:3315 aurelia-logging-console.js?dc89:35 WARN [Prime Launch] underflow in onOffStack

dkent600 commented 2 years ago

Not sure what this is about. Here is the info in the contract:

// About swap fees on joins and exits:
    // Any join or exit that is not perfectly balanced (e.g. all single token joins or exits) is mathematically
    // equivalent to a perfectly balanced join or  exit followed by a series of swaps. Since these swaps would charge
    // swap fees, it follows that (some) joins and exits should as well.
    // On these operations, we split the token amounts in 'taxable' and 'non-taxable' portions, where the 'taxable' part
    // is the one to which swap fees are applied.

    // Invariant is used to collect protocol swap fees by comparing its value between two times.
    // So we can round always to the same direction. It is also used to initiate the BPT amount
    // and, because there is a minimum BPT, we round down the invariant.
    function _calculateInvariant(uint256[] memory normalizedWeights, uint256[] memory balances)
        internal
        pure
        returns (uint256 invariant)
    {
        /**********************************************************************************************
        // invariant               _____                                                             //
        // wi = weight index i      | |      wi                                                      //
        // bi = balance index i     | |  bi ^   = i                                                  //
        // i = invariant                                                                             //
        **********************************************************************************************/

        invariant = FixedPoint.ONE;
        for (uint256 i = 0; i < normalizedWeights.length; i++) {
            invariant = invariant.mulDown(balances[i].powDown(normalizedWeights[i]));
        }

        _require(invariant > 0, Errors.ZERO_INVARIANT);
    }