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

Internal review #3

Closed
wants to merge 94 commits into from
Closed
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
899634c
forge install: forge-std
kasperpawlowski Jul 18, 2023
06dd594
initial commit
kasperpawlowski Aug 21, 2023
be8b505
rework
kasperpawlowski Nov 29, 2023
3da999e
feat: first tests
kasperpawlowski Jan 23, 2024
8df9e88
feat: project rename
kasperpawlowski Jan 23, 2024
7b2e4e5
feat: add MockERC20BalanceForwarder
kasperpawlowski Jan 23, 2024
b87d458
fix: bugs revealed while testing
kasperpawlowski Jan 24, 2024
a6136e4
fix: interface and functions visibility
kasperpawlowski Jan 24, 2024
3ad232d
optimizations + tests
kasperpawlowski Jan 25, 2024
a37025f
fix: minor improvements
kasperpawlowski Jan 25, 2024
9547904
feat: improve coverage
kasperpawlowski Jan 25, 2024
0f4b6b8
feat: readme
kasperpawlowski Jan 25, 2024
80ee09a
fix: RewardRegistered event
kasperpawlowski Jan 25, 2024
6645bc5
feat: references
kasperpawlowski Jan 26, 2024
634f0d8
fix: move references
kasperpawlowski Jan 26, 2024
36ea806
fix: readme improvements
kasperpawlowski Jan 26, 2024
09e07c2
fix: docs
kasperpawlowski Jan 26, 2024
eee02a6
feat: storage optimizations
kasperpawlowski Jan 26, 2024
94b220c
fix: refactor
kasperpawlowski Jan 26, 2024
8fc1c54
feat: optimizations
kasperpawlowski Jan 26, 2024
ebbfbe9
fix: cleanup
kasperpawlowski Jan 27, 2024
31e0365
further optimizations
kasperpawlowski Jan 27, 2024
efa627a
feat: update to the recent EVC
kasperpawlowski Feb 1, 2024
f5a1d21
chore: update
kasperpawlowski Feb 15, 2024
0612eb5
fix: prevent overflow
kasperpawlowski Feb 15, 2024
2d8bca2
fix: minor optimizations
kasperpawlowski Feb 15, 2024
765666d
fix: as per review remarks
kasperpawlowski Mar 7, 2024
ef704b9
A couple more comments and changes
Mar 8, 2024
8666d10
More comments
Mar 8, 2024
c6661d4
A bit of natspec to point out that rewards must be allocated
Mar 8, 2024
1d21751
fix: as per review remarks
kasperpawlowski Mar 8, 2024
379f626
Merge pull request #2 from euler-xyz/review-alberto-2
kasperpawlowski Mar 8, 2024
6f64f04
fix: change uint40 to uint48 for timestamps and epochs, increase opti…
kasperpawlowski Mar 11, 2024
877e2ac
fix remappings, expose EPOCH_DURATION function in the interface
kasperpawlowski Mar 20, 2024
b17c2ce
fix: remappings
kasperpawlowski Apr 1, 2024
066ec49
fix: improve tests vm.assume
kasperpawlowski Apr 2, 2024
7781676
chore: add mappings optimizations
kasperpawlowski Apr 2, 2024
8d8c1bc
chore: change name from staking-free to tracking distributor
kasperpawlowski Apr 2, 2024
2719205
fix: improvements as per review comments
kasperpawlowski Apr 2, 2024
7c1d88e
chore: add coverage script
kasperpawlowski Apr 3, 2024
1c9d92d
fix: minor improvement
kasperpawlowski Apr 3, 2024
3aef69f
chore: add more tests
kasperpawlowski Apr 3, 2024
6b197d8
fix: review remarks
kasperpawlowski Apr 11, 2024
65c41a5
Merge pull request #4 from euler-xyz/review-fix
kasperpawlowski Apr 11, 2024
609930c
Review remarks fix
kasperpawlowski Apr 12, 2024
86eee69
Merge pull request #5 from euler-xyz/review-fix
kasperpawlowski Apr 12, 2024
0f4af22
fix: simplify the logic at the gas expense
kasperpawlowski Apr 18, 2024
4376f27
fix: add additional cast
kasperpawlowski Apr 18, 2024
42dd739
fix: reuse the public function for clarity
kasperpawlowski Apr 18, 2024
959e211
simplify reward write logic
hoytech Apr 18, 2024
5bc5fce
fmt
hoytech Apr 18, 2024
b9e5dc6
storeAmounts is only used once, inline it
hoytech Apr 18, 2024
0c1e4bc
fix: gas optimizations
kasperpawlowski Apr 19, 2024
df7b037
chore: fix solidity version
kasperpawlowski Apr 19, 2024
809c1c0
chore: update dependencies
kasperpawlowski Apr 19, 2024
9d5c628
chore: add tests ci
kasperpawlowski Apr 19, 2024
612ee63
fix: overall cosmetic improvements
kasperpawlowski Apr 19, 2024
f3b2da7
Merge pull request #7 from euler-xyz/ci
kasperpawlowski Apr 19, 2024
b6ee0e9
fix: phantom test failures
totomanov Apr 19, 2024
d00916e
Merge pull request #8 from euler-xyz/fix-test-address-fuzzing
kasperpawlowski Apr 19, 2024
03281e3
fix: add increaseRewardAmounts
kasperpawlowski Apr 19, 2024
9063858
Merge pull request #6 from euler-xyz/review-fix
kasperpawlowski Apr 23, 2024
d9d88b4
feat: storage optimization
totomanov Apr 23, 2024
3f681cd
feat: more pointer optimizations
totomanov Apr 23, 2024
e7d92fb
docs: natspec
totomanov Apr 23, 2024
de419fe
chore: rm commented out line
totomanov Apr 23, 2024
f4dd615
feat: unify totalsStorage
totomanov Apr 23, 2024
025d6f6
feat: simplify reward updating
totomanov Apr 23, 2024
34eabbd
feat: pack distribution amounts
totomanov Apr 23, 2024
1f2faaa
feat: optimize reward amounts calculation
totomanov Apr 23, 2024
8b8674c
chore: various nits
totomanov Apr 23, 2024
a2e30d5
docs: natspec nits
totomanov Apr 23, 2024
7565b7c
feat: simplify claim
totomanov Apr 23, 2024
f874edc
docs: add missing natspec
totomanov Apr 23, 2024
56e50f6
test: improve fuzzing
totomanov Apr 23, 2024
850b76e
optimize: _timeElapsedInEpoch for hot path
totomanov Apr 23, 2024
987367b
add assertion back
totomanov Apr 23, 2024
68ec8e5
revert: assertion in claim
totomanov Apr 23, 2024
a0322b0
nit: fix typo
totomanov Apr 24, 2024
d31fdce
nit: word order
totomanov Apr 24, 2024
a6e1f32
revert: add back assert in claim
totomanov Apr 24, 2024
59d34c3
feat: use `EarnStorage storage` in `calculateRewards`, return `claima…
totomanov Apr 24, 2024
2f30814
fix: overall improvements
kasperpawlowski Apr 24, 2024
595d581
Merge pull request #9 from euler-xyz/feat/storage-optimization
kasperpawlowski Apr 24, 2024
2b24afc
chore: add license file
kasperpawlowski Apr 25, 2024
f216a06
Merge pull request #10 from euler-xyz/license
kasperpawlowski Apr 25, 2024
00e46d6
chore: remove .solhint.json
kasperpawlowski Apr 25, 2024
fb8f962
Merge pull request #11 from euler-xyz/solhint-remove
kasperpawlowski Apr 25, 2024
8023219
nits: readability improvements
totomanov Apr 30, 2024
5f87550
docs: update natspec
totomanov Apr 30, 2024
f9c9d47
nit: IRewardStreams order
totomanov Apr 30, 2024
334083d
Merge pull request #12 from euler-xyz/pre-audit-nits
kasperpawlowski Apr 30, 2024
67b6001
Restore encapsulation of distributions layout, broken by gas optimisa…
hoytech Apr 30, 2024
efcee13
Merge pull request #13 from euler-xyz/restore-encapsulation
kasperpawlowski Apr 30, 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
26 changes: 22 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# IDE - VSCode
.vscode/

# Logs
logs/
*.log

# Dependency directories
node_modules/

# Optional npm cache directory
.npm/

# Compiler files
cache/
out/
Expand All @@ -7,8 +20,13 @@ out/
/broadcast/*/31337/
/broadcast/**/dry-run/

# Docs
docs/

# Dotenv file
.env
*.env

# System Files
.DS_Store
Thumbs.db

# Coverage
coverage/
*.info
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
[submodule "lib/ethereum-vault-connector"]
path = lib/ethereum-vault-connector
url = https://github.com/euler-xyz/ethereum-vault-connector
5 changes: 5 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"private-vars-leading-underscore": ["off",{"strict":false}]
}
}
198 changes: 198 additions & 0 deletions README.md

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# generates lcov.info
forge coverage --report lcov --no-match-test testFork

if ! command -v lcov &>/dev/null; then
echo "lcov is not installed. Installing..."
# check if its macos or linux.
if [ "$(uname)" == "Darwin" ]; then
brew install lcov
else
sudo apt-get install lcov
fi
fi

lcov --version

# forge does not instrument libraries https://github.com/foundry-rs/foundry/issues/4854
EXCLUDE="*test* *mock* *node_modules* $(grep -r 'library' contracts -l)"
lcov --rc lcov_branch_coverage=1 \
--output-file forge-pruned-lcov.info \
--remove lcov.info $EXCLUDE

if [ "$CI" != "true" ]; then
genhtml --rc lcov_branch_coverage=1 \
--ignore-errors category \
--output-directory coverage forge-pruned-lcov.info \
&& open coverage/index.html
fi
26 changes: 25 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,29 @@
src = "src"
out = "out"
libs = ["lib"]
solc = "0.8.24"
optimizer_runs = 100000
remappings = [
"forge-std/=lib/forge-std/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/contracts",
"evc/=lib/ethereum-vault-connector/src"
]

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
[profile.default.fuzz]
max_test_rejects = 1_000_000
runs = 1000
seed = "0xee1d0f7d9556539a9c0e26aed5e63556"

[profile.default.fmt]
line_length = 120
tab_width = 4
bracket_spacing = false
int_types = "long"
multiline_func_header = "params_first"
quote_style = "double"
number_underscore = "preserve"
override_spacing = true
wrap_comments = true
ignore = [
"src/interfaces/IRewardStreams.sol"
]
1 change: 1 addition & 0 deletions lib/ethereum-vault-connector
1 change: 1 addition & 0 deletions lib/forge-std
Submodule forge-std added at e4aef9
1 change: 1 addition & 0 deletions lib/openzeppelin-contracts
Submodule openzeppelin-contracts added at 11dc5e
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "euler-rewards",
"version": "1.0.0",
"main": "index.js",
"author": "Euler Labs",
"license": "MIT",
"scripts": {},
"devDependencies": {}
}
12 changes: 0 additions & 12 deletions script/Counter.s.sol

This file was deleted.

Empty file added script/placeholder
Empty file.
Loading