-
Notifications
You must be signed in to change notification settings - Fork 3
AMPL Bridge Primer
Bridges transfer data from one block-chain to another.
Token transfers through bridges work by locking up assets on one block-chain and minting equivalent number of assets on a different chain. eg) BTC is locked up in the REN's BTC wallet on the bitcoin block-chain, then renBTC ERC-20 tokens are issued on ethereum. When they are transferred back, the ERC-20 tokens are burnt on ethereum and BTC is released to the user wallet on the bitcoin block-chain.
The AMPL is a rebasing crypto currency that confirms to the ERC-20 interface deployed on the ethereum v1.0 blockchain. AMPL adjusts its total supply proportionally based on supply and demand, through a daily rebase operation. User's AMPL balances can change up or down at any given day. AMPLs are non-dilutive, any user's AMPL share or the ratio of the user's AMPL balance to the total supply of AMPL will be constant regardless of rebasing.
- User should be able to lock up X AMPLs on ethereum and X xc-amples minted to a specified wallet on the other chain
- When rebase on ethereum changes supply and wallet balances, it reflects in change supply and wallet balances on the other chain
The Ampleforth ERC-20 uses a internal scalar variable to proportionally change all users balances. When the rebase operation occurs on ethereum, the scalar variable is updated. The updated scalar propagated through the bridge to the other chain. The other chain lazily updates its local copy of the scalar, and thus updating user's balances on the other chain.
When a user sends AMPL from ethereum to some other chain (say tron, acala or near), AMPLs are locked up in a vault contract on ethereum and "bridge-secured" xc-amples (cross-chain amples) are minted on the other chain.
To guarantee rebase safe transfers between chains, we denominate transfers using 2 numbers:
- The amount of AMPL being transfered and
- The total supply of AMPL on the current-chain at the time of transfer
Cross-Chain Ample is an almost identical version of the AMPL token and controlling contracts deployed on the other chains. Its controlled primarily by the bridge contract. Bridges have the ability to mint
,burn
and rebase
the xc-ample tokens.