From a092d5b5e7a1fd9d9e9a31dce6310b9f1c3e08cc Mon Sep 17 00:00:00 2001 From: maxrobot Date: Wed, 2 Oct 2024 14:29:02 +0100 Subject: [PATCH 1/2] added auction queries to dummy --- Cargo.lock | 1 + contracts/dummy/Cargo.toml | 1 + contracts/dummy/src/contract.rs | 12 ++++++++++++ .../src/types/injective/auction/v1beta1.rs | 5 +++-- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ed0f98b..eea0b769 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -958,6 +958,7 @@ dependencies = [ "cw-storage-plus", "cw2", "injective-cosmwasm 0.3.0", + "injective-std 1.13.0", "schemars", "serde 1.0.210", "thiserror", diff --git a/contracts/dummy/Cargo.toml b/contracts/dummy/Cargo.toml index 647c5406..b8a0c5c3 100644 --- a/contracts/dummy/Cargo.toml +++ b/contracts/dummy/Cargo.toml @@ -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 } diff --git a/contracts/dummy/src/contract.rs b/contracts/dummy/src/contract.rs index b1c2378f..cd77f8b7 100644 --- a/contracts/dummy/src/contract.rs +++ b/contracts/dummy/src/contract.rs @@ -12,6 +12,10 @@ use crate::error::ContractError; use crate::mock_pyth_attestation::execute_trigger_pyth_update; use crate::msg::{ExecuteMsg, InstantiateMsg, QueryMsg, SudoMsg}; +use injective_std::types::injective::auction::v1beta1::{ + AuctionQuerier, QueryLastAuctionResultRequest, QueryLastAuctionResultResponse, +}; + // version info for migration info const CONTRACT_NAME: &str = "crates.io:injective:dummy"; const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -27,6 +31,14 @@ pub fn instantiate( _msg: InstantiateMsg, ) -> Result { set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + + let auction_querier = AuctionQuerier::new(&deps.querier); + + // let res = auction_querier.current_auction_basket().unwrap(); + // let res = auction_querier.auction_params().unwrap(); + let res = auction_querier.last_auction_result().unwrap(); + + deps.api.debug(&format!("res: {:?}", res)); COUNTER.save(deps.storage, &0u32)?; ACTIVE.save(deps.storage, &false)?; Ok(Response::new() diff --git a/packages/injective-std/src/types/injective/auction/v1beta1.rs b/packages/injective-std/src/types/injective/auction/v1beta1.rs index fe630259..6146b168 100644 --- a/packages/injective-std/src/types/injective/auction/v1beta1.rs +++ b/packages/injective-std/src/types/injective/auction/v1beta1.rs @@ -31,8 +31,9 @@ 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")] + #[prost(message, optional, tag = "2")] + pub amount: ::core::option::Option, /// round defines the round number of auction #[prost(uint64, tag = "3")] #[serde( From f4d468aa36dca721f6ec956ac1f5761ac0a964f1 Mon Sep 17 00:00:00 2001 From: maxrobot Date: Tue, 8 Oct 2024 16:08:53 +0100 Subject: [PATCH 2/2] fix: did a manual fix for coins that are being labelled as strings and not marshalling as coin correctly --- packages/injective-std/Cargo.toml | 2 +- .../src/types/injective/auction/v1beta1.rs | 23 ++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/packages/injective-std/Cargo.toml b/packages/injective-std/Cargo.toml index ea3aaa65..3333763f 100644 --- a/packages/injective-std/Cargo.toml +++ b/packages/injective-std/Cargo.toml @@ -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 diff --git a/packages/injective-std/src/types/injective/auction/v1beta1.rs b/packages/injective-std/src/types/injective/auction/v1beta1.rs index 6146b168..7b3f9bf7 100644 --- a/packages/injective-std/src/types/injective/auction/v1beta1.rs +++ b/packages/injective-std/src/types/injective/auction/v1beta1.rs @@ -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, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)] @@ -32,6 +35,8 @@ pub struct LastAuctionResult { 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, + // NOTE: THIS IS A FIX FOR RUST BINDINGS, PLEASE COPY IN FUTURE RELEASES #[prost(message, optional, tag = "2")] pub amount: ::core::option::Option, /// round defines the round number of auction @@ -50,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, /// round defines the round number of auction #[prost(uint64, tag = "3")] #[serde( @@ -68,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, /// round defines the round number of auction #[prost(uint64, tag = "3")] #[serde(