This repository has been archived by the owner on Jan 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPausable.sol
47 lines (40 loc) · 1.7 KB
/
Pausable.sol
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
// SPDX-License-Identifier: SYMM-Core-Business-Source-License-1.1
// This contract is licensed under the SYMM Core Business Source License 1.1
// Copyright (c) 2023 Symmetry Labs AG
// For more information, see https://docs.symm.io/legal-disclaimer/license
pragma solidity >=0.8.18;
import "../storages/GlobalAppStorage.sol";
abstract contract Pausable {
modifier whenNotGlobalPaused() {
require(!GlobalAppStorage.layout().globalPaused, "Pausable: Global paused");
_;
}
modifier whenNotLiquidationPaused() {
require(!GlobalAppStorage.layout().globalPaused, "Pausable: Global paused");
require(!GlobalAppStorage.layout().liquidationPaused, "Pausable: Liquidation paused");
_;
}
modifier whenNotAccountingPaused() {
require(!GlobalAppStorage.layout().globalPaused, "Pausable: Global paused");
require(!GlobalAppStorage.layout().accountingPaused, "Pausable: Accounting paused");
_;
}
modifier whenNotPartyAActionsPaused() {
require(!GlobalAppStorage.layout().globalPaused, "Pausable: Global paused");
require(!GlobalAppStorage.layout().partyAActionsPaused, "Pausable: PartyA actions paused");
_;
}
modifier whenNotPartyBActionsPaused() {
require(!GlobalAppStorage.layout().globalPaused, "Pausable: Global paused");
require(!GlobalAppStorage.layout().partyBActionsPaused, "Pausable: PartyB actions paused");
_;
}
modifier whenEmergencyMode(address partyB) {
require(
GlobalAppStorage.layout().emergencyMode ||
GlobalAppStorage.layout().partyBEmergencyStatus[partyB],
"Pausable: It isn't emergency mode"
);
_;
}
}