Starting a Teleportation
Fees
As with all bridges, Teleport charges a small fee on amounts bridged between supported domains. This fee can be checked from the SDK by calling TeleportBridge.getAmounts. This function returns an object with the following structure:
{
mintable: BigNumber, // the amount of DAI that can be minted on the destination domain
bridgeFee: BigNumber, // the amount of DAI that will be paid as a bridging fee
relayFee: BigNumber, // optional - the amount of DAI that will be paid to the relayer service, if applicable
}
The bridgeFee
is set by Maker Governance, and at the time of writing it is set at 1 basis point (0.01%).
Initiating a Teleportation
To initiate a teleportation, two calls have to be made:
- Approve the spending of DAI to the gateway contract
- Initiate the teleportation
To achieve this, the SDK exposes two functions: TeleportBridge.approveSrcGateway and TeleportBridge.initTeleport.
These functions:
- Set up allowances for L2 DAI
- Initiate teleportation
- Burn the L2 DAI in the Gateway contract.
- Retrieve the generated TeleportGUID event
Both of these functions' sender
parameters must be an ethers.js Signer. The SDK does not accept SignerOrProvider in its constructor, meaning that this is where you would pass it in.
initTeleport
will return a promise to a transaction object that you will need to utilise for the next step. This transaction object can be used to
- wait for the transaction to pass by calling
tx?.wait()
- retrieve the transaction hash
tx?.hash