Important Information
- When a SKALE Chain is created, there are NO ERC-1155 tokens mapped by default
- In order to bridge an ERC-1155 token to a SKALE Chain from Ethereum, it must be added by the SKALE Chain owner or operator via the standard mapping process
- All ERC-1155 tokens bridged into SKALE have a set of basic requirements to make them compatible with SKALE’s bridging layer
SKALE utilizes a popular architectural design within bridging which is a liquidity based bridge.
This means that tokens bridged into SKALE are locked on Ethereum and a copy is minted on target SKALE Chain.
Bridge Setup
1. Prepare the ERC-1155 on SKALE
ERC-1155 tokens that are being bridged to SKALE should follow two basic requirements in order to be compatible with the SKALE IMA bridging layer:- Have a mint function that is locked down to the IMA Bridge
- Have a burn function that is locked down to the IMA Bridge
If the mint function is not locked down to just the IMA Bridge, specifically TokenManagerERC1155; there is a chance that
the existing tokens on the SKALE Chain may not match what is secured in the bridge.
If the burn function is not locked down to just the IMA Bridge, specifically TokenManagerERC1155; there is a chance that
the supply on the SKALE Chain side could be “burned”, while the tokens still exist on Ethereum which could later be withdrawn under certain circumstances. It is recommended that explicit burns on a SKALE Chain should be avoided for bridged tokens.
2. Deploy the ERC-1155 on SKALE
Utilize your preferred tooling i.e Foundry, Hardhat, Remix, etc. to deploy your IMA compatible ERC-1155 token to the SKALE Chain you want to be able to bridge assets too.InterchainERC1155.sol is inherited from the code above
3. Map the SKALE and Ethereum tokens together
If you are trying to setup a token on SKALE in a production environment please join us in Discord for support!
Add the token on Ethereum via SAFE
Start by visiting your SAFE via the official SAFE website or your preferred tool. If you are unsure, you can follow the steps here. Once on your SAFE, start by preparing a transaction via the Transaction Builder. Follow these steps:- Input the DepositBoxERC1155 address into the address field.
- Select Use Implementation ABI
- Select
addERC1155TokenByOwnerfor the method - Input your SKALE Chain Name and your ERC-1155 contract address on Ethereum in the fields
- Send by itself or via batch
Add the token on SKALE Chain TokenManagerERC1155
- Multisigwallet CLI
Multisigwallet CLI
Verify the Mapping
To verify the mapping, you should have an event emitted from the following:-
DepositBoxERC1155 on Ethereum -
event ERC1155TokenAdded(string schainName, address indexed contractOnMainnet); -
TokenManagerERC1155 on SKALE Chain -
event ERC1155TokenAdded(SchainHash indexed chainHash, address indexed erc1155OnMainChain, address indexed erc1155nSchain);
Bridging ERC-1155
The following does not require you to setup your own token. This works with ANY ERC-1155 token that is mapped from Ethereum to any SKALE Chain as long as the actual ERC-1155 token on each side does not have additional restrictions around who can transfer. The flow for bridging an ERC-1155 from Ethereum to SKALE follows a very similar flow to a standard ERC-1155 transfer:- Approve the bridge contract on the ERC-1155 token to allow it to move your NFTs
- Call the bridge directly to transfer the specific ERC-1155 from Ethereum -> SKALE Chain, if the mapping exists
- Wait for the message to be posted by the validator set on the SKALE Chain, which is the net-new minted NFT corresponding to the NFT (by id(s) and amount(s)) locked on Ethereum during the bridge
Bridge to SKALE (from Ethereum)
The following will help you bridge an NFT from Ethereum to SKALE.- bridge.js
- bridgeDirect.js
- bridgeBatch.js
- bridgeBatchDirect.js
Bridge to Ethereum (from SKALE)
SKALE’s decentralized bridge offers a simple two-step process to bridge from any SKALE Chain to Ethereum Mainnet.- The first step, which only has to be done if you don’t have a sufficient balance to exit, is to fill up your gas wallet on Ethereum
- The second step is to initiate the bridge (technically known as an exit) on the SKALE Chain
Gas Wallet, officially referred to as community pool, is a smart contract on Ethereum that is used to handle exits from SKALE. Users pre-pay ETH into this contract which is then used to reimburse validators for the gas costs of the bridge cost back to Ethereum. Make sure users top up their gas wallet to ensure the bridge can succeed.
Pre-pay for your Exit
This step is optional IF the user has already filled up their gas wallet and has sufficient balance left. You can check if the wallet is anactiveUser on the CommunityLocker 0xD2aaa00300000000000000000000000000000000 smart contract on the SKALE Chain. If active, no need to fill the pool again.
Bridge to Ethereum
Once the above prepayment steps are completed, you can proceed with the bridging. Bridging from SKALE simply requires theexitToMainERC1155 function to be called with the corresponding token and amount to initiate the transfer back to Ethereum.
- exit.js
- exitBatch.js
If your bridge is not working, it is most likely for one of three reasons:
- You forgot to prepay for gas
- You forgot to approve bridge on the ERC-1155 token id you want to bridge
- You don’t actually own the ERC-1155 Token
