Skip to content

Commit

Permalink
Add tests for ibc-translator contract (#3301)
Browse files Browse the repository at this point in the history
  • Loading branch information
misko9 authored Nov 13, 2023
1 parent 9c678e1 commit ac9ff33
Show file tree
Hide file tree
Showing 9 changed files with 2,177 additions and 5 deletions.
31 changes: 29 additions & 2 deletions cosmwasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion cosmwasm/contracts/ibc-translator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@ serde_wormhole = "0.1.0"
token-bridge-cosmwasm = { version = "0.1.0", features = ["library"] }
wormhole-bindings = "0.1.0"
wormhole-cosmwasm = { version = "0.1.0", features = ["library"] }
wormhole-sdk = { version = "0.1.0", features = ["schemars"] }
wormhole-sdk = { version = "0.1.0", features = ["schemars"] }

[dev-dependencies]
cosmwasm-crypto = { version = "1.2.7" }
hex = "0.4.3"
prost = "0.11.0"
serde = { version = "1.0.103", features = ["derive", "alloc"]}
5 changes: 4 additions & 1 deletion cosmwasm/contracts/ibc-translator/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ pub fn convert_and_transfer(
.load(deps.storage)
.context("could not load token bridge contract address")?;

ensure!(info.funds.len() == 1, "no bridging coin included");
ensure!(
info.funds.len() == 1,
"info.funds should contain only 1 coin"
);
let bridging_coin = info.funds[0].clone();
let cw20_contract_addr = parse_bank_token_factory_contract(deps, env, bridging_coin.clone())?;

Expand Down
2 changes: 1 addition & 1 deletion cosmwasm/contracts/ibc-translator/src/reply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pub fn convert_cw20_to_bank_and_send(
}

// Base58 allows the subdenom to be a maximum of 44 bytes (max subdenom length) for up to a 32 byte address
fn contract_addr_to_base58(deps: Deps, contract_addr: String) -> Result<String, anyhow::Error> {
pub fn contract_addr_to_base58(deps: Deps, contract_addr: String) -> Result<String, anyhow::Error> {
// convert the contract address into bytes
let contract_addr_bytes = deps.api.addr_canonicalize(&contract_addr).context(format!(
"could not canonicalize contract address {contract_addr}"
Expand Down
Loading

0 comments on commit ac9ff33

Please sign in to comment.