Fetching Oracle Prices

Create fetchprice Channel

# create channel with clients and connections
# tooks 5 minutes (send any tx to boost)
hermes create channel \
  --a-chain $L2_CHAIN_ID \
  --b-chain $L1_CHAIN_ID \
  --a-port fetchprice \
  --b-port icqhost \
  --new-client-connection 
  
SUCCESS Channel {
    ...
}

Update Chain Params

Create message.json.

Normally the fetch price channel id is channel-1 if you followed the tutorial, else you have to change messages[2][source_channel] to proper channel id.

{
  "messages": [
    {
      "@type": "/slinky.oracle.v1.MsgAddCurrencyPairs",
      "authority": "init1gz9n8jnu9fgqw7vem9ud67gqjk5q4m2w0aejne",
      "currency_pairs":[{"Base": "BITCOIN","Quote": "USD"}, {"Base": "ETHEREUM", "Quote": "USD"}]
    },
    {
      "@type": "/ibc.applications.fetchprice.v1.MsgUpdateParams",
      "authority": "init1gz9n8jnu9fgqw7vem9ud67gqjk5q4m2w0aejne",
      "params": {
        "fetch_enabled": true,
        "fetch_activated": false,
        "timeout_duration": "30s"
      }
    },
    {
      "@type": "/ibc.applications.fetchprice.v1.MsgActivate",
      "authority": "init1gz9n8jnu9fgqw7vem9ud67gqjk5q4m2w0aejne",
      "source_port": "fetchprice",
      "source_channel": "channel-1",
      "timeout_duration": "30s"
    }
  ]
}

Execute messages.json with validator key

minitiad tx opchild execute-messages \
    ./messages.json \
    --from operator \
    --chain-id $L2_CHAIN_ID
    --gas auto
    --gas-adjustment 1.4
    --gas-price 0.15$DENOM

Check Prices

minitiad q oracle price BITCOIN USD

Last updated