Skip to content

Commit

Permalink
Merge branch 'f/denom-fix-injective-testing' into f/injective-std-traits
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrobot committed Sep 2, 2024
2 parents 09759a3 + 2d67326 commit 8138fd2
Show file tree
Hide file tree
Showing 17 changed files with 161 additions and 141 deletions.
50 changes: 16 additions & 34 deletions Cargo.lock

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

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ 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-math = { version = "0.3.0" }
injective-std = { version = "1.13.0" }
injective-std-derive = { version = "1.13.0" }
injective-test-tube = { version = "=1.13.0-2" }
injective-testing = { version = "0.2.1" }
injective-cosmwasm = { version = "0.3.0", path = "./packages/injective-cosmwasm" }
injective-math = { version = "0.3.0", path = "./packages/injective-math" }
injective-std = { version = "1.13.0", path = "./packages/injective-std" }
injective-std-derive = { version = "1.13.0", path = "./packages/injective-std-derive" }
injective-test-tube = { version = "1.13.2" }
injective-testing = { version = "1.1.0", path = "./packages/injective-testing" }
itertools = { version = "0.10.3" }
primitive-types = { version = "0.12.2", default-features = false }
proc-macro2 = { version = "1.0.40" }
Expand Down
2 changes: 1 addition & 1 deletion build_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ fi
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/workspace-optimizer${ARCH}:0.12.11
cosmwasm/optimizer${ARCH}:0.16.0
2 changes: 1 addition & 1 deletion contracts/injective-cosmwasm-mock/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use injective_test_tube::{
},
Account, Authz, Bank, Exchange, ExecuteResponse, Gov, InjectiveTestApp, Insurance, Module, Oracle, Runner, SigningAccount, Wasm,
};
use injective_testing::human_to_i64;
use injective_testing::utils::human_to_i64;
use prost::Message;
use std::{collections::HashMap, ops::Neg, str::FromStr};

Expand Down
18 changes: 18 additions & 0 deletions packages/injective-testing/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.1.2] - 2024-08-30

### Fixed

- Fixed decimals used as denoms in spot markets

## [1.1.1] - 2024-08-30

### Fixed

- Fixed incorrect denoms

## [1.1.0] - 2024-08-23

### Changed

- Updated `lib.rs` so that the re-organisation is adhered to

## [1.0.0] - 2024-08-23

### Changed
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"
license = "Apache-2.0"
name = "injective-testing"
repository = "https://github.com/InjectiveLabs/cw-injective/tree/dev/packages/injective-testing"
version = "1.0.0"
version = "1.1.2"

[dependencies]
anyhow = { workspace = true }
Expand Down
11 changes: 3 additions & 8 deletions packages/injective-testing/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
mod mocks;
mod multi_test;
mod test_tube;
pub mod mocks;
pub mod multi_test;
pub mod test_tube;
pub mod utils;

pub use mocks::*;
pub use multi_test::*;
pub use test_tube::*;
pub use utils::*;
3 changes: 1 addition & 2 deletions packages/injective-testing/src/mocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ pub const MOCK_ATOM_DECIMALS: i32 = 8i32;
pub const MOCK_QUOTE_DECIMALS: i32 = 6i32;

pub const MOCK_ATOM_DENOM: &str = "atom";
pub const MOCK_GAS_DENOM: &str = "inj";
pub const MOCK_BASE_DENOM: &str = "ubase";
pub const MOCK_BASE_DENOM: &str = "inj";
pub const MOCK_QUOTE_DENOM: &str = "usdt";
pub const MOCK_USDC_DENOM: &str = "usdc";

Expand Down
2 changes: 1 addition & 1 deletion packages/injective-testing/src/multi_test/chain_mock.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::InjectiveAddressGenerator;
use crate::multi_test::address_generator::InjectiveAddressGenerator;

use anyhow::{bail, Result as AnyResult};
use cosmwasm_std::{testing::MockApi, Addr, Api, Binary, BlockInfo, Coin, CustomQuery, Empty, MemoryStorage, Querier, Storage};
Expand Down
7 changes: 2 additions & 5 deletions packages/injective-testing/src/multi_test/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
mod address_generator;
mod chain_mock;

pub use address_generator::{generate_inj_address, InjectiveAddressGenerator, StorageAwareInjectiveAddressGenerator};
pub use chain_mock::*;
pub mod address_generator;
pub mod chain_mock;
18 changes: 10 additions & 8 deletions packages/injective-testing/src/test_tube/authz.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use injective_std::{
shim::{Any, Timestamp},
types::cosmos::{
authz::v1beta1::{GenericAuthorization, Grant, MsgGrant, MsgRevoke, MsgRevokeResponse},
bank::v1beta1::SendAuthorization,
base::v1beta1::Coin as BaseCoin,
use injective_test_tube::{
injective_std::{
shim::{Any, Timestamp},
types::cosmos::{
authz::v1beta1::{GenericAuthorization, Grant, MsgGrant, MsgRevoke, MsgRevokeResponse},
bank::v1beta1::SendAuthorization,
base::v1beta1::Coin as BaseCoin,
},
},
Account, Authz, ExecuteResponse, InjectiveTestApp, Module, Runner, SigningAccount,
};
use injective_test_tube::{Account, Authz, ExecuteResponse, InjectiveTestApp, Module, Runner, SigningAccount};
use prost::Message;

pub fn create_generic_authorization(app: &InjectiveTestApp, granter: &SigningAccount, grantee: String, msg: String, expiration: Option<Timestamp>) {
Expand Down Expand Up @@ -80,7 +82,7 @@ pub fn create_send_authorization(app: &InjectiveTestApp, granter: &SigningAccoun
.unwrap();
}

pub fn execute_grid_authorizations(app: &InjectiveTestApp, granter: &SigningAccount, grantee: String, msgs: Vec<String>) {
pub fn execute_generic_authorizations(app: &InjectiveTestApp, granter: &SigningAccount, grantee: String, msgs: Vec<String>) {
for msg in msgs {
create_generic_authorization(app, granter, grantee.clone(), msg, None);
}
Expand Down
10 changes: 6 additions & 4 deletions packages/injective-testing/src/test_tube/bank.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use cosmwasm_std::Uint128;
use injective_std::types::cosmos::{
bank::v1beta1::{MsgSend, QueryBalanceRequest},
base::v1beta1::Coin,
use injective_test_tube::{
injective_std::types::cosmos::{
bank::v1beta1::{MsgSend, QueryBalanceRequest},
base::v1beta1::Coin,
},
Account, Bank, InjectiveTestApp, SigningAccount,
};
use injective_test_tube::{Account, Bank, InjectiveTestApp, SigningAccount};
use std::str::FromStr;

pub fn send(bank: &Bank<InjectiveTestApp>, amount: &str, denom: &str, from: &SigningAccount, to: &SigningAccount) {
Expand Down
Loading

0 comments on commit 8138fd2

Please sign in to comment.