Minting
Minting FAssets is the process of wrapping underlying tokens from connected blockchains into FAssets to be used on the Flare blockchain. Any user can mint FAssets.
Minting Processβ
This is the summary of the minting process:
-
The minter chooses an agent from the publicly available agent list. The choice is based on the minting fee or the amount of free collateral, which must be enough to back the amount to be minted.
-
The minter sends to the Asset Manager contract a collateral reservation transaction (CRT). The CRT includes:
- The address of the chosen agent
- The amount to mint, which must be a whole number of lots
- The collateral reservation fee (CRF) to compensate for the locked collateral
-
The Asset Manager contract locks the agent's collateral in the amount needed to back the whole minting until the underlying payment is proved or disproved. The collateral reservation response is an event issued by the contract, which includes:
-
The agent's address to which the minter must send funds on the underlying chain.
-
The amount to be paid on the underlying chain, which corresponds to the amount to be minted plus the agent's fee.
-
The payment reference, which is a unique 32-byte number the minter must include as a memo in the payment on the underlying chain.
-
The last underlying block and the last underlying timestamp to pay. Valid payments occur either before the last block or before the last timestamp, both inclusive.
The time to pay is measured both in the underlying chain's block numbers and block times because the underlying chain might halt for a long time. In this situation, the block numbers do not increment but the block timestamps do.
-
-
After this event is emitted, the minter must pay the full underlying amount plus the fee to the agent on the underlying chain in a certain amount of time.
-
Using the Data Connector, the minter proves the payment on Flare.
-
After the payment is proved, the minter executes the minting process, which sends FAssets to the minter's account.
When minting is executed, the minting fee is split between the agent and the pool:
- The percentage split is set by the agent.
- The agent's share increases the free balance on the agent's underlying address. The free balance is the part of the balance in an agent's underlying address that the agent can withdraw. It is composed of minting fees, redemption fees, and self-closed FAssets.
- The pool share gets minted as FAssets and credited to the collateral pool contract.
After minting is complete, the Asset Manager creates a redemption ticket, which includes the mint amount and the name of the agent backing the minting.
Feesβ
The following fees are paid to mint FAssets:
Collateral Reservation Feeβ
The collateral reservation fee (CRF) is paid in native tokens by the minter at the same time the CRT is made. The CRF is defined by governance as a percentage of the minted value, and the same fee applies to all agents.
When the minter does not pay on the underlying chain, this fee compensates the agent and the CPT holders for the time their collateral was locked while the mint processed. If the minter pays on the underlying chain, the CRF is burned.
For underlying chains on which proving payments takes a long time, the fee might be higher than the fee on chains that quickly prove payments.
Minting Feeβ
The minting fee is paid by the minter with the underlying currency as a percentage of the minted amount, and each agent can declare a different fee value. This fee is the main source of revenue for the agent and the CPT holders.
The minting fee is further divided in two shares:
Agent shareβ
This share remains in the agent's underlying account but is not marked as being in use. The agent can use this balance freely.
Pool shareβ
This share is minted as FAssets and sent to the collateral pool. The percentage of this share is defined by the agent and can be changed by the agent after a delay that provides time for minters to notice the change.
Trailing Feesβ
To ensure that agents and collateral pool providers receive steady income, the FAsset system offers an option to enable FAsset token transfer fees, also known as trailing fees.
Whenever FAssets are transferred, a small proportional fee is deducted and contributed to a common pool. In a regular transfer, this fee is subtracted from the payment, meaning the sender pays the exact amount specified in the transfer request, while the receiver ends up receiving a slightly lower amount.
There is also a method where the receiver gets the exact amount specified in the call, while the sender pays more. The fee percentage is a system setting and is typically quite small.
The fees are collected over a certain period, known as an epoch, after which they are distributed among all agents in proportion to each agent's average backed amount during that epoch.
An agent can claim their portion of the fees for an epoch at any time after the epoch ends and before it expires. When making a claim, the fee is distributed between the agent and the pool in the same manner as the minting fee, based on the agent's settings.
Handshakeβ
Certain jurisdictions may require agents to confirm that those minting or redeeming assets are not engaged in illegal activities. Although the FAsset system does not impose this requirement, it does provide agents with the option to utilize an external service to verify the identities of minters and redeemers before proceeding with minting or redemption.
To enable the handshake, the agent must configure this setting in the agent settings. Once this is enabled, minting and redemption will involve an additional step.
Mintingβ
The FAssets agent verifies the minter after the user completes the collateral reservation and pays the collateral reservation fee. The agent is responsible for confirming or rejecting the minter's status. If the agent does not respond within a certain timeframe, the minter has the option to cancel the reservation and receive a full refund of the collateral reservation fee.
To enable the agent to verify the minter, the collateral reservation must include the address (or multiple addresses, in the case of UTXO chains) from which the payment will be made. If multiple addresses are provided, all of them must be used for the payment.
Users must wait up to 60 seconds before they can cancel their request. If the agent accepts within this time, the user can proceed to mint by depositing the underlying assets. Therefore, it is important for the agent to respond quickly. If the agent does not respond in time, it will depend on whether the user is willing to wait; otherwise, the agent will simply miss the opportunity to mint, but there will be no loss of tokens.
When the agent rejects the minter's request or the minter decides to cancel, the minter will receive a refund of the collateral reservation fee, minus a small percentage (e.g., 5%) that is burned. This burned amount is designed to prevent abuse of the agent by stopping someone from repeatedly reserving collateral from a sanctioned address. If the burned percentage were zero, an attacker could exploit the system without any cost.
Redemptionβ
The agent has a few minutes to verify the redeemer's addresses and either approve or reject the redemption. If rejected, another agent can take over. If no one takes over, the minter receives the full amount plus a small premium from the rejecting agent, with the premium for a handshake rejection being smaller than for a redemption default.
An agent may only fulfill part of a request due to insufficient minting or too many small tickets. In these situations, the system allows for a βpartial takeoverβ, where the remaining portion can either be taken over by another agent or covered by collateral from the agent who declined the redemption.
Payment Failureβ
To finalize the minting, the minter must pay the agent on the underlying chain and prove the payment was received. If the payment is not completed in the time frame defined by the underlying chain block and timestamp, the agent must prove nonpayment to release the locked collateral. After nonpayment is proved, the agent's collateral that was reserved by the CRT is released, and the agent receives the CRF.
The agent's registration process verifies that the agent's underlying address does not purposefully block payments and illegally collects the CRF.
The following example shows proof of nonpayment.
Proof of nonpayment example.
The following example shows how the nonpayment proof works.
The Data Connector's payment nonexistence attestation type proves nonpayment.
-
The minter sends a request to mint FBTC. At the time the request is received, the last mined block on the Bitcoin chain is number 92, with timestamp 09:00 AM.
The Asset Manager answers with the following threshold settings to complete the payment:
- Block 100
- Timestamp 11:00 AM
-
Block 101 is mined with timestamp 10:59 AM. At this point, the payment can still happen.
-
Block 102 is mined with timestamp 11:04 AM. Payment did not occur. After this block is finalized, nonpayment can be proved.
-
Block 109 is mined. In this case, 7 blocks on the Bitcoin blockchain are enough blocks to assume finality.
-
The agent sends a nonpayment attestation request, which includes the payment reference, the underlying amount that was expected, the last block (100), and the last timestamp (11:00).
-
Attestation providers attest to the following facts:
- Block 102 is finalized and has both the number and timestamp larger than required.
- Until this block, the required payment either was not made or was not sufficient.
Now, the mint-payment failure and the nonpayment proof can be submitted to the FAssets system.
Edge Casesβ
Unresponsive minterβ
After a successful payment, the minter might not provide the payment proof needed to complete the minting process. In this case, the agent can present the payment proof and execute minting at any time. FAssets are still transferred to the minter's account, and the agent's collateral becomes redeemable.
Expired proofβ
Proofs provided by the Data Connector are available for only 24 hours, approximately. If neither the minter nor the agent presents the proof of payment or nonpayment within 24 hours, the regular minting process cannot continue, and the agent's collateral could be locked indefinitely.
In this case, the agent can still recover the collateral by buying it back with native tokens. The recovery is accomplished with the following procedure:
- Request the proof from the time when the deposit should have happened. The Data Connector's answer will indicate that payments proofs are no longer available for that time.
- Provide the amount of FLR collateral equivalent to the price of the underlying assets that should have been deposited.
- Present the proof.
Because a successful deposit cannot be proven, the FAssets system burns the amount of collateral in native tokens provided by the agent. After the burn is complete, the rest of the agent's collateral is released, both from his vault and the collateral pool.
Note that this procedure should be used only in rare cases because providing timely payment or nonpayment proofs is always more advantageous for agents.
Duration of the Minting Processβ
The duration of the minting process depends mainly on the speed of the underlying chain. The maximum duration of the process is the sum of:
- A system-defined maximum time for deposit. It is either a few blocks on the underlying chain or a few minutes, whichever is longer.
- The underlying chain's finalization time.
- The Data Connector proof time, which is approximately 3 - 5 minutes, independent of the underlying chain.
On fast chains like XRPL, the maximum total time is less than 10 minutes, while on Bitcoin it is approximately 1.5 hours. For payment failures, the agent needs to wait the maximum time, as defined above, before the nonpayment proof can be retrieved.
Minting Payment Referenceβ
The system generates a unique payment reference at the time of the collateral reservation request. The minter must include the payment reference in a memo field when the underlying payment transaction is made.
The payment reference ensures the payment transaction cannot be used by another entity that might claim to have made the payment on the underlying chain and receive the minted FAssets in return. Additionally, if the payment time expires before payment is done, the agent can prove that no payment with that reference was made.
A similar payment reference for the same purposes is generated for redemptions.
Redemption Tickets and the Redemption Queueβ
For every minting operation, a redemption ticket is created. This ticket references the minted amount and the agent that is backing the minting.
The redemption tickets are ordered in a queue that determines the next agent to be redeemed against according to the first in, first out method (FIFO). In other words, the first redemption ticket created will be the first redemption ticket processed. The FIFO queue impartially ensures that all agents have the opportunity to fulfill the duties of their role.
The following example shows how the redemption queue works.
Redemption queue example.
-
Bob mints 10 FXRP with Agent 1.
-
Alice mints 20 FXRP with Agent 2.
-
Charlie mints 5 FXRP with Agent 1.
After Bob, Alice, and Charlie have minted their FAssets, the redemption queue according to the FIFO method is:
- Agent 1 with 10 FXRP.
- Agent 2 with 20 FXRP.
- Agent 1 with 5 FXRP.
-
Dana redeems 25 FXRP. To redeem 25 FXRP:
- Agent 1 pays 10 FXRP.
- Agent 2 pays 15 FXRP.
Now, the redemption queue according to the FIFO method is:
- Agent 2 with 5 FXRP.
- Agent 1 with 5 FXRP.
Lotsβ
Every minting and redemption must be made in a whole number of lots. Lots serve the following purposes:
- They prevent underlying transaction fees from exceeding minting or redemption fees.
- They restrict large numbers of very small redemption tickets from being submitted, which would increase gas costs.
Therefore, the amount of tokens in a lot (the lot size) varies for each underlying chain. For example, on the XRPL chain, a lot can be as small as 10 XRP because transaction fees are low. On the other hand, on the Bitcoin chain, lots might need to be as big as 0.25 BTC or more because transactions are far more expensive.
Over time, the lot size can be updated to reflect price fluctuations of the underlying asset. Only a governance call can update the lot size, and it can be updated only by a limited amount per day.
Dustβ
Some processes generate a fractional number of lots:
- On minting, part of the minting fee is minted as the FAsset fee to the collateral pool. This value is usually less than 1 lot.
- When the lot size is changed, redemptions close only a whole number of lots of each redemption ticket, which leaves the remainder unredeemed.
These amounts, known as dust, cannot be redeemed directly because redemption requires a whole number of lots.
In such cases, the generated dust is not included in any redemption ticket. Instead, each agent's dust is accumulated until the dust amounts to a whole lot. When that happens, another redemption ticket is automatically created.
Therefore, the dust can be recovered or destroyed in the following ways:
-
If the dust exceeds 1 lot during minting, the part that is a whole multiple of a lot is automatically added to the created redemption ticket.
-
If an agent does not mint any FAssets for a while but the lot size changes and several redemptions occur, enough dust might accumulate to more than 1 lot.
In this case, the part that is a whole multiple of a lot can be converted to a redemption ticket by request. To prevent an inactive agent making FAssets less fungible, this request can be made by any address.
-
Self-closing can work with fractional lots, so it can be used to remove dust.
-
Liquidation can work with fractional lots too, so it can also be used to remove dust.
Self-Mintingβ
Agents can also act as minters and mint FAssets from their own vaults. This process is called self-minting and is simpler than regular minting because neither the CRT nor the agent's fee are necessary.
When an agent self-mints FAssets:
- The agent still needs to pay the amount to mint on the underlying chain and execute the minting.
- The self-minting operation also adds a ticket to the redemption queue, alongside tickets added by mints done by other users. All tickets are processed by the FIFO queue.
- Only the pool's share of the fee must be paid.
Because self-minting is done without a collateral reservation request, in some cases, a change between the underlying deposit and the execution, such as another collateral reservation, price change which reduces the amount of free lots, or lot-size change, might prohibit the intended number of lots to be minted. If one of these changes occurs, the agent can self-mint a smaller number of lots, even 0 lots, and the remainder of the deposited underlying assets is added to the free underlying balance.
Additionally, when agents create a vault, they can choose not to make it public, so the vault can only be used to self-mint.