LISA
  • What is LISA?
    • LISA
  • Supported Tokens
    • Stacks ($STX)
      • How LiSTX Architecture Works?
        • Mint Factory
        • LISA Vault
        • Strategies
    • Bitcoin ($BTC)
      • How LiaBTC Earns Bitcoin Yield?
      • What is LiaBTC backed by?
      • How LiaBTC utilizes Cobo?
      • How would ALEX V2 Upgrade Affects LiaBTC?
    • ALEX ($ALEX)
  • Features (How To's)
    • Staking / Stacking
    • Unstaking / Unstacking
    • LISA Point System
    • Wrapping / Unwrapping
    • My Rewards / Overviews
    • Review to Earn
    • Send LISA Tokens
    • Checking your Balance
  • Rebasing Mechanism 101
    • Rebasing vs Reward-Bearing Mechanism
    • Depositing / Withdrawing from LISA
  • LISA FAQs
    • How are Rewards Paid Out?
    • How do I calculate my earnings?
    • Do I Earn Rewards if I withdraw before a Cycle Ends?
    • How is APR determined?
    • How can I check my past transactions on LISA?
    • How can I check the accurate LiSTX amount I’ve swapped via AMM?
    • Can I bridge out my LISA Tokens to other networks?
    • How to Participate in LISA Merkl Campaign?
  • LISA Point System
    • Point Reward Scores
    • Points to Loot Box Conversion
    • Entry / Exit Cycle Cooldown FAQs
  • Governance
    • LISA DAO
      • LISA DAO Improvements
    • Stacking Strategies
  • Is LISA Safe?
    • Security Audits
    • External Analytics
    • Deployed Contracts
  • Ecosystem Partners
    • ALEX
    • Ryder
    • Fast Pool by Ryder
    • Xverse
    • XLink
    • Cobo
  • Developers
    • List with LISA!
    • LISA Supported Network
    • LISA Media Kits
    • Contracts
      • liabtc-mint-endpoint
      • liabtc-mint-registry
      • token-liabtc
      • token-vliabtc
Powered by GitBook
On this page
  • Mint
  • Burn
  • Request
  • Finalize
  • Revoke
  • Rebase
  • Features
  • Public
  • Governance
  • Supporting features
  • Getters
  • Storage
  • mint-paused
  • burn-paused
  • burn-delay
  • use-whitelist
  • whitelisted
  • Relevant constants
  • Contract calls
  • Errors
  1. Developers
  2. Contracts

liabtc-mint-endpoint

PreviousContractsNextliabtc-mint-registry

Last updated 3 months ago

  • Location: xlink-dao/contracts/liabtc/liabtc-mint-endpoint.clar

Façade for contract designed to handle the lifecycle of the LiaBTC rebasing token (mint, burn and rebase operations).

The liabtc-mint-endpoint contract acts as single aBTC staker within the contract. It serves as an abstraction layer, simplifying interactions between LiaBTC users and the liquid staking pool management provided by the contract, also known as XLink Staking Manager.

Mint

The mint operation consists of two main actions:

  • User transfers aBTC to be staked in the liquid staking pool.

  • User receives LiaBTC tokens in exchange at a 1:1 ratio (1 aBTC = 1 LiaBTC).

When a user mints LiaBTC, the underlying aBTC is transferred to the Staking Manager, which stores the funds, tracks the liquid staking status (including shares and stake balances) and emits an event.

Burn

The burn operation (or unstake) allows users to withdraw their aBTC from the liquid staking pool in exchange for burning LiaBTC tokens at a 1:1 ratio. These operations are managed by the and involve a waiting period between the burn request and the final withdrawal of aBTC.

Request

User initiates the request to unstake a specific amount of aBTC. During this step:

  • That same amount of LiaBTC tokens are burned from the user wallet.

  • A burn request is created in the registry with a unique request-id and a status.

  • The aBTC are sent from the Staking Manager to the registry, which will hold the funds until the request is either finalized or revoked.

Finalize

  • The corresponding aBTC is transferred from the registry to the requester, completing the unstaking process.

Revoke

Burn requests can be revoked by the requester at any time before it is finalized. When revoke:

  • The corresponding aBTC is returned to the user.

Rebase

The rebasing mechanism is implemented via the "shares" concept. The LiaBTC reserve reperesents the value in aBTC of the staking shares held by the liabtc-mint-endpoint, as tracked by the XLink Staking Manager contract.

The staking shares held by the liabtc-mint-endpoint are adjusted whenever users mint or burn LiaBTC. Over time, the value of these shares in aBTC grows as accrued staking rewards are reinvested, increasing the reserve.

Features

Public

rebase

Updates the LiaBTC token reserve by recalculating its value in aBTC based on the staking shares held by the liabtc-mint-endpoint contract.

mint

Mints LiaBTC to the caller (defined as sender within the contract) in exchange for aBTC at a 1:1 ratio. The provided aBTC is staked in the XLink Staking Manager by the liabtc-mint-endpoint on behalf of the user.

Parameters

Name
Type

amount

uint

message

{ token: principal, accrued-rewards: uint, update-block: uint }

signature-packs

list 100 { signer: principal, message-hash: (buff 32), signature: (buff 65) }

request-burn

Initiates the burn procedure for a certain amount of LiaBTC. Several actions are performed:

  • LiaBTC amount is burned from the user wallet.

  • A request with PENDING status is created on the registry.

Parameters

Name
Type

amount

uint

message

{ token: principal, accrued-rewards: uint, update-block: uint }

signature-packs

list 100 { signer: principal, message-hash: (buff 32), signature: (buff 65) }

revoke-burn

Parameters

Name
Type

request-id

uint

message

{ token: principal, accrued-rewards: uint, update-block: uint }

signature-packs

list 100 { signer: principal, message-hash: (buff 32), signature: (buff 65) }

finalize-burn

Finalizes a burn request by transferring the aBTC from the registry to the user (requested-by field of the request). Request is set as FINALIZED. This function is permissionless and can be called by any user, even those who did not initiate the burn request.

Parameters

Name
Type

request-id

uint

finalize-burn-many

Finalizes requests in bulk.

Parameters

Name
Type

request-ids

list 1000 uint

Governance

set-use-whitelist

Parameters

Name
Type

new-use

bool

set-whitelisted

Parameters

Name
Type

user

principal

new-whitelisted

bool

set-whitelisted-many

Assigns the whitelist status of users in bulk.

Parameters

Name
Type

users

list 1000 principal

new-whitelisted

list 1000 bool

set-mint-paused

Parameters

Name
Type

new-paused

bool

set-burn-paused

Parameters

Name
Type

new-paused

bool

set-burn-delay

Parameters

Name
Type

new-delay

uint

Supporting features

is-dao-or-extension

Standard protocol function to check whether the contract-caller is an enabled extension within the DAO or the tx-sender is the DAO itself (proposal execution scenario). The enabled extension check is delegated to the LISA's executor-dao contract.

is-whitelisted-or-mint-for-all

Checks if a given principal is eligible for minting under the current whitelist settings. If the whitelist is active, returns false if the user is not whitelisted. Returns true in all other cases.

Parameters

Name
Type

user

principal

validate-mint

Parameters

Name
Type

amount

uint

validate-request-burn

Parameters

Name
Type

amount

uint

validate-revoke-burn

Parameters

Name
Type

request-id

uint

validate-finalize-burn

Parameters

Name
Type

request-id

uint

Getters

is-mint-paused

is-burn-paused

is-not-mint-paused-or-fail

Throws with err-paused if mint is paused, returns (ok true) otherwise.

is-not-burn-paused-or-fail

Throws with err-paused if burn is paused, returns (ok true) otherwise.

get-burn-request-or-fail

Returns a burn request stored in the liabtc-mint-registry's burn-request map. If entry doesn't exist, throws.

Parameters

Name
Type

request-id

uint

get-burn-request-or-fail-many

Returns a list of burn requests stored in the liabtc-mint-registry. If any of the entries doesn't exist, throws.

Parameters

Name
Type

request-ids

list 1000 uint

get-burn-delay

get-current-bitcoin-block

Getter for testing purposes. If mainnet, returns the burn-block-height.

Storage

mint-paused

Data
Type

Variable

bool

Indicates the operational status for the mint (stake) operations.

burn-paused

Data
Type

Variable

bool

Indicates the operational status for the burn (unstake) operations.

burn-delay

Data
Type

Variable

uint

Indicates the waiting period for a burn request, measured in Bitcoin blocks (burn chain). It represents the time users must wait between initiating burn request and being able to finalize it.

use-whitelist

Data
Type

Variable

bool

Indicates whether the whitelist mechanism is currently active. The whitelist applies to mint (stake) operations but not to burn (unstake) ones.

whitelisted

Data
Type

Map

principal bool

Maintains a mapping of users (principal) to their whitelist status (bool).

Relevant constants

PENDING

Type
Value

buff 1

0x00

Burn request pending status. When created, burn requests start with this status.

FINALIZED

Type
Value

buff 1

0x01

Burn request finalize status.

REVOKED

Type
Value

buff 1

0x02

Burn request revoked status.

Contract calls

  • 'SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.token-abtc: As the underlying token that backs LiaBTC, this contract is called for transfers and to specify the token being staked in the Staking Manager.

Errors

Error Name
Value

err-unauthorised

(err u1000)

err-paused

(err u7001)

err-request-pending

(err u7006)

err-request-finalized-or-revoked

(err u7007)

err-not-whitelisted

(err u7008)

Once the period (typically 1,000 Bitcoin blocks) has passed, the user or any other principal can finalize the request. On finalization:

The request status is updated to .

A operation is executed in the same transaction, restoring the user's original amount of LiaBTC.

The request status is updated to .

This contract manages the LiaBTC token reserve through the public function. Mint and burn operations perfom a rebase every time they are executed. However, rebase can be called permissionlessly by any principal.

For a detailed overview of the LiaBTC liquid token, refer to the contract documentation.

The message and signature-packs parameters serve as inputs to the function. They are part of the XLink liquid staking pool's reward accrual mechanism, which operates permissionlessly and relies on validators.

The same amount of aBTC is unstaked from the xlink-staking contract and transferred to the liabtc-mint-endpoint, which then transfers it to the , where it is held until finalization or revocation.

As with , the message and signature-packs parameters serve as inputs to the function.

Revokes a burn request. Only the requester (requested-by field of the request) can call this function. The registry returns the funds back to user as in finalize-request, with the key difference that the function is invoked (with the user as sender) to restake the aBTC and mint the LiaBTC back to the user. Request status is updated to REVOKED.

The following functions are guarded by the function. This implies that only the LISA DAO or an enabled extension can use these features.

Sets the variable.

Assigns the whitelist status of a user. Modifies the map.

Sets the variable.

Sets the variable.

Sets the variable.

xlink-staking::validate-stake façade for handling aBTC staking. Within the contract, this function is solely called by the function. Throws if mint is paused or the sender is not whitelisted (when applicable).

xlink-staking::validate-unstake façade for handling aBTC unstaking. Within the contract, this function is solely called by the function. Throws if burn is paused.

Performs revoke burn validations and returns the corresponding request details. Within the contract, this function is solely called by the function. Validations encompass: burn is not paused, request exists, request has PENDING status and sender matches the requested-by field on the burn request (only the requester can revoke).

Performs finalize burn validations and returns the corresponding request details. Within the contract, this function is solely called by the function. Validations encompass: burn is not paused, request exists, request has PENDING status and the period has been completed.

Returns the variable.

Returns the variable.

Returns the variable.

: Interactions with the Staking Manager are present in the contract's core opertions. It is called during every mint or burn operation to handle the corresponding stake or unstake actions. Additionally, the Staking Manager is essential to perfom the LiaBTC rebase by retrieving the value of aBTC held by the liabtc-mint-endpoint as a staker within the protocol.

: The registry is called to manage burn requests and handle funds during the burning/unstaking process.

: This contract is called to perform three essential actions: rebase, mint and burn.

'SM26NBC8SFHNW4P1Y4DFH27974P56WN86C92HPEHH.lisa-dao: This contract is exclusively called by the function for authorizing governance operations.

token-liabtc
xlink-staking::stake
liabtc-mint-registry
xlink-staking
liabtc-mint-registry
token-liabtc
burn-delay
FINALIZED
mint
REVOKED
rebase
xlink-staking::unstake
mint
mint
is-dao-or-extension
use-whitelist
whitelisted
mint-paused
burn-paused
burn-delay
mint
request-burn
revoke-burn
finalize-burn
burn-delay
mint-paused
burn-paused
burn-delay
is-dao-or-extension
Deployed contract
xlink-staking
xlink-staking
xlink-staking
liabtc-mint-registry
PENDING