uManagers are used to allow actions of functionSigs of a target contract, in behalf of the BoringVault. We will briefly explain here how to add a new uManager.
ManagerWithMerkleVerification: Verifies strategist actions using Merkle proofs for secure BoringVault management. The leaves define what actions are possible, the Merkle root summarizes these permissions, and the ManagerWithMerkleVerification takes proofs and uses the root to verify and allow actions.
uManager: Micro-manager contract enforcing additional checks and custom logic for specific operations.
RolesAuthority: Manages system-wide roles and permissions.
BoringVault: The managed vault contract holding and managing assets.
MerkleTreeHelper: Functions to add target functions as leafs to the Markle tree.
Micro-Managers: Or uManagers, uses Merkle proofs to verify and execute actions with the target cotnracts securely, ensuring each operation on the target is authorized and recorded correctly in the MerkleTree.
CreateSuperSymbioticLRTMerkleRoot.s.sol: Generates leaves and Merkle root for specific actions. This has to later be manually added into the managermerkle contract. DeploySymbioticUManager.s.sol: Deploys and configures the uManager, a contract for creating the Merkle root and being able to run target functions against it.
Merkle Tree Structure:
- Leaves: Individual permissions/actions
- Composition:
keccak256(abi.encodePacked(decodersAndSanitizer, target, valueIsNonZero, selector, argumentAddress_0, ..., argumentAddress_N))
- Each leaf represents a specific allowed action
- Composition:
- Tree: Hierarchical structure of leaves
- Root: Single hash representing the entire tree
- Create
src/micro-managers/YourCustomUManager.sol
:contract YourCustomUManager is BaseUManager { // Your custom logic here }
- Implement custom checks and functionality.
- Create
src/base/DecodersAndSanitizers/Protocols/YourCustomDecoderAndSanitizer.sol
. You will have to select what functions you are targeting. - If required, create
src/base/DecodersAndSanitizers/YourDeploymentDecoderAndSanitizer.sol
, this aims to solve and route similarly named target gunctions. - In
test/resources/MerkleTreeHelper/MerkleTreeHelper.sol
create functions to add target functions of the new contract as leaves to the Merkle tree. For instance,_addYourCustomApproveAndDepositLeaf
function. You will also need to add this function to the create root or uManager deployer script. - Create a new uManager in
src/micro-managers/YourUManager.sol
. You will have to create a function to provide proofs for each of the functions you added toYourCustomDecoderAndSanitizer
. For each function you will have to providemanageProofs (bytes32[][]), decodersAndSanitizers (address[]), targets (address[]), values (uint256[])
.
-
Update
test/resources/ChainValues.sol
:- Add new deployer address
- Replace relevant addresses (dev0, dev1, underlying tokens, vaults, etc.)
-
Update or take inspiration from
script/MerkleRootCreation/Sepolia/CreateSepoliaSuzakuMerkleRoot.s.sol
and sniper script:script/DeploySepoliaSuzakuUManager.s.sol
:- Replace relevant addresses and new point to new Decoder contracts
- Manage JSON files: to prevent overwriting previous files, delete or rename
SuperSuzakuStrategistLeafs.json
andsepoliaSuzakuSniperLeafs.json
- Modify the tokens section to use the correct
MerkleTreeHelper.sol
function to add the leaf. - Modify the tokens section if new or more target contracts are used.
- Modify the size of the tree's and number of leafs added, depending on the number of contracts you're interacting with.
-
Configure permissions (either through contracts or withing the script):
- Ensure uManager has a specific role
- This role should have permission to call
manageVaultWithMerkleVerification
- This has to be done through the
rolesAuthoriy
contract
-
If using
DeploySepoliaSuzakuUManager
with sniper:- Add MerkleRoot located in
leafs/sepoliaSuzakuSniperLeafs.json
to theManagerWithMerkleVerification
contract, with strategist as the uManager address. This can be done withsetManageRoot(strategist, newRoot)
function. - Actions can be made through the
uManager
contract.
- Add MerkleRoot located in
-
If using
leafs/CreateSepoliaSuzakuMerkleRoot.json
:- Add MerkleRoot located in
leafs/SuperSuzakuStrategistLeafs
to theManagerWithMerkleVerification
contract , with strategist as an EOA address. This can be done withsetManageRoot(strategist, newRoot)
function. - To perform any action you will have to interact with the
ManagerWithMerkleVerification
through themanageVaultWithMerkleVerification
function. To generate a proof you can use the scriptgenerate_proof.py
.
- Add MerkleRoot located in
-
Updating Permissions: Call
setManageRoot(strategist, newRoot)
on ManagerWithMerkleVerification.
- Perform the previous actions by adding the new
DecoderAndSanitzier
anduManager
contracts. - Re-launch your
BoringVault
Deploy script, you can updateconfigureDeployment
configuration to not do unnecesary tasks. You may only need thedeployCotnracts
section. - Update DecoderAndSanitizer version in
resources/ContractNames.sol
,script/MerkleRootCreation/Sepolia/CreateSepoliaSuzakuMerkleRoot.s.sol
andscript/DeploySepoliaSuzakuUManager.s.sol
. - Update
test/resources/ChainValues.sol
with the new addresses. - Re-create
MerkleRoot
, or launch the newuManager
- Add the Root with the
setManageRoot(strategist, newRoot)
function. in theManagerWithMerkleVerification
contract - Setup permissions.