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:
- Registering a token within the SORA blockchain
- Registering a SORA asset on the bridge
- Registering an ERC-20 token in Ethereum and its mapping with a SORA asset
- 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
Get the AssetId of the asset you want to add (e.g.
0x000268050a977248b641719592e7a0247ce4741839c83ec6aac6a865d3d0ba2c
).Go to polkadot{.js} and call the
ethBridge.addAsset
extrinsic via a fast track motion (see the steps in Fast track public voting) with the asset id from the first step and network id0
(for Ethereum).Once the proposal goes through, acquire the bridge’s peers' signatures via the
ethBridge.getAccountRequests
RPC with your account as the first argument and statusApprovalsReady
.The RPC will return a bunch of hashes. These are off-chain request hashes, the last one should be
OutgoingAddAsset
request. To find out if the asset was added successfully, use thegetRequests
RPC.After your hash is found, use
getApprovedRequests
RPC to get the approvals.Call
addEthSidechainToken
in the bridge's smart contract.
Using Remix
Copy the contract ABI from the Code section on Etherscan:
Create a file with ABI on https://remix.ethereum.org:
Choose Metamask as a provider:
- Copy the contract address in the "At Address" field and click on the At Address button
- Fill in the transaction data:
- 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
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)
- Address (e.g.
Create a proposal (see the steps in Fast track public voting) to call the
ethBridge.addSidechainToken
extrinsic with arguments from the first step.After the proposal is approved, acquire the bridge’s peers' signatures via the
ethBridge.getAccountRequests
RPC of thecnTQ1kbv7PBNNQrEb1tZpmK7hZUUWqKBpWxmnxL4nczYfYfrh
account.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 thegetRequests
RPC.After your hash is found, use the
getApprovedRequests
RPC to get the approvals.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 by27
. That is if you seev: 0
andv: 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.