Each new deployment on a new chain should have its own deployment files.
To do this, you will need to create and adapt certain files:
scripts/ArchitectureDeployments/{your_chain}/DeployDeployer.s.sol
: adapted fromscripts/ArchitectureDeployments/Sepolia/DeployDeployer.s.sol
scripts/ArchitectureDeployments/{your_chain}/Deploy{your_deployment_name}.s.sol
: adapted fromscripts/ArchitectureDeployments/Sepolia/DeploySepoliasAVAX.s.sol
test/resources/{Your_chain}Addresses.sol
: adapted fromtest/resources/SepoliaAddresses.sol
scripts/MerkleRootCreation/{your_chain}/Create{your_deployment_name}SuzakuMerkleRoot.s.sol
: adapted fromscripts/MerkleRootCreation/Sepolia/CreateSepoliaSuzakuMerkleRoot.s.sol
scripts/ArchitectureDeployments/{your_chain}/Deploy{your_deployment_name}AtomicQueue.s.sol
: adapted fromscripts/ArchitectureDeployments/Sepolia/DeploySepoliaAtomicQueue.s.sol
You will also need to modify the following file if you are making use of the Merkle Root creation:
test/resources/ChainValues.sol
: add the addresses of your deployment here that will be used for the Merkle Root to target contracts and functions.
Note: The rest of the deployment explanation will use the Sepolia files as an example deployment.
Verify and update the environment variables that you will be using; in our case, it will be .env.sepolia
.
Then you can run the following command:
set -a; source .env.sepolia
Confirm addresses in Sepolia: test/resources/SepoliaAddresses.sol
-
Build the project:
forge build
Deploy the Deployer script. This will set up a deployer that will be in charge of launching all other contracts:
forge script scripts/ArchitectureDeployments/Sepolia/DeployDeployer.s.sol:DeployDeployerScript --slow --with-gas-price 30000000000 --broadcast --etherscan-api-key $ETHERSCAN_API_KEY
Update the Deployer address in SepoliaAddresses.sol
and rebuild.
We will be defining which tokens the deployment will use. In our example, this means modifying DeploySepoliaBTCb.s.sol
and SepoliaAddresses.sol
. Particularly in DeploySepoliaBTCb.s.sol
, you will add or modify:
- Base Token: Add the base token (for instance, BTC.b). This will define the asset class.
- Public Access: Define if public deposits or withdrawals are available.
- Additional Assets: Specify what additional assets can be added or withdrawn. You will also need to define additional categories such as the completion window and withdrawal fee.
- Deployment Stage: Define the stage of the deployment. This script can be launched part by part by defining the booleans in
configureDeployment
. For more information on what this activates, you will need to check thescripts/ArchitectureDeployments/DeployArcticArchitecture.sol
contract.
After these modifications, you can deploy the vault:
forge script scripts/ArchitectureDeployments/Sepolia/DeploySepoliaBTCb.s.sol:DeploySepoliaBTCb --with-gas-price 30000000000 --broadcast --etherscan-api-key $ETHERSCAN_API_KEY --verify -vvvvv
To interact with the contracts, you can find the complete deployment in deployments/SepoliaDeployment.json
. Here is a basic flow of what can be done with this base deployment. For additional steps, you can check the tests.
- Mint Tokens: Mint underlying
ERC20
tokens to an address and approve the BoringVault contract to manage the underlyingERC20
. - Deposit Tokens: Deposit the
ERC20
through theTeller
contract. This contract will also be used for withdrawals if theAtomicQueue
is deployed later. Otherwise, we will useDelayedWithdraw
in the following steps. - Verify Withdrawal Assets: Check if the deposited
ERC20
exists as a withdrawal asset in theDelayedWithdraw
contract. If not, refer to the previous section to configure this. - Configure
pullFundsFromVault
: Verify ifpullFundsFromVault
is set totrue
. If not, it will need to be updated using thesetPullFundsFromVault
function.-
To do this, you will need to add a role to your address to enable modification:
# Name Type Data 0 role uint8 8 1 code address <DelayedWithdraw> 2 sig bytes4 0xb013c6c5 # Method ID of pullFundsFromVault 3 enabled bool true
-
Use
setPullFundsFromVault
to changepullFundsFromVault
totrue
.
-
- Approve Share Token: Approve the BoringVault share token for the
DelayedWithdraw
contract to manage. - Initiate Withdrawal: Withdraw through the
DelayedWithdraw
usingrequestWithdrawal
. - Complete Withdrawal: Wait for the specified period to complete the withdrawal.
This setup allows the BoringVault to redistribute assets. These actions will be performed by a Strategist, which can be either an Externally Owned Account (EOA) or a contract called uManager
.
To learn more about creating interactions with other contracts and how to interact with the Merkle Tree and Managers, please refer to specs/uManager.md
.
To deploy the uManager
that allows interaction with the default collateral of BTC.b, follow these steps:
-
Update Chain Values: Update
test/resources/ChainValues.sol
with the contract addresses of the underlying tokens, collateral, and core vault tokens. -
Modify Deployment Script: Update
DeploySepoliaSuzakuUManager.s.sol
if required. -
Deploy
SuzakuUManager
:forge script scripts/DeploySepoliaSuzakuUManager.s.sol:DeploySepoliaSuzakuUManagerScript --slow --with-gas-price 100000000000 --broadcast --etherscan-api-key $ETHERSCAN_API_KEY --verify
Note: Information about the root and leaves can be found in
leafs/sepoliaSuzakuSniperLeaves.json
. -
Set Management Root: Add the root using the function
setManageRoot(strategist, newRoot)
in theManagerWithMerkleVerification
contract. Thestrategist
will be the address of theuManager
that was previously deployed, andnewRoot
can be found inleafs/sepoliaSuzakuSniperLeaves.json
. -
Assign Roles and Permissions: Grant the correct roles and permissions to the
uManager
address to interact with theRolesAuthority
contract.
Note: This requires the Core Vault to be deployed.
-
Update Chain Values: Update
test/resources/ChainValues.sol
with the contract addresses of the underlying tokens, collateral, and core vault tokens. -
Modify Deployment Script: Update
DeploySepoliaVaultUManager.s.sol
if required. -
Deploy
SuzakuVaultUManager
:forge script scripts/DeploySepoliaVaultUManager.s.sol:DeploySepoliaVaultUManagerScript --slow --with-gas-price 10000000000 --broadcast --etherscan-api-key $ETHERSCAN_API_KEY --verify
Note: Information about the root and leaves can be found in
leafs/sepoliaSuzakuVaultSniperLeaves.json
. -
Set Management Root: Add the root using the function
setManageRoot(strategist, newRoot)
in theManagerWithMerkleVerification
contract. Thestrategist
will be the address of theuManager
that was previously deployed, andnewRoot
can be found inleafs/sepoliaSuzakuVaultSniperLeaves.json
. -
Assign Roles and Permissions: Grant the correct roles and permissions to the
uManager
address to interact with theRolesAuthority
contract.