Zest Protocol Docs
  • What is Zest Protocol? 🍊
  • Unlocking Bitcoin Lending
  • Points
  • Zest Protocol Borrow
    • Zest Protocol Borrow Overview
      • How to use Stacks Market to Earn Yield
      • How to use Stacks Market to Borrow Assets
        • Traditional Borrowing
        • E-Mode Borrowing
      • How to use Stacks Market as a Liquidator
      • Protocol Design
        • Oracles
        • Interest Rates Mechanism and Risk Management
  • Zest Protocol BTCz
    • Zest Protocol BTCz Overview
      • BTCz
      • BTCz User Guide
      • BTCz FAQ
    • Audits
  • Zest Protocol BORROW - CONTRACTS
    • Zest Borrow Contracts Overview
    • Reserve and Configuration
      • pool-0-reserve
      • pool-reserve-data
        • Isolation Mode
      • pool-vault
    • Pool Logic
      • pool-borrow
      • liquidation-manager
    • Audits
  • ZEST PROTOCOL BTCz - CONTRACTS
    • BTCz Contracts Overview
  • Other
    • Disclaimer
Powered by GitBook
On this page
  1. Zest Protocol BORROW - CONTRACTS
  2. Pool Logic

pool-borrow

List of Core Functions:

  1. supply: Supplies an asset to the protocol.

  2. withdraw: Withdraws an asset from the protocol.

  3. borrow: Borrows an asset from the protocol.

  4. repay: Repays a borrowed asset.

  5. liquidation-call: Executes a liquidation call on an undercollateralized loan.

  6. flashloan: Executes a flash loan transaction.

  7. set-configurator: Sets the configurator address.

  8. set-user-use-reserve-as-collateral: Sets whether a user's reserve can be used as collateral.

  9. init: Initializes a reserve.

  10. set-reserve: Sets the state of a reserve.

  11. set-borrowing-enabled: Enables or disables borrowing for a reserve.

  12. set-usage-as-collateral-enabled: Enables or disables a reserve's usage as collateral.

  13. add-isolated-asset: Adds an asset to the list of isolated assets.

  14. add-asset: Adds an asset to the protocol.

  15. remove-asset: Removes an asset from the protocol.

  16. remove-isolated-asset: Removes an asset from the list of isolated assets.

  17. set-borroweable-isolated: Sets an asset as borrowable when isolated assets are used as collateral.

  18. remove-borroweable-isolated: Removes an asset from the list of borrowable assets when isolated assets are used as collateral.

Detailed Tables:

supply

Supplies an asset to the protocol.

Parameter
Type
Description

lp

<ft-mint-trait>

The liquidity pool trait reference.

pool-reserve

principal

The pool reserve address.

asset

<ft>

The asset to supply.

amount

uint

The amount of the asset to supply.

owner

principal

The owner of the asset.

withdraw

Withdraws an asset from the protocol.

Parameter
Type
Description

pool-reserve

principal

The pool reserve address.

asset

<ft>

The asset to withdraw.

oracle

<oracle-trait>

The oracle trait reference.

assets

list

List of asset details.

amount

uint

The amount to withdraw.

current-balance

uint

The current balance of the user.

owner

principal

The owner of the asset.

borrow

Borrows an asset from the protocol.

Parameter
Type
Description

pool-reserve

principal

The pool reserve address.

oracle

<oracle-trait>

The oracle trait reference.

asset-to-borrow

<ft>

The asset to borrow.

lp

<ft>

The liquidity pool trait reference.

assets

list

List of asset details.

amount-to-be-borrowed

uint

The amount to be borrowed.

fee-calculator

principal

The fee calculator address.

interest-rate-mode

uint

The interest rate mode.

owner

principal

The owner of the asset.

repay

Repays a borrowed asset.

Parameter
Type
Description

asset

<ft>

The asset to repay.

amount-to-repay

uint

The amount to repay.

on-behalf-of

principal

The user on behalf of whom the repayment is made.

payer

principal

The user who is making the repayment.

liquidation-call

Executes a liquidation call on an undercollateralized loan.

Parameter
Type
Description

assets

list

List of asset details.

collateral-lp

<a-token>

The collateral liquidity pool trait reference.

collateral-to-liquidate

<ft>

The collateral asset to liquidate.

debt-asset

<ft>

The debt asset involved in the liquidation.

collateral-oracle

<oracle-trait>

The oracle trait for the collateral.

debt-oracle

<oracle-trait>

The oracle trait for the debt.

liquidated-user

principal

The user being liquidated.

debt-amount

uint

The amount of debt to cover in the liquidation.

to-receive-atoken

bool

Whether to receive aTokens or underlying asset.

flashloan

Executes a flash loan transaction.

Parameter
Type
Description

receiver

principal

The receiver of the flash loan.

lp

<ft>

The liquidity pool trait reference.

asset

<ft>

The asset to be flash loaned.

amount

uint

The amount of the flash loan.

flashloan

<flash-loan>

The flash loan trait reference.

set-configurator

Sets the configurator address.

Parameter
Type
Description

new-configurator

principal

The new configurator address.

set-user-use-reserve-as-collateral

Sets whether a user's reserve can be used as collateral.

Parameter
Type
Description

who

principal

The user for whom the setting is being applied.

lp-token

<ft>

The liquidity pool token trait reference.

asset

<ft>

The asset to set for collateral usage.

enable-as-collateral

bool

Whether the asset should be used as collateral.

oracle

<oracle-trait>

The oracle trait reference.

assets-to-calculate

list

List of assets to calculate for the collateral check.

init

Initializes a reserve.

Parameter
Type
Description

a-token-address

principal

The address of the aToken.

asset

principal

The asset to initialize.

decimals

uint

The number of decimals for the asset.

supply-cap

uint

The supply cap for the asset.

borrow-cap

uint

The borrow cap for the asset.

oracle

principal

The oracle address for the asset.

interest-rate-strategy-address

principal

The interest rate strategy address.

set-reserve

Sets the state of a reserve.

Parameter
Type
Description

asset

principal

The asset for which to set the reserve.

state

tuple

The state details of the reserve.

set-borrowing-enabled

Enables or disables borrowing for a reserve.

Parameter
Type
Description

asset

principal

The asset for which to set borrowing.

enabled

bool

Whether borrowing should be enabled.

set-usage-as-collateral-enabled

Enables or disables a reserve's usage as collateral.

Parameter
Type
Description

asset

principal

The asset for which to set the usage.

enabled

bool

Whether the usage as collateral should be enabled.

base-ltv-as-collateral

uint

The base LTV as collateral.

liquidation-threshold

uint

The liquidation threshold.

liquidation-bonus

uint

The liquidation bonus.

add-isolated-asset

Adds an asset to the list of isolated assets.

Parameter
Type
Description

asset

principal

The asset to be added to the list.

debt-ceiling

uint

The debt ceiling for the asset.

add-asset

Adds an asset to the protocol.

Parameter
Type
Description

asset

principal

The asset to be added.

remove-asset

Removes an asset from the protocol.

Parameter
Type
Description

asset

principal

The asset to be removed.

remove-isolated-asset

Removes an asset from the list of isolated assets.

Parameter
Type
Description

asset

principal

The asset to be removed from the list.

set-borroweable-isolated

Sets an asset as borrowable when isolated assets are used as collateral.

Parameter
Type
Description

asset

principal

The asset to be set as borrowable.

remove-borroweable-isolated

Removes an asset from the list of borrowable assets when isolated assets are used as collateral.

Parameter
Type
Description

asset

principal

The asset to be removed from the list of borrowable.

PreviousPool LogicNextliquidation-manager

Last updated 11 months ago

Page cover image