Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/periphery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Blue public allocator contracts are in [blue-public-allocator](./blue-public-all
Gate contracts are in [gates](./gates/).
Adapter registry contracts are in [registries](./registries/).

## Revoker

`Revoker` lets vault sentinels cancel pending vault or adapter actions whose data is too large to send in a transaction. It is recommended to add it as a vault sentinel.
Comment thread
adhusson marked this conversation as resolved.
Resolved

## Blue Public Allocator

`BluePublicAllocator` lets anyone (not only the vault's allocators) reallocate a Vault V2's liquidity between Morpho Blue markets reached through the `MorphoMarketV1AdapterV2`, within the vault's caps, and the public allocator's own limits.
Expand Down
31 changes: 31 additions & 0 deletions src/periphery/Revoker.sol
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());
Comment thread
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
function revoke(address vault, address target, bytes memory creationCode) external {
require(target == vault || IMorphoMarketV1AdapterV2(target).parentVault() == vault, InvalidTarget());
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());
}
function revoke(address vault, address target, bytes memory creationCode) external {
require(target == vault || IMorphoMarketV1AdapterV2(target).parentVault() == vault, InvalidTarget());
require(IVaultV2(vault).isSentinel(msg.sender), NotSentinel());
IVaultV2(target).revoke(RevokeSource(source).revokeData());
}

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.

Do you mean revoke(address vault, address target, address source), with the caller deploying the source beforehand? Removing deployment while keeping bytes memory creationCode leaves source undefined.

}
Loading