Skip to content

Commit

Permalink
Merge pull request #452 from FastLane-Labs/surcharge-settings-deploy
Browse files Browse the repository at this point in the history
feat: add surcharge settings to deploy script
  • Loading branch information
BenSparksCode authored Nov 13, 2024
2 parents f837859 + 60a70b3 commit e6b1718
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
10 changes: 5 additions & 5 deletions deployments.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"FL_ONLINE_DAPP_CONTROL": "0xf0E388C7DFfE14a61280a4E5b84d77be3d2875e3"
},
"POLYGON": {
"ATLAS": "0x912AceADa1b9c9B378894D0610C5684167710FDD",
"ATLAS_VERIFICATION": "0x2fBF38a38D753E4ce398000CCC552Efa50702e1e",
"SIMULATOR": "0x1244E4B8D93D2A72692Bf3600f7f5a494e24895a",
"SORTER": "0xFac7bf300E7eb17A2eD0Be67b60f5FeDd2E28E90",
"ATLAS": "0xB363f4D32DdB0b43622eA07Ae9145726941272B4",
"ATLAS_VERIFICATION": "0x621c6970fD9F124230feE35117d318069056819a",
"SIMULATOR": "0x82A3460920582968688FD887F21c5F3155A3BBd4",
"SORTER": "0xf8Bd19064A77297A691a29d9a40dF76F32fc86ad",
"FL_ONLINE_DAPP_CONTROL": "0x498aC70345AD6b161eEf4AFBEA8F010401cfa780"
},
"BSC": {
Expand Down Expand Up @@ -54,4 +54,4 @@
"SORTER": "",
"FL_ONLINE_DAPP_CONTROL": ""
}
}
}
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 e6b1718

Please sign in to comment.