Inherits: Auth
State Variables
manageRoot
A merkle tree root that restricts what data can be passed to the BoringVault.
Maps a strategist address to their specific merkle root.
*Each leaf is composed of the keccak256 hash of abi.encodePacked {decodersAndSanitizer, target, valueIsNonZero, selector, argumentAddress_0, ...., argumentAddress_N} Where:
decodersAndSanitizer is the address to call to extract packed address arguments from the calldata
target is the address to make the call to
valueIsNonZero is a bool indicating whether or not the value is non-zero
selector is the function selector on target
argumentAddress is each allowed address argument in that call*
Copy mapping(address => bytes32) public manageRoot;
Bool indicating whether or not this contract is actively performing a flash loan.
Used to block flash loans that are initiated outside a manage call.
Copy bool internal performingFlashLoan;
flashLoanIntentHash
keccak256 hash of flash loan data.
Copy bytes32 internal flashLoanIntentHash = bytes32(0);
isPaused
Used to pause calls to manageVaultWithMerkleVerification
.
Copy bool public isPaused;
vault
The BoringVault this contract can manage.
Copy BoringVault public immutable vault;
balancerVault
The balancer vault this contract can use for flash loans.
Copy BalancerVault public immutable balancerVault;
Functions
constructor
Copy constructor(address _owner, address _vault, address _balancerVault) Auth(_owner, Authority(address(0)));
setManageRoot
Sets the manageRoot.
Callable by OWNER_ROLE.
Copy function setManageRoot(address strategist, bytes32 _manageRoot) external requiresAuth;
pause
Pause this contract, which prevents future calls to manageVaultWithMerkleVerification
.
Callable by MULTISIG_ROLE.
Copy function pause() external requiresAuth;
unpause
Unpause this contract, which allows future calls to manageVaultWithMerkleVerification
.
Callable by MULTISIG_ROLE.
Copy function unpause() external requiresAuth;
manageVaultWithMerkleVerification
Allows strategist to manage the BoringVault.
The strategist must provide a merkle proof for every call that verifiees they are allowed to make that call.
Callable by MANAGER_INTERNAL_ROLE.
Callable by STRATEGIST_ROLE.
Callable by MICRO_MANAGER_ROLE.
Copy function manageVaultWithMerkleVerification(
bytes32[][] calldata manageProofs,
address[] calldata decodersAndSanitizers,
address[] calldata targets,
bytes[] calldata targetData,
uint256[] calldata values
)
external
requiresAuth;
flashLoan
In order to perform a flash loan,
Merkle root must contain the leaf(address(this), this.flashLoan.selector, ARGUMENT_ADDRESSES ...)
Strategist must initiate the flash loan using manageVaultWithMerkleVerification
balancerVault MUST callback to this contract with the same userData
Copy function flashLoan(
address recipient,
address[] calldata tokens,
uint256[] calldata amounts,
bytes calldata userData
)
external;
receiveFlashLoan
Add support for balancer flash loans.
userData can optionally have salt encoded at the end of it, in order to change the intentHash, if a flash loan is exact userData is being repeated, and their is fear of 3rd parties front-running the rebalance.
Copy function receiveFlashLoan(
address[] calldata tokens,
uint256[] calldata amounts,
uint256[] calldata feeAmounts,
bytes calldata userData
)
external;
_verifyCallData
Helper function to decode, sanitize, and verify call data.
Copy function _verifyCallData(
bytes32 currentManageRoot,
bytes32[] calldata manageProof,
address decoderAndSanitizer,
address target,
uint256 value,
bytes calldata targetData
)
internal
view;
_verifyManageProof
Helper function to verify a manageProof is valid.
Copy function _verifyManageProof(
bytes32 root,
bytes32[] calldata proof,
address target,
address decoderAndSanitizer,
uint256 value,
bytes4 selector,
bytes memory packedArgumentAddresses
)
internal
pure
returns (bool);
Events
ManageRootUpdated
Copy event ManageRootUpdated(address indexed strategist, bytes32 oldRoot, bytes32 newRoot);
BoringVaultManaged
Copy event BoringVaultManaged(uint256 callsMade);
Paused
Unpaused
Errors
ManagerWithMerkleVerification__InvalidManageProofLength
Copy error ManagerWithMerkleVerification__InvalidManageProofLength();
ManagerWithMerkleVerification__InvalidTargetDataLength
Copy error ManagerWithMerkleVerification__InvalidTargetDataLength();
ManagerWithMerkleVerification__InvalidValuesLength
Copy error ManagerWithMerkleVerification__InvalidValuesLength();
ManagerWithMerkleVerification__InvalidDecodersAndSanitizersLength
Copy error ManagerWithMerkleVerification__InvalidDecodersAndSanitizersLength();
ManagerWithMerkleVerification__FlashLoanNotExecuted
Copy error ManagerWithMerkleVerification__FlashLoanNotExecuted();
ManagerWithMerkleVerification__FlashLoanNotInProgress
Copy error ManagerWithMerkleVerification__FlashLoanNotInProgress();
ManagerWithMerkleVerification__BadFlashLoanIntentHash
Copy error ManagerWithMerkleVerification__BadFlashLoanIntentHash();
ManagerWithMerkleVerification__FailedToVerifyManageProof
Copy error ManagerWithMerkleVerification__FailedToVerifyManageProof(address target, bytes targetData, uint256 value);
ManagerWithMerkleVerification__Paused
Copy error ManagerWithMerkleVerification__Paused();
ManagerWithMerkleVerification__OnlyCallableByBoringVault
Copy error ManagerWithMerkleVerification__OnlyCallableByBoringVault();
ManagerWithMerkleVerification__OnlyCallableByBalancerVault
Copy error ManagerWithMerkleVerification__OnlyCallableByBalancerVault();
ManagerWithMerkleVerification__TotalSupplyMustRemainConstantDuringManagement
Copy error ManagerWithMerkleVerification__TotalSupplyMustRemainConstantDuringManagement();