On this page

latest contributor to this doc

Last Edit:

@gcharang

enable_eth_with_tokens

The Komodo DeFi Framework supports ETH(Ethereum) and many other EVM type platform coins like AVAX(Avalanche), BNB(Binance), FTM(Fantom), MATIC(Polygon), ONE(Harmony), ETH-ARB20(Arbitrum). Additionally, it supports ERC20 tokens on the ETH chain and associated ERC20 like tokens on the rest of the platform coin chains.Using this method, you can enable a platform coin along with multiple ERC20 like tokens of the platform coin chain in a single command.

ParameterTypeDescription
tickerstringTicker of the platform protocol coin. Options: ETH, AVAX, BNB, FTM, MATIC, ONE, ETH-ARB20
mm2integerRequired if not set in coins file. Informs the Komodo DeFi Framework API whether or not the coin is expected to function. Accepted values are 0 or 1
swap_contract_addressstringAddress of etomic swap smart contract
fallback_swap_contractstringAddress of backup etomic swap smart contract
nodesarray of objectsA list of standard EvmNode objects.
erc20_tokens_requestsarray of objectsA list of standard TokensRequest objects.
gas_station_decimalsintegerOptional, for ETH/ERC20 and other gas model chains. Defaults to 8. Defines the decimals used to denominate the gas station response to gwei units. For example, the ETH gas station uses 8 decimals, which means that "average": 860 is equal to 86 gwei. While the Matic gas station uses 9 decimals, so 860 would mean 860 gwei exactly.
gas_station_policy.policystringOptional, for ETH/ERC20 and other gas model chains. Defaults to "MeanAverageFast". Defines the method of gas price calculation from the station response. "MeanAverageFast" will use the mean between average and fast fields. "Average" will return a simple average value.
get_balancesbooleanOptional, defaults to true. If false, coin and token balances will not be returned in the response, and the response will be returned more quickly.
priv_key_policystringOptional, defaults to ContextPrivKey. value can be ContextPrivKey,Trezor when Komodo DeFi Framework is built for native platforms. value can be ContextPrivKey, Trezor, Metamask when the Komodo DeFi Framework is built targeting wasm
required_confirmationsintegerOptional, defaults to 3. When the platform coin is involved, the number of confirmations for the Komodo DeFi Framework API to wait during the transaction steps of an atomic swap
requires_notarizationbooleanOptional, defaults to false. If true, coins protected by Komodo Platform's dPoW security will wait for a notarization before progressing to the next atomic swap transactions step.
rpc_modestringOptional, defaults to Http, value can be Metamask when the Komodo DeFi Framework is built targeting wasm
tx_historybooleanOptional, defaults to false. If true the Komodo DeFi Framework API will preload transaction history as a background process. Must be set to true to use the my_tx_history method

ParameterTypeDescription
current_blockintegerBlock height of the coin being activated
eth_addresses_infosobjectA standard AddressInfo object. Note: the structure may vary based on the value of the get_balances parameter.
erc20_addresses_infosobjectA standard AddressInfo object. Note: the structure may vary based on the value of the get_balances parameter.

POST
enable_eth_with_tokens
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "enable_eth_with_tokens",
  "mmrpc": "2.0",
  "params": {
    "ticker": "ETH",
    "gas_station_url": "https://ethgasstation.info/json/ethgasAPI.json",
    "gas_station_decimals": 8,
    "gas_station_policy": {
      "policy": "MeanAverageFast"
    },
    "mm2": 1,
    "priv_key_policy": "ContextPrivKey",
    "swap_contract_address": "0x24ABE4c71FC658C91313b6552cd40cD808b3Ea80",
    "fallback_swap_contract": "0x8500AFc0bc5214728082163326C2FF0C73f4a871",
    "nodes": [
      {
        "url": "http://eth1.cipig.net:8555",
        "gui_auth": false
      },
      {
        "url": "https://node.komodo.earth:8080/ethereum",
        "gui_auth": true
      }
    ],
    "rpc_mode": "Http",
    "tx_history": true,
    "erc20_tokens_requests": [
      {
        "ticker": "APE-ERC20",
        "required_confirmations": 4
      },
      {
        "ticker": "BCH-ERC20",
        "required_confirmations": 4
      },
      {
        "ticker": "MINDS-ERC20",
        "required_confirmations": 4
      },
      {
        "ticker": "BUSD-ERC20",
        "required_confirmations": 4
      }
    ],
    "required_confirmations": 5,
    "requires_notarization": false
  }
}

POST
enable_eth_with_tokens
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "enable_eth_with_tokens",
  "mmrpc": "2.0",
  "params": {
    "ticker": "MATIC",
    "get_balances": false,
    "tx_history": false,
    "gas_station_url": "https://gasstation-mainnet.matic.network/",
    "swap_contract_address": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
    "fallback_swap_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE",
    "nodes": [
      {
        "url": "https://polygon-rpc.com"
      },
      {
        "url": "https://poly-rpc.gateway.pokt.network"
      }
    ],
    "erc20_tokens_requests": [
      {
        "ticker": "PGX-PLG20",
        "required_confirmations": 4
      },
      {
        "ticker": "AAVE-PLG20",
        "required_confirmations": 4
      }
    ],
    "required_confirmations": 5,
    "requires_notarization": false
  }
}