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 61 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 archival 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=
27 changes: 27 additions & 0 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
EigenAirdropSampleDataTest:testClaimWithSampleData() (gas: 21791727)
EigenAirdropSampleDataTest:testDeployWithSampleData() (gas: 20970602)
EigenAirdropSampleDataTest:testUpdateUserAmountsWithSampleData() (gas: 22248176)
EigenAirdropTest:testClaim() (gas: 93053)
EigenAirdropTest:testClaimAmountAfterUpdateUserAmounts() (gas: 113720)
EigenAirdropTest:testClaimAndRestakeWithSignature() (gas: 342287)
EigenAirdropTest:testClaimAndRestakeWithSignatureRevertsAfterSignatureExpiry() (gas: 203495)
EigenAirdropTest:testClaimAndRestakeWithSignatureRevertsIfPaused() (gas: 108052)
EigenAirdropTest:testClaimRevertsIfAmountExceeds() (gas: 43184)
EigenAirdropTest:testClaimRevertsIfAmountZero() (gas: 38777)
EigenAirdropTest:testClaimRevertsIfPaused() (gas: 70782)
EigenAirdropTest:testClaimThenStake() (gas: 274294)
EigenAirdropTest:testDefaults() (gas: 56059)
EigenAirdropTest:testPause() (gas: 45790)
EigenAirdropTest:testPauseRevertsAlreadyPaused() (gas: 48631)
EigenAirdropTest:testPauseRevertsNotOwner() (gas: 18357)
EigenAirdropTest:testUnpause() (gas: 37263)
EigenAirdropTest:testUnpauseRevertsNotOwner() (gas: 48358)
EigenAirdropTest:testUnpauseRevertsNotPaused() (gas: 22537)
EigenAirdropTest:testUpdateUserAmounts() (gas: 61354)
EigenAirdropTest:testUpdateUserAmountsRevertsIfNotPaused() (gas: 27744)
EigenAirdropTest:testUpdateUserAmountsRevertsNotOwner() (gas: 53580)
EigenTransferAndStakeTest:testDefaults() (gas: 40779)
EigenTransferAndStakeTest:testStakeFailsWithoutBalance() (gas: 41871)
EigenTransferAndStakeTest:testStakeFromUser() (gas: 242300)
EigenTransferAndStakeTest:testTransferFailsFromUser() (gas: 68772)
EigenTransferAndStakeTest:testTransferToUser() (gas: 61419)
95 changes: 95 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
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: "Check gas snapshots"
run: forge snapshot --check

- 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"
}
89 changes: 89 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Default values
Copy link

@danoctavian danoctavian Sep 28, 2024

Choose a reason for hiding this comment

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

unnecessarily complex Makefile
we only need to deploy and test

Let's keep everything minimal and simple, no extra boilerplate

don't clean this one now, but going forward.

json ?= script/inputs/season-one-eigen.json
network ?= mainnet
deployerAccountName := $(shell grep '^DEPLOYER_ACCOUNT_NAME=' .env | cut -d '=' -f2)
deployerAddress := $(shell grep '^DEPLOYER_ADDRESS=' .env | cut -d '=' -f2)

# 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 -vvv

# Create a gas snapshot
.PHONY: snapshot
snapshot:
forge snapshot

# 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 --output-directory 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
.PHONY: convert
convert:
@if [ -z "${csv}" ]; then echo "Error: csv is required"; exit 1; fi
bash ./script/bash/convertCSVjson.sh ${csv}

# make simulate json=script/inputs/season-one-eigen.json network=mainnet

.PHONY: simulate

Choose a reason for hiding this comment

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

does not work:

forge script DeployEigenAirdrop --sig "run(string memory)" script/inputs/ynETH.json --rpc-url mainnet
[⠊] Compiling...
No files changed, compilation skipped
Script ran successfully.

== Logs ==
  Deployed EigenAirdrop implementation at address:  0x90193C961A926261B756D1E5bb255e67ff9498A1
  Deployed EigenAirdrop at address:  0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496

## Setting up 1 EVM.

Failed with `revert: ERC1967: new implementation is not a contract`:

  [3568] → new <unknown>@0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496
    └─  [Revert] revert: ERC1967: new implementation is not a contract

Error:
Simulated execution failed.
make: *** [simulate] Error 1```

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@danoctavian I'm unable to figure out why its failing. Can only conclude that there is a bug with foundry itself. Earlier i was using create2 deployment and it was working fine. Even now i tried to include a {salt: SALT} to the deployment script and simulation ran fine without the (--account and --sender).

For the time being @MrDeadCe11 has added the --account and --sender to the simulate script and it runs without any errors.

Choose a reason for hiding this comment

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

let's not add it if there's no point to it.

This feature is not needed. All we need is:

  1. Test
  2. Deploy

Any extra things let's leave oout

simulate:
@if [ -z "${network}" ]; then echo "Error: network is required"; exit 1; fi
@if [ -z "${json}" ]; then echo "Error: json is required"; exit 1; fi
@if [ -z "${deployerAccountName}" ]; then echo "Error: deployerAccountName is required"; exit 1; fi
@if [ -z "${deployerAddress}" ]; then echo "Error: deployerAddress is required"; exit 1; fi
forge script DeployEigenAirdrop --sig "run(string memory)" ${json} --rpc-url ${network} --account ${deployerAccountName} --sender ${deployerAddress} --slow

# make deploy json=script/inputs/season-one-eigen.json network=mainnet
.PHONY: deploy
deploy:
dan13ram marked this conversation as resolved.
Show resolved Hide resolved
@if [ -z "${network}" ]; then echo "Error: network is required"; exit 1; fi
@if [ -z "${json}" ]; then echo "Error: json is required"; exit 1; fi
@if [ -z "${deployerAccountName}" ]; then echo "Error: deployerAccountName is required"; exit 1; fi
@if [ -z "${deployerAddress}" ]; then echo "Error: deployerAddress is required"; exit 1; fi
forge script DeployEigenAirdrop --sig "run(string memory)" ${json} --rpc-url ${network} --account ${deployerAccountName} --sender ${deployerAddress} --slow --broadcast --verify
Loading
Loading