Coder Social home page Coder Social logo

cw-osmo-price's Introduction

IBC query contract

contracts-ci

This is a contract to demonstrate osmosis query price over ibc.

Relayer

Create channel

hermes create channel uni testing --port-a wasm.juno1hau40wepfjrvu7z549j3zwz955agv0em7wz8p9nkrwczf84ut0eshp4wxv --port-b gamm -v gamm-1

Contract

ExecuteMsg:

  • SpotPrice - this will send GammPrice packet to query spot price in remote osmosis chain and store the info locally

Msg example:

{
  "spot_price": {
    "channel": "channel-13",
    "pool": "2",
    "token_in": "uosmo",
    "token_out": "ibc/0F192F25408BEF0845A4EFF1FB52CF4D390C224D21543F30DE84651745A6F9A2",
    "timeout": 1200
  }
}
  • EstimateSwap - this will send EstimateSwapAmountInPacket packet to query "Estimate Swap Exact Amount In"
  • and store the info locally

Msg example:

{
  "estimate_swap": {
    "channel": "channel-13",
    "pool": "1",
    "sender": "osmo16vj8qhvhvjptnlre8ke8p37f54z9wy68p7hxf6",
    "amount": "1000000uion",
    "token_out": "uosmo",
    "timeout": 900
  }
}

QueryMsg:

  • ListAccounts - to list all accounts tied to open channels. ChannelID, account address on the remote chain (if known) and last updated price.
  • Account - queries the above data for one channel

Example: Get last price stored.

{
  "account": {
    "channel_id": "channel-13"
  }
}

Output:

{
  "channel_id": "channel-13",
  "last_update_time": 164145882654434,
  "remote_spot_price": "2.5656456457547"
}

cw-osmo-price's People

Contributors

giansalex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sbnair

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.