Skip to content

Commit

Permalink
added auction queries to dummy
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrobot committed Oct 2, 2024
1 parent 2d58148 commit a092d5b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

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 }
12 changes: 12 additions & 0 deletions contracts/dummy/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -27,6 +31,14 @@ pub fn instantiate(
_msg: InstantiateMsg,
) -> Result<Response, ContractError> {
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()
Expand Down
5 changes: 3 additions & 2 deletions packages/injective-std/src/types/injective/auction/v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<super::super::super::cosmos::base::v1beta1::Coin>,
/// round defines the round number of auction
#[prost(uint64, tag = "3")]
#[serde(
Expand Down

0 comments on commit a092d5b

Please sign in to comment.