@@ -61,6 +61,7 @@ module initia_std::vip {
61
61
const DEFAULT_PROPORTION_RATIO : vector <u8 > = b"0.5 ";
62
62
const DEFAULT_USER_VESTING_PERIOD : u64 = 52 ; // 52 times
63
63
const DEFAULT_OPERATOR_VESTING_PERIOD : u64 = 52 ;
64
+ const DEFAULT_STAGE_PERIOD : u64 = 604800 ; // 1 week
64
65
const DEFAULT_MINIMUM_ELIGIBLE_TVL : u64 = 0 ;
65
66
const DEFAULT_MAXIMUM_TVL_RATIO : vector <u8 > = b"1 ";
66
67
const DEFAULT_MAXIMUM_WEIGHT_RATIO : vector <u8 > = b"1 ";
@@ -70,6 +71,7 @@ module initia_std::vip {
70
71
// global stage
71
72
stage: u64 ,
72
73
// governance-defined vesting period in stage unit
74
+ stage_period: u64 ,
73
75
// the number of times vesting is divided
74
76
user_vesting_period: u64 ,
75
77
operator_vesting_period: u64 ,
@@ -95,6 +97,7 @@ module initia_std::vip {
95
97
}
96
98
97
99
struct StageData has store {
100
+ stage_period: u64 ,
98
101
pool_split_ratio: Decimal256 ,
99
102
total_operator_funded_reward: u64 ,
100
103
total_user_funded_reward: u64 ,
@@ -133,6 +136,7 @@ module initia_std::vip {
133
136
134
137
struct ModuleResponse has drop {
135
138
stage: u64 ,
139
+ stage_period: u64 ,
136
140
agent: address ,
137
141
proportion: Decimal256 ,
138
142
pool_split_ratio: Decimal256 ,
@@ -148,6 +152,7 @@ module initia_std::vip {
148
152
}
149
153
150
154
struct StageDataResponse has drop {
155
+ stage_period: u64 ,
151
156
pool_split_ratio: Decimal256 ,
152
157
total_operator_funded_reward: u64 ,
153
158
total_user_funded_reward: u64 ,
@@ -181,6 +186,7 @@ module initia_std::vip {
181
186
#[event]
182
187
struct StageAdvanceEvent has drop , store {
183
188
stage: u64 ,
189
+ stage_period: u64 ,
184
190
pool_split_ratio: Decimal256 ,
185
191
total_operator_funded_reward: u64 ,
186
192
total_user_funded_reward: u64 ,
@@ -207,6 +213,7 @@ module initia_std::vip {
207
213
chain,
208
214
ModuleStore {
209
215
stage: DEFAULT_VIP_START_STAGE ,
216
+ stage_period: DEFAULT_STAGE_PERIOD ,
210
217
user_vesting_period: DEFAULT_USER_VESTING_PERIOD ,
211
218
operator_vesting_period: DEFAULT_OPERATOR_VESTING_PERIOD ,
212
219
proportion: decimal256::from_string (
@@ -1008,6 +1015,7 @@ module initia_std::vip {
1008
1015
&mut module_store.stage_data,
1009
1016
table_key::encode_u64 (stage),
1010
1017
StageData {
1018
+ stage_period: module_store.stage_period,
1011
1019
pool_split_ratio: module_store.pool_split_ratio,
1012
1020
total_operator_funded_reward,
1013
1021
total_user_funded_reward,
@@ -1023,6 +1031,7 @@ module initia_std::vip {
1023
1031
event::emit (
1024
1032
StageAdvanceEvent {
1025
1033
stage,
1034
+ stage_period: module_store.stage_period,
1026
1035
pool_split_ratio: module_store.pool_split_ratio,
1027
1036
total_operator_funded_reward,
1028
1037
total_user_funded_reward,
@@ -1244,6 +1253,19 @@ module initia_std::vip {
1244
1253
validate_vip_weights (module_store);
1245
1254
}
1246
1255
1256
+ public entry fun update_stage_period (
1257
+ chain: &signer ,
1258
+ stage_period: u64 ,
1259
+ ) acquires ModuleStore {
1260
+ check_chain_permission (chain);
1261
+ let module_store = borrow_global_mut <ModuleStore >(signer ::address_of (chain));
1262
+ assert !(
1263
+ stage_period > 0 ,
1264
+ error::invalid_argument (EINVALID_VEST_PERIOD )
1265
+ );
1266
+ module_store.stage_period = stage_period;
1267
+ }
1268
+
1247
1269
public entry fun update_vesting_period (
1248
1270
chain: &signer ,
1249
1271
user_vesting_period: u64 ,
@@ -1490,6 +1512,7 @@ module initia_std::vip {
1490
1512
);
1491
1513
1492
1514
StageDataResponse {
1515
+ stage_period: stage_data.stage_period,
1493
1516
pool_split_ratio: stage_data.pool_split_ratio,
1494
1517
total_operator_funded_reward: stage_data.total_operator_funded_reward,
1495
1518
total_user_funded_reward: stage_data.total_user_funded_reward,
@@ -1515,6 +1538,35 @@ module initia_std::vip {
1515
1538
}
1516
1539
}
1517
1540
1541
+ #[view]
1542
+ public fun get_bridge_infos (): vector <BridgeResponse > acquires ModuleStore {
1543
+ let module_store = borrow_global <ModuleStore >(@initia_std );
1544
+ let iter = table::iter (
1545
+ &module_store.bridges,
1546
+ option::none (),
1547
+ option::none (),
1548
+ 1
1549
+ );
1550
+
1551
+ let bridge_infos = vector ::empty <BridgeResponse >();
1552
+ loop {
1553
+ if (!table::prepare <vector <u8 >, Bridge >(iter)) { break };
1554
+ let (_, bridge) = table::next <vector <u8 >, Bridge >(iter);
1555
+ vector ::push_back (
1556
+ &mut bridge_infos,
1557
+ BridgeResponse {
1558
+ bridge_addr: bridge.bridge_addr,
1559
+ operator_addr: bridge.operator_addr,
1560
+ vip_weight: bridge.vip_weight,
1561
+ user_reward_store_addr: bridge.user_reward_store_addr,
1562
+ operator_reward_store_addr: bridge.operator_reward_store_addr,
1563
+ }
1564
+ );
1565
+ };
1566
+
1567
+ bridge_infos
1568
+ }
1569
+
1518
1570
#[view]
1519
1571
public fun get_whitelisted_bridge_ids (): vector <u64> acquires ModuleStore {
1520
1572
let module_store = borrow_global <ModuleStore >(@initia_std );
@@ -1568,6 +1620,7 @@ module initia_std::vip {
1568
1620
1569
1621
ModuleResponse {
1570
1622
stage: module_store.stage,
1623
+ stage_period: module_store.stage_period,
1571
1624
agent: module_store.agent,
1572
1625
proportion: module_store.proportion,
1573
1626
pool_split_ratio: module_store.pool_split_ratio,
0 commit comments