-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Changes from 61 commits
16c87c3
45678e6
892ad32
dcd89f5
bf110c2
3bc256b
4a6aa32
0c91e39
1824925
37d58ba
d352f82
36cd2a4
cfa1f4a
6132765
7036ebd
ec61001
cf387ff
88be3c6
7688501
5cbebdd
3589392
f8cdf5c
dfdbf32
b7785ff
dce346c
4c0db6a
50b1bdf
194f1df
ff9205d
745289d
7907923
ae75417
dc629f5
2bf2610
a19748d
a8abf92
944ee37
09c07bd
3a40621
00cf754
ea808b3
009b677
0cdc586
600df34
b42cd6c
d3a84b3
ddb0ded
81291b8
537d9ff
8c20f66
86dc4d9
82c9a7c
945f92e
6f41e3a
0b32773
1a65f5b
444c03f
234c760
9d4dd3d
08ce7e9
b521400
6e95d6c
2912156
0509a41
201de20
0116e33
076c46a
a71b6be
693d8f0
9313d39
87be981
9d16b90
529dd1b
bb417f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
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= |
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) |
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 |
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/ |
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 |
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" |
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" | ||
} | ||
} |
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" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Default values | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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``` There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
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 |
There was a problem hiding this comment.
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.