diff --git a/README.md b/README.md index 70554a08..5348858c 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ utils ├─ LibBit — "A library ported from solady for bit twiddling operations" ├─ MerkleProofLib — "Gas optimized merkle proof verification library" ├─ Multicallable — "Enables a single call to call multiple methods within a contract" +├─ Pausable — "An implementation of the Pausable standard" ├─ ReentrancyGuard — "Gas optimized reentrancy protection for smart contracts" ├─ Refunded — "Efficient gas refunds distributed through a modifier" ├─ SafeTransferLib — "Safe ETH and ERC20 transfer library that gracefully handles missing return values" diff --git a/src/utils/Pausable.huff b/src/utils/Pausable.huff index 8f70eed3..76d1c5fc 100644 --- a/src/utils/Pausable.huff +++ b/src/utils/Pausable.huff @@ -24,50 +24,48 @@ #define event Unpaused(address) - // Storage /// @notice Paused Storage Slot #define constant PAUSED_SLOT = FREE_STORAGE_POINTER() /// @notice Unpaused representation -#define constant _UNPAUSED = 0x01 +#define constant NOT_PAUSED = 0x01 /// @notice Paused representation -#define constant _PAUSED = 0x02 +#define constant PAUSED = 0x02 /// @notice Pausable constructor #define macro PAUSABLE_CONSTRUCTOR() = takes (0) returns (0) { - [_UNPAUSED] [PAUSED_SLOT] sstore // [] + [NOT_PAUSED] [PAUSED_SLOT] sstore // [] } /// @notice whenNotPaused modifier #define macro WHEN_NOT_PAUSED_MODIFIER() = takes (0) returns (0) { - [PAUSED_SLOT] sload // [isPaused] - [_UNPAUSED] eq when_not_paused jumpi // [] - 0x00 dup1 revert // [] - when_not_paused: // [] + [PAUSED_SLOT] sload // [isPaused] + [NOT_PAUSED] eq when_not_paused jumpi // [] + 0x00 dup1 revert // [] + when_not_paused: // [] } /// @notice whenPaused modifier #define macro WHEN_PAUSED_MODIFIER() = takes (0) returns (0) { - [PAUSED_SLOT] sload // [isPaused] - [_PAUSED] eq when_paused jumpi // [] - 0x00 dup1 revert // [] - when_paused: // [] -} + [PAUSED_SLOT] sload // [isPaused] + [PAUSED] eq when_paused jumpi // [] + 0x00 dup1 revert // [] + when_paused: // [] +} /// @notice return whether contract is paused #define macro PAUSABLE_IS_PAUSED() = takes (0) returns (0) { - 0x01 // [1] - [PAUSED_SLOT] sload // [isPaused, 1] - sub // [bool] - 0x00 mstore // [] - 0x20 0x00 return // [] + 0x01 // [1] + [PAUSED_SLOT] sload // [isPaused, 1] + sub // [bool] + 0x00 mstore // [] + 0x20 0x00 return // [] } - /// @notice Pause the contract #define macro PAUSABLE_PAUSE() = takes (0) returns (0) { WHEN_NOT_PAUSED_MODIFIER() // [] @@ -76,7 +74,7 @@ caller __EVENT_HASH(Paused) 0x00 dup1 // [0, 0, EVENT_PAUSED, msg.sender] log2 // [] - [_PAUSED] [PAUSED_SLOT] sstore // [] + [PAUSED] [PAUSED_SLOT] sstore // [] stop } @@ -88,6 +86,6 @@ caller __EVENT_HASH(Unpaused) 0x00 dup1 // [0, 0, EVENT_UNPAUSED, msg.sender] log2 // [] - [_UNPAUSED] [PAUSED_SLOT] sstore // [] + [NOT_PAUSED] [PAUSED_SLOT] sstore // [] stop }