ManagerWithMerkleVerification

Git Source

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*

mapping(address => bytes32) public manageRoot;

performingFlashLoan

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.

flashLoanIntentHash

keccak256 hash of flash loan data.

isPaused

Used to pause calls to manageVaultWithMerkleVerification.

vault

The BoringVault this contract can manage.

balancerVault

The balancer vault this contract can use for flash loans.

Functions

constructor

setManageRoot

Sets the manageRoot.

Callable by OWNER_ROLE.

pause

Pause this contract, which prevents future calls to manageVaultWithMerkleVerification.

Callable by MULTISIG_ROLE.

unpause

Unpause this contract, which allows future calls to manageVaultWithMerkleVerification.

Callable by MULTISIG_ROLE.

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.

flashLoan

In order to perform a flash loan,

  1. Merkle root must contain the leaf(address(this), this.flashLoan.selector, ARGUMENT_ADDRESSES ...)

  2. Strategist must initiate the flash loan using manageVaultWithMerkleVerification

  3. balancerVault MUST callback to this contract with the same userData

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.

_verifyCallData

Helper function to decode, sanitize, and verify call data.

_verifyManageProof

Helper function to verify a manageProof is valid.

Events

ManageRootUpdated

BoringVaultManaged

Paused

Unpaused

Errors

ManagerWithMerkleVerification__InvalidManageProofLength

ManagerWithMerkleVerification__InvalidTargetDataLength

ManagerWithMerkleVerification__InvalidValuesLength

ManagerWithMerkleVerification__InvalidDecodersAndSanitizersLength

ManagerWithMerkleVerification__FlashLoanNotExecuted

ManagerWithMerkleVerification__FlashLoanNotInProgress

ManagerWithMerkleVerification__BadFlashLoanIntentHash

ManagerWithMerkleVerification__FailedToVerifyManageProof

ManagerWithMerkleVerification__Paused

ManagerWithMerkleVerification__OnlyCallableByBoringVault

ManagerWithMerkleVerification__OnlyCallableByBalancerVault

ManagerWithMerkleVerification__TotalSupplyMustRemainConstantDuringManagement

Was this helpful?