Circulation Model
BC and FC share the same token universe for 5T and BEP8/BEP2/FRC20 tokens. This defines:
- The same token can circulate on both networks, and flow between them bi-directionally via a cross-chain communication mechanism.
- The total circulation of the same token should be managed across the two networks, i.e. the total effective supply of a token should be the sum of the token’s total effective supply on both FC and BC.
- The tokens can be initially created on FC as a FRC20, or on BC as a BEP2, then created on the other. There are native ways on both networks to link the two and secure the total supply of the token.
Peg Account
To secure the total circulation of the token on both chains, we introduce Peg Account
to lock tokens on chain.
Peg Account
is a pure-code-controlled account that no one has the right to access to the account.
- For BC, the
Peg Account
isbnb1v8vkkymvhe2sf7gd2092ujc6hweta38xadu2pj
. (tbnb1v8vkkymvhe2sf7gd2092ujc6hweta38xnc4wpr
for testnet) - For NC, the
Peg Account
is TokenHub contract.
Bind
Token Binding can happen at any time after BEP2/BEP8 and FRC20 are ready. The token owners of either BEP2/BEP8 or FRC20 only need to complete the Binding process when a cross-chain feature is necessary.
Binding process helps to build the relationship between the two tokens on BC and NC. It will ensure that the two tokens share the same symbol and same total supply. The most important part is that it will reallocate the circulation on both chains to ensure the total circulation equals the total supply.
Let's walk through an example:
- Bob issues BTC on BC with a total supply of 10, and he sends Alice 2 BTC.
- Bob issues BTC on FC with a total supply of 10, and he sends Tom 1 BTC.
Now Bob wants BTC to flow between BC and NC, but the total circulation on BC and FC is 20=10+10 BTC which is not correct, so he decided to bind these two tokens. He made a decision that 8 BTC circulation on BC and 2 BTC circulation on NC, then he started a bind transaction.
The BC execution engine will:
1. Transfer 2 BTC from Bob's account to Peg Account
.
2. Emit a cross-chain event.
For now, on BC, Bob has 6 BTC, Alice has 2 BTC, 2 BTC is locked in Peg Account
, circulation on BC is 8 BTC.
Relayer watches the cross-chain event on BC, and send a transaction to TokenManager contract on NC.
Then Bob invokes the BTC contract on FC to approve TokenManager to spend 8 BTC of his account.
After that Bob approves the bind request by invoking TokenManager.
The TokenManager will transfer 8 BTC from Bob's account to Peg Account
.
For now, on NC, Bob has 1 BTC, Tom has 1 BTC, 8 BTC is locked in Peg Account
, circulation on FC is 2 BTC.
The binding process ends here, and the total circulation on both chains is 10 BTC which equals to its total supply.
Cross Chain Transfer
When one token transfer from the native chain to the parallel chain, the process is:
1. Token transfer from the sender to Peg Account
on the native chain.
2. Token transfer from Peg Account
to the receiver on the parallel chain.
Burn
When a user burns a certain amount of token on the native chain, there is no need to burn on the parallel chain.
Let's walk through an example:
- The circulation on BC is 5 BTC, and 5 BTC on NC.
- User burns 2 BTC on BC.
- Now circulation on BC is 3 BTC, and 5 BTC on NC.
- The total circulation is 8 now which is expected.
Mint
When user mint token on the native chain, but do not mint on the parallel chain, it may cause an issue that user can not cross transfer all token from native chain to parallel chain.
Let's walk through an example:
- The circulation on BC is 5 BTC, and the locked token is 5 BTC.
- The circulation on FC is 5 BTC, and the locked token is 5 BTC.
- User mint 2 BTC on BC.
- It will fail if the user tries to transfer 7 BTC from BC to NC, because the balance of
Peg Account
on FC is 5 BTC and can’t afford to unlock 7 BTC.
The best practice for mint is:
- Mint token on the native chain.
- Mint token on the parallel chain.
- Transfer the mint token to
Peg Account
on the parallel chain.