You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🧐 Motivation
Currently, the Pausable.sol contract triggers the error EnforcedPause() when the contract is paused. However, this error does not convey any additional context (such as user instructions) that may be important when the contract is paused.
In the web3 space, communicating essential information during critical events, such as a contract hack, and guiding users on the necessary actions can be challenging. Often, platforms rely on Twitter or other social media to inform users. This is particularly difficult for protocols that are integrated into multiple dapps, as the origin of the user is often unknown.
📝 Details
I propose adding a string reason or string message parameter to the EnforcedPause error, which can be set when invoking the _pause() function.
This would provide more informative feedback when the contract is paused, helping users understand the situation and act accordingly.
function _pause(string memory reason) internal virtual whenNotPaused {
_paused = true;
_reason = reason;
emit Paused(_msgSender());
}
// and then when error is thrown:
function _requireNotPaused() internal view virtual {
if (paused()) {
revert EnforcedPause(_reason);
}
}
The text was updated successfully, but these errors were encountered:
I'm curious what you think the extra parameters of reason should be, that is not already explicit enough in EnforcedPause(). Adding a string (or anything) has a cost. Isn't EnforcedPause explicit enough?
Hey @Amxx, my understanding is that a contract would typically be paused in the event of an incident or hack. In such cases, I believe it would be reasonable to incur additional costs to provide information to end users. One example I would return as an error string is the URL that leads to i.e. to incident status page, where users can stay updated on the hack’s status.
I’ve noticed many (d)apps do this by linking to their websites, but not all dapps have dedicated sites, especially protocols integrated into other applications.
🧐 Motivation
Currently, the
Pausable.sol
contract triggers theerror EnforcedPause()
when the contract is paused. However, this error does not convey any additional context (such as user instructions) that may be important when the contract is paused.In the web3 space, communicating essential information during critical events, such as a contract hack, and guiding users on the necessary actions can be challenging. Often, platforms rely on Twitter or other social media to inform users. This is particularly difficult for protocols that are integrated into multiple dapps, as the origin of the user is often unknown.
📝 Details
I propose adding a
string reason
orstring message
parameter to theEnforcedPause
error, which can be set when invoking the_pause()
function.This would provide more informative feedback when the contract is paused, helping users understand the situation and act accordingly.
The text was updated successfully, but these errors were encountered: