-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sovereign-Forge SC #207
Sovereign-Forge SC #207
Changes from all commits
1f12f09
f487641
3aedf9e
03267f8
5fe6ad8
0d251bf
ed0de28
9388b08
49ea528
219c858
7425469
f41524b
d00a00a
76c00f4
07543dd
a3af379
289b4a6
7d64754
6c19855
aab02c3
ab15d7f
6db7e27
9af6408
ce21a4c
3be917a
cf59257
6c89084
e26b18f
897e6c4
8731152
166c241
8092094
2815501
af698be
890a559
ac70b26
b82e3b5
c888c6b
8f1f159
b100aa6
d63d628
5aae9b0
39e5a75
18f4662
48bb128
e03a74f
41ab7e0
7dee3f2
b9eccdc
6deed30
90fbe08
ca44ef2
b3622f9
23d7de9
78a202f
bbb49b8
a98d980
bbabe4d
02c06e8
edbf8ef
90cb662
6690a93
4cafca9
f17a5d5
56b81a2
e6ac6eb
bd87dec
af54cc1
207d459
136c33e
34ad384
ab26a6f
f27be3b
b6f777f
fc75117
60d19a3
7e7ac8f
ab60f22
1ec46e1
7a9bf14
4a4da14
3646982
1a0ad42
410bb3b
fa66115
ed7d46c
95100ab
3968673
586e475
f1711bd
6ec9842
769c41f
b42d94a
6e90a97
ad67803
767794c
2f07c42
9872203
6f3e181
47fde5d
a78f490
4f366ed
669a447
120737f
8412739
467a819
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,11 @@ use validator_rules::TokenIdAmountPair; | |
|
||
multiversx_sc::imports!(); | ||
|
||
pub mod bridge; | ||
pub mod validator_rules; | ||
|
||
#[multiversx_sc::contract] | ||
pub trait ChainConfigContract: | ||
bridge::BridgeModule + validator_rules::ValidatorRulesModule + only_admin::OnlyAdminModule | ||
validator_rules::ValidatorRulesModule + only_admin::OnlyAdminModule + setup_phase::SetupPhaseModule | ||
{ | ||
#[init] | ||
fn init( | ||
|
@@ -42,6 +41,47 @@ pub trait ChainConfigContract: | |
self.additional_stake_required().set(additional_stake_vec); | ||
} | ||
|
||
#[only_admin] | ||
fn update_config( | ||
&self, | ||
opt_min_validators: Option<u64>, | ||
opt_max_validators: Option<u64>, | ||
opt_min_stake: Option<BigUint>, | ||
opt_additional_stake_required: Option<MultiValueEncoded<StakeMultiArg<Self::Api>>>, | ||
) { | ||
if let Some(min_validators) = opt_min_validators { | ||
self.min_validators().set(min_validators); | ||
} | ||
if let Some(max_validators) = opt_max_validators { | ||
self.max_validators().set(max_validators); | ||
} | ||
if let Some(min_stake) = opt_min_stake { | ||
self.min_stake().set(min_stake); | ||
} | ||
if let Some(additional_stake_required) = opt_additional_stake_required { | ||
let mut additional_stake_vec = ManagedVec::new(); | ||
for multi_value in additional_stake_required { | ||
let (token_id, amount) = multi_value.into_tuple(); | ||
let value = TokenIdAmountPair { token_id, amount }; | ||
|
||
additional_stake_vec.push(value); | ||
} | ||
self.additional_stake_required().set(additional_stake_vec); | ||
Comment on lines
+62
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extract in separate function |
||
} | ||
} | ||
|
||
#[only_owner] | ||
fn complete_setup_phase(&self) { | ||
if self.is_setup_phase_complete() { | ||
return; | ||
} | ||
|
||
self.require_config_set(); | ||
// validator set in header verifier | ||
// change ownership to header-verifier | ||
self.setup_phase_complete().set(true); | ||
} | ||
|
||
#[upgrade] | ||
fn upgrade(&self) {} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#[multiversx_sc::module] | ||
pub trait CompletePhasesModule { | ||
#[endpoint(completeChainConfigSetup)] | ||
fn complete_chain_config_setup(&self) {} | ||
|
||
#[endpoint(completeHeaderVerifierSetup)] | ||
fn complete_header_verifier_setup(&self) {} | ||
|
||
#[endpoint(completeFeeMarketSetup)] | ||
fn complete_fee_market_setup(&self) {} | ||
|
||
#[endpoint(completeEsdtSafeSetup)] | ||
fn complete_esdt_safe_setup(&self) {} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be modified when a stable release of the
actions.yml
is launched