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 (which you can find on polkaswap.io); e.g.
0x000268050a977248b641719592e7a0247ce4741839c83ec6aac6a865d3d0ba2c
).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 areassetId
andnetworkId
(0
for Ethereum).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.
You should get the authorityAccount for the Bridge
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 statusApprovalsReady
.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 thegetRequests
RPC.After finding your hash, use the
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/0x313416870a4da6f12505a550b67bb73c8e21d5d3#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 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.