From 4807453749ccb3d613bc037a1ee8890cf7d92f98 Mon Sep 17 00:00:00 2001 From: Ben Sparks <52714090+BenSparksCode@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:24:00 +0200 Subject: [PATCH] feat: add surcharge settings to deploy script --- script/base/deploy-base.s.sol | 13 +++++++++++++ script/deploy-atlas.s.sol | 6 ++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/script/base/deploy-base.s.sol b/script/base/deploy-base.s.sol index 0b5059d45..ca7a4b748 100644 --- a/script/base/deploy-base.s.sol +++ b/script/base/deploy-base.s.sol @@ -70,6 +70,19 @@ contract DeployBaseScript is Script { } } + function _getSurchargeRates() internal view returns (uint256 atlasSurchargeRate, uint256 bundlerSurchargeRate) { + uint256 chainId = block.chainid; + if (chainId == 137 || chainId == 80_002) { + // POLYGON and AMOY + atlasSurchargeRate = 5_000_000; // 50% + bundlerSurchargeRate = 5_000_000; // 50% + } else { + // Default - for all other chains + atlasSurchargeRate = 1_000_000; // 10% + bundlerSurchargeRate = 1_000_000; // 10% + } + } + // NOTE: When handling JSON with StdJson, prefix keys with '.' e.g. '.ATLAS' // These 2 functions abstract away the '.' thing though. // Pass in a key like 'ATLAS', and the current chain will be detected via `block.chainid` in `_getDeployChain()` diff --git a/script/deploy-atlas.s.sol b/script/deploy-atlas.s.sol index b60e37e1b..da8f07b95 100644 --- a/script/deploy-atlas.s.sol +++ b/script/deploy-atlas.s.sol @@ -16,8 +16,8 @@ import { ExecutionEnvironment } from "../src/contracts/common/ExecutionEnvironme contract DeployAtlasScript is DeployBaseScript { uint256 ESCROW_DURATION = 64; - uint256 ATLAS_SURCHARGE_RATE = 1_000_000; // 10% - uint256 BUNDLER_SURCHARGE_RATE = 1_000_000; // 10% + uint256 ATLAS_SURCHARGE_RATE; // Set below + uint256 BUNDLER_SURCHARGE_RATE; // Set below function run() external { console.log("\n=== DEPLOYING Atlas ===\n"); @@ -27,6 +27,8 @@ contract DeployAtlasScript is DeployBaseScript { uint256 deployerPrivateKey = vm.envUint("GOV_PRIVATE_KEY"); address deployer = vm.addr(deployerPrivateKey); + (ATLAS_SURCHARGE_RATE, BUNDLER_SURCHARGE_RATE) = _getSurchargeRates(); + // Computes the addresses at which AtlasVerification will be deployed address expectedAtlasAddr = vm.computeCreateAddress(deployer, vm.getNonce(deployer) + 2); address expectedAtlasVerificationAddr = vm.computeCreateAddress(deployer, vm.getNonce(deployer) + 3);