1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use crate::asset::Asset;
use cosmwasm_std::{Addr, Binary, Decimal, Uint128};
use cw20::Cw20ReceiveMsg;
/// ## Description
/// This structure describes the execute messages available in the contract.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
/// ## Description
/// Receives a message of type [`Cw20ReceiveMsg`]
Receive(Cw20ReceiveMsg),
/// ProvideLiquidity allows an account to provide liquidity in a pool with bLUNA
ProvideLiquidity {
/// The two assets available in the pool
assets: [Asset; 2],
/// The slippage tolerance that allows liquidity provision only if the price in the pool doesn't move too much
slippage_tolerance: Option<Decimal>,
/// Determines whether the LP tokens minted for the user is auto_staked in the Generator contract
auto_stake: Option<bool>,
/// The receiver of LP tokens
receiver: Option<String>,
},
/// Swap performs a swap in the pool
Swap {
offer_asset: Asset,
belief_price: Option<Decimal>,
max_spread: Option<Decimal>,
to: Option<String>,
},
/// Update the pair configuration
UpdateConfig { params: Binary },
/// Claims bLUNA rewards and sends them to the specified receiver
ClaimReward {
/// An address which will receive the bLUNA reward
receiver: Option<String>,
},
/// Claims the bLUNA reward for a user that deposited their LP tokens in the Generator contract
ClaimRewardByGenerator {
/// The user whose LP tokens are/were staked in the Generator
user: String,
/// The user's LP token amount before the LP token transfer between their wallet and the Generator
user_share: Uint128,
/// The total LP token amount already deposited by all users in the Generator
total_share: Uint128,
},
/// Callback for distributing bLUNA rewards
HandleReward {
previous_reward_balance: Uint128,
user: Addr,
user_share: Uint128,
total_share: Uint128,
receiver: Option<Addr>,
},
}
/// ## Description
/// This structure describes the query messages available in the contract.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
/// Returns information about a pair in an object of type [`PairInfo`].
Pair {},
/// Returns information about a pool in an object of type [`PoolResponse`].
Pool {},
/// Returns contract configuration settings in a custom [`ConfigResponse`] structure.
Config {},
/// Returns information about the share of the pool in a vector that contains objects of type [`Asset`].
Share { amount: Uint128 },
/// Returns information about a swap simulation in a [`SimulationResponse`] object.
Simulation { offer_asset: Asset },
/// Returns information about a reverse simulation in a [`ReverseSimulationResponse`] object.
ReverseSimulation { ask_asset: Asset },
/// Returns information about cumulative prices (used for TWAPs) in a [`CumulativePricesResponse`] object.
CumulativePrices {},
/// Returns pending token rewards that can be claimed by a specific user in a [`PendingRewardResponse`] object.
PendingReward { user: String },
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct StablePoolParams {
pub amp: u64,
pub bluna_rewarder: String,
pub generator: String,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct StablePoolConfig {
pub amp: Decimal,
pub bluna_rewarder: Addr,
pub generator: Addr,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum StablePoolUpdateParams {
StartChangingAmp { next_amp: u64, next_amp_time: u64 },
StopChangingAmp {},
BlunaRewarder { address: String },
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct MigrateMsg {
pub bluna_rewarder: String,
pub generator: String,
}