Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add injective-testing fixes #239

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cw-utils = { version = "2.0.0" }
cw2 = { version = "2.0.0" }
ethereum-types = { version = "0.5.2" }
hex = { version = "0.4.3", features = [ "serde" ] }
injective-cosmwasm = { version = "0.3.0" }
injective-cosmwasm = { version = "0.3.1" }
injective-math = { version = "0.3.0" }
injective-std = { version = "1.13.0" }
injective-std-derive = { version = "1.13.0" }
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-cosmwasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "Apache-2.0"
name = "injective-cosmwasm"
readme = "README.md"
repository = "https://github.com/InjectiveLabs/cw-injective/tree/dev/packages/injective-cosmwasm"
version = "0.3.0"
version = "0.3.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions packages/injective-cosmwasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub mod querier;
pub mod query;
pub mod route;
pub mod tokenfactory;
pub mod utils;
pub mod wasmx;

#[cfg(not(target_arch = "wasm32"))]
Expand Down
7 changes: 7 additions & 0 deletions packages/injective-cosmwasm/src/utils.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use cosmwasm_std::{instantiate2_address, CanonicalAddr, Instantiate2AddressError};

pub const INJECTIVE_ADDRESS_LENGTH: usize = 20;

pub fn instantiate2_address_inj(checksum: &[u8], creator: &CanonicalAddr, salt: &[u8]) -> Result<CanonicalAddr, Instantiate2AddressError> {
Ok(instantiate2_address(checksum, creator, salt)?[..INJECTIVE_ADDRESS_LENGTH].into())
}
3 changes: 2 additions & 1 deletion packages/injective-testing/src/address_generator.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use cosmwasm_std::{Addr, Storage};
use cw_multi_test::AddressGenerator;
use injective_cosmwasm::addr_to_bech32;
use injective_cosmwasm::utils::instantiate2_address_inj;
use rand::OsRng;
use secp256k1::Secp256k1;
use std::fmt::Write;
Expand Down Expand Up @@ -29,7 +30,7 @@ impl AddressGenerator for InjectiveAddressGenerator {
creator: &cosmwasm_std::CanonicalAddr,
salt: &[u8],
) -> anyhow::Result<Addr> {
let canonical_addr = cosmwasm_std::instantiate2_address(checksum, creator, salt)?;
let canonical_addr = instantiate2_address_inj(checksum, creator, salt)?;
Ok(api.addr_humanize(&canonical_addr)?)
}
}
Expand Down
Loading