Natrium docs
  • ๐ŸงชOverview
    • ๐Ÿ“–Introducing Natrium
    • ๐Ÿ”ฎVision
  • โš™๏ธProtocol Overview
    • ๐ŸŒProtocol architecture
      • โšœ๏ธNatrium Core & Enterprise
    • ๐ŸŒŠLiquidations
    • ๐Ÿ“ˆInterest Rate Models
    • โšกOracles
    • โš–๏ธProtocol Fees
  • ๐Ÿ’ฐTokenomics
    • ๐Ÿš€Presale & Launch
    • ๐ŸงฌNTM & NaCl
  • โš’๏ธDev Docs
    • ๐Ÿ”‘Contract specs
      • Isolated Pools (Layer 1)
        • Bucket config
        • Supply underlying asset
        • Withdraw underlying asset
        • Deposit OverCollateralized asset
        • Borrow
        • Repay
        • Withdraw OverCollaterlized asset
        • Liquidate
      • Shufflers (Layer 2)
        • Contract functionalities
          • Shuffler Creation
          • Shuffler Management
          • Supply Cap Management
          • Risk Exposure Management
      • Error Library
        • Error lib
  • ๐Ÿ“šLibrary
    • Brand Assets
    • Community Links
    • Legal Disclaimer
Powered by GitBook
On this page
  1. โš’๏ธDev Docs
  2. ๐Ÿ”‘Contract specs
  3. Shufflers (Layer 2)
  4. Contract functionalities

Risk Exposure Management

PreviousSupply Cap ManagementNextError Library

Last updated 1 year ago

CtrlK
  • Set the Supply Queueโ€‹
  • Update the Withdraw Queueโ€‹
  • Remove a marketโ€‹
  • Reallocation examplesโ€‹

Set the Supply Queueโ€‹

Let's consider that we applied all steps from the previous section such that the supply Queue is thus composed of 3 Id:

  • 0x3098a46de09dd8d9a8c6fa1ab7b3f943b6f13e5ea72a4e475d9e48f222bfd5a0

  • 0x23f355fc1b8221349892985d6cebff02f9fd9d5e96c35f6f0e8a23a7a617ef23

  • 0xd9d856a68713c76e5cfa4cdd11777d77522506f09970d59ba54663872e009a84 (idle market)

We can verify it here:

Supply Queue

To change, one can call the setSupplyQueue with a new set of Id, by moving market 1 and 2 for instance:

  • 0x23f355fc1b8221349892985d6cebff02f9fd9d5e96c35f6f0e8a23a7a617ef23

  • 0x3098a46de09dd8d9a8c6fa1ab7b3f943b6f13e5ea72a4e475d9e48f222bfd5a0

  • 0xd9d856a68713c76e5cfa4cdd11777d77522506f09970d59ba54663872e009a84

And call setSupplyQueue with the object:

setSupplyQueue([0x30...5a0,0x23...f23,0xd9...a84])

Then we can verify that this worked as expected:

New Supply Queue

Update the Withdraw Queueโ€‹

Similarly to what we have done in the "Set Supply Queue" section, one has to give a set of IDs.

Please keep in mind that it could be relevant to put the "idle" market on the top of the withdraw queue.

Remove a marketโ€‹

To force remove a market, one can call submitMarketRemoval.

WARNING

Submits a forced market removal from the vault, eventually losing all funds supplied to the market.

Reallocation examplesโ€‹

Any address that has the onlyAllocatorRole will be able to execute the reallocate function which thus reallocates the vault's liquidity so as to reach a given allocation of assets on each given market. The allocator can withdraw from any market, even if it's not in the withdraw queue, as long as the loan token of the market is the same as the vault's asset.

NOTE

Be sure to have read the technical reference definition of the reallocate function before proceeding.

The function takes into input the MarketAllocation[], with MarketAllocation implemented like this:

struct MarketAllocation {
    MarketParams marketParams;
    uint256 assets;
}:

and MarketParams implemented like this:

struct MarketParams {
    address loanToken;
    address collateralToken;
    address oracle;
    address irm;
    uint256 lltv;
}

A basic Etherscan exemple that would use the reallocate function would be to replace the following input with the right addresses and values: Don't forget to delete the lines that are commented.

[
    {
    "marketParams":
        {
        "loanToken":"LOAN_TOKEN_ADDRESS",             // To adapt
        "collateralToken":"COLLATERAL_TOKEN_ADDRESS", // To adapt
        "oracle":"ORACLE_ADDRESS",                    // To adapt
        "irm":"IRM_ADDRESS",                          // To adapt
        "lltv":"900000000000000000"                   // To adapt, this value corresponds to 90% (18 decimals precision)
        },
    "assets":"NB_OF_ASSET"                            // To adapt
    },
    {
    "marketParams":
        {
        "loanToken":"LOAN_TOKEN_ADDRESS",             // To adapt
        "collateralToken":"COLLATERAL_TOKEN_ADDRESS", // To adapt
        "oracle":"ORACLE_ADDRESS",                    // To adapt
        "irm":"IRM_ADDRESS",                          // To adapt
        "lltv":"900000000000000000"                   // To adapt, this value corresponds to 90% (18 decimals precision)
        },
    "assets":"NB_OF_ASSET"                            // To adapt
    },
    {
    "marketParams":                                   // Possibility: add the idle markets
        {
        "loanToken":"LOAN_TOKEN_ADDRESS",             // To adapt
        "collateralToken":"0x0000000000000000000000000000000000000000",
        "oracle":"0x0000000000000000000000000000000000000000",
        "irm":"0x0000000000000000000000000000000000000000",
        "lltv":"0"
        },
    "assets":"115792089237316195423570985008687907853269984665640564039457584007913129639935" // 2^256-1
    }
]