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

Feature/second round audit review #79

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
3256d9f
create new contract that represents stETH on L2
kovalgek Oct 10, 2023
e4b2cbd
add wrap/unwrap functions
kovalgek Oct 11, 2023
82038ea
add shares to rebasable token
kovalgek Oct 13, 2023
380caaa
add unit tests
kovalgek Oct 17, 2023
eab8718
add deposit flow for new rebasable token
kovalgek Nov 4, 2023
c3bc0db
add withdraw flow for rebasable token on optimism
kovalgek Nov 5, 2023
eb98d0b
send rate in data and time during deposit flow
kovalgek Nov 9, 2023
800e33f
add possibility to depost 0 tokens
kovalgek Nov 9, 2023
d9ac556
init structs
kovalgek Nov 9, 2023
ddb9ca3
add comments
kovalgek Dec 11, 2023
a73bcf4
add gas test
kovalgek Dec 11, 2023
6d37edc
update gas test
kovalgek Dec 12, 2023
8098fe1
fix tests
kovalgek Dec 16, 2023
3335339
add token rate oracle
kovalgek Dec 20, 2023
86037dc
add tests for new token, renaming
kovalgek Dec 24, 2023
86788b2
simplify oracle, remove warnings
kovalgek Dec 27, 2023
ddffe1f
update unit tests for token rate oracle
kovalgek Dec 28, 2023
7c79d2d
fix integration tests for rebasable token
kovalgek Jan 9, 2024
6174943
Merge branch 'main' into feature/add_stETH_token_to_optimism
kovalgek Jan 9, 2024
f0b891a
add test for push token rate method
kovalgek Jan 9, 2024
e314bb1
unused return values fix
kovalgek Jan 9, 2024
4b56ccf
fix deployment scripts for new oracle and token
kovalgek Jan 9, 2024
3b82da7
add hearbeat to oracle
kovalgek Jan 10, 2024
171db5a
pr fixes from first rount review: apply unstructured storage in token…
kovalgek Jan 22, 2024
76b4ff3
PR fixes: fix comments, rename interface, abstract wst
kovalgek Jan 29, 2024
7abf60f
use real implemnations of non rebasable token and oracle contracts in…
kovalgek Feb 2, 2024
707da9b
update unit tests for bridges
kovalgek Feb 8, 2024
1cb344a
fix evetns + formating
kovalgek Feb 13, 2024
f9463f0
Merge branch 'main' into feature/add_stETH_token_to_optimism
kovalgek Feb 29, 2024
3fd1e94
move token rate to the base contract
kovalgek Mar 6, 2024
66b2501
use inheritance for token rate in l1 bridge, fix e2e tests
kovalgek Mar 6, 2024
7badd9e
add rebasable token e2e tests
kovalgek Mar 6, 2024
72bc8f3
add bridging-to e2e tests for rebasable token
kovalgek Mar 6, 2024
83e292b
add token rate observer
kovalgek Mar 7, 2024
dbf2f92
add observers array
kovalgek Mar 14, 2024
47c50c6
add factory and tests
kovalgek Mar 18, 2024
7e45410
add unit tests for notifier
kovalgek Mar 19, 2024
55111b8
add token rate pusher
kovalgek Mar 22, 2024
d99a52f
update unit tests for token rate oracle
kovalgek Mar 22, 2024
fb3eb40
remove observer array
kovalgek Mar 22, 2024
b167ebd
fix token rate publicher and notifier unit tests
kovalgek Mar 22, 2024
55d2e3f
fix small comments from PR review
kovalgek Mar 22, 2024
13712ca
feat(steth): intermediate work on adding ERC-2612/EIP-1271 permit
arwer13 Mar 27, 2024
6a46704
update optimism sdk version to fix integration tests
kovalgek Mar 29, 2024
b9d5e56
update addresses to run e2e tests
kovalgek Mar 29, 2024
a3f4544
fix integration test
kovalgek Mar 29, 2024
e2c29e0
deployment scripts
kovalgek Apr 1, 2024
d28d53d
Merge branch 'feature/add_stETH_token_to_optimism' into feat/steth-pe…
arwer13 Apr 1, 2024
0d2df1d
add token rate oracle integration tests
kovalgek Apr 1, 2024
8dc246e
fix happy path test for permit for rebasable
arwer13 Apr 2, 2024
ba0b41e
test(rebasable permit): move the rest tests from core stethpermit.tes…
arwer13 Apr 2, 2024
18a1dc5
add e2e tests for oracle
kovalgek Apr 2, 2024
624219c
Merge pull request #74 from lidofinance/feat/steth-permit
kovalgek Apr 2, 2024
5f86091
remove increaseAllowance and decreaseAllowance from tokens
kovalgek Apr 3, 2024
cc868ef
change function names
kovalgek Apr 3, 2024
06d00c7
rename stETH to rebasable token in env
kovalgek Apr 3, 2024
0b22b0f
deploy all script, refactor other deploy scripts
kovalgek Apr 8, 2024
f563fab
add permit to non-rebasable token
kovalgek Apr 9, 2024
3332e30
add unit tests for non-rebasable token
kovalgek Apr 10, 2024
0545e33
PR fixes: fix comments, readme, rename bridges, notifier refactoring
kovalgek Apr 10, 2024
a55b5f0
use mapping for tokens in bridges
kovalgek Apr 15, 2024
f54eecd
fix bridge unit and integration tests, remove mapping in storing toke…
kovalgek Apr 15, 2024
bc1c56f
fix scripts
kovalgek Apr 15, 2024
b62fbee
PR fixes: add comments, rename constracts, more interfaces to contrac…
kovalgek Apr 15, 2024
11c2b04
Bump undici from 5.26.3 to 5.28.4
dependabot[bot] Apr 16, 2024
d13586b
remove arbitrum folders
kovalgek Apr 16, 2024
ac8e584
remove arbitrum in configs and scripts
kovalgek Apr 16, 2024
f387de6
PR fixes: rename tokens, add sanity check to oracle update, add unit …
kovalgek Apr 16, 2024
135968a
remove goerli leftovers, 0.6.11 solidity config
kovalgek Apr 17, 2024
83dbf25
Merge pull request #2 from lidofinance/remove_arbitrum
TheDZhon Apr 17, 2024
d4672ae
fix: Make storage-layout up to date
TheDZhon Apr 17, 2024
c721357
Merge pull request #6 from lidofinance/update-storage-layout-main
TheDZhon Apr 17, 2024
d09fa77
Merge pull request #1 from lidofinance/dependabot/npm_and_yarn/undici…
TheDZhon Apr 17, 2024
171f19b
Merge branch 'main' into feature/rebasable_token
kovalgek Apr 17, 2024
06768b6
remove arbitrum leftovers after mergin
kovalgek Apr 17, 2024
5d26aab
update package lock
kovalgek Apr 17, 2024
e587c93
Merge branch 'main' into feature/rebasable_token
kovalgek Apr 17, 2024
6a5257d
fix: Make storage-layout up to date
TheDZhon Apr 17, 2024
b1963d3
Merge pull request #8 from lidofinance/update-storage-layout-feature/…
TheDZhon Apr 17, 2024
ea6fcd7
fix: update npm locks
TheDZhon Apr 17, 2024
0ef8c86
use unstrucured storage in PermitExtension, add initializers to permi…
kovalgek Apr 17, 2024
e2cf92f
remove OZ 4.9
kovalgek Apr 17, 2024
fa0fc29
remove unused contract
kovalgek Apr 17, 2024
429aa7e
refactor bridges
kovalgek Apr 17, 2024
68066b9
remove unused function
kovalgek Apr 17, 2024
84ed665
set default value in config example
kovalgek Apr 17, 2024
58fb55f
use unstructured storage in token rate oracle
kovalgek Apr 17, 2024
4ac5b44
add transferShares and transferSharesFrom to rebasable token, unit tests
kovalgek Apr 18, 2024
1cf4329
add Versioned contract
kovalgek Apr 21, 2024
16b6484
disable initializers
kovalgek Apr 21, 2024
b6dd6a2
disable initializers for bridges
kovalgek Apr 21, 2024
f310a3e
rename variables
kovalgek Apr 21, 2024
1b8cd59
fix tests
kovalgek Apr 21, 2024
0e222ec
change filters for updating token rate
kovalgek Apr 21, 2024
4d16767
fix initilization
kovalgek Apr 22, 2024
fad1a4e
fix token rate oracle according to feedback
kovalgek Apr 22, 2024
3f2ef87
fix token rate uptading conditions, add tests for initializer
kovalgek Apr 22, 2024
c10f864
update scripts and tests
kovalgek Apr 23, 2024
8518ca1
fix: Make storage-layout up to date
TheDZhon Apr 23, 2024
c3e8b9e
small fixes and init tests
kovalgek Apr 23, 2024
f2ff45e
Merge pull request #9 from lidofinance/update-storage-layout-feature/…
TheDZhon Apr 23, 2024
792071c
update comments, change functions order, emit additional event when b…
kovalgek Apr 24, 2024
695fa42
add integration tests for zero and 1wei amount of token
kovalgek Apr 24, 2024
689a194
fix critical: mint wstETH and wrap to stETH during stETH deposit and …
kovalgek Apr 29, 2024
737f969
update tests for wrap/unwrap on L2 during deposit/withdrwal
kovalgek Apr 29, 2024
ad309de
refactor and add new integration tests for non rebasable token
kovalgek Apr 29, 2024
e4d45cc
refactor _mintTokens, add new method for rebasable token that can unw…
kovalgek May 1, 2024
ccb3410
remove approval before withdrawal in tests, add new tests for bridgeU…
kovalgek May 1, 2024
b552925
remove bridgeMintShares and bridgeBurnShares methods and rename inter…
kovalgek May 1, 2024
88cf382
remove tests for bridgeBurnShares and bridgeMintShares
kovalgek May 1, 2024
d49322a
add bridgeWrap, setup infinite allowance l2 bridge for bridged token,…
kovalgek May 2, 2024
e965a88
add tests for bridgeWrap
kovalgek May 2, 2024
a3abe91
rename interface
kovalgek May 2, 2024
d2bc0a1
fix comments in few contracts
kovalgek May 2, 2024
9d6f66c
Merge pull request #10 from lidofinance/feature/rebasable_token_fix_w…
kovalgek May 2, 2024
205cd67
add unwrapShares method to rebasable roken, add tests
kovalgek May 8, 2024
b68c9a5
check name and symbol for emptyness during initialization, tests
kovalgek May 8, 2024
752bb46
add comment for CEXes
kovalgek May 8, 2024
f00015b
check maxAllowedTokenRateDeviationPerDay in oracle
kovalgek May 8, 2024
af27454
optimisations: skip token rate range if value the same, improve remov…
kovalgek May 9, 2024
ccaa023
small improvements: unnecessary spaces, add comments, remove unused f…
kovalgek May 9, 2024
6795332
setup token rate oracle decimals in rebasable token constructor
kovalgek May 9, 2024
560a382
upgrade comment
kovalgek May 9, 2024
47c729d
check if bridge is zero address
kovalgek May 9, 2024
a5a3da5
check time and rate in init, fix rate deviation calculation, tests
kovalgek May 10, 2024
eba565f
change rate and time restrictions during init
kovalgek May 10, 2024
2f895fa
additional test to prove that it is imposible to init afer upgrade
kovalgek May 11, 2024
be90d6b
check that withdrawTo doesn't allow to withdraw to stETH on L1 address
kovalgek May 11, 2024
b497031
remove bottom limit of l2 blocktime in oracle init
kovalgek May 12, 2024
4b301e8
fix comments, error names, refactor token rate oracle and l2bridge
kovalgek May 15, 2024
d48ce20
remove token rate from event about wrong l1 time
kovalgek May 15, 2024
5c48830
update comment
kovalgek May 16, 2024
34ac185
use min/max functions
kovalgek May 16, 2024
64c8b98
don't allow to call initialize on prev deployed contract
kovalgek May 16, 2024
c95fdad
draft: change rate reporting approach
TheDZhon May 16, 2024
d4a19da
Merge branch 'feature/rebasable_token_mixbytes_audit_fixes' into draf…
kovalgek May 16, 2024
7019875
split l1 bridge and token pusher connection to be able to deploy orac…
kovalgek May 20, 2024
c2d3650
fix tests
kovalgek May 20, 2024
e55068e
refactor scripts
kovalgek May 20, 2024
a9e4df1
add tests for large amount of tokens
kovalgek May 22, 2024
6c5f357
add logs to scipts
kovalgek May 22, 2024
e6888cc
emit correct amount of token during unwrap and bridgeUnwrap
kovalgek May 22, 2024
5ea0159
emit correct events, fix comment, remove unsued code
kovalgek May 22, 2024
e137a55
fix: change event name for rate timestamp update
TheDZhon May 22, 2024
2830a6d
Merge pull request #12 from lidofinance/draft/change-rate-reporting
TheDZhon May 22, 2024
7369c2e
additional checks in constructors
kovalgek May 23, 2024
6d653c6
Merge branch 'feature/rebasable_token_mixbytes_audit_fixes' into feat…
kovalgek May 23, 2024
e2ec2b4
add new permit method with signature
kovalgek May 23, 2024
d69127f
Merge pull request #13 from lidofinance/feature/ackee_fixes
TheDZhon May 24, 2024
8958868
remove unused library
kovalgek May 27, 2024
5022c96
revert approve event changes
kovalgek May 27, 2024
074dee0
draft
kovalgek May 27, 2024
5ce9749
update pause/unpause logic
kovalgek May 27, 2024
6ddbdb5
update comments, add external methods
kovalgek May 28, 2024
ee950e4
add additional checks
kovalgek May 28, 2024
c4c14f1
fix tests
kovalgek May 28, 2024
48f3106
return instead of revert when updates are paused
kovalgek May 28, 2024
5bc7a43
add tests, small improvements in pause
kovalgek May 29, 2024
e54f586
rename constants, add comments, don't allow often rate updates
kovalgek May 30, 2024
a1f2587
add tests for double pause/unpause
kovalgek May 30, 2024
be9775f
Merge pull request #14 from lidofinance/feature/pause_token_rate
kovalgek May 31, 2024
b68fbaf
fix comments, small refactoring, rename events, constants
kovalgek May 31, 2024
a479315
Merge pull request #11 from lidofinance/feature/rebasable_token_mixby…
kovalgek May 31, 2024
6fba907
check admin address during initialization in bridges, fix indentation…
kovalgek Jun 6, 2024
a31049a
Merge pull request #15 from lidofinance/feature/ackee_fixes_1_1
kovalgek Jun 6, 2024
baf9859
update upgrade/deploy scripts
kovalgek Jun 11, 2024
12333ef
add permission to handle toekn rate report by token rate notifier
kovalgek Jun 14, 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
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 4

[*.{js,ts,yml,json,cjs}]
indent_size = 2
max_line_length = 120
57 changes: 38 additions & 19 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,57 @@
# ############################

RPC_ETH_MAINNET=
RPC_ETH_GOERLI=
RPC_ETH_SEPOLIA=

RPC_OPT_MAINNET=https://mainnet.optimism.io
RPC_OPT_GOERLI=https://goerli.optimism.io

RPC_ARB_MAINNET=https://arb1.arbitrum.io/rpc
RPC_ARB_GOERLI=https://goerli-rollup.arbitrum.io/rpc
RPC_OPT_SEPOLIA=https://sepolia.optimism.io

# ############################
# Etherscan
# ############################

ETHERSCAN_API_KEY_ETH=
ETHERSCAN_API_KEY_ARB=
ETHERSCAN_API_KEY_OPT=

# ############################
# Bridge/Gateway Deployment
# ############################

# Address of the token to deploy the bridge/gateway for
# Address of the token on L1 to deploy the bridge/gateway for
TOKEN=

# Address of the rebasable token on L1 to deploy the bridge/gateway for
REBASABLE_TOKEN=

# Address of token rate pusher. Required to config TokenRateOracle.
L1_OP_STACK_TOKEN_RATE_PUSHER=

# Gas limit required to complete pushing token rate on L2.
# Default is: 300_000.
# This value was calculated by formula:
# l2GasLimit = (gas cost of L2Bridge.finalizeDeposit() + OptimismPortal.minimumGasLimit(depositData.length)) * 1.5
L2_GAS_LIMIT_FOR_PUSHING_TOKEN_RATE=300000

# A time period when token rate can be considered outdated.
TOKEN_RATE_OUTDATED_DELAY=86400 # default is 86400 (24 hours)

# Address of L1 token bridge proxy.
L1_TOKEN_BRIDGE=

# Address of L2 token bridge proxy.
L2_TOKEN_BRIDGE=

# Address of the non-rebasable token proxy on L2.
L2_TOKEN=

# Address of token rate oracle on L2
L2_TOKEN_RATE_ORACLE=

# Address of bridge executor.
GOV_BRIDGE_EXECUTOR=

# Name of the network environments used by deployment scripts.
# Might be one of: "mainnet", "goerli".
# Might be one of: "mainnet", "sepolia".
NETWORK=mainnet

# Run deployment in the forking network instead of public ones
Expand All @@ -38,7 +64,6 @@ FORKING=true
# Private key of the deployer account used for deployment process
ETH_DEPLOYER_PRIVATE_KEY=
OPT_DEPLOYER_PRIVATE_KEY=
ARB_DEPLOYER_PRIVATE_KEY=

L1_DEV_MULTISIG=
L1_PROXY_ADMIN=
Expand All @@ -63,17 +88,13 @@ L2_WITHDRAWALS_DISABLERS=[]
# Integration Acceptance & E2E Testing
# ############################

TESTING_ARB_NETWORK=
TESTING_ARB_L1_TOKEN=0x7AEE39c46f20135114e85A03C02aB4FE73fB8127
TESTING_ARB_L2_TOKEN=0x775ede8029C117effce283b3391E420EacF3c85F
TESTING_ARB_L1_ERC20_TOKEN_GATEWAY=0x0A7e12b563Ba623646a31a09F0182e8aD45D6cfD
TESTING_ARB_L2_ERC20_TOKEN_GATEWAY=0x8c269989D839eE9DaEe64D57C8c41404DF87F722
TESTING_ARB_L1_GATEWAY_ROUTER=0xa2a8F940752aDc4A3278B63B96d56D72D2b075B1
TESTING_ARB_L2_GATEWAY_ROUTER=0x57f54f87C44d816f60b92864e23b8c0897D4d81D

TESTING_OPT_NETWORK=
TESTING_OPT_L1_TOKEN=0xaF8a2F0aE374b03376155BF745A3421Dac711C12
TESTING_OPT_L2_TOKEN=0xAED5F9aaF167923D34174b8E636aaF040A11f6F7
TESTING_OPT_L1_TOKEN_RATE_NOTIFIER=0x554f2C7D58522c050d38Ebea4FF072ED7C4e61cb
TESTING_OPT_L1_REBASABLE_TOKEN=0xB82381A3fBD3FaFA77B3a7bE693342618240067b
TESTING_OPT_L2_REBASABLE_TOKEN=0x6696Cb7bb602FC744254Ad9E07EfC474FBF78857
TESTING_OPT_L2_TOKEN_RATE_ORACLE=0x8ea513d1e5Be31fb5FC2f2971897594720de9E70
TESTING_OPT_L1_ERC20_TOKEN_BRIDGE=0x243b661276670bD17399C488E7287ea4D416115b
TESTING_OPT_L2_ERC20_TOKEN_BRIDGE=0x447CD1794d209Ac4E6B4097B34658bc00C4d0a51

Expand All @@ -84,7 +105,6 @@ TESTING_OPT_L2_ERC20_TOKEN_BRIDGE=0x447CD1794d209Ac4E6B4097B34658bc00C4d0a51
TESTING_USE_DEPLOYED_CONTRACTS=false
TESTING_L1_TOKENS_HOLDER=

TESTING_ARB_GOV_BRIDGE_EXECUTOR=
TESTING_OPT_GOV_BRIDGE_EXECUTOR=

# ############################
Expand All @@ -93,4 +113,3 @@ TESTING_OPT_GOV_BRIDGE_EXECUTOR=

TESTING_PRIVATE_KEY=
TESTING_OPT_LDO_HOLDER_PRIVATE_KEY=
TESTING_ARB_LDO_HOLDER_PRIVATE_KEY=
75 changes: 0 additions & 75 deletions .env.wsteth.arb_goerli

This file was deleted.

75 changes: 0 additions & 75 deletions .env.wsteth.arb_mainnet

This file was deleted.

71 changes: 0 additions & 71 deletions .env.wsteth.opt_goerli

This file was deleted.

5 changes: 4 additions & 1 deletion .env.wsteth.opt_mainnet
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ ETHERSCAN_API_KEY_OPT=
# Address of the token to deploy the bridge/gateway for
TOKEN=0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0

# Address of the rebasable token to deploy the bridge/gateway for
REBASABLE_TOKEN=

# Name of the network environments used by deployment scripts.
# Might be one of: "mainnet", "goerli".
# Might be one of: "mainnet", "sepolia".
NETWORK=mainnet

# Run deployment in the forking network instead of public ones
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/verify-bytecode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,3 @@ jobs:
file: artifacts-opt.json
rpcUrl: ${{ secrets.OPTIMISM_RPC }}

- name: Verify bytecode of contracts on Arbitrum chain
uses: lidofinance/action-verify-bytecode@master
if: always()
with:
file: artifacts-arb.json
rpcUrl: ${{ secrets.ARBITRUM_RPC }}
2 changes: 1 addition & 1 deletion .solcover.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
skipFiles: ["stubs", "optimism/stubs", "proxy/stubs", "arbitrum/stubs"],
skipFiles: ["stubs", "optimism/stubs", "proxy/stubs"],
};
Loading
Loading