LogoLogo
  • Overview
  • Learn
    • Lend
    • Borrow
    • Interest Rate
    • Liquidate
    • Flash Loans
    • NEPT Token
    • Risks
  • Develop
    • Contracts
      • Market
      • Interest Model
      • Token
      • Oracle
      • Querier
      • Flashloan Reciever
      • nToken
    • Token Addresses
  • User Guides
    • How to Lend on Neptune
    • How to Borrow on Neptune
    • How to Stake with the Neptune Validator
    • How to bridge TIA to Injective
  • Socials and Media
  • Audits
Powered by GitBook
On this page
  • Query Messages
  • 1. Get All Markets
  • 2. Get All Collaterals
  • 3. Get State
  • 4. Get User Accounts
  • 5. Get All Accounts
  • 6. Get Params
  • Execute Messages
  • 1. Receive
  • 2. Lend
  • 3. Redeem
  • 3.1 Deposit Collateral (Native Token)
  • 3.2 Deposit Collateral (CW20 Token)
  • 4. Withdraw Collateral
  • 5. Borrow
  • 6. Return
  • 7. Inject
  • 8. Borrow Flashloan
  • 9. Return Flashloan
  • 10. Assert Flashloan Repaid
  • 11. Liquidate
  • 12. Update Market Asset
  • 13. Update Collateral Asset
  • 14. Distribute Interest
  1. Develop
  2. Contracts

Market

PreviousContractsNextInterest Model

Last updated 2 months ago

Market Contract Address:

The Market Contract is a core component of the Neptune Protocol, responsible for handling various financial operations such as lending, borrowing, collateral management, flash loans and liquidations. It provides a robust and flexible interface for users to interact with the Neptune financial ecosystem.

Query Messages

1. Get All Markets

Query: get_all_markets

Purpose: Returns a paginated list of all markets available in the Neptune Protocol, including their current state, interest rates, utilization metrics, and market-specific parameters. Supports pagination through start_after and limit parameters. If pagnation is not used, returns all markets.

Query Input:

{
  "get_all_markets": {
    "start_after": {
      "native_token": {
        "denom": "inj"
      }
    },
    "limit": 2
  }
}

Query Response:

[
  [
    {
      "native_token": {
        "denom": "peggy0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
      }
    },
    {
      "time_last_distributed_interest": "1740443520617491324",
      "utilization_accumulator": "17052188166231954.57528721805685724",
      "lending_principal": "13161660610653173698",
      "debt_pool": {
        "balance": "7987724390439616559",
        "shares": "7626917102526772054"
      },
      "market_asset_details": {
        "receipt_addr": "inj1kehk5nvreklhylx22p3x0yjydfsz9fv3fvg5xt",
        "borrow_halt_utilization": "0.85",
        "interest_fee": "0.01",
        "borrow_cap": "180000000000000000000",
        "enabled": true
      }
    }
  ],
  [
    {
      "native_token": {
        "denom": "peggy0xdAC17F958D2ee523a2206206994597C13D831ec7"
      }
    },
    {
      "time_last_distributed_interest": "1740443389082701440",
      "utilization_accumulator": "26033903718931173.530196318587580776",
      "lending_principal": "1050352807605",
      "debt_pool": {
        "balance": "873600917508",
        "shares": "697338323165"
      },
      "market_asset_details": {
        "receipt_addr": "inj1cy9hes20vww2yr6crvs75gxy5hpycya2hmjg9s",
        "borrow_halt_utilization": "0.95",
        "interest_fee": "0.02",
        "borrow_cap": null,
        "enabled": true
      }
    }
  ]
]
Parameter
Type
Description

native_token

AssetInfo

Contains details about the native token

native_token.

denom

string

The denomination of the native token

time_last_distributed_interest

Timestamp

The timestamp of the last interest distribution

utilization_accumulator

Decimal256

The accumulated utilization value

lending_principal

Uint256

The principal amount currently lent

debt_pool

Pool

Contains details about the debt pool

debt_pool.

balance

Uint256

The balance of the debt pool

debt_pool.

shares

Uint256

The shares of the debt pool

market_asset_details

MarketAssetDetails

Contains details about the market asset

market_asset_details.

receipt_addr

Addr

The receipt address for the market asset

market_asset_details.

borrow_halt_utilization

Decimal256

The utilization level at which borrowing halts

market_asset_details.

interest_fee

Decimal256

The interest fee applied to the market asset

market_asset_details.

borrow_cap

Uint256

The borrowing cap for the market asset. Can be null

market_asset_details.

enabled

boolean

Indicates if the market asset is enabled

2. Get All Collaterals

Query: get_all_collaterals

Purpose: Fetches a paginated list of all collateral assets available in the Neptune Protocol, including their LTV ratios, liquidation parameters, collateral caps, and current pool states. Supports pagination through start_after and limit parameters. If pagnation is not used, returns all collaterals.

Query Input:

{
  "get_all_collaterals": {
    "start_after": {
      "native_token": {
        "denom": "inj"
      }
    },
    "limit": 2
  }
}

Query Response:

[
  [
    {
      "native_token": {
        "denom": "peggy0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
      }
    },
    {
      "collateral_details": {
        "collateral_type": "regular",
        "liquidation_ltv": "0.7",
        "allowable_ltv": "0.69",
        "max_discount": "0.14",
        "min_discount": "0.14",
        "collateral_cap": "160000000000000000000",
        "enabled": true
      },
      "collateral_pool": {
        "balance": "2987272506047754137",
        "shares": "2987272506047754137"
      }
    }
  ],
  [
    {
      "native_token": {
        "denom": "peggy0xdAC17F958D2ee523a2206206994597C13D831ec7"
      }
    },
    {
      "collateral_details": {
        "collateral_type": "regular",
        "liquidation_ltv": "0.78",
        "allowable_ltv": "0.77",
        "max_discount": "0.08",
        "min_discount": "0.08",
        "collateral_cap": "450000000000",
        "enabled": true
      },
      "collateral_pool": {
        "balance": "2629718706",
        "shares": "2629718706"
      }
    }
  ]
]
Parameter
Type
Description

native_token

AssetInfo

Contains details about the native token

native_token.

denom

string

The denomination of the native token

collateral_details

CollateralDetails

Contains details about the collateral

collateral_details.

collateral_type

AssetType

The type of collateral (e.g., regular)

collateral_details.

liquidation_ltv

Decimal256

The loan-to-value ratio for liquidation

collateral_details.

allowable_ltv

Decimal256

The allowable loan-to-value ratio

collateral_details.

max_discount

Decimal256

The maximum discount applied to the collateral

collateral_details.

min_discount

Decimal256

The minimum discount applied to the collateral

collateral_details.

collateral_cap

Uint256

The cap on the amount of collateral

collateral_details.

enabled

boolean

Indicates if the collateral is enabled

collateral_pool

Pool

Contains details about the collateral pool

collateral_pool.

balance

Uint256

The balance of the collateral pool

collateral_pool.

shares

Uint256

The shares of the collateral pool

3. Get State

Query: get_state

Purpose: Retrieves a comprehensive snapshot of the entire market contract state, combining both the market assets data and collateral assets data in a single query. This provides a complete view of all markets and collaterals without pagination.

Query Input:

{
  "get_state": {}
}

Query Response:

{
  "markets": [
    [
      {
        "native_token": {
          "denom": "factory/inj1n636d9gzrqggdk66n2f97th0x8yuhfrtx520e7/ausd"
        }
      },
      {
        "time_last_distributed_interest": "1740441525814418055",
        "utilization_accumulator": "914755917117089.362843672401733295",
        "lending_principal": "100066949842",
        "debt_pool": {
          "balance": "42565274086",
          "shares": "42429423999"
        },
        "market_asset_details": {
          "receipt_addr": "inj1tkuemghm734h9qy8fh2eu0qp9hyfdlws0llt8g",
          "borrow_halt_utilization": "0.95",
          "interest_fee": "0.02",
          "borrow_cap": null,
          "enabled": true
        }
      }
    ],
    ...............
  ],
  "collaterals": [
    [
      {
        "native_token": {
          "denom": "factory/inj1n636d9gzrqggdk66n2f97th0x8yuhfrtx520e7/ausd"
        }
      },
      {
        "collateral_details": {
          "collateral_type": "regular",
          "liquidation_ltv": "0.78",
          "allowable_ltv": "0.77",
          "max_discount": "0.12",
          "min_discount": "0.08",
          "collateral_cap": "300000000000",
          "enabled": true
        },
        "collateral_pool": {
          "balance": "44893",
          "shares": "44893"
        }
      }
    ],
    .................
  ]
}

4. Get User Accounts

Query: get_user_accounts

Purpose: Retrieves detailed information about all sub-accounts associated with a specific wallet address, including their debt positions and collateral deposits across different assets.

Query Input:

{
  "get_user_accounts": {
    "addr": "inj.........."
  }
}
Parameter
Type
Description

addr

Addr

Injective wallet address

Query Response:

[
  [
    2,
    {
      "debt_pool_accounts": [
        [
          {
            "native_token": {
              "denom": "inj"
            }
          },
          {
            "principal": "14730000000000000000",
            "shares": "14955143791342905893"
          }
        ]
      ],
      "collateral_pool_accounts": [
        [
          {
            "token": {
              "contract_addr": "inj18luqttqyckgpddndh8hvaq25d5nfwjc78m56lc"
            }
          },
          {
            "principal": "27049873259216212851",
            "shares": "26907049547493586917"
          }
        ]
      ]
    }
  ]
]
Parameter
Type
Description

[0]

uint8

sub account index number

debt_pool_accounts

array<[AssetInfo, PoolAccount]>

Contains details about the user's debt pools

debt_pool_accounts[].

native_token.

denom

string

The denomination of the native token in the debt pool

debt_pool_accounts[].

principal

Uint256

The principal amount in the debt pool

debt_pool_accounts[].

shares

Uint256

The shares in the debt pool

collateral_pool_accounts

array<[AssetInfo, PoolAccount]>

Contains details about the user's collateral pools

collateral_pool_accounts[].

token.

contract_addr

Addr

The contract address of the token in the collateral pool

collateral_pool_accounts[].

native_token.

denom

string

The denomination of the native token in the collateral pool

collateral_pool_accounts[].

principal

Uint256

The principal amount in the collateral pool

collateral_pool_accounts[].

shares

Uint256

The shares in the collateral pool

5. Get All Accounts

Query: get_all_accounts

Purpose: Returns a paginated list of all margin accounts across all users in the protocol, including their debt and collateral positions. Supports efficient pagination through [address, index] cursor and limit parameters.

Query Input:

{
  "get_all_accounts": {
    "start_after": ["inj...........", 0],
    "limit": 2
  }
}
Parameter
Type
Description

start_after

[Addr, uint8]

The address and index to start the query after

start_after[0]

Addr

The address to start after

start_after[1]

uint8

The account index to start after

limit

uint32

The maximum number of accounts to return

Query Response:

[
  [
    ["inj.............", 0],
    {
      "debt_pool_accounts": [
        [
          {
            "native_token": {
              "denom": "inj"
            }
          },
          {
            "principal": "1000000000000000000",
            "shares": "1000000000000000000"
          }
        ]
      ],
      "collateral_pool_accounts": [
        [
          {
            "token": {
              "contract_addr": "inj1contractaddress"
            }
          },
          {
            "principal": "2000000000000000000",
            "shares": "2000000000000000000"
          }
        ]
      ]
    }
  ],
  [
    ["inj...........", 1],
    {
      "debt_pool_accounts": [],
      "collateral_pool_accounts": [
        [
          {
            "native_token": {
              "denom": "peggy0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
            }
          },
          {
            "principal": "3000000000000000000",
            "shares": "3000000000000000000"
          }
        ]
      ]
    }
  ]
]
Parameter
Type
Description

debt_pool_accounts

array<[AssetInfo, PoolAccount]>

Contains details about the account's debt pools

debt_pool_accounts[].

native_token.

denom

string

The denomination of the native token in the debt pool

debt_pool_accounts[].

principal

Uint256

The principal amount in the debt pool

debt_pool_accounts[].

shares

Uint256

The shares in the debt pool

collateral_pool_accounts

array<[AssetInfo, PoolAccount]>

Contains details about the account's collateral pools

collateral_pool_accounts[].

token.

contract_addr

Addr

The contract address of the token in the collateral pool

collateral_pool_accounts[].

native_token.

denom

string

The denomination of the native token in the collateral pool

collateral_pool_accounts[].

principal

Uint256

The principal amount in the collateral pool

collateral_pool_accounts[].

shares

Uint256

The shares in the collateral pool

6. Get Params

Query: get_params

Purpose: Retrieves the protocol's global configuration parameters, including liquidation settings, staking parameters, fee structures, flash loan settings, and core token addresses (hINJ and NEPT).

Query Input:

{
  "get_params": {}
}

Query Response:

{
  "time_window_nanos": 3600000000000,
  "partial_liquidation_threshold": "1000000000000000000000",
  "staking_health_modifier": "0.03",
  "stake_collateral_ratio": "0.1",
  "stake_flash_loan_ratio": "0.1",
  "target_liquidation_health": "1.03",
  "dynamic_discount_width": "0.01",
  "liquidation_fee": "0",
  "flash_loan_fee": "0",
  "flash_loans_enabled": true,
  "hinj": {
    "token": {
      "contract_addr": "inj18luqttqyckgpddndh8hvaq25d5nfwjc78m56lc"
    }
  },
  "nept": {
    "native_token": {
      "denom": "factory/inj1v3a4zznudwpukpr8y987pu5gnh4xuf7v36jhva/nept"
    }
  }
}
Parameter
Type
Description

time_window_nanos

uint64

Number of nanoseconds that an oracle price is valid for

partial_liquidation_threshold

Uint256

Minimum account value to avoid complete liquidation. Represented in USD with 18 decimal precision

staking_health_modifier

Decimal256

The maximum health increase provided by NEPT staking

stake_collateral_ratio

Decimal256

The required ratio of weighted staked NEPT to collateral value

stake_flash_loan_ratio

Decimal256

The required ratio of weighted staked NEPT to flash loan value

target_liquidation_health

Decimal256

The account health target to bring an account up to from a liquidation action

dynamic_discount_width

Decimal256

The required change in account health below 1.0 to achieve the maximum discount on a collateral asset

liquidation_fee

Decimal256

The coefficient used to calculate the liquidation protocol fee

flash_loan_fee

Decimal256

The coefficient used to calculate the flash loan fee

flash_loans_enabled

boolean

Whether flash loans are enabled

hinj

AssetInfo

AssetInfo for the hINJ token

hinj.

token.

contract_addr

Addr

The contract address of the hINJ token

nept

AssetInfo

AssetInfo for the NEPT token

nept.

native_token.

denom

string

The denomination of NEPT native token


Execute Messages

1. Receive

Execute: receive

Purpose: Handles incoming CW20 token transfers through the CW20 hook mechanism, allowing the contract to process token-specific operations based on the encoded instructions in the message.

{
  "receive": {}
}

2. Lend

Execute: lend

Purpose: Allows users to provide assets to the lending pool, which increases the pool's liquidity and enables the lender to receive nTokens representing their lending position.

{ 
    "lend": {}
},
"funds": "1000000peggy0xdAC17F958D2ee523a2206206994597C13D831ec7"
Parameter
Type
Description
Required

funds

Coin

The amount and denomination of tokens to lend

Yes

3. Redeem

Execute: redeem

Purpose: Allows users to withdraw their lending deposits by burning their nTokens in exchange for the underlying asset plus any accrued interest.

{
  "sender": "inj142aemh62w2fpqjws0yre5936ts9x9e93fj8322",
  "contract": "inj1cy9hes20vww2yr6crvs75gxy5hpycya2hmjg9s",
  "msg": {
    "send": {
      "amount": "829841",
      "contract": "inj1nc7gjkf2mhp34a6gquhurg8qahnw5kxs5u3s4u",
      "msg": "eyJyZWRlZW0iOnt9fQ==" //{"redeem":{}}
    }
  },
  "funds": "0"
}
Parameter
Type
Description
Required

sender

Addr

Wallet address of the user redeeming tokens

Yes

contract

Addr

nToken contract address that is initiating the redeem operation

Yes

msg

Cw20ReceiveMsg

CW20 hook message wrapping the redeem instruction

Yes

msg.send

object

Nested message instructing the market contract regarding the redeem sub-message

Yes

msg.

send.

amount

Uint128

The amount of nTokens to be redeemed

Yes

msg.

send.

contract

Addr

Market contract address that should process the redeem sub-message

Yes

msg.

send.

msg

Binary

Base64 encoded sub-message (which decodes to { "redeem": {} })

Yes

funds

Coin

Not used in this operation. Must be set to "0"

Yes

3.1 Deposit Collateral (Native Token)

Execute: deposit_collateral

Purpose: Enables users to deposit native tokens as collateral into a specified margin account, which can then be used to secure borrowed positions.

{
  "deposit_collateral": {
    "account_index": 0
  }
},
"funds": "1000000peggy0xdAC17F958D2ee523a2206206994597C13D831ec7"
Parameter
Type
Description
Required

account_index

uint8

The index of the account to deposit collateral into

Yes

funds

Coin

The amount and denomination of tokens to deposit as collateral

Yes

3.2 Deposit Collateral (CW20 Token)

Execute: deposit_collateral

Purpose: Enables users to deposit CW20 tokens as collateral into a specified margin account, which can then be used to secure borrowed positions.

Example: Applicable to hINJ token

{
  "sender": "inj...........",
  "contract": "inj18luqttqyckgpddndh8hvaq25d5nfwjc78m56lc",
  "msg": {
    "send": {
      "amount": "1000000000000000000",
      "contract": "inj1nc7gjkf2mhp34a6gquhurg8qahnw5kxs5u3s4u",
      "msg": "eyJkZXBvc2l0X2NvbGxhdGVyYWwiOnsiYWNjb3VudF9pbmRleCI6Mn19" //{"deposit_collateral":{"account_index":2}}
    }
  },
  "funds": "0"
}
Parameter
Type
Description
Required

sender

addr

Wallet address of the user depositing tokens (CW20 sender)

Yes

contract

addr

CW20 token contract address initiating the deposit operation

Yes

msg

Cw20ReceiveMsg

Container for the CW20 hook message payload

Yes

msg.

send

object

The CW20 hook message instructing the market contract on how to process the collateral deposit

Yes

msg.

send.

amount

uint128

The amount of tokens to be deposited as collateral

Yes

msg.

send.

contract

addr

The market contract address that will process the deposit collateral request

Yes

msg.

send.

msg

binary

A Base64-encoded sub-message instructing the market contract to execute the deposit collateral operation

Yes

funds

coin

Not used for this operation. Must be set to "0"

Yes

4. Withdraw Collateral

Execute: withdraw_collateral

Purpose: Allows users to withdraw their deposited collateral from a margin account, provided the withdrawal doesn't violate the account's minimum collateralization requirements.

{
  "withdraw_collateral": {
    "account_index": 0,
    "asset_info": {
      "native_token": {
        "denom": "peggy0xdAC17F958D2ee523a2206206994597C13D831ec7"
      }
    },
    "shares": "1000000"
  }
}
Parameter
Type
Description
Required

account_index

uint8

The index of the account to withdraw collateral from

Yes

asset_info

AssetInfo

Information about the asset being withdrawn

Yes

asset_info.

native_token

object

Token type

Yes

asset_info.

native_token.

denom

string

Token address

Yes

shares

Uint256

The number of shares to withdraw

Yes

5. Borrow

Execute: borrow

Purpose: Enables users to borrow assets against their deposited collateral, subject to the account's collateralization ratio requirements and market's borrowing limits.

{
  "borrow": {
    "account_index": 0,
    "amount": "1000000",
    "asset_info": {
      "native_token": {
        "denom": "peggy0xdAC17F958D2ee523a2206206994597C13D831ec7"
      }
    }
  }
}
Parameter
Type
Description
Required

account_index

uint8

The index of the account to withdraw collateral from

Yes

amount

Uint256

Amount of tokens to borrow

Yes

asset_info

AssetInfo

Information about the asset being withdrawn

Yes

asset_info.

native_token

object

Token type

Yes

asset_info.

native_token.

denom

string

Token address

Yes

6. Return

Execute: return

Purpose: Allows users to repay borrowed assets to their margin account, reducing their debt position and associated interest accrual.

{
    "return": {
      "account_index": 0
    }
},
"funds": "1000001peggy0xdAC17F958D2ee523a2206206994597C13D831ec7"
Parameter
Type
Description
Required

account_index

uint8

The index of the account to return tokens to

Yes

funds

Coin

The amount and denomination of tokens to return

Yes

7. Inject

Execute: inject

Purpose: Enables privileged addresses to inject liquidity into market pools (lending, borrowing, or collateral) to manage pool balances, compound rewards, or adjust yields. Injecting into lending or collateral pools increases their value, while injecting into borrow pools decreases the system's debt.

{
    "inject": {
      "injection_type": "lend"
  }
},
"funds": "1000000peggy0xdAC17F958D2ee523a2206206994597C13D831ec7"
Parameter
Type
Description
Required

injection_type

RewardType

Target market pool to inject liquidty to. Can lend, borrow, or collateral

Yes

funds

Coin

The amount and denomination of tokens to inject

Yes

8. Borrow Flashloan

Execute: borrow_flash_loan

Purpose: Initiates a flash loan operation, allowing a user to temporarily borrow specified assets for short-lived, atomic operations (e.g., arbitrage, liquidation, or other custom strategies). The borrowed funds are sent directly to a designated flash loan receiver contract along with an array of messages (msgs) that instruct the receiver on how to utilize the funds. The entire operation must be completed within one transaction, with the borrowed funds being returned prior to the execution of the final protocol checks.

NOTE: A user's access to use flash loans, and the flash loan capacity, is gated by the value of their staked NEPT tokens.

Execute JSON:

{
  "borrow_flash_loan": {
    "assets": [
      [
        {
          "native_token": {
            "denom": "inj"
          }
        },
        "1000000"
      ]
    ],
    "msgs": [
      {
        "msg_data": {
          "execute": {
            "custom_operation": {
              "detail": "operation details"
            }
          }
        },
        "route": "custom"
      }
    ],
    "receiver": "inj1wmtzan6tgzg0zyauknuxdnnfjwn350yewjf6fq"
  }
}
Parameter
Type
Description
Required

assets

array<[AssetInfo, Uint256]>

A list of asset-amount pairs representing the tokens to be borrowed

Yes

assets[0].

native_token

object

Token type

Yes

assets[0].

native_token.

denom

string

Token address

Yes

assets[1]

Uint256

Amount of tokens to be flashloaned

Yes

msgs

array<CosmosMsg_for_InjectiveMsgWrapper>

A list of sub messages to be forwarded and executed by the receiver address

Yes

receiver

Addr

The Flashloan Receiver address

Yes

9. Return Flashloan

Execute: return_flash_loan

Purpose: Used to repay the funds borrowed via a flash loan. Once the flash loan receiver (or borrower) completes its operations utilizing the temporarily provided liquidity, this call returns the exact borrowed amount(s) back to the market contract. The returned funds are then verified by a subsequent check to ensure the entire flash loan is repaid within the same transaction.

NOTE: The total amount of tokens to be repaid is equal to amount_borrowed + floashloan_fee

Execute JSON:

{
  "return_flash_loan": {
    "assets": [
      [
        {
          "native_token": {
            "denom": "inj"
          }
        },
        "1000000"
      ]
    ]
  }
}
Parameter
Type
Description
Required

assets

array<[AssetInfo, Uint256]>

A list of asset-amount pairs representing the tokens to be repaid

Yes

assets[0].

native_token

object

Token type

Yes

assets[0].

native_token.

denom

string

Token address

Yes

assets[1]

Uint256

Amount of tokens to be repaid

Yes

10. Assert Flashloan Repaid

Execute: assert_flash_loan_repaid

Purpose: Ensures that all funds borrowed via a flashloan have been fully repaid within the same transaction. This check is executed after the corresponding return_flash_loan call, and if the repayment is incomplete, the entire transaction will revert.

Execute JSON:

{
  "assert_flash_loan_repaid": {}
}

11. Liquidate

Execute: liquidate

Purpose: Performs the liquidation of an undercollateralized margin account. This call allows a liquidator to repay a portion of the outstanding debt in a margin account that has fallen below the required collateralization threshold. In exchange, the liquidator seizes a discounted share of the account's collateral. The parameters ensure that the repaid amount does not exceed the account's outstanding debt and that the collateral received reflects the value of the repaid debt adjusted by the liquidation discount.

Execute JSON:

{
  "liquidate": {
    "account_index": 0,
    "repayment_amount": "1000000",
    "asset_info": {
      "native_token": {
        "denom": "peggy0xdAC17F958D2ee523a2206206994597C13D831ec7"
      }
    }
  }
}
Parameter
Type
Description
Required

account_index

uint8

The index of the margin account to be liquidated

Yes

repayment_amount

Uint256

The amount of debt to be repaid by the liquidator

Yes

asset_info

AssetInfo

The asset information representing the collateral type

Yes

asset_info.

native_token

object

Token type

Yes

asset_info.

native_token.

denom

string

Token address

Yes

12. Update Market Asset

Execute: update_market_asset

Purpose: Allows privileged addresses to modify market-specific parameters such as interest rates, utilization caps, and operational status for a given asset market.

NOTE: Only whitelisted addresses can execute update_market_asset

Execute JSON:

{
  "update_market_asset": {
    "asset": {
      "native_token": {
        "denom": "factory/inj1n636d9gzrqggdk66n2f97th0x8yuhfrtx520e7/ausd"
      }
    },
    "market_asset_details": {
      "borrow_cap": null,
      "borrow_halt_utilization": "0.95",
      "enabled": true,
      "interest_fee": "0.02",
      "receipt_addr": "inj1tkuemghm734h9qy8fh2eu0qp9hyfdlws0llt8g"
    }
  }
}
Parameter
Type
Description
Required

asset

AssetInfo

Describes the asset for which the market configuration is to be updated

Yes

asset.

native_token

object

Token type

Yes

asset.

native_token.

denom

string

Token address

Yes

market_asset_details

MarketAssetDetails

Contains the updated market asset parameters

Yes

market_asset_details.

receipt_addr

Addr

The matching CW20 nToken address

Yes

market_asset_details.

borrow_halt_utilization

Decimal256

Utilization threshold to halt borrowing

Yes

market_asset_details.

interest_fee

Decimal256

The interest fee applied on borrows

Yes

market_asset_details.

borrow_cap

Uint256

The borrowing cap for the asset. Can be null

Yes

market_asset_details.

enabled

boolean

Indicates if the market asset is active

Yes

13. Update Collateral Asset

Execute: update_collateral_asset

Purpose: Allows privileged addresses to modify collateral-specific parameters such as LTV ratios, liquidation thresholds, and collateral caps for a given asset.

NOTE: Only whitelisted addresses can execute update_collateral_asset

Execute JSON:

{
  "update_collateral_asset": {
    "asset": {
      "native_token": {
        "denom": "factory/inj1n636d9gzrqggdk66n2f97th0x8yuhfrtx520e7/ausd"
      }
    },
    "collateral_asset_info": {
      "allowable_ltv": "0.77",
      "collateral_cap": "300000000000",
      "collateral_type": "regular",
      "enabled": true,
      "liquidation_ltv": "0.78",
      "max_discount": "0.12",
      "min_discount": "0.08"
    }
  }
}
Parameter
Type
Description
Required

asset

AssetInfo

Describes the asset for which the collateral configuration is to be updated

Yes

asset.

native_token

object

Token type

Yes

asset.

native_token.

denom

string

Token address

Yes

collateral_asset_info

CollateralDetails

Contains the updated collateral asset parameters

Yes

collateral_asset_info.

allowable_ltv

Decimal256

The allowable loan-to-value ratio for the collateral asset

Yes

collateral_asset_info.

collateral_cap

Uint256

The cap on the amount of collateral that can be used in the market

Yes

collateral_asset_info.

collateral_type

AssetType

The type of collateral (regular or receipt_token)

Yes

collateral_asset_info.

enabled

boolean

Indicates if the collateral asset is enabled

Yes

collateral_asset_info.

liquidation_ltv

Decimal256

The loan-to-value ratio at which the collateral is subject to liquidation

Yes

collateral_asset_info.

max_discount

Decimal256

The maximum discount applied to the collateral during liquidation

Yes

collateral_asset_info.

min_discount

Decimal256

The minimum discount applied to the collateral during liquidation

Yes

14. Distribute Interest

Execute: distribute_interest

Purpose: Updates the protocol's interest rate calculations and distributes accrued interest from borrowers to lenders, maintaining accurate accounting of lending and borrowing positions.

Execute JSON:

{
  "distribute_interest": {
    "assets": [
      {
        "native_token": {
          "denom": "peggy0xdAC17F958D2ee523a2206206994597C13D831ec7"
        }
      },
      {
        "native_token": {
          "denom": "inj"
        }
      }
    ]
  }
}
Parameter
Type
Description
Required

assets

array<AssetInfo>

A list of asset information for which interest is to be distributed

Yes

assets[].

native_token

object

Token type

Yes

assets[].

native_token.

denom

string

Token address

Yes

inj1nc7gjkf2mhp34a6gquhurg8qahnw5kxs5u3s4u
Parameter
Type
Description
Required

start_after

object

Object containing information of the token to start after

No

start_after.

native_token

object

Token type

Yes

start_after.

native_token.

denom

string

Denomination of native token

Yes

limit

u64

Number of responses to return

No

Parameter
Type
Description
Required

start_after

object

Object containing information of the token to start after

No

start_after.

native_token

object

Token type

Yes

start_after.

native_token.

denom

string

Denomination of native token

Yes

limit

u64

Number of responses to return

No