Giter Site home page Giter Site logo

interchain-swap's Introduction

Interchain swap

Overview

This codebase is the minimal demo to test interchain query and ica txs with osmosis chain.

Developer Documentation

Interchain Queries developer docs can be found here https://github.com/strangelove-ventures/async-icq/blob/main/README.md

Medium blog - https://link.medium.com/a70uOK1cFwb

Demo

Start the instance of interchain-swapd

ignite chain serve -c sender.yml --reset-once

Start the instance of osmosisd

sh start_osmosisd.sh

Setup osmosis pool

Create a new liquidity pool and provide initial liquidity to it.

osmosisd tx gamm create-pool --pool-file="./pool.json"
{
  "weights": "5stake,5uosmo",
  "initial-deposit": "100000000stake,1000000uosmo",
  "swap-fee": "0.002",
  "exit-fee": "0.0",
  "future-governor": "168h"
}

Initialize connection and start hermes for ICA relayer

sh hermes_init.sh
sh network/hermes/start.sh

Configure and start the icq relayer

rm -rf ~/.ignite/relayer
ignite relayer configure -a \
--source-rpc "http://localhost:26659" \
--source-faucet "http://localhost:4500" \
--source-port "interquery" \
--source-gasprice "0.0stake" \
--source-gaslimit 5000000 \
--source-prefix "cosmos" \
--source-version "icq-1" \
--target-rpc "http://localhost:26559" \
--target-faucet "http://localhost:4501" \
--target-port "icqhost" \
--target-gasprice "0.0stake" \
--target-gaslimit 300000 \
--target-prefix "cosmos"  \
--target-version "icq-1"
ignite relayer connect

Send the query to "receiver" chain

interchain-swapd tx interquery send-query-osmosis-price channel-0 cosmos1ez43ye5qn3q2zwh8uvswppvducwnkq6w6mthgl --chain-id=sender --node=tcp://localhost:26659 --home ~/.sender --from alice
interchain-swapd query interquery query-price-state 1 --chain-id=sender --node=tcp://localhost:26659

Create interchain account

interchain-swapd tx interquery register-ica channel-1 ""

Query interchain account address

interchain-swapd query interquery query-ica [connection-id] [owner]

Send tokens to interchain-account

osmosisd tx bank send bob $ICA_ADDRESS 10000000uosmo --keyring-backend=test

Send ICA swap tx

interchain-swapd tx interquery swap-exact-amount-in [connection-id] [token-in] [token-out-min-amount] --pool-id --from --chain-id

Example

interchain-swapd tx interquery swap-exact-amount-in connection-0 100000stake 1400 --swap-route-pool-ids 1 --swap-route-denoms uosmo --from WALLET_NAME --chain-id osmosis-1

interchain-swap's People

Contributors

icafa avatar

Stargazers

Roman avatar

Watchers

 avatar

Forkers

akure

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.