---
# System prepended metadata

title: Limit tokens & tokenomics model

---

# Limit tokens & tokenomics model




## Pool econmic

As additional part, pool economic now has two parameters whcih are used for computing suply rate:

1. `totalBorrow` represents totalBorrowed by all credit managers as it was before. 
2. `extraRiskPremium` is virtual balance which doesn't related for real transferred assets and used to accuire higher interest rate when risk assets borrowed.

expectedLiquidity() will now compute extra interest rate:

```solidity
function expectedLiquidity() public view override returns (uint256) {
    // timeDifference = blockTime - previous timeStamp
    uint256 timeDifference = block.timestamp - _timestampLU;

    //                                    currentBorrowRate * timeDifference
    //  interestAccrued = totalBorrow *  ------------------------------------
    //                                             SECONDS_PER_YEAR
    //
    uint256 interestAccrued = ((totalBorrowed *
        borrowAPY_RAY *
        timeDifference) /
        RAY /
        SECONDS_PER_YEAR; // T:[PS-29]

    return _expectedLiquidityLU + interestAccrued; // T:[PS-29]
}

```

Pools will have function which updates extraPremium. 
This change will provide correct rate for dieselRate_RAY, however for end-users, it's better to add function which returns current supply rate:

```
function  depositRate() external returns (uint256) {

return totalLP == 0
            ? borrowAPY_RAY
            : (borrowAPY_RAY * (totalBorrowed + extraRiskPremium).percentMul(
                PERCENTAGE_FACTOR - result.withdrawFee
            ) / totalLP;
}
            
```

## Credit Managers

Some properties should be added to CMs:

immutable boolean setting `riskyAsstes` which enable custom collaeral computation.

`limitTokensMask` - bitmask each bit represents that this particular token is limit ones.

`mapping(address => uint256) limitTotalBorrowed` represents limit token exposure.

`mapping(address => uint256) tokenLimit` represents limit token exposure.

`mapping(address => mapping(address -> uint256)) limitCollateral` Collateral limit for current user in underlying token


### Enabling limit token as collateral
If token is limit token, it could not be enabled using function enableToken, it just compute tokenMask & limitTokenMask and if >0 - then do nothing. 

To enable limit token, user should add function `enableAndFreezeLimit` token to multicall. This function enable maximum possible collateral part and `freeze` token - so all other operation when this token could be spent - will be reverted,

For unfreezing token, user can user `disableLimitToken` in multicall, which do all needed computation and make it transfers possible.

#### enableAndFreezeLimit pseudocode

This function computes possible allowed limit as:
`allowedLimit = tokenLimit[token] - limitTotalBorrowed[token]`

`limitCollateral[borrower] = min(allowedLimit, priceOracle.convertToUnderlying(tokenBalance))`

if `limitCollateral[borrower]` > 0, it enables token. Then it updates `extraRiskPremium`:

`extraRiskPremium += delta of limitCollateral[borrower] * coeff[borrower]`

#### 

