Rescueable
Inherits: IRescueable, ERC165
Title: Rescueable
An abstract base for contracts that expose a privileged rescue() to sweep
accidentally-sent assets.
Derived contracts authorize the caller via the _authorizeRescue() hook.
The native asset is identified using the EIP-7528 sentinel.
Functions
rescue
Sweeps the entire balance of the specified asset to the provided recipient.
Pass the EIP-7528 native sentinel (ERC7528Constants.NATIVE_ASSET) as token_
to rescue the native asset.
Reverts if:
- The caller is not authorised by the implementation's
_authorizeRescue(). to_is the zero address.
Does NOT revert when the contract's balance of token_ is zero, so the call is
a no-op in that case.
function rescue(address token_, address payable to_) public virtual override;
Parameters
| Name | Type | Description |
|---|---|---|
| token_ | address | The token to rescue, or the EIP-7528 native sentinel for the native asset. |
| to_ | address payable | The recipient of the rescued assets. |
_authorizeRescue
Hook for subclasses to authorize the caller of rescue().
Implementations MUST revert if the caller is not authorised.
function _authorizeRescue() internal view virtual;
supportsInterface
See IERC165.
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
| interfaceId | bytes4 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |