Skip to content

Commit

Permalink
added base script
Browse files Browse the repository at this point in the history
  • Loading branch information
dan13ram committed Sep 5, 2024
1 parent 795ce49 commit 37fb9ed
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 14 deletions.
47 changes: 33 additions & 14 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
test = 'test'
cache_path = 'cache'
fs_permissions = [
{ access = "read-write", path = "./deployments" },
{ access = "read", path = "./" },
]
optimizer = true
optimizer-runs = 200
evm_version = "cancun"
solc_version = "0.8.24"
prompt_timeout = 120
src = "src"
out = "out"
libs = ["lib"]
test = 'test'
cache_path = 'cache'
fs_permissions = [
{ access = "read-write", path = "./deployments" },
{ access = "read", path = "./" },
]
optimizer = true
optimizer-runs = 200
evm_version = "cancun"
solc_version = "0.8.24"
prompt_timeout = 120

[rpc_endpoints]
mainnet = "${MAINNET_RPC_URL}"
arbitrum = "${ARBITRUM_RPC_URL}"
optimism = "${OPTIMISM_RPC_URL}"
base = "${BASE_RPC_URL}"
fraxtal = "${FRAXTAL_RPC_URL}"
holesky = "${HOLESKY_RPC_URL}"
fraxtal_testnet = "${FRAXTAL_TESTNET_RPC_URL}"

[etherscan]
mainnet = { key = "${ETHERSCAN_API_KEY}" }
arbitrum = { key = "${ARBISCAN_API_KEY}" }
optimism = { key = "${OPTIMISTIC_ETHERSCAN_API_KEY}" }
base = { key = "${BASESCAN_API_KEY}", url = "https://api.basescan.org/api/" }
holesky = { key = "${ETHERSCAN_API_KEY}" }
fraxtal = { key = "${FRAXSCAN_API_KEY}", url = "https://api.fraxscan.io/api/" }
fraxtal_testnet = { key = "${FRAXSCAN_API_KEY}", url = "https://api-holesky.fraxscan.io/api/" }

85 changes: 85 additions & 0 deletions script/BaseData.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// SPDX-License-Identifier: MIt
pragma solidity ^0.8.24;

import {Script} from "forge-std/Script.sol";

contract BaseData is Script {
struct Actors {
address OFT_DELEGATE;
address TOKEN_ADMIN;
address PROXY_ADMIN;
}

struct ChainAddresses {
address lzEndpoint;
}

struct ChainIds {
uint256 mainnet;
uint256 base;
uint256 optimism;
uint256 arbitrum;
uint256 fraxtal;
uint256 holeksy;
uint256 fraxtalTestnet;
}

mapping(uint256 => Actors) public actors;
mapping(uint256 => ChainAddresses) public addresses;

ChainIds public chainIds = ChainIds({
mainnet: 1,
base: 8453,
optimism: 10,
arbitrum: 42161,
fraxtal: 252,
holeksy: 17000,
fraxtalTestnet: 2522
});

function setUp() public virtual {
addresses[chainIds.mainnet] = ChainAddresses({lzEndpoint: 0x1a44076050125825900e736c501f859c50fE728c});
actors[chainIds.mainnet] = Actors({
OFT_DELEGATE: 0xfcad670592a3b24869C0b51a6c6FDED4F95D6975, // yn security council
TOKEN_ADMIN: 0xfcad670592a3b24869C0b51a6c6FDED4F95D6975,
PROXY_ADMIN: 0xfcad670592a3b24869C0b51a6c6FDED4F95D6975
});

addresses[chainIds.fraxtal] = ChainAddresses({lzEndpoint: 0x1a44076050125825900e736c501f859c50fE728c});
actors[chainIds.fraxtal] = Actors({OFT_DELEGATE: address(0), TOKEN_ADMIN: address(0), PROXY_ADMIN: address(0)});

addresses[chainIds.optimism] = ChainAddresses({lzEndpoint: 0x1a44076050125825900e736c501f859c50fE728c});
actors[chainIds.optimism] = Actors({OFT_DELEGATE: address(0), TOKEN_ADMIN: address(0), PROXY_ADMIN: address(0)});

addresses[chainIds.arbitrum] = ChainAddresses({lzEndpoint: 0x1a44076050125825900e736c501f859c50fE728c});
actors[chainIds.arbitrum] = Actors({OFT_DELEGATE: address(0), TOKEN_ADMIN: address(0), PROXY_ADMIN: address(0)});

addresses[chainIds.base] = ChainAddresses({lzEndpoint: 0x1a44076050125825900e736c501f859c50fE728c});
actors[chainIds.base] = Actors({OFT_DELEGATE: address(0), TOKEN_ADMIN: address(0), PROXY_ADMIN: address(0)});

addresses[chainIds.holeksy] = ChainAddresses({lzEndpoint: 0x6EDCE65403992e310A62460808c4b910D972f10f});
actors[chainIds.holeksy] = Actors({
OFT_DELEGATE: 0x743b91CDB1C694D4F51bCDA3a4A59DcC0d02b913, // yn security council
TOKEN_ADMIN: 0x743b91CDB1C694D4F51bCDA3a4A59DcC0d02b913,
PROXY_ADMIN: 0x743b91CDB1C694D4F51bCDA3a4A59DcC0d02b913
});

addresses[chainIds.fraxtalTestnet] = ChainAddresses({lzEndpoint: 0x6EDCE65403992e310A62460808c4b910D972f10f});
actors[chainIds.fraxtalTestnet] =
Actors({OFT_DELEGATE: address(0), TOKEN_ADMIN: address(0), PROXY_ADMIN: address(0)});
}

function getActors(uint256 chainId) external view returns (Actors memory) {
return actors[chainId];
}

function getChainAddresses(uint256 chainId) external view returns (ChainAddresses memory) {
return addresses[chainId];
}

function isSupportedChainId(uint256 chainId) external view returns (bool) {
return chainId == chainIds.mainnet || chainId == chainIds.base || chainId == chainIds.fraxtal
|| chainId == chainIds.optimism || chainId == chainIds.arbitrum || chainId == chainIds.holeksy
|| chainId == chainIds.fraxtalTestnet;
}
}
16 changes: 16 additions & 0 deletions script/BaseScript.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import {stdJson} from "forge-std/StdJson.sol";
import {console} from "forge-std/console.sol";

import {BaseData} from "script/BaseData.sol";

abstract contract BaseScript is BaseData {
using stdJson for string;

function setUp() public virtual override {
super.setUp();
console.log("BaseScript.setUp");
}
}

0 comments on commit 37fb9ed

Please sign in to comment.