Skip to content

Commit

Permalink
Fix after review
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Baltariu <[email protected]>
  • Loading branch information
andreiblt1304 committed Nov 21, 2024
1 parent 5d16078 commit 35b679c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
13 changes: 5 additions & 8 deletions common/setup-phase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@ multiversx_sc::imports!();

#[multiversx_sc::module]
pub trait SetupPhaseModule {
fn require_setup_complete(&self, caller_shard_id: u32) {
require!(
self.is_setup_phase_complete(),
"The setup is not completed in shard {}",
caller_shard_id
);
}

fn require_caller_initiator(&self) {
let caller = self.blockchain().get_caller();
let initiator = self.initiator_address().get();

require!(caller == initiator, "Invalid caller");
}

#[inline]
fn require_setup_complete(&self) {
require!(self.is_setup_phase_complete(), "The setup is not completed");
}

#[inline]
fn is_setup_phase_complete(&self) -> bool {
self.setup_phase_complete().get()
Expand Down
3 changes: 2 additions & 1 deletion sovereign-forge/src/phases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const NUMBER_OF_SHARDS: u32 = 3;
pub trait PhasesModule:
common::utils::UtilsModule + common::storage::StorageModule + setup_phase::SetupPhaseModule
{
#[only_owner]
#[endpoint(completeSetupPhase)]
fn complete_setup_phase(&self) {
if !self.is_setup_phase_complete() {
Expand Down Expand Up @@ -56,7 +57,7 @@ pub trait PhasesModule:
let caller = blockchain_api.get_caller();
let caller_shard_id = blockchain_api.get_shard_of_address(&caller);

self.require_setup_complete(caller_shard_id);
self.require_setup_complete();

let call_value = self.call_value().egld_value();
self.require_correct_deploy_cost(call_value.deref());
Expand Down

0 comments on commit 35b679c

Please sign in to comment.