Skip to content

(pausable option B) Add pause at the module level#95

Closed
Agusx1211 wants to merge 2 commits intomasterfrom
module-pausable
Closed

(pausable option B) Add pause at the module level#95
Agusx1211 wants to merge 2 commits intomasterfrom
module-pausable

Conversation

@Agusx1211
Copy link
Copy Markdown
Member

Adds an option to pause the modules helpers themselves and the sapient signer, allows adding pausable without SDK changes.

@Agusx1211 Agusx1211 requested a review from a team April 15, 2026 07:28
Comment thread src/base/IPause.sol

import {Self} from "src/base/Self.sol";

abstract contract IPause is Self {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an interface

Comment thread src/base/Pausable.sol
event OperatorSet(address indexed operator, bool allowed);

mapping(address => bool) private _operators;
bool private _paused;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if this was a feature level mapping instead. Then we can do granular locking.

mapping(bytes32 => bool) private _paused;

modifier whenNotPaused(bytes32 featureId) {
  if (paused(featureId)) {
    revert EnforcedPause();
  }
  _;
}

HydrateProxy

bytes32 HYDRATE_FEATURE_ID = bytes32(0xabc123);

function hydrateExecute(/*...*/) external payable whenActive(HYDRATE_FEATURE_ID)

Comment thread src/base/Pausable.sol
Comment on lines +33 to +38
modifier onlyDirectCall() {
if (address(this) != SELF) {
revert OnlyDirectCallAllowed();
}
_;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to Self

Comment thread src/base/Pausable.sol
Comment on lines +55 to +59
if (address(this) == SELF) {
return super.owner();
}

return Pausable(SELF).owner();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a modifier in Self

modifier forwardToSelf() {
    if (address(this) != SELF) {
        (bool ok, bytes memory ret) = SELF.staticcall(msg.data);
        assembly {
            if iszero(ok) {
                revert(add(ret, 0x20), mload(ret))
            }
            return(add(ret, 0x20), mload(ret))
        }
    }
    _;
}

@Agusx1211
Copy link
Copy Markdown
Member Author

Closed in favor of C

@Agusx1211 Agusx1211 closed this Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants