-
Notifications
You must be signed in to change notification settings - Fork 39
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
[WIP] Add Rebasable token to Optimism #58
Draft
kovalgek
wants to merge
65
commits into
main
Choose a base branch
from
feature/add_stETH_token_to_optimism
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 12 commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
3256d9f
create new contract that represents stETH on L2
kovalgek e4b2cbd
add wrap/unwrap functions
kovalgek 82038ea
add shares to rebasable token
kovalgek 380caaa
add unit tests
kovalgek eab8718
add deposit flow for new rebasable token
kovalgek c3bc0db
add withdraw flow for rebasable token on optimism
kovalgek eb98d0b
send rate in data and time during deposit flow
kovalgek 800e33f
add possibility to depost 0 tokens
kovalgek d9ac556
init structs
kovalgek ddb9ca3
add comments
kovalgek a73bcf4
add gas test
kovalgek 6d37edc
update gas test
kovalgek 8098fe1
fix tests
kovalgek 3335339
add token rate oracle
kovalgek 86037dc
add tests for new token, renaming
kovalgek 86788b2
simplify oracle, remove warnings
kovalgek ddffe1f
update unit tests for token rate oracle
kovalgek 7c79d2d
fix integration tests for rebasable token
kovalgek 6174943
Merge branch 'main' into feature/add_stETH_token_to_optimism
kovalgek f0b891a
add test for push token rate method
kovalgek e314bb1
unused return values fix
kovalgek 4b56ccf
fix deployment scripts for new oracle and token
kovalgek 3b82da7
add hearbeat to oracle
kovalgek 171db5a
pr fixes from first rount review: apply unstructured storage in token…
kovalgek 76b4ff3
PR fixes: fix comments, rename interface, abstract wst
kovalgek 7abf60f
use real implemnations of non rebasable token and oracle contracts in…
kovalgek 707da9b
update unit tests for bridges
kovalgek 1cb344a
fix evetns + formating
kovalgek f9463f0
Merge branch 'main' into feature/add_stETH_token_to_optimism
kovalgek 3fd1e94
move token rate to the base contract
kovalgek 66b2501
use inheritance for token rate in l1 bridge, fix e2e tests
kovalgek 7badd9e
add rebasable token e2e tests
kovalgek 72bc8f3
add bridging-to e2e tests for rebasable token
kovalgek 83e292b
add token rate observer
kovalgek dbf2f92
add observers array
kovalgek 47c50c6
add factory and tests
kovalgek 7e45410
add unit tests for notifier
kovalgek 55111b8
add token rate pusher
kovalgek d99a52f
update unit tests for token rate oracle
kovalgek fb3eb40
remove observer array
kovalgek b167ebd
fix token rate publicher and notifier unit tests
kovalgek 55d2e3f
fix small comments from PR review
kovalgek 13712ca
feat(steth): intermediate work on adding ERC-2612/EIP-1271 permit
arwer13 6a46704
update optimism sdk version to fix integration tests
kovalgek b9d5e56
update addresses to run e2e tests
kovalgek a3f4544
fix integration test
kovalgek e2c29e0
deployment scripts
kovalgek d28d53d
Merge branch 'feature/add_stETH_token_to_optimism' into feat/steth-pe…
arwer13 0d2df1d
add token rate oracle integration tests
kovalgek 8dc246e
fix happy path test for permit for rebasable
arwer13 ba0b41e
test(rebasable permit): move the rest tests from core stethpermit.tes…
arwer13 18a1dc5
add e2e tests for oracle
kovalgek 624219c
Merge pull request #74 from lidofinance/feat/steth-permit
kovalgek 5f86091
remove increaseAllowance and decreaseAllowance from tokens
kovalgek cc868ef
change function names
kovalgek 06d00c7
rename stETH to rebasable token in env
kovalgek 0b22b0f
deploy all script, refactor other deploy scripts
kovalgek f563fab
add permit to non-rebasable token
kovalgek 3332e30
add unit tests for non-rebasable token
kovalgek 0545e33
PR fixes: fix comments, readme, rename bridges, notifier refactoring
kovalgek a55b5f0
use mapping for tokens in bridges
kovalgek f54eecd
fix bridge unit and integration tests, remove mapping in storing toke…
kovalgek bc1c56f
fix scripts
kovalgek b62fbee
PR fixes: add comments, rename constracts, more interfaces to contrac…
kovalgek f387de6
PR fixes: rename tokens, add sanity check to oracle update, add unit …
kovalgek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// SPDX-FileCopyrightText: 2023 Lido <[email protected]> | ||
kovalgek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity 0.8.10; | ||
|
||
contract DepositDataCodec { | ||
kovalgek marked this conversation as resolved.
Show resolved
Hide resolved
folkyatina marked this conversation as resolved.
Show resolved
Hide resolved
kovalgek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
struct DepositData { | ||
uint256 rate; | ||
uint256 time; | ||
bytes data; | ||
} | ||
|
||
function encodeDepositData(DepositData memory depositData) internal pure returns (bytes memory) { | ||
bytes memory data = bytes.concat( | ||
abi.encodePacked(depositData.rate), | ||
abi.encodePacked(depositData.time), | ||
abi.encodePacked(depositData.data) | ||
); | ||
return data; | ||
} | ||
|
||
function decodeDepositData(bytes calldata buffer) internal pure returns (DepositData memory) { | ||
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. later on would be great to fuzz these methods |
||
|
||
if (buffer.length < 32 * 2) { | ||
revert ErrorDepositDataLength(); | ||
} | ||
|
||
DepositData memory depositData = DepositData({ | ||
rate: uint256(bytes32(buffer[0:32])), | ||
time: uint256(bytes32(buffer[32:64])), | ||
data: buffer[64:] | ||
}); | ||
|
||
return depositData; | ||
} | ||
|
||
error ErrorDepositDataLength(); | ||
} | ||
kovalgek marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There is an attack vector of asynchronous bridge upgrades
E.g., suppose L2 has been updated while L1 hasn't been yet
This case anyone would be able to pass arbitrary
tokenRate
andtimestamp
disrupting operations and breaking the protocol's invariants on L2.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.
Vise versa, if L1 upgraded and L2 is not, then stETH deposits would lead to funds being stuck on the L1 bridge