types
Types
Constructors
-
AssetClass { policy_id: PolicyId, asset_name: AssetName }
The data structure of the datum in the audit UTXO
Constructors
-
AuditDatum { timestamp: PosixTime, collateral_asset: AssetClass, loanable_asset: AssetClass, collateral_ratio: Int, total_collateral: Int, total_borrowed: Int, health_score: (Int, Int), utilization_rate: (Int, Int), }.timestamptime of last update, POSIX time in milliseconds
.collateral_assetthe
AssetClassof the asset that can be used as collateral
.loanable_assetthe
AssetClassof the stable coin or any asset that can be borrowed
.collateral_ratiothe loan-to-value ratio of the collateral asset, expressed in whole number percentage figure (eg:
70for 70%)
.total_collateraltotal amount of collateral asset used to secure open loan positions
.total_borrowedtotal amount of borrowed loanable asset in all open positions
.health_scorehealth score of the whole lending pool (numerator, denominator)
.utilization_rateutilization rate of the whole lending pool (numerator, denominator)
Stand-alone constructor type for the GlobalSettings, used for type checking and passing the value around
Constructors
-
CfgGlobal { admin_key_hash: VerificationKeyHash, pool_contract: ScriptHash, audit_contract: ScriptHash, oracle_contract: ScriptHash, registry_contract: ScriptHash, collateral_contract: ScriptHash, collateral_ratio: Int, max_tx_validity: Int, liquidation_dexes: List<LiquidationDex>, }
Stand-alone constructor type for the OracleSettings, used for type checking and passing the value around
Constructors
-
CfgOracle { oracle_contract: ScriptHash, providers: List<Signer> }
The datum structure for UTXOs in the collateral manager contract.
Constructors
-
CollateralDatum { owner: Address, collateral_asset: AssetClass, status: CollateralStatus, }
An alias for QuotePrice, and in this case particularly, a tuple containg the price of the collateral asset denominated in the loanable asset, and the loanable asset’s decimal digits.
Alias
CollateralPrice = QuotePrice
Collateral status constructors, for CollateralDatum
Constructors
-
Available -
LoanRequested { request: LoanRequest } -
LoanIssued -
RepayRequested
The return type of get_common_utxos()
Constructors
-
CommonUtxos { collateral_input: Input, collateral_output: Output, pool_input: Input, pool_output: Output, }
The decimal digits of an asset’s amount (especially applies to the loanable asset).
Alias
DecimalDigits = Int
The loan interest rate, expressed in whole number percentage figure (eg: 5 for 5%)
Alias
IntRate = Int
The lending pool UTXO datum structure.
Constructors
-
LendingPoolDatum { loanable_asset: AssetClass, collateral_asset: AssetClass, interest_rates: List<InterestRate>, }.loanable_assetthe
AssetClassof the stable coin or any asset that can be borrowed
.collateral_assetthe
AssetClassof the asset that can be used as collateral
.interest_ratesthe list of
InterestRatetuples
Constructors for supported dexes used for liquidating overdue or undercollateralized positions
Constructors
-
Minswap { order_contract: ScriptHash } -
SundaeSwap { order_contract: ScriptHash } -
WingRiders { order_contract: ScriptHash }
The loan info data structure that is part of the PositionRegistryDatum
Constructors
-
LoanDatum { collateral_asset: AssetClass, borrowed_asset: AssetClass, collateral_amt: Int, borrowed_amt: Int, interest_amt: Int, loan_term: Int, maturity: PosixTime, }
The loan request data structure that is part of the LoanRequested CollateralStatus
Constructors
-
LoanRequest { borrowed_asset: AssetClass, borrowed_amt: Int, loan_term: Int }
The datum structure for UTXOs at the oracle contract, containing price quotes.
Constructors
-
OracleDatum { timestamp: PosixTime, validity_period: Int, quoted_asset: AssetClass, denomination: AssetClass, price: QuotePrice, consumers: List<Signer>, }.timestampthe time of last update, expressed as POSIX time in milliseconds
.validity_periodthe period to consider the price update usable, expressed as POSIX time duration in milliseconds
.quoted_assetthe
AssetClassof the asset whose price is quoted (i.e. the collateral asset)
.denominationthe
AssetClassof the asset that is used to price the quoted asset (i.e. the loanable asset)
.pricethe price of the
quoted_assetdenominated in thedenominationasset.
.consumersCan be used later, to whitelist consumers of oracle UTXOs
The datum structure for UTXOs in the loans_registry contract.
Constructors
-
PositionRegistryDatum { borrower: Address, loan: LoanDatum, liquidator: Option<Signer>, }
POSIX time in milliseconds
Alias
PosixTime = Int
The price of the collateral asset denominated in the loanable asset.
Example: If we have a collateral in ADA and the loanable asset is USDM; and the
price of ADA is 0.812345 USDM, this would be 812345.
Alias
Price = Int
The return type of count_protocol_inputs() containing
the number of Inputs from each of the protocol’s contracts.
Constructors
-
ProtocolInputs { collateral: Int, lending_pool: Int, registry: Int }
A tuple containg the price of an asset denominated in another asset, and the latter’s decimal digits.
Example: If we are quoting the price of ADA in USDM as 0.812345 USDM and USDM has 6 decimal digits, this would be (812345, 6)
Alias
QuotePrice = (Price, DecimalDigits)
The data structure of datums in UTXOs held by the settings contract
Constructors
-
GlobalSettings { admin_key_hash: VerificationKeyHash, pool_contract: ScriptHash, audit_contract: ScriptHash, oracle_contract: ScriptHash, registry_contract: ScriptHash, collateral_contract: ScriptHash, collateral_ratio: Int, max_tx_validity: Int, liquidation_dexes: List<LiquidationDex>, }.pool_contractthe
ScriptHashof thelending_poolvalidator
.audit_contractthe
ScriptHashof theauditvalidator
.oracle_contractthe
ScriptHashof theoraclevalidator
.registry_contractthe
ScriptHashof theposition_registryvalidator
.collateral_contractthe
ScriptHashof thecollateralvalidator
.collateral_ratiothe loan-to-value ratio of the collateral asset, expressed in whole number percentage figure (eg:
70for 70%)
.max_tx_validitythe maximum transaction validity period allowed by the protocol, expressed as a POSIX time duration
Int(in milliseconds)
.liquidation_dexesthe list of supported dexes used for liquidating overdue or undercollateralized positions
-
OracleSettings { oracle_contract: ScriptHash, providers: List<Signer> }.oracle_contractthe
ScriptHashof theoraclevalidator
.providersthe list of trusted providers’ key hashes
The parameter for when compiling the parameterized settings contract
Constructors
-
SettingsValidatorParams { init_output_ref: OutputReference }
Signers can be either a ScriptHash or a VerificationKeyHash, which are both just aliases for ByteArray.
Alias
Signer = ByteArray
The loan term expressed as a POSIX time duration Int (in milliseconds)
Alias
Term = Int
The data structure for the redeemer that can be used for any of the contracts in the protocol
Constructors
-
BorrowRequest { loan_amt: Int, loan_term: Int, loan_asset: AssetClass, input_idx: Int, output_idx: Int, }.input_idxcollateral input idx
.output_idxcollateral output idx
-
BorrowProcess { collateral_idxs: (Int, Int), pool_idxs: (Int, Int), oracle_idx: Int, cfg_idx: Int, registry_output_idx: Int, }.collateral_idxs(input_idx, output_idx)
.pool_idxslending_pool UTXO (input_idx, output_idx)
.oracle_idxoracle UTXO (reference input index)
.cfg_idxglobal settings UTXO (reference input index)
.registry_output_idxposition registry UTXO
-
RepayRequest { collateral_idxs: (Int, Int), registry_idx: Int, cfg_idx: Int }.collateral_idxs(input_idx, output_idx)
.registry_idxposition registry UTXO (reference input index)
.cfg_idxglobal settings UTXO (reference input index)
-
RepayProcess { collateral_idxs: (Int, Int), pool_idxs: (Int, Int), cfg_idx: Int, registry_input_idx: Int, }.collateral_idxs(input_idx, output_idx)
.pool_idxs(input_idx, output_idx)
.cfg_idxglobal settings UTXO (reference input index)
-
LiquidateCollateral { collateral_input_idx: Int, registry_idxs: (Int, Int), dex_output_idx: Int, oracle_idx: Int, cfg_idx: Int, liquidation_dex: LiquidationDex, liquidator: Signer, }.registry_idxs(input_idx, output_idx)
.oracle_idxoracle UTXO (reference input index)
.cfg_idxglobal settings UTXO (reference input index)
-
SettleLiquidation { collateral_input_idx: Int, registry_input_idx: Int, pool_idxs: (Int, Int), cfg_idx: Int, }.pool_idxs(input_idx, output_idx)
.cfg_idxglobal settings UTXO (reference input index)
-
WithdrawCollateral { input_idx: Int }.input_idxcollateral input idx
-
WithdrawLendingPool { pool_input_idx: Int, cfg_idx: Int }.pool_input_idxlending_pool input idx
.cfg_idxglobal settings UTXO (reference input index)
-
MintSettingsBeacons { init_utxo_idx: Int }.init_utxo_idxThe index of the input
UTXOthat will be used to mint the protocol’s only settings beacon tokens.
-
BurnSettingsBeacons { glob_cfg_utxo_idx: Int }.glob_cfg_utxo_idxThe index of the input
UTXOcontaining the global settings
-
UpdateGlobalCfg { input_idx: Int, output_idx: Int }.input_idxglobal settings input idx
.output_idxglobal settings output idx
-
UpdateOracleCfg { global_cfg_idx: Int, oracle_cfg_idxs: (Int, Int) }.global_cfg_idxglobal settings UTXO (reference input index)
.oracle_cfg_idxsoracle settings UTXO (input_idx, output_idx)
-
MintOracleBeacon { cfg_idx: Int }.cfg_idxglobal settings UTXO (reference input index)
-
BurnOracleBeacon { cfg_idx: Int }.cfg_idxglobal settings UTXO (reference input index)
-
UpdateOraclePrice { price_idxs: (Int, Int), cfg_idx: Int, provider: Signer }.price_idxsoracle UTXO with price datum (input_idx, output_idx)
.cfg_idxoracle settings UTXO (reference input index)
.providerkey hash of the provider that is submitting the price update
-
UpdateAuditDatum { audit_idxs: (Int, Int), gcfg_idx: Int, ocfg_idx: Int, pool_idx: Int, oracle_idx: Int, provider: Signer, }.gcfg_idxglobal settings UTXO (reference input index)
.ocfg_idxoracle settings UTXO (reference input index)
.pool_idxlending_pool UTXO (reference input index)
.oracle_idxoracle UTXO (reference input index)
.providerkey hash of the provider that is submitting the price update
-
UpdateLenderConfig { input_idx: Int, output_idx: Int, cfg_idx: Int }.input_idxlending_pool input idx
.output_idxlending_pool output idx
.cfg_idxglobal settings UTXO (reference input index)