use crate::prelude::*;
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::{Addr, Uint128};
use crate::contracts::cw20::Cw20Coin;
#[cw_serde]
pub struct InstantiateMsg {
pub tap_limit: Option<u32>,
pub cw20_code_id: u64,
pub gas_allowance: Option<GasAllowance>,
}
#[cw_serde]
pub enum ExecuteMsg {
Tap {
assets: Vec<FaucetAsset>,
recipient: RawAddr,
amount: Option<Number>,
},
Multitap {
recipients: Vec<MultitapRecipient>,
},
OwnerMsg(OwnerMsg),
}
#[cw_serde]
pub struct MultitapRecipient {
pub addr: RawAddr,
pub assets: Vec<FaucetAsset>,
}
#[cw_serde]
pub enum FaucetAsset {
Cw20(RawAddr),
Native(String),
}
#[cw_serde]
pub enum OwnerMsg {
AddAdmin {
admin: RawAddr,
},
RemoveAdmin {
admin: RawAddr,
},
SetTapLimit {
tap_limit: Option<u32>,
},
SetTapAmount {
asset: FaucetAsset,
amount: Number,
},
DeployToken {
name: String,
tap_amount: Number,
trading_competition_index: Option<u32>,
initial_balances: Vec<Cw20Coin>,
},
SetMarketAddress {
name: String,
trading_competition_index: u32,
market: RawAddr,
},
SetCw20CodeId {
cw20_code_id: u64,
},
Mint {
cw20: String,
balances: Vec<Cw20Coin>,
},
SetGasAllowance {
allowance: GasAllowance,
},
ClearGasAllowance {},
SetMultitapAmount {
name: String,
amount: Decimal256,
},
}
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
#[returns(cw2::ContractVersion)]
Version {},
#[returns(ConfigResponse)]
Config {},
#[returns(GetTokenResponse)]
GetToken {
name: String,
trading_competition_index: Option<u32>,
},
#[returns(NextTradingIndexResponse)]
NextTradingIndex { name: String },
#[returns(GasAllowanceResp)]
GetGasAllowance {},
#[returns(TapEligibleResponse)]
IsTapEligible {
addr: RawAddr,
#[serde(default)]
assets: Vec<FaucetAsset>,
},
#[returns(IsAdminResponse)]
IsAdmin { addr: RawAddr },
#[returns(TapAmountResponse)]
TapAmount { asset: FaucetAsset },
#[returns(TapAmountResponse)]
TapAmountByName { name: String },
#[returns(FundsSentResponse)]
FundsSent {
asset: FaucetAsset,
timestamp: Option<Timestamp>,
},
#[returns(TappersResp)]
Tappers {
start_after: Option<RawAddr>,
limit: Option<u32>,
},
}
#[cw_serde]
pub enum GetTokenResponse {
Found { address: Addr },
NotFound {},
}
#[cw_serde]
pub struct NextTradingIndexResponse {
pub next_index: u32,
}
#[cw_serde]
pub struct MigrateMsg {}
#[cw_serde]
pub struct ConfigResponse {
pub admins: Vec<Addr>,
pub tap_limit: Option<u32>,
}
#[cw_serde]
pub struct GasAllowance {
pub denom: String,
pub amount: Uint128,
}
#[cw_serde]
pub enum GasAllowanceResp {
Enabled { denom: String, amount: Uint128 },
Disabled {},
}
#[cw_serde]
pub enum TapEligibleResponse {
Eligible {},
Ineligible {
seconds: Decimal256,
message: String,
reason: IneligibleReason,
},
}
#[cw_serde]
pub enum IneligibleReason {
TooSoon,
AlreadyTapped,
}
#[cw_serde]
pub struct IsAdminResponse {
pub is_admin: bool,
}
#[cw_serde]
pub enum TapAmountResponse {
CannotTap {},
CanTap { amount: Decimal256 },
}
#[cw_serde]
pub struct FundsSentResponse {
pub amount: Decimal256,
}
#[cw_serde]
pub struct TappersResp {
pub tappers: Vec<Addr>,
}