Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add surcharge settings to deploy script #452

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading