eHMND to HMND
The guide to swap eHMND to HMND.
Tools
- Environment to deploy ethereum smart contracts like Remix IDE 
- Ethereum supported wallet like Metamask 
Steps
- Open the Remix IDE and create a file containing the currency swap precompile interface. 
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.7.0 <0.9.0;
/**
 * @title Currency Swap Interface
 *
 * An interface enabling swapping the funds from EVM accounts to
 * native Substrate accounts.
 *
 * Address: 0x0000000000000000000000000000000000000900
 */
interface CurrencySwap {
  /**
   * Transfer the funds from an EVM account to native substrate account.
   * Selector: 76467cbd
   *
   * @param nativeAddress The native address to send the funds to.
   * @return success Whether or not the swap was successful.
   */
  function swap(bytes32 nativeAddress) external payable returns (bool success);
}

- Go to - compiletab and compile the interface. 
- Go to deploy tab.  
- Properly select - ENVIRONMENT,- ACCOUNTand- CONTRACTfields. 
- Use - 0x0000000000000000000000000000000000000900value as an input for- Deploytab at- At Addressfield. 
- Click on - Deploytab and open- Deployed Contractstab. You will be able to see a- swapcall. The call accepts- bytes32- nativeAddressas an argument to send currency to. 
- Open - Utilitiestab at Polkadot-JS apps connected to Humanode Israfel Testnet. 
- Convert your native HMND address into - bytes32value. 
- Copy the value from the - hex public keyfield and go back to Remix IDE. Input the value as an argument for the- swapcall. Input the amount you would like to swap into- VALUEfield. Keep in mind, that you should input the amount with 18 point decimals value in case using- Wei. 
- Finally, perform the swap by clicking on the - swapcall and confirm the transaction. 
- Check the balance on the Polkadot-JS app.  
Last updated
