Skip to content
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
42 changes: 6 additions & 36 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Wallet Configuration

# Using Private Key
PRIVATE_KEY="YOUR_PRIVATE_KEY"

# Using Mnemonic
MNEMONIC="YOUR_MNEMONIC"

EOA_INDEX=0 # Optional (Default to 0)
Expand All @@ -10,14 +12,13 @@ EOA_INDEX=0 # Optional (Default to 0)

CHAINS="ethereum,optimism,base,arbitrum" # Chains to deploy

# Etherscan
# Etherscan Configuration

ETHERSCAN_API_KEY="YOUR_ETHERSCAN_API_KEY"

# RPC Provider

# Using Alchemy RPC URL
# RPC Provider Configuration

# Using Alchemy
RPC_API_KEY="YOUR_ALCHEMY_API_KEY"

RPC_ETHEREUM="https://eth-mainnet.g.alchemy.com/v2/${RPC_API_KEY}"
Expand All @@ -26,12 +27,6 @@ RPC_SEPOLIA="https://eth-sepolia.g.alchemy.com/v2/${RPC_API_KEY}"
RPC_OPTIMISM="https://opt-mainnet.g.alchemy.com/v2/${RPC_API_KEY}"
RPC_OPTIMISM_SEPOLIA="https://opt-sepolia.g.alchemy.com/v2/${RPC_API_KEY}"

RPC_BNB="https://bnb-mainnet.g.alchemy.com/v2//${RPC_API_KEY}"
RPC_BNB_TESTNET="https://bnb-testnet.g.alchemy.com/v2/${RPC_API_KEY}"

RPC_UNICHAIN="https://unichain-mainnet.g.alchemy.com/v2/${RPC_API_KEY}"
RPC_UNICHAIN_SEPOLIA="https://unichain-sepolia.g.alchemy.com/v2/${RPC_API_KEY}"

RPC_POLYGON="https://polygon-mainnet.g.alchemy.com/v2/${RPC_API_KEY}"
RPC_POLYGON_AMOY="https://polygon-amoy.g.alchemy.com/v2/${RPC_API_KEY}"

Expand All @@ -41,17 +36,7 @@ RPC_BASE_SEPOLIA="https://base-sepolia.g.alchemy.com/v2/${RPC_API_KEY}"
RPC_ARBITRUM="https://arb-mainnet.g.alchemy.com/v2/${RPC_API_KEY}"
RPC_ARBITRUM_SEPOLIA="https://arb-sepolia.g.alchemy.com/v2/${RPC_API_KEY}"

RPC_AVALANCHE="https://avax-mainnet.g.alchemy.com/v2/${RPC_API_KEY}"
RPC_AVALANCHE_FUJI="https://avax-fuji.g.alchemy.com/v2/${RPC_API_KEY}"

RPC_LINEA="https://linea-mainnet.g.alchemy.com/v2/${RPC_API_KEY}"
RPC_LINEA_SEPOLIA="https://linea-sepolia.g.alchemy.com/v2/${RPC_API_KEY}"

RPC_SCROLL="https://scroll-mainnet.g.alchemy.com/v2/${RPC_API_KEY}"
RPC_SCROLL_SEPOLIA="https://scroll-sepolia.g.alchemy.com/v2/${RPC_API_KEY}"

# Using Infura RPC URL

# Using Infura
RPC_API_KEY="YOUR_INFURA_API_KEY"

RPC_ETHEREUM="https://mainnet.infura.io/v3/${RPC_API_KEY}"
Expand All @@ -60,12 +45,6 @@ RPC_SEPOLIA="https://sepolia.infura.io/v3/${RPC_API_KEY}"
RPC_OPTIMISM="https://optimism-mainnet.infura.io/v3/${RPC_API_KEY}"
RPC_OPTIMISM_SEPOLIA="https://optimism-sepolia.infura.io/v3/${RPC_API_KEY}"

RPC_BNB="https://bsc-mainnet.infura.io/v3/${RPC_API_KEY}"
RPC_BNB_TESTNET="https://bsc-testnet.infura.io/v3/${RPC_API_KEY}"

RPC_UNICHAIN="https://unichain-mainnet.infura.io/v3/${RPC_API_KEY}"
RPC_UNICHAIN_SEPOLIA="https://unichain-sepolia.infura.io/v3/${RPC_API_KEY}"

RPC_POLYGON="https://polygon-mainnet.infura.io/v3/${RPC_API_KEY}"
RPC_POLYGON_AMOY="https://polygon-amoy.infura.io/v3/${RPC_API_KEY}"

Expand All @@ -74,12 +53,3 @@ RPC_BASE_SEPOLIA="https://base-sepolia.infura.io/v3/${RPC_API_KEY}"

RPC_ARBITRUM="https://arbitrum-mainnet.infura.io/v3/${RPC_API_KEY}"
RPC_ARBITRUM_SEPOLIA="https://arbitrum-sepolia.infura.io/v3/${RPC_API_KEY}"

RPC_AVALANCHE="https://avalanche-mainnet.infura.io/v3/${RPC_API_KEY}"
RPC_AVALANCHE_FUJI="https://avalanche-fuji.infura.io/v3/${RPC_API_KEY}"

RPC_LINEA="https://linea-mainnet.infura.io/v3/${RPC_API_KEY}"
RPC_LINEA_SEPOLIA="https://linea-sepolia.infura.io/v3/${RPC_API_KEY}"

RPC_SCROLL="https://scroll-mainnet.infura.io/v3/${RPC_API_KEY}"
RPC_SCROLL_SEPOLIA="https://scroll-sepolia.infura.io/v3/${RPC_API_KEY}"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ docs/
# Dotenv file
.env

# OS files
.DS_Store

# NPM
node_modules
7 changes: 3 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
foundry.toml
out/
lib/
.github/
cache/
.github/
lib/
out/
8 changes: 4 additions & 4 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"tabWidth": 4,
"useTabs": true,
"singleQuote": false,
"bracketSpacing": true,
"trailingComma": "all",
"overrides": [
{
"files": "*.sol",
"options": {
"bracketSpacing": false
}
"files": ["*.ts", "*.js", "*.json"],
"options": {}
}
]
}
28 changes: 0 additions & 28 deletions config/feeds/42161.json
Original file line number Diff line number Diff line change
Expand Up @@ -391,20 +391,6 @@
"base": "0xf6718b2701D4a6498eF77D7c152b2137Ab28b8A3",
"quote": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"
},
{
"aggregator": "0xded2c52b75B24732e9107377B7Ba93eC1fFa4BAf",
"description": "STETH / ETH",
"decimals": 18,
"base": "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
"quote": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"
},
{
"aggregator": "0x07C5b924399cc23c24a95c8743DE4006a32b7f2a",
"description": "STETH / USD",
"decimals": 8,
"base": "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
"quote": "0x0000000000000000000000000000000000000348"
},
{
"aggregator": "0xe74d69E233faB0d8F48921f2D93aDfDe44cEb3B7",
"description": "STG / USD",
Expand Down Expand Up @@ -531,13 +517,6 @@
"base": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"quote": "0x0000000000000000000000000000000000000348"
},
{
"aggregator": "0x20bAe7e1De9c596f5F7615aeaa1342Ba99294e12",
"description": "weETH / eETH Exchange Rate",
"decimals": 18,
"base": "0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe",
"quote": "0x35fA164735182de50811E8e2E824cFb9B6118ac2"
},
{
"aggregator": "0xE141425bc1594b8039De6390db1cDaf4397EA22b",
"description": "weETH / ETH",
Expand All @@ -559,13 +538,6 @@
"base": "0x5979D7b546E38E414F7E9822514be443A4800529",
"quote": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"
},
{
"aggregator": "0xB1552C5e96B312d0Bf8b554186F846C40614a540",
"description": "wstETH-stETH Exchange Rate",
"decimals": 18,
"base": "0x5979D7b546E38E414F7E9822514be443A4800529",
"quote": "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"
},
{
"aggregator": "0x806c532D543352e7C344ba6C7F3F00Bfbd309Af1",
"description": "XAI / USD",
Expand Down
25 changes: 18 additions & 7 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,40 @@ bytecode_hash = "none"
cbor_metadata = false
dynamic_test_linking = true
ffi = true
ignored_error_codes = [2394]
optimizer = true
optimizer_runs = 1000000
verbosity = 2
via_ir = true

fs_permissions = [
{ access = "read-write", path = "./config"},
{ access = "read-write", path = "./deployments"},
{ access = "read", path = "./out"},
{ access = "read", path = "./script" },
{ access = "read", path = "./test"}
{ access = "read-write", path = "config" },
{ access = "read-write", path = "deployments" },
{ access = "read", path = "out" },
{ access = "read", path = "script" }
]

gas_reports = ["ChainlinkRouter"]

remappings = [
"forge-std/=lib/forge-std/src/",
"@openzeppelin/=lib/openzeppelin-contracts/contracts",
"@proxy-forge/=lib/proxy-forge/src/"
"proxy-forge/=lib/proxy-forge/src/"
]

[fuzz]
runs = 1000
max_test_rejects = 1000000

[fmt]
line_length = 120
tab_width = 4
quote_style = "double"
func_attrs_with_params_multiline = true
inline_attribute_style = "compact"
return_statement = "inline"

[lint]
lint_on_build = false

[rpc_endpoints]
ethereum = "${RPC_ETHEREUM}"
Expand Down
106 changes: 53 additions & 53 deletions script/BaseScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,68 +4,68 @@ pragma solidity ^0.8.30;
import {Script} from "forge-std/Script.sol";

abstract contract BaseScript is Script {
error UnsupportedChainId(uint256 chainId);
error UnsupportedChainId(uint256 chainId);

string private constant TEST_MNEMONIC = "test test test test test test test test test test test junk";
string private constant DEFAULT_MNEMONIC = "test test test test test test test test test test test junk";

uint256 internal constant ETHEREUM_CHAIN_ID = 1;
uint256 internal constant SEPOLIA_CHAIN_ID = 11155111;
uint256 internal constant ETHEREUM_CHAIN_ID = 1;
uint256 internal constant SEPOLIA_CHAIN_ID = 11155111;

uint256 internal constant OPTIMISM_CHAIN_ID = 10;
uint256 internal constant OPTIMISM_SEPOLIA_CHAIN_ID = 11155420;
uint256 internal constant OPTIMISM_CHAIN_ID = 10;
uint256 internal constant OPTIMISM_SEPOLIA_CHAIN_ID = 11155420;

uint256 internal constant POLYGON_CHAIN_ID = 137;
uint256 internal constant POLYGON_AMOY_CHAIN_ID = 80002;
uint256 internal constant POLYGON_CHAIN_ID = 137;
uint256 internal constant POLYGON_AMOY_CHAIN_ID = 80002;

uint256 internal constant BASE_CHAIN_ID = 8453;
uint256 internal constant BASE_SEPOLIA_CHAIN_ID = 84532;
uint256 internal constant BASE_CHAIN_ID = 8453;
uint256 internal constant BASE_SEPOLIA_CHAIN_ID = 84532;

uint256 internal constant ARBITRUM_CHAIN_ID = 42161;
uint256 internal constant ARBITRUM_SEPOLIA_CHAIN_ID = 421614;
uint256 internal constant ARBITRUM_CHAIN_ID = 42161;
uint256 internal constant ARBITRUM_SEPOLIA_CHAIN_ID = 421614;

address broadcaster;
address broadcaster;

modifier broadcast() {
vm.startBroadcast(broadcaster);
_;
vm.stopBroadcast();
}
modifier broadcast() {
vm.startBroadcast(broadcaster);
_;
vm.stopBroadcast();
}

function setUp() public virtual {
uint256 privateKey = vm.envOr({
name: "PRIVATE_KEY",
defaultValue: vm.deriveKey({
mnemonic: vm.envOr({name: "MNEMONIC", defaultValue: TEST_MNEMONIC}),
index: uint8(vm.envOr({name: "EOA_INDEX", defaultValue: uint256(0)}))
})
});
function setUp() public virtual {
uint256 privateKey = vm.envOr({
name: "PRIVATE_KEY",
defaultValue: vm.deriveKey({
mnemonic: vm.envOr({name: "MNEMONIC", defaultValue: DEFAULT_MNEMONIC}),
index: uint8(vm.envOr({name: "EOA_INDEX", defaultValue: uint256(0)}))
})
});

broadcaster = vm.rememberKey(privateKey);
}
broadcaster = vm.rememberKey(privateKey);
}

function forkChain(uint256 chainId) internal virtual {
if (chainId == ETHEREUM_CHAIN_ID) {
vm.createSelectFork("ethereum");
} else if (chainId == SEPOLIA_CHAIN_ID) {
vm.createSelectFork("sepolia");
} else if (chainId == OPTIMISM_CHAIN_ID) {
vm.createSelectFork("optimism");
} else if (chainId == OPTIMISM_SEPOLIA_CHAIN_ID) {
vm.createSelectFork("optimism-sepolia");
} else if (chainId == POLYGON_CHAIN_ID) {
vm.createSelectFork("polygon");
} else if (chainId == POLYGON_AMOY_CHAIN_ID) {
vm.createSelectFork("polygon-amoy");
} else if (chainId == BASE_CHAIN_ID) {
vm.createSelectFork("base");
} else if (chainId == BASE_SEPOLIA_CHAIN_ID) {
vm.createSelectFork("base-sepolia");
} else if (chainId == ARBITRUM_CHAIN_ID) {
vm.createSelectFork("arbitrum");
} else if (chainId == ARBITRUM_SEPOLIA_CHAIN_ID) {
vm.createSelectFork("arbitrum-sepolia");
} else {
revert UnsupportedChainId(chainId);
}
}
function forkChain(uint256 chainId) internal virtual {
if (chainId == ETHEREUM_CHAIN_ID) {
vm.createSelectFork("ethereum");
} else if (chainId == SEPOLIA_CHAIN_ID) {
vm.createSelectFork("sepolia");
} else if (chainId == OPTIMISM_CHAIN_ID) {
vm.createSelectFork("optimism");
} else if (chainId == OPTIMISM_SEPOLIA_CHAIN_ID) {
vm.createSelectFork("optimism-sepolia");
} else if (chainId == POLYGON_CHAIN_ID) {
vm.createSelectFork("polygon");
} else if (chainId == POLYGON_AMOY_CHAIN_ID) {
vm.createSelectFork("polygon-amoy");
} else if (chainId == BASE_CHAIN_ID) {
vm.createSelectFork("base");
} else if (chainId == BASE_SEPOLIA_CHAIN_ID) {
vm.createSelectFork("base-sepolia");
} else if (chainId == ARBITRUM_CHAIN_ID) {
vm.createSelectFork("arbitrum");
} else if (chainId == ARBITRUM_SEPOLIA_CHAIN_ID) {
vm.createSelectFork("arbitrum-sepolia");
} else {
revert UnsupportedChainId(chainId);
}
}
}
Loading
Loading