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),
    }

    .timestamp

    time of last update, POSIX time in milliseconds


    .collateral_asset

    the AssetClass of the asset that can be used as collateral


    .loanable_asset

    the AssetClass of the stable coin or any asset that can be borrowed


    .collateral_ratio

    the loan-to-value ratio of the collateral asset, expressed in whole number percentage figure (eg: 70 for 70%)


    .total_collateral

    total amount of collateral asset used to secure open loan positions


    .total_borrowed

    total amount of borrowed loanable asset in all open positions


    .health_score

    health score of the whole lending pool (numerator, denominator)


    .utilization_rate

    utilization 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

A loan interest rate, expressed as a tuple containing the following items:

  1. The loan term (Term)
  2. The loan interest rate (IntRate)

Alias

InterestRate = (Term, IntRate)

The lending pool UTXO datum structure.

Constructors

  • LendingPoolDatum {
      loanable_asset: AssetClass,
      collateral_asset: AssetClass,
      interest_rates: List<InterestRate>,
    }

    .loanable_asset

    the AssetClass of the stable coin or any asset that can be borrowed


    .collateral_asset

    the AssetClass of the asset that can be used as collateral


    .interest_rates

    the list of InterestRate tuples


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>,
    }

    .timestamp

    the time of last update, expressed as POSIX time in milliseconds


    .validity_period

    the period to consider the price update usable, expressed as POSIX time duration in milliseconds


    .quoted_asset

    the AssetClass of the asset whose price is quoted (i.e. the collateral asset)


    .denomination

    the AssetClass of the asset that is used to price the quoted asset (i.e. the loanable asset)


    .price

    the price of the quoted_asset denominated in the denomination asset.


    .consumers

    Can 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_contract

    the ScriptHash of the lending_pool validator


    .audit_contract

    the ScriptHash of the audit validator


    .oracle_contract

    the ScriptHash of the oracle validator


    .registry_contract

    the ScriptHash of the position_registry validator


    .collateral_contract

    the ScriptHash of the collateral validator


    .collateral_ratio

    the loan-to-value ratio of the collateral asset, expressed in whole number percentage figure (eg: 70 for 70%)


    .max_tx_validity

    the maximum transaction validity period allowed by the protocol, expressed as a POSIX time duration Int (in milliseconds)


    .liquidation_dexes

    the list of supported dexes used for liquidating overdue or undercollateralized positions


  • OracleSettings { oracle_contract: ScriptHash, providers: List<Signer> }

    .oracle_contract

    the ScriptHash of the oracle validator


    .providers

    the 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_idx

    collateral input idx


    .output_idx

    collateral 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_idxs

    lending_pool UTXO (input_idx, output_idx)


    .oracle_idx

    oracle UTXO (reference input index)


    .cfg_idx

    global settings UTXO (reference input index)


    .registry_output_idx

    position registry UTXO


  • RepayRequest { collateral_idxs: (Int, Int), registry_idx: Int, cfg_idx: Int }

    .collateral_idxs

    (input_idx, output_idx)


    .registry_idx

    position registry UTXO (reference input index)


    .cfg_idx

    global 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_idx

    global 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_idx

    oracle UTXO (reference input index)


    .cfg_idx

    global 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_idx

    global settings UTXO (reference input index)


  • WithdrawCollateral { input_idx: Int }

    .input_idx

    collateral input idx


  • WithdrawLendingPool { pool_input_idx: Int, cfg_idx: Int }

    .pool_input_idx

    lending_pool input idx


    .cfg_idx

    global settings UTXO (reference input index)


  • MintSettingsBeacons { init_utxo_idx: Int }

    .init_utxo_idx

    The index of the input UTXO that will be used to mint the protocol’s only settings beacon tokens.


  • BurnSettingsBeacons { glob_cfg_utxo_idx: Int }

    .glob_cfg_utxo_idx

    The index of the input UTXO containing the global settings


  • UpdateGlobalCfg { input_idx: Int, output_idx: Int }

    .input_idx

    global settings input idx


    .output_idx

    global settings output idx


  • UpdateOracleCfg { global_cfg_idx: Int, oracle_cfg_idxs: (Int, Int) }

    .global_cfg_idx

    global settings UTXO (reference input index)


    .oracle_cfg_idxs

    oracle settings UTXO (input_idx, output_idx)


  • MintOracleBeacon { cfg_idx: Int }

    .cfg_idx

    global settings UTXO (reference input index)


  • BurnOracleBeacon { cfg_idx: Int }

    .cfg_idx

    global settings UTXO (reference input index)


  • UpdateOraclePrice { price_idxs: (Int, Int), cfg_idx: Int, provider: Signer }

    .price_idxs

    oracle UTXO with price datum (input_idx, output_idx)


    .cfg_idx

    oracle settings UTXO (reference input index)


    .provider

    key 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_idx

    global settings UTXO (reference input index)


    .ocfg_idx

    oracle settings UTXO (reference input index)


    .pool_idx

    lending_pool UTXO (reference input index)


    .oracle_idx

    oracle UTXO (reference input index)


    .provider

    key hash of the provider that is submitting the price update


  • UpdateLenderConfig { input_idx: Int, output_idx: Int, cfg_idx: Int }

    .input_idx

    lending_pool input idx


    .output_idx

    lending_pool output idx


    .cfg_idx

    global settings UTXO (reference input index)


Search Document