white_whale_std/pool_network/incentive_factory.rs
1use cosmwasm_schema::{cw_serde, QueryResponses};
2use cosmwasm_std::Addr;
3
4use crate::pool_network::asset::{Asset, AssetInfo};
5
6#[cw_serde]
7pub struct InstantiateMsg {
8 /// The address of the fee collector to send flow creation fees to.
9 pub fee_collector_addr: String,
10 /// Fee distributor contract address.
11 pub fee_distributor_addr: String,
12 /// The fee that must be paid to create a flow.
13 pub create_flow_fee: Asset,
14 /// The maximum amount of flows that can exist for a single LP token at a single time.
15 pub max_concurrent_flows: u64,
16 /// The code ID of the incentive contract.
17 pub incentive_code_id: u64,
18 /// The maximum epoch buffer for a new flow (in epochs).
19 ///
20 /// New flows are allowed to start up to `current_epoch + start_epoch_buffer` into the future.
21 pub max_flow_epoch_buffer: u64,
22 /// The minimum amount of seconds that a user must bond their tokens for.
23 pub min_unbonding_duration: u64,
24 /// The maximum amount of seconds that a user must bond their tokens for.
25 pub max_unbonding_duration: u64,
26}
27
28#[cw_serde]
29pub enum ExecuteMsg {
30 /// Creates a new incentive contract tied to the `lp_asset` specified.
31 CreateIncentive { lp_asset: AssetInfo },
32 /// Updates the configuration of the contract.
33 ///
34 /// Unspecified fields will not be updated.
35 UpdateConfig {
36 /// The owner of the contract.
37 ///
38 /// If unspecified, the owner address will not change.
39 owner: Option<String>,
40 /// The new fee collector address to send flow creation fees to.
41 ///
42 /// If unspecified, the fee collector address will not change.
43 fee_collector_addr: Option<String>,
44 /// The new fee distributor address to get epochs from.
45 ///
46 /// If unspecified, the fee distributor address will not change.
47 fee_distributor_addr: Option<String>,
48 /// The new fee that must be paid to create a flow.
49 ///
50 /// If unspecified, the flow fee will not change.
51 create_flow_fee: Option<Asset>,
52 /// The maximum amount of concurrent flows that can exist for a single LP token at a single time.
53 ///
54 /// If unspecified, the max concurrent flows will not change.
55 max_concurrent_flows: Option<u64>,
56 /// The new code ID of the incentive contract.
57 ///
58 /// If unspecified, the incentive contract id will not change.
59 incentive_code_id: Option<u64>,
60
61 /// The new maximum start time buffer for a new flow (in seconds).
62 ///
63 /// If unspecified, the flow start buffer will not change.
64 max_flow_start_time_buffer: Option<u64>,
65 /// The minimum amount of seconds that a user must bond their tokens for.
66 ///
67 /// If unspecified, the `min_unbonding_duration` will not change.
68 min_unbonding_duration: Option<u64>,
69 /// The maximum amount of seconds that a user must bond their tokens for.
70 ///
71 /// If unspecified, the `max_unbonding_duration` will not change.
72 max_unbonding_duration: Option<u64>,
73 },
74 MigrateIncentives {
75 /// The address of the incentive contract. If unspecified, will migrate all incentive contracts.
76 incentive_address: Option<String>,
77 /// The new code ID to migrate the incentive contract to.
78 code_id: u64,
79 },
80}
81
82#[cw_serde]
83#[derive(QueryResponses)]
84pub enum QueryMsg {
85 /// Retrieves the config of the incentive factory.
86 #[returns(ConfigResponse)]
87 Config {},
88 /// Retrieves a specific incentive address.
89 #[returns(IncentiveResponse)]
90 Incentive {
91 /// The LP token asset info.
92 lp_asset: AssetInfo,
93 },
94 #[returns(IncentivesResponse)]
95 Incentives {
96 /// An optional parameter specifying what incentive contract to start
97 /// searching after.
98 start_after: Option<AssetInfo>,
99 /// The amount of incentive contracts to return.
100 ///
101 /// If unspecified, will default to a value specified by the contract.
102 limit: Option<u32>,
103 },
104}
105
106#[cw_serde]
107pub struct MigrateMsg {}
108
109/// Stores the configuration of the incentive factory.
110#[cw_serde]
111pub struct Config {
112 pub owner: Addr,
113 /// The address to send fees to.
114 pub fee_collector_addr: Addr,
115 /// Fee distributor contract address.
116 pub fee_distributor_addr: Addr,
117 /// The fee that must be paid each time a user wants to create a flow.
118 pub create_flow_fee: Asset,
119 /// The maximum amount of flows that can exist at any one time.
120 pub max_concurrent_flows: u64,
121 /// The code ID of the incentive contract.
122 pub incentive_code_id: u64,
123 /// The maximum amount of epochs in the future a new flow is allowed to start in.
124 pub max_flow_epoch_buffer: u64,
125 /// The minimum amount of seconds that a user must bond their tokens for.
126 pub min_unbonding_duration: u64,
127 /// The maximum amount of seconds that a user must bond their tokens for.
128 pub max_unbonding_duration: u64,
129}
130
131pub type ConfigResponse = Config;
132pub type IncentiveResponse = Option<Addr>;
133
134#[cw_serde]
135pub struct IncentivesContract {
136 /// The address of the incentive contract.
137 pub incentive_address: Addr,
138 /// A byte-array reference to the LP address.
139 pub lp_reference: Vec<u8>,
140}
141pub type IncentivesResponse = Vec<IncentivesContract>;