Skip to content

Commit

Permalink
Implement ibc transfers.
Browse files Browse the repository at this point in the history
  • Loading branch information
dowlandaiello committed Jun 30, 2024
1 parent 8cd95b6 commit ea682d0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
3 changes: 3 additions & 0 deletions examples/osmosis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@ fn main() -> Result<(), Box<dyn Error>> {
.with_initial_deposit(&bruhtoken, 1)
.send()?;

// Get its id
ctx.get_osmo_pool("uomso", bruhtoken)?;

Ok(())
}
31 changes: 29 additions & 2 deletions src/utils/fixtures.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use super::{
super::{
error::Error, AUCTION_CONTRACT_NAME, FACTORY_NAME, NEUTRON_CHAIN_NAME, PAIR_NAME,
PRICE_ORACLE_NAME, STABLE_PAIR_NAME, TX_HASH_QUERY_PAUSE_SEC, TX_HASH_QUERY_RETRIES,
error::Error, AUCTION_CONTRACT_NAME, FACTORY_NAME, NEUTRON_CHAIN_NAME, OSMOSIS_CHAIN_NAME,
PAIR_NAME, PRICE_ORACLE_NAME, STABLE_PAIR_NAME, TX_HASH_QUERY_PAUSE_SEC,
TX_HASH_QUERY_RETRIES,
},
test_context::TestContext,
};
Expand Down Expand Up @@ -239,4 +240,30 @@ impl TestContext {
Some(addr.to_owned()),
))
}

/// Gets the id of the pool with the specifieed denoms.
pub fn get_osmo_pool(
&self,
denom_a: impl AsRef<str>,
denom_b: impl AsRef<str>,
) -> Result<u64, Error> {
let osmosis = self.get_chain(OSMOSIS_CHAIN_NAME);
let denom_a_str = denom_a.as_ref();

let res = osmosis.rb.query(
&format!("q poolmanager list-pools-by-denom {denom_a_str}"),
true,
);

let pools_value = res.get("pools").ok_or(Error::ContainerCmd(String::from(
"q poolmanager list-pools-by-denom",
)))?;
let pools = res.as_array().ok_or(Error::ContainerCmd(String::from(
"q poolmanager list-pools-by-denom",
)))?;

println!("{:?}", pools);

Ok(0)
}
}

0 comments on commit ea682d0

Please sign in to comment.