Skip to content

AMPL Bridge Primer

Nithin Krishna edited this page Jan 6, 2021 · 13 revisions

Cross Chain Bridges

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.

Ampleforth

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.

AMPL bridge design

Spec

  • 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

Rebase

The Ampleforth ERC-20 uses a internal scalar variable to proportionally change all users balances. When the rebase operation occurs on master chain (currently ethereum v1.0), 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.

Transfer

When a user sends AMPL from the master chain to another chain, AMPLs are locked up in a vault contract on the main-chain 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:

  1. The amount of AMPL being transfered and
  2. The total supply of AMPL on the current-chain at the time of transfer
Clone this wiki locally