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

merge to main #2

Open
wants to merge 74 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
16c87c3
test
MrDeadCe11 Sep 21, 2024
45678e6
fixed contract name errors
MrDeadCe11 Sep 21, 2024
892ad32
barebones airdrop contract up.
MrDeadCe11 Sep 21, 2024
dcd89f5
spellcheck
MrDeadCe11 Sep 24, 2024
bf110c2
removed package.json
dan13ram Sep 24, 2024
3bc256b
forge install: forge-std
dan13ram Sep 24, 2024
4a6aa32
forge install: openzeppelin-contracts-upgradeable
dan13ram Sep 24, 2024
0c91e39
forge install: openzeppelin-contracts
dan13ram Sep 24, 2024
1824925
forge install: eigenlayer-contracts
dan13ram Sep 24, 2024
37d58ba
fixed dependencies
dan13ram Sep 24, 2024
d352f82
updated github workflow
dan13ram Sep 24, 2024
36cd2a4
added tests for transfers and staking
dan13ram Sep 24, 2024
cfa1f4a
forge install: openzeppelin-contracts
dan13ram Sep 24, 2024
6132765
forge install: openzeppelin-contracts-upgradeable
dan13ram Sep 24, 2024
7036ebd
added claimAndRestake
dan13ram Sep 24, 2024
ec61001
added SigUtils
dan13ram Sep 24, 2024
cf387ff
claim and stake works
dan13ram Sep 24, 2024
88be3c6
added deadline
MrDeadCe11 Sep 24, 2024
7688501
added csv file and bash script to convert csv to json
MrDeadCe11 Sep 24, 2024
5cbebdd
total numbers added to the end of json
MrDeadCe11 Sep 24, 2024
3589392
working on deploy script
MrDeadCe11 Sep 25, 2024
f8cdf5c
added missing files
MrDeadCe11 Sep 25, 2024
dfdbf32
broadcast
MrDeadCe11 Sep 25, 2024
b7785ff
fixed tests
dan13ram Sep 25, 2024
dce346c
Merge pull request #3 from yieldnest/feat/deploy-script
dan13ram Sep 25, 2024
4c0db6a
deployment working
dan13ram Sep 25, 2024
50b1bdf
Merge pull request #4 from yieldnest/feat/deploy-script
dan13ram Sep 25, 2024
194f1df
fixed github action
dan13ram Sep 25, 2024
ff9205d
added tests for setDeadline and saved deployment
MrDeadCe11 Sep 26, 2024
745289d
added missing files
MrDeadCe11 Sep 26, 2024
7907923
removed console logs
MrDeadCe11 Sep 26, 2024
ae75417
fixed airdrop deadline
MrDeadCe11 Sep 26, 2024
dc629f5
another console.log
MrDeadCe11 Sep 26, 2024
2bf2610
forge fmt
dan13ram Sep 26, 2024
a19748d
incorporated review comments
dan13ram Sep 26, 2024
a8abf92
commit gas snapshot file
dan13ram Sep 26, 2024
944ee37
simplified updateUserAmounts
dan13ram Sep 26, 2024
09c07bd
add functions for bundled delegation
danoctavian Sep 27, 2024
3a40621
fixed simulation script
MrDeadCe11 Sep 27, 2024
00cf754
Added natspec comments
dan13ram Sep 27, 2024
ea808b3
logs in deployment script
dan13ram Sep 27, 2024
009b677
fixed test for delegation
dan13ram Sep 27, 2024
0cdc586
added readme
dan13ram Sep 27, 2024
600df34
added checks to Makefile
dan13ram Sep 27, 2024
b42cd6c
added new json to inputs and fixed _calculateUserAmounts to use the p…
MrDeadCe11 Sep 27, 2024
d3a84b3
added missing files
MrDeadCe11 Sep 27, 2024
ddb0ded
fixed json formatting
MrDeadCe11 Sep 27, 2024
81291b8
added deployment folder
MrDeadCe11 Sep 27, 2024
537d9ff
removed simulation log
MrDeadCe11 Sep 27, 2024
8c20f66
Merge pull request #5 from yieldnest/feat/use-precomputed-tokens
danoctavian Sep 28, 2024
86dc4d9
add testClaimAndRestakeWithSignatureAndDelegate
danoctavian Sep 28, 2024
82c9a7c
add holesky contracts
danoctavian Sep 28, 2024
945f92e
add data to test
danoctavian Sep 28, 2024
6f41e3a
fix error message
danoctavian Sep 28, 2024
0b32773
add holesky inputs
danoctavian Sep 28, 2024
1a65f5b
add owner and admin msigs and enable holesky
danoctavian Sep 28, 2024
444c03f
modify test amounts
danoctavian Sep 28, 2024
234c760
log deployer
danoctavian Sep 28, 2024
9d4dd3d
add deployment to holesky
danoctavian Sep 28, 2024
08ce7e9
upgraded oz proxy to v5.0.2
dan13ram Sep 28, 2024
b521400
add latest testing address
danoctavian Sep 28, 2024
6e95d6c
remove unused from remappings.txt.
danoctavian Sep 28, 2024
2912156
remove 0.4.9 references
danoctavian Sep 28, 2024
0509a41
remove further references from remmapings
danoctavian Sep 28, 2024
201de20
remove oz-upgades
danoctavian Sep 28, 2024
0116e33
remove forge-std ref
danoctavian Sep 28, 2024
076c46a
fix all imports
danoctavian Sep 29, 2024
a71b6be
cleanup all imports to be from /lib
danoctavian Sep 29, 2024
693d8f0
latest deployment done
danoctavian Sep 29, 2024
9313d39
add utility scripts
danoctavian Sep 29, 2024
87be981
verify deployment script added
danoctavian Sep 29, 2024
9d16b90
boost README.md
danoctavian Sep 29, 2024
529dd1b
add deployment
danoctavian Sep 29, 2024
bb417f0
test owner change and upgradeability
danoctavian Sep 29, 2024
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
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig http://EditorConfig.org

# top-most EditorConfig file
root = true

# All files
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.sol]
indent_size = 4

[*.tree]
indent_size = 1
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# for verifying contracts
ETHERSCAN_API_KEY=

# 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=
92 changes: 92 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: "CI"

env:
API_KEY_ALCHEMY: ${{ secrets.API_KEY_ALCHEMY }}
FOUNDRY_PROFILE: "ci"

on:
workflow_dispatch:
pull_request:
push:
branches:
- "main"

jobs:
lint:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"

- name: "Setup node"
uses: actions/setup-node@v4

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install the dependencies"
run: "forge install"

- name: "Install solhint"
run: "npm install -g solhint"

- name: "Lint the code"
run: "forge fmt --check && solhint \"{script,src,test}/**/*.sol\""

- name: "Add lint summary"
run: |
echo "## Lint result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

build:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install the dependencies"
run: "forge install"

- name: "Build the contracts and print their size"
run: "forge build --sizes"

- name: "Add build summary"
run: |
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

test:
needs: ["lint", "build"]
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install the dependencies"
run: "forge install"

- name: "Show the Foundry config"
run: "forge config"

- name: "Generate a fuzz seed that changes weekly to avoid burning through RPC allowance"
run: >
echo "FOUNDRY_FUZZ_SEED=$(
echo $(($EPOCHSECONDS - $EPOCHSECONDS % 604800))
)" >> $GITHUB_ENV

- name: "Run the tests"
env:
CI: true
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
run: "forge test -vvv"

- name: "Add test summary"
run: |
echo "## Tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# directories
cache
coverage
node_modules
out

# files
*.env
*.log
.DS_Store
.pnp.*
lcov.info
package-lock.json
pnpm-lock.yaml
yarn.lock

# broadcasts
!broadcast
broadcast/*
broadcast/*/31337/
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/eigenlayer-contracts"]
path = lib/eigenlayer-contracts
url = https://github.com/layr-labs/eigenlayer-contracts
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
14 changes: 14 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
image: "gitpod/workspace-bun"

tasks:
- name: "Install dependencies"
before: |
curl -L https://foundry.paradigm.xyz | bash
source ~/.bashrc
foundryup
init: "bun install"

vscode:
extensions:
- "esbenp.prettier-vscode"
- "NomicFoundation.hardhat-solidity"
14 changes: 14 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "solhint:default",
"rules": {
"code-complexity": ["error", 8],
"compiler-version": ["error", ">=0.8.25"],
"func-name-mixedcase": "off",
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 120],
"named-parameters-mapping": "warn",
"no-console": "off",
"not-rely-on-time": "off",
"one-contract-per-file": "off"
}
}
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"[solidity]": {
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
},
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml"
},
"solidity.formatter": "forge"
}
67 changes: 67 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Default target
.PHONY: all
all: clean install build

# Clean the cache and output directories
.PHONY: clean
clean:
rm -rf cache out

# Install dependencies using forge
.PHONY: install
install:
forge install

# Build the project using forge
.PHONY: build
build:
forge build

# Compile the project using forge
.PHONY: compile
compile:
forge compile

# Run the tests using forge
.PHONY: test
test:
forge test

# Generate a coverage report
.PHONY: coverage
coverage:
forge coverage

# Generate a coverage report and create an HTML report
.PHONY: coverage-report
coverage-report:
forge coverage --report lcov && genhtml lcov.info --branch-coverage --output-dir coverage

# Show the coverage report
.PHONY: coverage-show
coverage-show:
npx http-server ./coverage

# Lint the Solidity files using forge fmt and solhint
.PHONY: lint
lint:
forge fmt --check && solhint "{script,src,test}/**/*.sol"

# Format the Solidity files using forge fmt
.PHONY: format
format:
forge fmt --root .


# make convert csv=script/input/ynETH.csv
csv ?= script/inputs/ynETH.csv
.PHONY: convert
convert:
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:
dan13ram marked this conversation as resolved.
Show resolved Hide resolved
forge script DeployEigenAirdrop --rpc-url ${network} --sig "run(string memory)" ${json}
44 changes: 44 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Full reference https://github.com/foundry-rs/foundry/tree/master/crates/config

[profile.default]
fuzz = { runs = 1_000 }
gas_reports = ["*"]
optimizer = true
optimizer_runs = 200
out = "out"
script = "script"
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]
mainnet = { key = "${ETHERSCAN_API_KEY}" }
holesky = { key = "${ETHERSCAN_API_KEY}" }

[fmt]
bracket_spacing = true
int_types = "long"
line_length = 115
multiline_func_header = "all"
number_underscore = "thousands"
quote_style = "double"
tab_width = 4
wrap_comments = true
single_line_statement_blocks = "multi"
sort_imports = true

[rpc_endpoints]
mainnet = "${MAINNET_RPC_URL}"
holesky = "${HOLESKY_RPC_URL}"
1 change: 1 addition & 0 deletions lib/eigenlayer-contracts
Submodule eigenlayer-contracts added at e9fca5
1 change: 1 addition & 0 deletions lib/forge-std
Submodule forge-std added at 1714be
1 change: 1 addition & 0 deletions lib/openzeppelin-contracts
Submodule openzeppelin-contracts added at dbb610
1 change: 1 addition & 0 deletions lib/openzeppelin-contracts-upgradeable
19 changes: 19 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@openzeppelin-upgrades-v4.9.0/=lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable-v4.9.0/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this remappings file is insanely complex and contributed to all the issues plagueing the wrong import of the wrong OZ library.

I have no clue what's going on here

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by myself and pushed directly to dev

@openzeppelin-upgrades/=lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable/
@openzeppelin-v4.9.0/=lib/eigenlayer-contracts/lib/openzeppelin-contracts-v4.9.0/
@openzeppelin/=lib/eigenlayer-contracts/lib/openzeppelin-contracts/

ds-test/=lib/eigenlayer-contracts/lib/ds-test/src/
eigenlayer-contracts/=lib/eigenlayer-contracts/src/contracts/
erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/
forge-std/=lib/forge-std/src/

openzeppelin-contracts-upgradeable-v4.9.0/=lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable-v4.9.0/
openzeppelin-contracts-v4.9.0/=lib/eigenlayer-contracts/lib/openzeppelin-contracts-v4.9.0/
openzeppelin/=lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable-v4.9.0/contracts/

@openzeppelin/contracts-upgradeable/=lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable/contracts/
@openzeppelin/contracts/=lib/eigenlayer-contracts/lib/openzeppelin-contracts/contracts/

@openzeppelin-upgradeable-v5.0.2/=lib/openzeppelin-contracts-upgradeable/contracts/
@openzeppelin-v5.0.2/=lib/openzeppelin-contracts/contracts/
51 changes: 51 additions & 0 deletions script/BaseData.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// SPDX-License-Identifier: BSD 3-Clause License
pragma solidity >=0.8.25 <0.9.0;

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

contract BaseData is Script {
struct Data {
address airdropOwner;
address proxyAdmin;
address rewardsSafe;
address eigenToken;
address bEigenToken;
address strategyManager;
address strategy;
}

struct ChainIds {
uint256 mainnet;
uint256 holeksy;
}

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

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

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 getData(uint256 chainId) internal view returns (Data memory) {
return __data[chainId];
}

function isSupportedChainId(uint256 chainId) internal view returns (bool) {
return chainId == chainIds.mainnet || chainId == chainIds.holeksy;
}
}
Loading
Loading