Skip to content

Adding a Token to the HASHI Bridge

Adding tokens to the HASHI bridge allows them to be transferred between the SORA and Ethereum networks.

Adding a token to the SORA HASHI bridge involves several steps:

  1. Registering a token within the SORA blockchain
  2. Registering a SORA asset on the bridge
  3. Registering an ERC-20 token in Ethereum and its mapping with a SORA asset
  4. Adding a token to a whitelist

Registering a token within the SORA blockchain

Refer to Registration for the instructions on registering a token within the SORA blockchain.

Registering a SORA asset on the bridge

  1. Get the AssetId of the asset you want to add (which you can find on polkaswap.io); e.g. 0x000268050a977248b641719592e7a0247ce4741839c83ec6aac6a865d3d0ba2c).

  2. Go to polkadot{.js} in the Governance > Preimages section and create a preimage with ethBridge.addAsset and the value for the address and bridge network ID of the token to be registered. The parameters are assetId and networkId (0 for Ethereum).

  3. Copy the preimage hash of your created preimage and submit a proposal in Governance > Democracy. Alternatively, you can reach out to a council member for the Council to directly create a motion to add the asset to the bridge with the preimage you created. This will fast-track the process of adding the asset to the bridge.

  4. Once the proposal goes through, acquire the signatures of the bridge’s peers via the ethBridge.getAccountRequests RPC with your account as the first argument and status ApprovalsReady.

  5. The RPC will return a bunch of hashes. These are off-chain request hashes; the last one should be the OutgoingAddAsset request. To determine if the asset was added successfully, use the getRequests RPC.

  6. After finding your hash, use the getApprovedRequests RPC to get the approvals.

  7. Call addEthSidechainToken in the bridge's smart contract.

Using Remix

  1. Copy the contract ABI from the Code section on Etherscan:

  2. Create a file with ABI on https://remix.ethereum.org:

  3. Choose Metamask as a provider:

  1. Copy the contract address in the "At Address" field and click on the At Address button
  1. Fill in the transaction data:
  1. Confirm the transaction:

Using Etherscan

Access https://etherscan.io/address/0x1485e9852ac841b52ed44d573036429504f4f602#writeContract and fill in the fields with data from the previous step. Note, that v parameters in signatures should be increased by 27. That is, if you see v: 0 and v: 1, these parameters should be passed as [27, 28].

Registering an ERC-20 token in Ethereum and its mapping with a SORA asset

  1. Get all the necessary information about the token:

    • Address (e.g. 0xdac17f958d2ee523a2206206994597c13d831ec7)
    • Symbol (e.g. USDT)
    • Name (e.g. Tether USD)
    • Decimals (e.g. 6)
    • Network id (e.g. 0 for Ethereum)
  2. Create a proposal to call the ethBridge.addSidechainToken extrinsic with arguments from the first step.

  3. After the proposal is approved, acquire the bridge’s peers' signatures via the ethBridge.getAccountRequests RPC of the cnTQ1kbv7PBNNQrEb1tZpmK7hZUUWqKBpWxmnxL4nczYfYfrh account.

  4. The RPC will return a bunch of hashes. These are off-chain request hashes, one of them should be OutgoingAddToken request. To find out if the asset was added successfully, use the getRequests RPC.

  5. After your hash is found, use the getApprovedRequests RPC to get the approvals.

  6. Go to https://etherscan.io/address/0x313416870a4da6f12505a550b67bb73c8e21d5d3#writeContract and call addEthNativeToken with data from the previous step. Note, that v parameters in signatures should be increased by 27. That is if you see v: 0 and v: 1, these parameters should be passed as [27, 28].

Adding a token to a whitelist

If you want to be able to bridge your token in Polkaswap, and in order to move your token to Ethereum, it needs to be whitelisted. You can whitelist your token by following the instructions on GitHub.

First, the pull request has to be approved, then the token will be whitelisted in future updates on Polkaswap.

sora.org