Skip to content

Instantly share code, notes, and snippets.

@stefanionescu
Created November 2, 2021 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanionescu/3d09f1f1c5acbfb66134a785ac200f83 to your computer and use it in GitHub Desktop.
Save stefanionescu/3d09f1f1c5acbfb66134a785ac200f83 to your computer and use it in GitHub Desktop.
Interface for test CosmWasm smart contract
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use cosmwasm_std::Uint128;
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct FundParameters {
pub owner: String,
pub penaltyReceiver: String,
pub penalty: u16,
pub deadmanDelay: u64,
}
#[derive(Serialize, Deserialize, JsonSchema)]
pub struct InstantiateMsg {
pub penalty: u16,
pub penaltyReceiver: String,
pub delay: u64,
}
#[derive(Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
ChangeAdmin {
admin: String,
},
ChangePenalty {
penalty: u16,
},
ChangePenaltyReceiver {
receiver: String,
},
ChangeDeadmanDelay {
delay: u64,
},
Deposit {
targetDepositor: String,
amount: Uint128,
deadline: u64,
},
Withdraw {
depositId: Uint128,
amountToWithdraw: Uint128
},
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Balance { owner: String },
Deposits { owner: String },
Admin {},
PenaltyReceiver {},
Penalty {},
DeadmanDelay {},
}
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct BalanceResponse {
pub balance: Uint128,
}
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct DepositsResponse {
pub deposits: Uint128,
}
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct AdminResponse {
pub admin: String,
}
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct PenaltyReceiverResponse {
pub receiver: String,
}
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct PenaltyResponse {
pub penalty: u16,
}
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct DeadmanDelayResponse {
pub delay: u64,
}
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct DepositResponse {
pub depositId: Uint128,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment