From a092d5b5e7a1fd9d9e9a31dce6310b9f1c3e08cc Mon Sep 17 00:00:00 2001 From: maxrobot Date: Wed, 2 Oct 2024 14:29:02 +0100 Subject: [PATCH] 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(