Skip to content

Commit

Permalink
chore: fix proto error
Browse files Browse the repository at this point in the history
  • Loading branch information
kerber0x committed Feb 27, 2024
1 parent 7ca6413 commit 8d2cb4a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
4 changes: 3 additions & 1 deletion contracts/injective-auction-pool/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ pub fn instantiate(
},
)?;

let current_auction_round = query_current_auction(deps.as_ref())?.auction_round;
let current_auction_round = query_current_auction(deps.as_ref())?
.auction_round
.ok_or(ContractError::CurrentAuctionQueryError)?;
CURRENT_AUCTION_NUMBER.save(deps.storage, &current_auction_round)?;

//todo mint lp for current auction
Expand Down
7 changes: 7 additions & 0 deletions contracts/injective-auction-pool/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
use cosmwasm_std::StdError;
use cw_utils::PaymentError;
use thiserror::Error;

#[derive(Error, Debug)]
pub enum ContractError {
#[error("{0}")]
Std(#[from] StdError),

#[error("{0}")]
PaymentError(#[from] PaymentError),

#[error("Unauthorized")]
Unauthorized {},

Expand All @@ -22,4 +26,7 @@ pub enum ContractError {
"The auction is locked since it's about to finish, therefore no withdrawals are allowed"
)]
PooledAuctionLocked,

#[error("Couldn't parse the current auction query response")]
CurrentAuctionQueryError,
}
10 changes: 8 additions & 2 deletions contracts/injective-auction-pool/src/executions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ pub(crate) fn join_pool(

let coin = info.funds[0].clone();

let current_auction_round = query_current_auction(deps.as_ref())?.auction_round;
let current_auction_round = query_current_auction(deps.as_ref())?
.auction_round
.ok_or(ContractError::CurrentAuctionQueryError)?;

ensure!(
current_auction_round == auction_round,
Expand Down Expand Up @@ -81,14 +83,18 @@ pub(crate) fn exit_pool(

let lp_denom = format!(
"factory/{}/{}",
env.contract.address, current_auction_round_response.auction_round
env.contract.address,
current_auction_round_response
.auction_round
.ok_or(ContractError::CurrentAuctionQueryError)?
);
cw_utils::must_pay(&info, lp_denom.as_str())?;

ensure!(
DAY_IN_SECONDS
> current_auction_round_response
.auction_closing_time
.ok_or(ContractError::CurrentAuctionQueryError)?
.saturating_sub(env.block.time.seconds()),
ContractError::PooledAuctionLocked
);
Expand Down
18 changes: 9 additions & 9 deletions packages/injective_auction/src/auction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ pub struct QueryCurrentAuctionBasketRequest {}
)]
#[proto_message(type_url = "/injective.auction.v1beta1.QueryCurrentAuctionBasketResponse")]
pub struct QueryCurrentAuctionBasketResponse {
// #[prost(message, repeated, tag = "1")]
#[prost(message, repeated, tag = "1")]
pub amount: Vec<Coin>,
// #[prost(uint64, optional, tag = "2")]
pub auction_round: u64,
// #[prost(int64, optional, tag = "3")]
pub auction_closing_time: u64,
// #[prost(string, optional, tag = "4")]
pub highest_bidder: String,
// #[prost(string, optional, tag = "5")]
pub highest_bid_amount: String,
#[prost(uint64, optional, tag = "2")]
pub auction_round: ::core::option::Option<u64>,
#[prost(uint64, optional, tag = "3")]
pub auction_closing_time: ::core::option::Option<u64>,
#[prost(string, optional, tag = "4")]
pub highest_bidder: ::core::option::Option<String>,
#[prost(string, optional, tag = "5")]
pub highest_bid_amount: ::core::option::Option<String>,
}
1 change: 0 additions & 1 deletion packages/injective_auction/src/auction_pool.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::{Addr, Decimal};
use osmosis_std_derive::CosmwasmExt;

#[cw_serde]
pub struct InstantiateMsg {
Expand Down

0 comments on commit 8d2cb4a

Please sign in to comment.