Skip to content

Commit

Permalink
feat: add surcharge settings to deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
BenSparksCode committed Nov 12, 2024
1 parent f837859 commit 4807453
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
13 changes: 13 additions & 0 deletions script/base/deploy-base.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Expand Down
6 changes: 4 additions & 2 deletions script/deploy-atlas.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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);
Expand Down

0 comments on commit 4807453

Please sign in to comment.