Smart contracts that integrate with Umbra, but are not part of the core protocol contracts.
Below is a list of contracts contained in this package:
UmbraBatchSend: Aggregate multipleUmbrasends into a single transaction.UniswapWithdrawHook: A withdrawal hook that swaps withdrawn tokens through Uniswap's SwapRouter02 and sends any remaining tokens to the recipient.
This package uses Foundry.
The script deploys UmbraBatchSend to each network in the networks array of script/DeployBatchSend.s.sol, using the RPC endpoints configured in foundry.toml.
-
Inside the
contracts-peripheryfolder, runcp .env.example .envand fill out all fields. -
Find the deployer's nonce:
cast nonce <DeployerAddress> --rpc-url <URL> -
Change
EXPECTED_NONCEin theDeployBatchSendscript to match that nonce. -
Make sure the script test passes:
forge test --mc DeployBatchSendTest --sender <DeployerAddress> -
Dry run the deployment across the networks. You should see gas estimates for each network. If you don't, the deployer's nonce may not match
EXPECTED_NONCE, or there may already be code at the expected contract address.forge script DeployBatchSend --private-key <PrivateKey> -
Execute the deployment by broadcasting the transactions:
forge script DeployBatchSend --private-key <PrivateKey> --broadcast
The script approves the Umbra contract to spend each listed token held by UmbraBatchSend. It must be run by the UmbraBatchSend owner.
-
Inside the
contracts-peripheryfolder, runcp .env.example .envand fill out all fields. -
Run
source .envto load the environment variables. -
Make sure the script test passes:
forge test --mc ApproveBatchSendTokensTest --sender <OwnerAddress> -
Dry run the script. Pass the owner's key in the
--private-keyflag and the desired network in the--rpc-urlflag. The contract and token addresses must be the ones on that network.forge script ApproveBatchSendTokens --sig "run(address,address,address,address[])" <OwnerAddress> <UmbraContractAddress> <UmbraBatchSendContractAddress> "[<TokenAddress>,<TokenAddress>]" --rpc-url $MAINNET_RPC_URL --private-key $PRIVATE_KEY -
Execute the script by adding the
--broadcastflag:forge script ApproveBatchSendTokens --sig "run(address,address,address,address[])" <OwnerAddress> <UmbraContractAddress> <UmbraBatchSendContractAddress> "[<TokenAddress>,<TokenAddress>]" --rpc-url $MAINNET_RPC_URL --private-key $PRIVATE_KEY --broadcast