use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::Uint128;
use cw20::Cw20ReceiveMsg;
#[cw_serde]
pub struct InstantiateMsg {
/// Token name
pub name: String,
/// Token symbol
pub symbol: String,
/// Token decimals
pub decimals: u8,
/// Admin address (defaults to sender)
pub admin: Option<String>,
/// Burn-exempt contract slots (spec ยง4.1)
pub mine_contract: Option<String>,
pub stake_contract: Option<String>,
pub refer_contract: Option<String>,
pub wrap_contract: Option<String>,
}
#[cw_serde]
pub enum ExecuteMsg {
// === CW-20 standard interface ===
/// Transfer tokens to another address. 1% fee routed to litium-mine unless exempt.
Transfer { recipient: String, amount: Uint128 },
/// Transfer tokens from owner to recipient (requires allowance). 1% fee unless exempt.
TransferFrom {
owner: String,
recipient: String,
amount: Uint128,
},
/// Send tokens to a contract with a message. 1% fee unless exempt.
Send {
contract: String,
amount: Uint128,
msg: cosmwasm_std::Binary,
},
/// Send tokens from owner to a contract (requires allowance). 1% fee unless exempt.
SendFrom {
owner: String,
contract: String,
amount: Uint128,
msg: cosmwasm_std::Binary,
},
/// Burn tokens from sender's balance.
Burn { amount: Uint128 },
/// Burn tokens from owner's balance (requires allowance).
BurnFrom { owner: String, amount: Uint128 },
/// Increase allowance for a spender.
IncreaseAllowance {
spender: String,
amount: Uint128,
expires: Option<cw20::Expiration>,
},
/// Decrease allowance for a spender.
DecreaseAllowance {
spender: String,
amount: Uint128,
expires: Option<cw20::Expiration>,
},
// === Authorized operations ===
/// Mint LI tokens to a recipient. Only authorized callers.
Mint { to: String, amount: Uint128 },
// === Admin operations ===
/// Register a contract as authorized mint/burn caller. Admin only.
RegisterAuthorizedCaller { contract_addr: String },
/// Remove an authorized caller. Admin only.
RemoveAuthorizedCaller { contract_addr: String },
/// Update config. Admin only.
UpdateConfig {
admin: Option<String>,
mine_contract: Option<String>,
stake_contract: Option<String>,
refer_contract: Option<String>,
wrap_contract: Option<String>,
},
/// Testing helper: mutate critical runtime state in-place (admin only).
ApplyTestingOverrides { overrides: TestingOverrides },
/// Full state reset for daily testing (admin only).
/// Zeroes total_minted, burn_total, fee_total, and all CW-20 balances/supply.
ResetState {},
/// Pause contract. Admin only.
Pause {},
/// Unpause contract. Admin only.
Unpause {},
// === CW-20 Receive (for composability) ===
/// Receive CW-20 tokens (not used by this contract, but included for interface completeness).
Receive(Cw20ReceiveMsg),
}
#[cw_serde]
pub struct TestingOverrides {
pub paused: Option<bool>,
pub burn_total: Option<Uint128>,
pub fee_total: Option<Uint128>,
pub total_minted: Option<Uint128>,
}
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
#[returns(ConfigResponse)]
Config {},
#[returns(BurnStatsResponse)]
BurnStats {},
#[returns(TotalMintedResponse)]
TotalMinted {},
#[returns(IsAuthorizedCallerResponse)]
IsAuthorizedCaller { address: String },
// === CW-20 queries ===
#[returns(cw20::BalanceResponse)]
Balance { address: String },
#[returns(cw20::TokenInfoResponse)]
TokenInfo {},
#[returns(Option<cw20::MinterResponse>)]
Minter {},
#[returns(cw20::AllowanceResponse)]
Allowance { owner: String, spender: String },
#[returns(cw20::AllAllowancesResponse)]
AllAllowances {
owner: String,
start_after: Option<String>,
limit: Option<u32>,
},
#[returns(cw20::AllSpenderAllowancesResponse)]
AllSpenderAllowances {
spender: String,
start_after: Option<String>,
limit: Option<u32>,
},
#[returns(cw20::AllAccountsResponse)]
AllAccounts {
start_after: Option<String>,
limit: Option<u32>,
},
}
#[cw_serde]
pub struct ConfigResponse {
pub admin: String,
pub paused: bool,
pub mine_contract: Option<String>,
pub stake_contract: Option<String>,
pub refer_contract: Option<String>,
pub wrap_contract: Option<String>,
}
#[cw_serde]
pub struct BurnStatsResponse {
pub total_burned: Uint128,
}
#[cw_serde]
pub struct TotalMintedResponse {
pub total_minted: Uint128,
pub supply_cap: Uint128,
}
#[cw_serde]
pub struct IsAuthorizedCallerResponse {
pub address: String,
pub authorized: bool,
}
cw-cyber/contracts/litium-core/src/msg.rs
ฯ 0.0%
use ;
use Uint128;
use Cw20ReceiveMsg;