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
  • What is LiaBTC?
  • Rebase mechanism
  • Balances
  • Units
  • Features
  • Public
  • Token management
  • Token governance
  • Supporting features
  • Getters
  • Storage
  • reserve
  • token-name
  • token-symbol
  • token-uri
  • token-decimals
  • Contract calls
  • Errors
  1. Developers
  2. Contracts

token-liabtc

Previousliabtc-mint-registryNexttoken-vliabtc

Last updated 3 months ago

  • Location: xlink-dao/contracts/liabtc/token-liabtc.clar

What is LiaBTC?

The LiaBTC token is a compliant rebasing token that represents staked aBTC. The underlying Bitcoin backing these aBTC tokens is staked externally.

This particular staking process uses the contract to track on-chain status and inform staking actions, the Bitcoin staking platform for execution and as the finality provider.

The lifecycle of the LiaBTC token invoves minting when aBTC is submitted for staking and burning upon unstaking. When users stake aBTC via LISA, they receive LiaBTC at a 1:1 ratio.

Rebase mechanism

The rebasing nature of LiaBTC is implemented via the "shares" concept. The contract tracks and stores each user's proportional share of an external reserve. By holding shares, users effectively hold a fraction of the total reserve. The reserve's value is tracked by the variable within the contract, which is updated externally, typically by the function.

The LiaBTC balance of a specific user is calculated according to the following equation.

User Balance=User SharesTotal Shares  ⋅ Reserve\begin{equation} \textrm{User Balance} = \frac{\textrm{User Shares}}{\textrm{Total Shares}} \; \cdot \: \textrm{Reserve} \end{equation}User Balance=Total SharesUser Shares​⋅Reserve​​

Where:

  • Reserve is the current total amount of aBTC staked, backed by the BTC staked at Babylon and their corresponding staking rewards which were converted to BTC and restaked.

  • User Shares represent the user's portion of the total reserve. Every time a user stakes aBTC, the equivalent value in shares is calculated and added to the user's shares balance. Shares increase when users deposit aBTC and decrease when they redeem.

  • Total Shares is the sum of all shares held by all LiaBTC token holders.

The above equation can be generalized for an arbitrary amount of shares:

while the token-to-share conversion can also be deduced by the same equation:

Balances

Users can freely use LiaBTC and its public interface just like any other token. The rebase and share mechanism is transparent from a LiaBTC token holder's perspective, with balance adjustments occurring automatically.

Units

Except for some specific cases, all interface functions' input and output amounts are in LiaBTC token units. The exceptions are the following functions:

Features

Public

transfer

Parameters

Name
Type

amount

uint

sender

principal

recipient

principal

memo

optional (buff 2048)

Token management

set-reserve

Parameters

Name
Type

new-reserve

uint

add-reserve

Increments the reserve.

Parameters

Name
Type

increment

uint

remove-reserve

Decrements the reserve.

Parameters

Name
Type

decrement

uint

dao-mint

Parameters

Name
Type

amount

uint

recipient

principal

dao-burn

Parameters

Name
Type

amount

uint

sender

principal

burn-many

Performs bulk burning of LiaBTC.

Parameters

Name
Type

senders

list 200 { amount: uint, sender: principal }

Token governance

dao-set-name

Parameters

Name
Type

new-name

string-ascii 32

dao-set-symbol

Parameters

Name
Type

new-symbol

string-ascii 10

dao-set-decimals

Parameters

Name
Type

new-decimals

uint

dao-set-token-uri

Parameters

Name
Type

new-uri

string-utf8 256

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.

get-tokens-to-shares

Converts a specified LiaBTC amount into its equivalent shares representation.

Parameters

Name
Type

amount

uint

get-shares-to-tokens

Converts a specified amount of shares into its equivalent value in LiaBTC tokens.

Parameters

Name
Type

shares

uint

Getters

get-balance

Returns the LiaBTC balance of a specified principal (who). The balance is calculated by retrieving the user's shares and converting them into their equivalent value in tokens. This conversion depends on the current share supply and the total value of the reserve.

Parameters

Name
Type

who

principal

get-total-supply

get-share

Parameters

Name
Type

who

principal

get-total-shares

get-reserve

get-name

get-symbol

get-token-uri

get-decimals

Storage

reserve

Data
Type

Variable

uint

token-name

Data
Type

Variable

string-ascii 32

Intial value is "LiaBTC".

token-symbol

Data
Type

Variable

string-ascii 10

Intial value is "LiaBTC".

token-uri

Data
Type

Variable

optional (string-utf8 256)

Initial value is some u"https://cdn.alexlab.co/metadata/token-liabtc.json".

token-decimals

Data
Type

Variable

uint

Initial value is u8.

Contract calls

Errors

Error Name
Value

err-unauthorised

(err u3000)

err-invalid-amount

(err u3001)

LiaBTC Tokens=SharesTotal Shares  ⋅ Reserve,\textrm{LiaBTC Tokens} = \frac{\textrm{Shares}}{\textrm{Total Shares}} \; \cdot \: \textrm{Reserve},LiaBTC Tokens=Total SharesShares​⋅Reserve,
Shares=LiaBTC TokensReserve  ⋅ Total Shares.\textrm{Shares} = \frac{\textrm{LiaBTC Tokens}}{\textrm{Reserve}} \; \cdot \: \textrm{Total Shares}.Shares=ReserveLiaBTC Tokens​⋅Total Shares.

This is how and functions work.

The LiaBTC balance of each user, accessible via the function, is automatically adjusted on each rebase, without involving an explicit token transfer. In a scenario where the user do not perform any staking movements, their balance will increase over time as staking rewards are reinjected into the staking protocol.

On the other hand, the shares balance, which can be obtained through the function, accounts for the portion of the total aBTC reserve that belongs to the user. Shares behave like a regular fungible token, meaning that balances can only changes with transfers, mints or burns.

: returns an amount in shares.

: receives shares and returns tokens.

: receives tokens and returns shares.

Both shares and tokens use the same number of decimals, defined by .

Transfers LiaBTC from the sender to the recipient. For authorization, the specified sender must either be the tx-sender or the contract-caller. Uses the Clarity function, where the actual transferred assets are shares.

The following functions are guarded by the function. These features are resticted to the LISA DAO or enabled extensions.

Updates the variable. It is primarly called by the contract.

Mints LiaBTC. This function uses the Clarity native function. The actual minted amount is first converted to shares before minting given the rebasing nature of LiaBTC. It is primarly called by the contract.

Burns LiaBTC. This function uses the Clarity native function. The actual burned amount is first converted to shares before burning given the rebasing nature of LiaBTC. It is primarly called by the contract.

The following functions are guarded by the function. These features are resticted to the LISA DAO or enabled extensions.

Updates the variable.

Updates the variable.

Updates the variable.

Updates the variable.

Returns the total supply of LiaBTC, which is the .

Returns the amount of shares held by a specified principal (who). This function uses the Clarity function.

Returns the total supply of shares, which is the value returned by the Clarity function.

Returns the variable.

Returns the variable.

Returns the variable.

Returns the variable.

Returns the variable.

Tracks the reserve of LiaBTC. It represents the current total value of aBTC staked through the , including the restaked rewards.

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

ft-transfer?
ft-mint?
liabtc-mint-endpoint
ft-burn?
liabtc-mint-endpoint
ft-get-balance
ft-get-supply
liabtc-mint-endpoint
get-shares-to-tokens
get-tokens-to-shares
get-balance
get-share
get-share
get-shares-to-tokens
get-tokens-to-shares
token-decimals
is-dao-or-extension
liabtc-mint-endpoint
reserve
is-dao-or-extension
token-name
token-symbol
token-decimals
token-uri
reserve
reserve
token-name
token-symbol
token-uri
token-decimals
is-dao-or-extension
Deployed contract
SIP-010
XLink Staking Manager
Babylon
Cobo
reserve
liabtc-mint-endpoint::rebase