Skip to content

Commit

Permalink
Merge pull request #246 from InjectiveLabs/f/dummy-contract-auction
Browse files Browse the repository at this point in the history
F/dummy contract auction
  • Loading branch information
maxrobot authored Oct 8, 2024
2 parents fd72a3a + c6203c7 commit 5626480
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 195 deletions.
355 changes: 181 additions & 174 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ethereum-types = { version = "0.5.2" }
hex = { version = "0.4.3", features = [ "serde" ] }
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 = { version = "1.13.2-auction", 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" }
Expand Down
1 change: 1 addition & 0 deletions contracts/dummy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ cosmwasm-std = { workspace = true }
cw-storage-plus = { workspace = true }
cw2 = { workspace = true }
injective-cosmwasm = { path = "../../packages/injective-cosmwasm" }
injective-std = { path = "../../packages/injective-std" }
schemars = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }
1 change: 1 addition & 0 deletions contracts/dummy/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub fn instantiate(
_msg: InstantiateMsg,
) -> Result<Response, ContractError> {
set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;

COUNTER.save(deps.storage, &0u32)?;
ACTIVE.save(deps.storage, &false)?;
Ok(Response::new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ fn test_query_grantee_grants() {
env.users[1].account.address().to_string(),
);

let combined_grants = response_user0
.grants
.into_iter()
.chain(response_user2.grants.into_iter())
.collect::<Vec<_>>();
let combined_grants = response_user0.grants.into_iter().chain(response_user2.grants).collect::<Vec<_>>();
let query_result = get_stargate_query_result::<StargateQueryGranteeGrantsResponse>(wasm.query(&env.contract_address, &query_msg)).unwrap();

let all_grants_present = combined_grants.iter().all(|grant| query_result.grants.contains(grant));
Expand Down Expand Up @@ -125,15 +121,14 @@ fn test_query_grants() {
};

let contract_response: RunnerResult<QueryStargateResponse> = wasm.query(&env.contract_address, &query_msg);
println!("{:?}", contract_response);

if let Err(QueryError { msg }) = contract_response {
assert_eq!(
msg, "Generic error: Querier contract error: codespace: authz, code: 2: query wasm contract failed",
"The error message does not match the expected value"
);
} else {
assert!(false, "Expected an error, but got a success: {:?}", contract_response);
panic!("Expected an error, but got a success: {:?}", contract_response);
}
}

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 @@ -14,7 +14,7 @@ cosmwasm-std = { workspace = true }
cw-storage-plus = { workspace = true }
ethereum-types = { workspace = true }
hex = { workspace = true }
injective-math = { workspace = true, path = "../../packages/injective-math" }
injective-math = { path = "../../packages/injective-math" }
schemars = { workspace = true }
serde = { workspace = true }
serde_repr = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ license = "MIT OR Apache-2.0"
name = "injective-std"
readme = "README.md"
repository = "https://github.com/InjectiveLabs/cw-injective/tree/dev/packages/injective-std"
version = "1.13.0"
version = "1.13.2-auction"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
28 changes: 20 additions & 8 deletions packages/injective-std/src/types/injective/auction/v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ pub struct Params {
pub struct Bid {
#[prost(string, tag = "1")]
pub bidder: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub amount: ::prost::alloc::string::String,
// #[prost(string, tag = "2")]
// pub amount: ::prost::alloc::string::String,
// NOTE: THIS IS A FIX FOR RUST BINDINGS, PLEASE COPY IN FUTURE RELEASES
#[prost(message, optional, tag = "2")]
pub amount: ::core::option::Option<super::super::super::cosmos::base::v1beta1::Coin>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Expand All @@ -31,8 +34,11 @@ pub struct LastAuctionResult {
#[prost(string, tag = "1")]
pub winner: ::prost::alloc::string::String,
/// amount describes the amount the winner get from the auction
#[prost(string, tag = "2")]
pub amount: ::prost::alloc::string::String,
// #[prost(string, tag = "2")]
// pub amount: ::prost::alloc::string::String,
// NOTE: THIS IS A FIX FOR RUST BINDINGS, PLEASE COPY IN FUTURE RELEASES
#[prost(message, optional, tag = "2")]
pub amount: ::core::option::Option<super::super::super::cosmos::base::v1beta1::Coin>,
/// round defines the round number of auction
#[prost(uint64, tag = "3")]
#[serde(
Expand All @@ -49,8 +55,11 @@ pub struct EventBid {
#[prost(string, tag = "1")]
pub bidder: ::prost::alloc::string::String,
/// amount describes the amount the bidder put on the auction
#[prost(string, tag = "2")]
pub amount: ::prost::alloc::string::String,
// #[prost(string, tag = "2")]
// pub amount: ::prost::alloc::string::String,
// NOTE: THIS IS A FIX FOR RUST BINDINGS, PLEASE COPY IN FUTURE RELEASES
#[prost(message, optional, tag = "2")]
pub amount: ::core::option::Option<super::super::super::cosmos::base::v1beta1::Coin>,
/// round defines the round number of auction
#[prost(uint64, tag = "3")]
#[serde(
Expand All @@ -67,8 +76,11 @@ pub struct EventAuctionResult {
#[prost(string, tag = "1")]
pub winner: ::prost::alloc::string::String,
/// amount describes the amount the winner get from the auction
#[prost(string, tag = "2")]
pub amount: ::prost::alloc::string::String,
// #[prost(string, tag = "2")]
// pub amount: ::prost::alloc::string::String,
// NOTE: THIS IS A FIX FOR RUST BINDINGS, PLEASE COPY IN FUTURE RELEASES
#[prost(message, optional, tag = "2")]
pub amount: ::core::option::Option<super::super::super::cosmos::base::v1beta1::Coin>,
/// round defines the round number of auction
#[prost(uint64, tag = "3")]
#[serde(
Expand Down
6 changes: 3 additions & 3 deletions packages/injective-testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ anyhow = { workspace = true }
base64 = { workspace = true }
cosmwasm-std = { workspace = true }
cw-multi-test = { workspace = true }
injective-cosmwasm = { version = "0.3.1", path = "../injective-cosmwasm" }
injective-math = { version = "0.3.0", path = "../injective-math" }
injective-std = { version = "1.13.0", path = "../injective-std" }
injective-cosmwasm = { path = "../injective-cosmwasm" }
injective-math = { path = "../injective-math" }
injective-std = { path = "../injective-std" }
injective-test-tube = { workspace = true }
prost = { workspace = true }
rand = { workspace = true }
Expand Down

0 comments on commit 5626480

Please sign in to comment.