Desk Queries¶
A number of functions can be called to retrieve information about a desk’s attributes and state. All these are view functions.
- base_coin() address¶
Returns the address of the smart contract of the base token for this desk.
- base_coin_decimals() uint8¶
Returns the number of decimal digits for the base coin.
- flashloan_fee() uint256¶
Returns the fee in bps that all flash loans will be charged.
- liquidation_bonus() uint256¶
Returns the gain in bps that a liquidator gets from paying a liquidatable part of a loan.
- control_contract() address¶
Returns the address of the
Controlsmart contract that controls some of the settings in this desk.
- horizons(_horizon: uint256) uint256¶
Returns the fee in bps that applies to loans for horizon _horizon. Note this returns 0 if
_horizonis not one of the horizons accepted by this desk._horizon: The horizon desired expressed in number of blocks
- total_liquidity() uint256¶
Returns the number of base tokens in the desk, i.e., deposited but not lent.
- total_loans() uint256¶
Returns the aggregate number of base tokens in all loans.
- total_reserved() uint256¶
Returns the total number of base tokens reserved for withdrawal by all users.
Note
When depositors submit a withdrawal request when not enough liquidity is available in the desk, the amount requested becomes a target level to be reserved until withdrawals are met. When loans are repaid, the additional liquidity is not available for re-lending until all the reserved target is matched. Reserved funds do not earn reward tokens.
- user_reserved(_user: address) uint256¶
Returns the amount of base tokens the user wants to withdraw. Repaid base tokens from loans will not be lent again until that amount is met.
_user: The address of the user whose reserved funds are sought
- user_loans(_user: address) uint256¶
Returns the total of all loans taken by _user.
_user: The address of the user whose loans amount is desired
- num_horizons() int128¶
Returns the number of horizons accepted by this desk.
- get_horizon_and_fee(_i: int128)¶
Returns the i-th accepted horizon by this desk and the corresponding fee.
_i: The index of the horizon. Use num_horizons() to get the full range
- num_longables() int128¶
Returns the number of longable tokens accepted by this desk.
- get_longable(_i: int128) address¶
Returns the i-th accepted longable token.
_i: The index of the desired longable. Usenum_longablesto get the range