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
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::{Addr, Uint128};
use crate::asset::{Asset, AssetInfo};
#[cw_serde]
pub struct InstantiateMsg {
pub vault_addr: Addr,
// allowed lockable tokens
pub allowed_lockable_tokens: Vec<AssetInfo>,
/// owner of the contract
pub owner: Addr,
}
#[cw_serde]
#[derive(Eq)]
pub struct LockInfo {
pub amount: Uint128,
pub unlock_time: u64,
}
#[cw_serde]
pub struct Config {
pub vault_addr: Addr,
pub owner: Addr,
pub allowed_lockable_tokens: Vec<AssetInfo>
}
#[cw_serde]
pub enum ExecuteMsg {
/// Locks an LST asset for the user, which can only be used to join a pool on Dexter
/// Kept this API to support CW20 LST tokens too which isn't an immediate usecase but might be useful in the future
LockLstAsset {
asset: Asset,
},
/// Join pool on behalf of the user using the locked LST and any extra tokens that the user is willing to spend.
/// This function will also bond the LP position for the user so they immediately start earning the LP incentive rewards.
JoinPoolAndBondUsingLockedLst {
pool_id: Uint128,
/// Represents the total amount of each token that the user wants to spend for joining the pool
/// This includes the amount of tokens that are locked for the user + any extra token that he is willing to send along and spend
total_assets: Vec<Asset>,
min_lp_to_receive: Option<Uint128>
},
/// Update config
UpdateConfig {
vault_addr: Option<Addr>,
},
// add a new token to the list of allowed lockable tokens
AddAllowedLockableToken {
asset_info: AssetInfo
},
// remove a token from the list of allowed lockable tokens
RemoveAllowedLockableToken {
asset_info: AssetInfo
},
/// Allows the owner to transfer ownership to a new address.
/// Ownership transfer is done in two steps:
/// 1. The owner proposes a new owner.
/// 2. The new owner accepts the ownership.
/// The proposal expires after a certain period of time within which the new owner must accept the ownership.
ProposeNewOwner {
owner: Addr,
expires_in: u64,
},
/// Allows the new owner to accept ownership.
ClaimOwnership {},
/// Allows the owner to drop the ownership transfer proposal.
DropOwnershipProposal {}
}
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
#[returns(Uint128)]
TotalAmountLocked {
user: Addr,
asset_info: AssetInfo
},
#[returns(Config)]
Config {}
}