Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dan13ram committed Sep 17, 2024
1 parent d00d1da commit 15f5a35
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
12 changes: 12 additions & 0 deletions script/BaseData.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ contract BaseData is Script {
require(isSupportedChainId(block.chainid), "BaseData: unsupported chainId");
a = __chainIdToAddresses[block.chainid];
require(a.OFT_DELEGATE != address(0), "BaseData: addresses not set");
require(a.TOKEN_ADMIN != address(0), "BaseData: addresses not set");
require(a.PROXY_ADMIN != address(0), "BaseData: addresses not set");
if (!isTestnet(block.chainid)) {
require(a.OFT_DELEGATE != TEMP_GNOSIS_SAFE, "BaseData: addresses not set");
require(a.TOKEN_ADMIN != TEMP_GNOSIS_SAFE, "BaseData: addresses not set");
require(a.PROXY_ADMIN != TEMP_PROXY_CONTROLLER, "BaseData: addresses not set");
}
}

function getEID(uint256 chainId) internal view returns (uint32) {
Expand All @@ -132,4 +139,9 @@ contract BaseData is Script {
bool isEID = __chainIdToLzEID[chainId] != 0;
return isSupported && isEID;
}

function isTestnet(uint256 chainId) internal view returns (bool) {
return
chainId == __chainIds.holesky || chainId == __chainIds.fraxtalTestnet || chainId == __chainIds.sepolia;
}
}
5 changes: 2 additions & 3 deletions script/DeployL1OFTAdapter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ contract DeployL1OFTAdapter is BaseScript {

vm.broadcast();
ITransparentUpgradeableProxy(address(l1OFTAdapter)).changeAdmin(getAddresses().PROXY_ADMIN);
console.log("Deployer L1OFTAdapter at: %s", address(l1OFTAdapter));
console.log("Deployed L1OFTAdapter at: %s", address(l1OFTAdapter));
} else {
l1OFTAdapter = L1YnOFTAdapterUpgradeable(currentDeployment.oftAdapter);
console.log("Already deployed L1OFTAdapter at: %s", address(l1OFTAdapter));
Expand All @@ -59,11 +59,10 @@ contract DeployL1OFTAdapter is BaseScript {
require(address(l1OFTAdapter) == predictions.l1OftAdapter, "Prediction mismatch");

if (l1OFTAdapter.owner() == CURRENT_SIGNER) {
console.log("Setting rate limits");
vm.broadcast();
l1OFTAdapter.setRateLimits(_getRateLimitConfigs());
console.log("Rate limits set");

console.log("Setting peers");
for (uint256 i = 0; i < baseInput.l2ChainIds.length; i++) {
uint256 chainId = baseInput.l2ChainIds[i];
uint32 eid = getEID(chainId);
Expand Down
4 changes: 1 addition & 3 deletions script/DeployL2OFTAdapter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,9 @@ contract DeployL2OFTAdapter is BaseScript {
require(predictedOFTAdapter == address(l2OFTAdapter), "Prediction mismatch");

if (l2OFTAdapter.owner() == CURRENT_SIGNER) {
console.log("Setting rate limits");
vm.broadcast();
l2OFTAdapter.setRateLimits(_getRateLimitConfigs());

console.log("Setting peers");
console.log("Rate limits set");

uint256[] memory chainIds = new uint256[](baseInput.l2ChainIds.length + 1);
for (uint256 i = 0; i < baseInput.l2ChainIds.length; i++) {
Expand Down
8 changes: 4 additions & 4 deletions script/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ function simulate() {
}

function broadcast() {
forge script $1 --sig $2 --rpc-url $3 --account $DEPLOYER_ACCOUNT_NAME --sender $DEPLOYER_ADDRESS --broadcast
forge script $1 --sig $2 --rpc-url $3 --account $DEPLOYER_ACCOUNT_NAME --sender $DEPLOYER_ADDRESS --broadcast --slow
}

function verify() {
forge script $1 --sig $2 --rpc-url $3 --account $DEPLOYER_ACCOUNT_NAME --sender $DEPLOYER_ADDRESS --verify --etherscan-api-key $3
forge script $1 --sig $2 --rpc-url $3 --account $DEPLOYER_ACCOUNT_NAME --sender $DEPLOYER_ADDRESS --verify --etherscan-api-key $3 --slow
}

function broadcastAndVerify() {
forge script $1 --sig $2 --rpc-url $3 --account $DEPLOYER_ACCOUNT_NAME --sender $DEPLOYER_ADDRESS --broadcast --verify
forge script $1 --sig $2 --rpc-url $3 --account $DEPLOYER_ACCOUNT_NAME --sender $DEPLOYER_ADDRESS --broadcast --verify --etherscan-api-key $3 --slow
}

function getRPC() {
Expand Down Expand Up @@ -215,7 +215,7 @@ while [[ $# -gt 0 ]]; do
shift
;;
--verify | -v)
BROADCAST=true
VERIFY=true
shift
;;
--force | -f)
Expand Down

0 comments on commit 15f5a35

Please sign in to comment.