Skip to content

Commit

Permalink
Merge pull request #4 from yieldnest/feat/deploy-script
Browse files Browse the repository at this point in the history
updated deployment scripts
  • Loading branch information
dan13ram authored Sep 25, 2024
2 parents dce346c + 4c0db6a commit 50b1bdf
Show file tree
Hide file tree
Showing 17 changed files with 3,637 additions and 4,369 deletions.
13 changes: 9 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
API_KEY_ALCHEMY="YOUR_API_KEY_ALCHEMY"
API_KEY_ETHERSCAN="YOUR_API_KEY_ETHERSCAN"
API_KEY_INFURA="YOUR_API_KEY_INFURA"
# for verifying contracts
ETHERSCAN_API_KEY=

FOUNDRY_PROFILE="default"
# for testing and deploying the contracts please use full arhcival nodes
MAINNET_RPC_URL=
HOLEKSY_RPC_URL=

# for use with cast wallet. store the deployer private key in the keystore and put the public address here.
DEPLOYER_ACCOUNT_NAME=
DEPLOYER_ADDRESS=
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "solhint:recommended",
"extends": "solhint:default",
"rules": {
"code-complexity": ["error", 8],
"compiler-version": ["error", ">=0.8.25"],
Expand Down
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,15 @@ format:
forge fmt --root .


# make convert path=script/eigenAmounts/eigen-points-result-ynETH.csv
# make convert csv=script/input/ynETH.csv
csv ?= script/inputs/ynETH.csv
.PHONY: convert
convert:
./script/eigenAmounts/convertCSVjson.sh ${path}
bash ./script/bash/convertCSVjson.sh ${csv}

# make deploy json=script/inputs/ynETH.json network=mainnet
json ?= script/inputs/ynETH.json
network ?= mainnet
.PHONY: deploy
deploy:
forge script DeployEigenAirdrop --rpc-url ${network} --sig "run(string memory)" ${json}
41 changes: 14 additions & 27 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
# Full reference https://github.com/foundry-rs/foundry/tree/master/crates/config

[profile.default]
auto_detect_solc = false
block_timestamp = 1_680_220_800 # March 31, 2023 at 00:00 GMT
bytecode_hash = "none"
evm_version = "shanghai"
fuzz = { runs = 1_000 }
gas_reports = ["*"]
optimizer = true
optimizer_runs = 10_000
optimizer_runs = 200
out = "out"
script = "script"
solc = "0.8.25"
src = "src"
test = "test"
libs = ["lib"]
fs_permissions = [
{ access = "read-write", path = "./deployments" },
{ access = "read", path = "./" },
]
cache_path = "cache"
evm_version = "shanghai"
solc_version = "0.8.25"
prompt_timeout = 120

[profile.ci]
fuzz = { runs = 10_000 }
verbosity = 4

[etherscan]
arbitrum = { key = "${API_KEY_ARBISCAN}" }
avalanche = { key = "${API_KEY_SNOWTRACE}" }
base = { key = "${API_KEY_BASESCAN}" }
bnb_smart_chain = { key = "${API_KEY_BSCSCAN}" }
gnosis_chain = { key = "${API_KEY_GNOSISSCAN}" }
goerli = { key = "${API_KEY_ETHERSCAN}" }
mainnet = { key = "${API_KEY_ETHERSCAN}" }
optimism = { key = "${API_KEY_OPTIMISTIC_ETHERSCAN}" }
polygon = { key = "${API_KEY_POLYGONSCAN}" }
sepolia = { key = "${API_KEY_ETHERSCAN}" }
mainnet = { key = "${ETHERSCAN_API_KEY}" }
holesky = { key = "${ETHERSCAN_API_KEY}" }

[fmt]
bracket_spacing = true
Expand All @@ -44,14 +40,5 @@
sort_imports = true

[rpc_endpoints]
arbitrum = "https://arbitrum-mainnet.infura.io/v3/${API_KEY_INFURA}"
avalanche = "https://avalanche-mainnet.infura.io/v3/${API_KEY_INFURA}"
base = "https://mainnet.base.org"
bnb_smart_chain = "https://bsc-dataseed.binance.org"
gnosis_chain = "https://rpc.gnosischain.com"
goerli = "https://goerli.infura.io/v3/${API_KEY_INFURA}"
localhost = "http://localhost:8545"
mainnet = "https://eth-mainnet.g.alchemy.com/v2/${API_KEY_ALCHEMY}"
optimism = "https://optimism-mainnet.infura.io/v3/${API_KEY_INFURA}"
polygon = "https://polygon-mainnet.infura.io/v3/${API_KEY_INFURA}"
sepolia = "https://sepolia.infura.io/v3/${API_KEY_INFURA}"
mainnet = "${MAINNET_RPC_URL}"
holesky = "${HOLESKY_RPC_URL}"
51 changes: 0 additions & 51 deletions script/Base.s.sol

This file was deleted.

47 changes: 28 additions & 19 deletions script/BaseData.s.sol
Original file line number Diff line number Diff line change
@@ -1,42 +1,51 @@
// SPDX-License-Identifier: BSD 3-Clause License
pragma solidity ^0.8.24;
pragma solidity >=0.8.25 <0.9.0;

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

contract BaseData is Script {
struct AirdropAddresses {
address REWARDS_MULTISIG;
address EIGEN_TOKEN;
address B_EIGEN_TOKEN;
address STRATEGY_MANAGER_ADDRESS;
address RESTAKING_STRATEGY;
struct Data {
address airdropOwner;
address proxyAdmin;
address rewardsSafe;
address eigenToken;
address bEigenToken;
address strategyManager;
address strategy;
}

struct ChainIds {
uint256 mainnet;
uint256 holeksy;
}

mapping(uint256 => AirdropAddresses) public addresses;
mapping(uint256 chainId => Data data) private __data;

ChainIds public chainIds = ChainIds({ mainnet: 1, holeksy: 17_000 });

constructor() {
addresses[chainIds.mainnet] = AirdropAddresses({
REWARDS_MULTISIG: 0xCCB2FEB7d8e081dcedFe1CFbefC9d46Eb383E389,
EIGEN_TOKEN: 0xec53bF9167f50cDEB3Ae105f56099aaaB9061F83,
B_EIGEN_TOKEN: 0xec53bF9167f50cDEB3Ae105f56099aaaB9061F83,
STRATEGY_MANAGER_ADDRESS: 0xdfB5f6CE42aAA7830E94ECFCcAd411beF4d4D5b6, // double check this got this
// from the protocol addresses
RESTAKING_STRATEGY: 0xaCB55C530Acdb2849e6d4f36992Cd8c9D50ED8F7
address private TEMP_AIRDROP_OWNER;
address private TEMP_PROXY_CONTROLLER;

function setUp() public virtual {
TEMP_AIRDROP_OWNER = makeAddr("airdrop-owner");
TEMP_PROXY_CONTROLLER = makeAddr("proxy-controller");

__data[chainIds.mainnet] = Data({
airdropOwner: TEMP_AIRDROP_OWNER,
proxyAdmin: TEMP_PROXY_CONTROLLER,
rewardsSafe: 0xCCB2FEB7d8e081dcedFe1CFbefC9d46Eb383E389,
eigenToken: 0xec53bF9167f50cDEB3Ae105f56099aaaB9061F83,
bEigenToken: 0xec53bF9167f50cDEB3Ae105f56099aaaB9061F83,
strategyManager: 0x858646372CC42E1A627fcE94aa7A7033e7CF075A,
strategy: 0xaCB55C530Acdb2849e6d4f36992Cd8c9D50ED8F7
});
}

function getAddresses(uint256 chainId) external view returns (AirdropAddresses memory) {
return addresses[chainId];
function getData(uint256 chainId) internal view returns (Data memory) {
return __data[chainId];
}

function isSupportedChainId(uint256 chainId) external view returns (bool) {
function isSupportedChainId(uint256 chainId) internal view returns (bool) {
return chainId == chainIds.mainnet || chainId == chainIds.holeksy;
}
}
63 changes: 63 additions & 0 deletions script/BaseScript.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.25 <0.9.0;

import { BaseData } from "./BaseData.s.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { console } from "forge-std/console.sol";

struct EigenPoints {
address addr;
uint256 points;
}

contract BaseScript is BaseData {
/// @dev Needed for the deterministic deployments.
bytes32 internal constant _SALT = bytes32("[email protected]");

Data public data;
uint256 public initialSafeBalance;
EigenPoints[] public eigenPoints;

error ChainIdNotSupported(uint256 chainId);
error InvalidInput();
error NoAirdrop();

function setUp() public override {
super.setUp();

if (!isSupportedChainId(block.chainid)) {
revert ChainIdNotSupported(block.chainid);
}

data = getData(block.chainid);

initialSafeBalance = IERC20(data.eigenToken).balanceOf(data.rewardsSafe);
if (initialSafeBalance == 0) {
revert NoAirdrop();
}
}

function _loadInput(string memory _path) internal {
string memory path = string(abi.encodePacked(vm.projectRoot(), "/", _path));
string memory json = vm.readFile(path);

bytes memory parsedEigenPoints = vm.parseJson(json, ".eigenPoints");
EigenPoints[] memory ePoints = abi.decode(parsedEigenPoints, (EigenPoints[]));
uint256 totalYnETHHolderEigenPoints = vm.parseJsonUint(json, ".totalYnETHHolderEigenPoints");

delete eigenPoints;

uint256 totalPoints;
for (uint256 i; i < ePoints.length; i++) {
eigenPoints.push(ePoints[i]);
totalPoints += ePoints[i].points;
}

console.log("Total Parsed Eigen Points: ", totalPoints);
console.log("Total Input Eigen Points: ", totalYnETHHolderEigenPoints);

// if (totalPoints != totalYnETHHolderEigenPoints) {
// revert InvalidInput();
// }
}
}
52 changes: 0 additions & 52 deletions script/Deploy.s.sol

This file was deleted.

Loading

0 comments on commit 50b1bdf

Please sign in to comment.