bLuna tokens are bAssets built for the Terra blockchain, their value backed by underlying Luna delegations. bLuna tokens follows full compliance with the Cw20 standard, having the potential to be integrated into a wide variety of decentralized finance applications.
The bLuna exchange rate is the rate of conversion used when bLuna is minted or redeemed. Defined as the amount of bonded Luna per bLuna in existence, the value initially starts with 1, and decreases with slashing events.
bLuna tokens equally share all losses from slashing events of whitelisted validators. Slashing events decrease the bLuna exchange rate, lowering the calculated value of a bLuna token.
The protocol applies a fee of 0.5% to bLuna mints and burns whenever the exchange rate is below 1, targeting a gradual recovery to a one-to-one peg.
The bLuna contract keeps a whitelist of validators, only permitting delegations to those included in the whitelist. This is crucial since all bLuna tokens equally share slashing risks, and delegations to low-performing validators could negatively affect all holders.
The initial whitelist includes the below validators:
P2P.ORG - P2P Validator
DSRV - CHAISCAN.com
Validators that have proven their operational capabilities are eligible for whitelisting. Track records such as uptime and community support are factors of consideration.
Underperforming validators are deregistered from the whitelist, disallowing bLuna minters from making new delegations to them. Following deregistration, the bLuna contract automatically redelegates existing delegations to a different, randomly selected validator.
The Terra blockchain permanently disables validator addresses that have double signed a block (i.e. tombstoned). Tombstoned validators are also deregistered, with their remaining delegations redelegated. The new address of the tombstoned validator can later be re-registered to the whitelist if necessary.
The bLuna contract processes Luna undelegations in batches, creating them in epochs of 3 days. Whenever an undelegation is done, an entry storing its information is created:
batch_id: incrementally-increasing unique identifier of the undelegation batch
amount: total amount of fee deducted bLuna unbonded in this batch
time: time of batch undelegation
applied_exchange_rate: bLuna exchange rate at the time of undelegation
withdraw_rate: rate applied when later withdrawing undelegated Luna from this batch
released: indicator on whether the unbonding period is over for this batch
When a batch is undelegated,
applied_exchange_rate is stored as the bLuna exchange rate at the time of undelegation, and
released is stored as
Later when users withdraw undelegated Luna, the contract first checks for newly undelegated batches by comparing the current time with the
time of recent batches. Batches that are older than 21 days are considered undelegated, and are marked by updating
withdraw_rate, which determines the amount of Luna withdrawable per unbonded bLuna, is also updated to account for slashing events that happened during batch undelegation. The amount of slashed Luna, calculated by comparing the Luna amount initially undelegated and the Luna amount actually received, is deducted pro-rata from the newly undelegated batches by updating the corresponding
withdraw_rate to the new decreased value.
bLuna tokens are minted by delegating Luna via the bLuna contract. Users are required to specify a validator to delegate, selected among the list of whitelisted validators. The amount of bLuna they receive is dependent on the current bLuna exchange rate -- minted bLuna amounts will be greater than the Luna amount sent when the bLuna exchange rate is below 1.
Any bLuna holder can redeem their tokens for their underlying bonded Luna. Redemption is a two-step process; 1) requesting to unbond bLuna (undelegates underlying Luna) and 2) withdrawing undelegated Luna.
Due to the Terra blockchain's unbonding period, a complete redemption cycle requires at least 21 days to finish.
A bLuna unbond request triggers the undelegation its underlying staked Luna. To track the Luna amount later withdrawable by each user, a waitlist entry with the the below information is created:
address: address of bLuna unbond requester
batch_id: ID of the batch that includes the user's undelegation request
amount: amount of fee deducted bLuna unbonded by user
The user's request is added to the current undelegation batch, which is undelegated in epochs of 3 days. If 3 days have past since the previous batch was undelegated, the current batch, along with the user's request is undelegated.
To disallow any holder from manipulating the bLuna contract's delegations by constant minting and redeeming, undelegations are performed from a randomly selected validator.
Users that previously made a request to unbond bLuna can later withdraw the undelegated Luna tokens. The amount of Luna that the user can withdraw from an undelegation batch is calculated by multiplying the amount in the user's waitlist with the batch's
withdraw_rate. Summation of this value for batches that are past the unbonding period (
released marked as
true) yields the user's total withdrawable amount.
bLuna tokens accrue TerraUSD rewards, generated from delegation rewards of underlying Luna delegations. Delegation rewards, collected in various native token denominations (TerraUSD, TerraSDR, Luna, etc.), are swapped for TerraUSD. Swapped TerraUSD is then distributed pro-rata to bLuna holders.
Holders can send a request to the bLuna contract, which prompts the transfer of accrued rewards to their account. As rewards accrue during the user's period of ownership, transferring bLuna to a different user automatically credits accrued rewards to the previous holder.