IMA Bridge Example Flow Diagrams

The IMA bridge is a very modular and expandable system. To illustrate some different ways the bridge can be setup by a SKALE Chain owner, please reference the below diagrams. Besides supporting ERC20, ERC721, and ERC1155 natively, the IMA bridge can be expanded to any other token type or arbitrary message (See "Managing other contracts using Message Proxy).

Also, a SKALE Chain owner can setup the bridge in different ways, for example:

  • manual (permission-by-owner): allows the Owner to permit only certain token types to transfer through the bridge, or

  • automatic (permissionless): allows any token deposits to automatically map and transfer through the bridge.

Please see manual or automatic flows below for more information, and check out IMA Access Control for additional information.

ERC20

Manual - Setup Steps

  1. [Mainnet] Owner registers ERC20

  2. [SKALE Chain] Owner deploys clone

  3. [SKALE Chain] Owner assigns clone minter

  4. [SKALE Chain] Owner registers clone

Transfer Flow

Deposit

  1. [Mainnet] User Approves ERC20 transfer

  2. [Mainnet] User deposits ERC20 to DepositBox

  3. [SKALE Chain] User can now transfer clone

Withdrawal

  1. [Mainnet] User funds CommunityPool ETH for exit

  2. [SKALE Chain] User exits from TokenManager

  3. [Mainnet] User can now transfer ERC20

ERC20 Flow with Manual Mapping
Figure 1. ERC20 Flow with Manual Mapping

Automatic - Setup Steps

  1. [SKALE Chain] Owner enables Autodeploy Mapping

  2. [Mainnet] Owner disables whitelist

Owner can enable autodeploy and keep whitelist enabled to allow automatic mapping of only certain tokens.

Transfer Flow

Deposit

  1. [Mainnet] User approves ERC20 transfer

  2. [Mainnet] User deposits ERC20 to DepositBox

  3. [SKALE Chain] User can now transfer clone

Withdrawal

  1. [Mainnet] User funds CommunityPool ETH for exit

  2. [SKALE Chain] User exits from TokenManager

  3. [Mainnet] User can now transfer ERC20

ERC20 Flow with Automatic Mapping
Figure 2. ERC20 Flow with Automatic Mapping

ERC721/1155

ERC721 Manual - Setup Steps

  1. [Mainnet] Owner registers ERC721

  2. [SKALE Chain] Owner deploys clone

  3. [SKALE Chain] Owner assigns clone minter

  4. [SKALE Chain] Owner registers clone

ERC721 Transfer Flow

Deposit

  1. [Mainnet] User Approves ERC721 transfer

  2. [Mainnet] User deposits ERC721 to DepositBox

  3. [SKALE Chain] User can now transfer clone

Withdrawal

  1. [Mainnet] User funds CommunityPool ETH for exit

  2. [SKALE Chain] User exits from TokenManager

  3. [Mainnet] User can now transfer ERC721

ERC721/1155 Flow with Manual Mapping
Figure 3. ERC721/1155 Flow with Manual Mapping

ERC721 Automatic - Setup Steps

  1. [SKALE Chain] Owner sets Autodeploy Mapping

  2. [Mainnet] Owner sets whitelist

ERC721 Transfer Flow

Deposit

  1. [Mainnet] User Approves ERC721 transfer

  2. [Mainnet] User deposits ERC721 to DepositBox

  3. [SKALE Chain] User can now transfer clone

Withdrawal

  1. [Mainnet] User funds CommunityPool ETH for exit

  2. [SKALE Chain] User exits from TokenManager

  3. [Mainnet] User can now transfer ERC721

ERC721 Flow with Automatic Mapping
Figure 4. ERC721 Flow with Automatic Mapping

ERC1155 Automatic Setup Steps

  1. [SKALE Chain] Owner sets Autodeploy Mapping

  2. [Mainnet] Owner sets whitelist

ERC1155 Transfer Flow

Deposit

  1. [Mainnet] User Approves ERC1155 transfer

  2. [Mainnet] User deposits ERC1155 to DepositBox

  3. [SKALE Chain] User can now transfer clone

Withdrawal

  1. [Mainnet] User funds CommunityPool ETH for exit

  2. [SKALE Chain] User exits from TokenManager

  3. [Mainnet] User can now transfer ERC1155

ERC1155 Flow with Automatic Mapping
Figure 5. ERC1155 Flow with Automatic Mapping

ERC721/1155 - SKALE Mint first

The following flow applies equally to 721 and 1155 contracts.

ERC721/1155 Flow, with Mint first on SKALE
Figure 6. ERC721/1155 Flow, with Mint first on SKALE

Deploy/Mint Process

  1. [SKALE Chain] Deploy and Mint NFTs

  2. [SKALE Chain] Upload images/videos + json to SKALE Chain Filestorage

One-time Setup Steps

  1. [Mainnet] Owner deploys Extension + NFT contract copy

  2. [Mainnet] Owner registers extension

  3. [SKALE Chain] Owner deploys Extension

  4. [SKALE Chain] Owner registers extension

  5. [SKALE Chain] Owner deploys clone

  6. [Mainnet] Owner sets Extension to SKALE Chain Extension

  7. [Mainnet] Owner assigns NFT Minter to Extension

Transfer Flow

Withdrawal

  1. [Mainnet] User funds SKALE Manager Wallet ETH for exit

  2. [SKALE Chain] User exits from Extension

  3. [Mainnet] Extension contract executes NFT mint

  4. [Mainnet] NFT of tokenID minted, with same tokenURI and other metadata