osmosis-labs / isotonic

Smart Contracts for the Lendex Protocol
MIT License
1 stars 0 forks source link

[CA, Market] Update osmosis-bindings-test to support swaps with a non-empty route #127

Closed uint closed 2 years ago

uint commented 2 years ago

Currently, the mocks in osmo-bindings-test only support swaps with an empty route. They panic otherwise.

This means the only swaps we can test are direct ones with one liquidity pool.

// pool 1 is ("OSMO", "ATOM")
// OSMO -> ATOM swap
let swap = OsmosisMsg::Swap {
    first: Swap {
        pool_id: 1,
        denom_in: "OSMO".to_string(),
        denom_out: "ATOM".to_string(),
    },
    route: vec![],
    amount: ...,
};

We cannot have more complex ones that go through multiple liquidity pools:

// pool 1 is ("OSMO", "ATOM")
// pool 2 is ("ATOM", "BTC")
// OSMO -> ATOM -> BTC swap
let swap = OsmosisMsg::Swap {
    first: Swap {
        pool_id: 1,
        denom_in: "OSMO".to_string(),
        denom_out: "ATOM".to_string(),
    },
    route: vec![Step {
        pool_id: 2,
        denom_out: "BTC".to_string(),
    }],
    amount: ...,
};

Without this, we cannot properly test #92 or #101.

Update osmosis-bindings and osmosis-bindings-test when new version that supports routes is out.

ueco-jb commented 2 years ago

Copied to actual osmosis-bindings repository - blocked by https://github.com/confio/osmosis-bindings/issues/19

uint commented 2 years ago

New version will have to wait. Guess who's the only owner on crates.io? :grin: https://crates.io/crates/osmo-bindings