Repository navigation
[midnight adapter] Add revoker for large action data #1285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
499b051
999dc9e
c4397d6
c254fd3
303585f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,31 @@ | ||||||||||||||||||||||||||||||||||||
| // SPDX-License-Identifier: MIT | ||||||||||||||||||||||||||||||||||||
| // Copyright (c) 2026 Morpho Association | ||||||||||||||||||||||||||||||||||||
| pragma solidity 0.8.28; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| import {IVaultV2} from "../interfaces/IVaultV2.sol"; | ||||||||||||||||||||||||||||||||||||
| import {IMorphoMarketV1AdapterV2} from "../adapters/interfaces/IMorphoMarketV1AdapterV2.sol"; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| interface RevokeSource { | ||||||||||||||||||||||||||||||||||||
| function revokeData() external view returns (bytes memory); | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| /// @dev This contract can safely have the sentinel role in any vault. | ||||||||||||||||||||||||||||||||||||
| contract Revoker { | ||||||||||||||||||||||||||||||||||||
| error NotSentinel(); | ||||||||||||||||||||||||||||||||||||
| error InvalidTarget(); | ||||||||||||||||||||||||||||||||||||
| error DeploymentFailed(); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| /// @dev Deploys a contract that returns bytes to revoke on target. | ||||||||||||||||||||||||||||||||||||
| function revoke(address vault, address target, bytes memory creationCode) external { | ||||||||||||||||||||||||||||||||||||
| require(target == vault || IMorphoMarketV1AdapterV2(target).parentVault() == vault, InvalidTarget()); | ||||||||||||||||||||||||||||||||||||
|
peyha marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||||||||||||||
| require(IVaultV2(vault).isSentinel(msg.sender), NotSentinel()); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| address source; | ||||||||||||||||||||||||||||||||||||
| assembly ("memory-safe") { | ||||||||||||||||||||||||||||||||||||
| source := create(0, add(creationCode, 32), mload(creationCode)) | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| require(source != address(0), DeploymentFailed()); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| IVaultV2(target).revoke(RevokeSource(source).revokeData()); | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+19
to
+30
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean |
||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.