Skip to content

Commit

Permalink
Merge pull request #1724 from multiversx/add-events-for-pause-module
Browse files Browse the repository at this point in the history
Add events for PauseModule
  • Loading branch information
CostinCarabas authored Aug 5, 2024
2 parents d1f0401 + 919451d commit 6746d08
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"expect": {
"out": [],
"status": "",
"logs": [],
"logs": "*",
"gas": "*",
"refund": "*"
}
Expand Down Expand Up @@ -110,7 +110,7 @@
"expect": {
"out": [],
"status": "",
"logs": [],
"logs": "*",
"gas": "*",
"refund": "*"
}
Expand All @@ -137,4 +137,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,14 @@
"type": "EsdtTokenPayment"
}
]
},
{
"identifier": "pauseContract",
"inputs": []
},
{
"identifier": "unpauseContract",
"inputs": []
}
],
"esdtAttributes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,14 @@
"type": "EsdtTokenPayment"
}
]
},
{
"identifier": "pauseContract",
"inputs": []
},
{
"identifier": "unpauseContract",
"inputs": []
}
],
"esdtAttributes": [
Expand Down
10 changes: 8 additions & 2 deletions contracts/modules/src/pause.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ pub trait PauseModule {
#[endpoint(pause)]
fn pause_endpoint(&self) {
self.set_paused(true);
// TODO: event
self.pause_event();
}

#[only_owner]
#[endpoint(unpause)]
fn unpause_endpoint(&self) {
self.set_paused(false);
// TODO: event
self.unpause_event();
}

fn require_paused(&self) {
Expand All @@ -48,6 +48,12 @@ pub trait PauseModule {
require!(self.not_paused(), "Contract is paused");
}

#[event("pauseContract")]
fn pause_event(&self);

#[event("unpauseContract")]
fn unpause_event(&self);

#[view(isPaused)]
#[storage_mapper("pause_module:paused")]
fn paused_status(&self) -> SingleValueMapper<bool>;
Expand Down

0 comments on commit 6746d08

Please sign in to comment.