Market
The Market contract acts as the point of interaction for all lending and borrowing related activities. New stablecoin deposits are added to this contract's balance, while borrows are subtracted from the contract balance.
Config
Key | Type | Description |
| CanonicalAddr | Address of itself (Market contract) |
| CanonicalAddr | Address of contract owner that can update config |
| CanonicalAddr | Contract address of aTerra |
| CanonicalAddr | Contract address of Interest Model |
| CanonicalAddr | Contract address of Distribution Model |
| CanonicalAddr | Contract address of Overseer |
| CanonicalAddr | Contract address of Collector |
| CanonicalAddr | Contract address of Distributor |
| String | Native token denomination for stablecoin |
| Decimal256 | Maximum portion of stablecoin liquidity available for borrows |
InstantiateMsg
Instantiates the money market Market contract. Requires the owner to make an initial deposit of 1 Terra stablecoin and mints 1 aTerra to the Market contract (inaccessible). The creator's initial stablecoin deposit ensures the aTerra supply to always be a high enough value to prevent rounding errors in the aTerra exchange rate calculation.
Key | Type | Description |
| String | Address of contract owner |
| String | Native token denomination for stablecoin |
| u64 | Code ID for aTerra contract |
| Decimal256 | Initial per-block ANC emission rate to borrowers |
| Decimal256 | Maximum portion of stablecoin liquidity available for borrows |
ExecuteMsg
Receive
Receive
Can be called during a CW20 token transfer when the Mint contract is the recipient. Allows the token transfer to execute a Receive Hook as a subsequent action within the same transaction.
Key | Type | Description |
| String | Sender of token transfer |
| Uint128 | Amount of tokens received |
| Binary | Base64-encoded string of JSON of Receive Hook |
RegisterContracts
RegisterContracts
Registers the addresses of other Money Market contracts. Can only be issued by the owner.
Key | Type | Description |
| String | Contract address of Overseer |
| String | Contract address of Interest Model |
| String | Contract address of Distribution Model |
| String | Contract address of Collector |
| String | Contract address of Distributor |
[Internal] RegisterATerra
[Internal] RegisterATerra
Registers the contract address of aTerra
Cw20 Token contract. Issued by aTerra
after initialization.
Key | Type | Description |
UpdateConfig
UpdateConfig
Updates the configuration of the contract. Can be only issued by the owner.
Key | Type | Description |
| String | Address of new owner |
| Decimal256 | New maximum portion of stablecoin liquidity available for borrows |
| String | New interest model contract address |
| String | New contract address of Distribution Model |
* = optional
[Internal] RepayStableFromLiquidation
[Internal] RepayStableFromLiquidation
Repays a liquidated loan using stablecoins gained from liquidated collaterals. Can only be issued by Overseer
.
Key | Type | Description |
| String | Address of loan borrower |
| Uint256 | Balance of Market contract prior to collateral liquidation |
[Internal] ExecuteEpochOperations
[Internal] ExecuteEpochOperations
Adjusts the borrower ANC emission rate and sends accumulated ANC excess yield reserves to Overseer. Can only be issued by Overseer.
Key | Type | Description |
| Decimal256 | Calculated per-block deposit of the last epoch |
| Decimal256 | Target per-block deposit rate of Anchor |
| Decimal256 | Threshold per-block deposit rate of Anchor |
| Uint256 | Amount of depositor subsidies distributed in this epoch |
DepositStable
DepositStable
Deposits stablecoins to Anchor. Requires stablecoins to be sent with the message.
Key | Type | Description |
BorrowStable
BorrowStable
Borrows stablecoins from Anchor.
Key | Type | Description |
| Uint256 | Amount of stablecoins to borrow |
| String | Withdrawal address for borrowed stablecoins |
* = optional
RepayStable
RepayStable
Repays previous stablecoin liability. Requires stablecoins to be sent with the message.
Key | Type | Description |
ClaimRewards
ClaimRewards
Claims accrued ANC rewards. Can designate an optional recipient. Sends rewards to message sender if to
is not specified.
Key | Type | Description |
| String | Optional recipient of accrued ANC rewards |
* = optional
Receive Hooks
RedeemStable
RedeemStable
Redeems aTerra to their underlying stablecoins.
Key | Type | Description |
QueryMsg
Config
Config
Gets the Market contract configuration.
Key | Type | Description |
ConfigResponse
ConfigResponse
Key | Type | Description |
| String | Address of contract owner |
| String | Contract address of aTerra |
| String | Contract address of Interest Model |
| String | Contract address of Distribution Model |
| String | Contract address of Overseer |
| String | Contract address of Collector |
| String | Contract address of Distributor |
| String | Native token denomination for stablecoin |
| Decimal256 | Maximum portion of stablecoin liquidity available for borrows |
State
State
Gets state information of Market. Returns an interest-accrued value if block_height
field is filled. Returns the stored (no interest accrued) state if not filled.
Key | Type | Description |
| u64 | Block number to use in query |
* = optional
StateResponse
StateResponse
Key | Type | Description |
| Decimal256 | Total amount of liabilities of all borrowers |
| Decimal256 | Total amount of ANC purchase reserves |
| u64 | Block number when interest was last accrued |
| u64 | Block number when rewards were last accrued |
| Decimal256 | Current global interest index |
| Decimal256 | Current ANC global reward index |
| Decimal256 | Current per-block ANC emission rate to borrowers |
| Uint256 | aTerra supply when interest was last accrued |
| Decimal256 | aTerra exchange rate when interest was last accrued |
EpochState
EpochState
Gets state information related to epoch operations. Returns an interest-accrued value if block_height
field is filled. Returns the stored (no interest accrued) state if not filled.
Key | Type | Description |
| u64 | Block number to use in query |
| Uint256 | Amount of depositor subsidies distributed in this epoch |
* = optional
EpochStateResponse
EpochStateResponse
Key | Type | Description |
| Decimal256 | Current aTerra exchange rate |
| Uint256 | Current aTerra supply |
BorrowerInfo
BorrowerInfo
Gets information for the specified borrower. Returns an interest-and-reward-accrued value if block_height
field is filled. Returns the stored (no interest / reward accrued) state if not filled.
Key | Type | Description |
| String | Address of borrower |
| u64 | Current block number |
* = optional
BorrowerInfoResponse
BorrowerInfoResponse
Key | Type | Description |
| String | Address of borrower |
| Decimal256 | Interest index of borrower |
| Decimal256 | ANC reward index of borrower |
| Uint256 | Amount of borrower's liability |
| Decimal256 | Amount of ANC rewards accrued to borrower |
BorrowInfos
BorrowInfos
Gets information for all borrowers.
Key | Type | Description |
| String | Borrower address to start query |
| u32 | Maximum number of entries to query |
* = optional
BorrowerInfosResponse
BorrowerInfosResponse
Key | Type | Description |
| Vec<BorrowerInfoResponse> | List of borrower information |
Key | Type | Description |
| String | Address of borrower |
| Decimal256 | Interest index of borrower |
| Decimal256 | ANC reward index of borrower |
| Uint256 | Amount of borrower's liability |
| Decimal256 | Amount of ANC rewards accrued to borrower |
Last updated