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

OZ Audit changes for OETH Withdrawal Queue #2168

Open
wants to merge 238 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
238 commits
Select commit Hold shift + click to select a range
063d8b2
initial commit of the native staking strategy
sparrowDom Apr 4, 2024
6e8332b
fix text
sparrowDom Apr 4, 2024
b933f22
add some more functionality
sparrowDom Apr 10, 2024
0a43d14
finish up the fuse interval test, update deploy script
sparrowDom Apr 11, 2024
d31fe30
some natspec and refactoring
sparrowDom Apr 11, 2024
03c544c
add some more accounting logic
sparrowDom Apr 11, 2024
9aa0d73
finish up accounting and add tests for it
sparrowDom Apr 12, 2024
e99f86c
add some comments
sparrowDom Apr 15, 2024
52ba11e
add tests for manually fixing accounting
sparrowDom Apr 15, 2024
e656ecb
lint and prettier
sparrowDom Apr 15, 2024
fe113a5
undo file delete
sparrowDom Apr 15, 2024
71ad71f
implement the collect rewards function and add tests for it
sparrowDom Apr 16, 2024
2c448bb
implement and test checkBalance
sparrowDom Apr 16, 2024
5d5e9cb
add functions to register and exit/remove the ssv validator
sparrowDom Apr 18, 2024
121c7f7
Native staking updates (#2023)
naddison36 Apr 22, 2024
8a64dc8
Native staking changes (#2024)
naddison36 Apr 23, 2024
8419fc7
Native staking changes and unit tests (#2029)
naddison36 Apr 25, 2024
87c5254
allow for WETH to send ETH to the contract
sparrowDom Apr 26, 2024
1d66508
shorten error message
sparrowDom Apr 26, 2024
00ec878
fix depositing bug
sparrowDom Apr 27, 2024
ec4933b
Holesky deploy (#2026)
sparrowDom Apr 29, 2024
6179cb1
manuallyFixAccounting changes (#2034)
naddison36 Apr 29, 2024
da6a7b5
fix fork tests
sparrowDom Apr 29, 2024
fd17ec9
Merge branch 'master' into sparrowDom/nativeStaking
sparrowDom May 6, 2024
8f7d3d5
prettier
sparrowDom May 6, 2024
967fe49
fix unit test
sparrowDom May 6, 2024
1af324d
mainnet native staking fork tests (#2037)
naddison36 May 7, 2024
ce2ec63
fix unit tests
sparrowDom May 6, 2024
fe12d23
fix global hooks filter
sparrowDom May 7, 2024
c61c9bb
add github workflow
sparrowDom May 7, 2024
7e2e640
another workflow fix
sparrowDom May 7, 2024
af8ea03
another workflow fix
sparrowDom May 7, 2024
32480dd
fix holesky tests
sparrowDom May 7, 2024
0fb09ea
remove the .only
sparrowDom May 7, 2024
c7175bb
prettier
sparrowDom May 7, 2024
69abd8f
Sparrow dom/native staking defender action (#2051)
sparrowDom May 9, 2024
2f7a9cd
Fix fork tests (#2050)
naddison36 May 9, 2024
0623a47
add payable to fee accumulator (#2053)
sparrowDom May 9, 2024
f268742
fix linter
naddison36 May 9, 2024
20d29a1
Fix balancer fork test
naddison36 May 10, 2024
2a93df2
Merge remote-tracking branch 'origin/master' into sparrowDom/nativeSt…
naddison36 May 10, 2024
b898801
Fixed resolveContract for none proxied contracts
naddison36 May 10, 2024
25170aa
simplified woethCcipZapperFixture
naddison36 May 10, 2024
e1ff728
Regenerated latest contract diagrams
naddison36 May 10, 2024
c09cd46
Resolved Slither divide-before-multiply warning
naddison36 May 10, 2024
9d83e97
Native staking deployment to reduceQueueTime
naddison36 May 10, 2024
7eb135b
Fixed fork test harvesting CRV rewards
naddison36 May 10, 2024
579a93c
gas optimisation
sparrowDom May 10, 2024
4c864ca
Merge remote-tracking branch 'origin/master' into sparrowDom/nativeSt…
naddison36 May 10, 2024
e7b96e9
make verification automatic
sparrowDom May 10, 2024
8a53f3e
removed wethToVault from manuallyFixAccounting
naddison36 May 10, 2024
98a193a
Merge remote-tracking branch 'origin/sparrowDom/nativeStaking' into s…
naddison36 May 10, 2024
905abf9
native staking strategy redeployed
sparrowDom May 10, 2024
fc48427
adjust the comment
sparrowDom May 10, 2024
4b51655
add rate limit to calling manually fix accounting (#2057)
sparrowDom May 13, 2024
657b064
Correct deployName in Native Staking deploy script
naddison36 May 13, 2024
769018a
Fix linter
naddison36 May 13, 2024
b98e9de
Remove approveAssets on Swapper contract in 095_ogn_buyback script as…
naddison36 May 13, 2024
622a3b4
Fix Holesky fork tests
naddison36 May 13, 2024
c25745d
Fix mainnet fork tests
naddison36 May 13, 2024
4ca3136
skip deploy 095_ogn_buyback for now
naddison36 May 13, 2024
37c9d0a
fix some Slither errors
naddison36 May 13, 2024
193af2f
Fix Slither warnings
naddison36 May 13, 2024
6d5034a
Upgrade the CI to use node.js 20.x
naddison36 May 13, 2024
848d578
Fix CI
naddison36 May 13, 2024
79d5058
Fix CI
naddison36 May 13, 2024
7b7ac39
Upgrade to node.js 20
naddison36 May 13, 2024
6b2be67
Still upgrade the buyback contracts but not approveAssets on the swapper
naddison36 May 13, 2024
5f2f8f6
Upgrade actions so they don't use node.js 16
naddison36 May 13, 2024
6baed9b
attempt to fix holesky fork run
sparrowDom May 13, 2024
9ce05e1
Generated latest contract diagram
naddison36 May 13, 2024
8c052d8
fix codecov upload
naddison36 May 13, 2024
3687fbe
Fix OETH process diagram for native staking
naddison36 May 13, 2024
6df4f5f
add a withdrawal event when withdrawing WETH to vault (#2059)
sparrowDom May 13, 2024
614b11e
Regenerated latest native staking diagram
naddison36 May 13, 2024
21d5569
Merge remote-tracking branch 'origin/master' into sparrowDom/nativeSt…
naddison36 May 13, 2024
8be6f90
Changed vault mint to call to Dripper.collect
naddison36 May 15, 2024
c8288b7
Added more vault mint fork tests
naddison36 May 16, 2024
63a11f7
first implementation of the withdrawal queue
naddison36 May 16, 2024
abe0e9c
Fix Slither
naddison36 May 16, 2024
cfe6a81
add a util contract that is able to recalculate a valid deposit data …
sparrowDom May 16, 2024
3a35b55
Slither fixes
naddison36 May 17, 2024
28ae453
Fix linter
naddison36 May 17, 2024
ad492cc
Updated contract diagram
naddison36 May 17, 2024
4872259
Merge remote-tracking branch 'origin/master' into nicka/oeth-arm
naddison36 May 20, 2024
c491131
Merge remote-tracking branch 'origin/master' into sparrowDom/nativeSt…
naddison36 May 22, 2024
e8c15b5
Prettier native staking test
naddison36 May 22, 2024
acad4b9
Renamed native staking deploy script
naddison36 May 22, 2024
638bf30
Fix event values (#2060)
sparrowDom May 22, 2024
b4e9c3f
Deploy latest Native Staking Strategy to Holesky (#2073)
naddison36 May 22, 2024
77d7b07
Deploy native staking Proxy via Relayer (#2066)
sparrowDom May 22, 2024
4c25093
Setup basic defender action (#2072)
sparrowDom May 22, 2024
c4456b9
Output more contract details in 097 deploy script
naddison36 May 23, 2024
c1922b6
Added claimWithdrawals to OETHVaultCore
naddison36 May 23, 2024
e5ebf29
Merge remote-tracking branch 'origin/sparrowDom/nativeStaking' into n…
naddison36 May 23, 2024
0643034
prettier
naddison36 May 23, 2024
a50f2d2
Add getting WETH from Dripper on mints over rebaseThreshold
naddison36 May 23, 2024
82b4fd1
Restricted OETH's depositToStrategy to only deposit WETH
naddison36 May 23, 2024
10b95df
Fixed unit tests
naddison36 May 23, 2024
f27966b
Suppress Slither
naddison36 May 23, 2024
112dd37
Changed ssv util getClusterInfo to use the SSV API instead of the ssv…
naddison36 May 23, 2024
f3e9d35
Fix Native Staking fork tests
naddison36 May 24, 2024
4e9e24f
Fix Native Staking fork tests
naddison36 May 24, 2024
8cf9a25
Changed ssv util getClusterInfo to use the SSV API instead of the ssv…
naddison36 May 24, 2024
fc09bed
Prettier
naddison36 May 24, 2024
bb3b7e6
ValidatorRegistrator.stakeEth gas improvement when multiple validators
naddison36 May 24, 2024
e163cff
Corrected stakeEth call in OETH processes diagram
naddison36 May 24, 2024
cdb36ef
Merge remote-tracking branch 'origin/sparrowDom/nativeStaking' into n…
naddison36 May 24, 2024
9d302ec
Fixes to withdrawal queue
naddison36 May 24, 2024
ef1c325
Add more withdrawal queue unit tests
naddison36 May 24, 2024
267d045
More withdrawal queue unit tests
naddison36 May 24, 2024
beb9170
Fixed adjusting the vault value for the withdrawal queue
naddison36 May 24, 2024
10259ce
Add more withdrawal queue tests
naddison36 May 24, 2024
dd7632d
Implemented withdrawAll in MockStrategy
naddison36 May 24, 2024
84d9a7f
Fixed bug in claimWithdrawals
naddison36 May 24, 2024
bb8577f
Complete code coverage of OETH Vault unit tests
naddison36 May 24, 2024
e853081
Added fork test for registering a validator twice
naddison36 May 27, 2024
12bba64
Stake funds with confirmations for front-running protection of Beacon…
sparrowDom May 28, 2024
5632653
Merge remote-tracking branch 'origin/sparrowDom/nativeStaking' into n…
naddison36 May 28, 2024
0a0e9da
Updated Buyback value flow for OETH
naddison36 May 28, 2024
93b3cdf
Updated Native staking process diagram
naddison36 May 29, 2024
003fcdb
Updated OETH Vault diagrams
naddison36 May 29, 2024
9295fe7
Add process for pausing the Native Staking Strategy
naddison36 May 29, 2024
8748170
Merge remote-tracking branch 'origin/master' into sparrowDom/nativeSt…
naddison36 May 29, 2024
270a3f6
Removed the redundant condition in the fuse interval check (#2082)
naddison36 Jun 2, 2024
706da2e
OZ - Native Staking - M-01 All Addresses Are Registered Validators by…
naddison36 Jun 2, 2024
71adea7
OZ - Native Staking - N-07 Lack of Indexed Event Parameters (#2083)
naddison36 Jun 2, 2024
8f8118d
Deployed new Native Staking Strategy
naddison36 Jun 2, 2024
d398042
generated latest NativeStakingSSVStrategy docs
naddison36 Jun 2, 2024
b6c2219
P2P API changes (#2084)
naddison36 Jun 2, 2024
81b9359
Merge remote-tracking branch 'origin/sparrowDom/nativeStaking' into n…
naddison36 Jun 2, 2024
49439ec
Hardhat tasks for Native Staking (#2085)
naddison36 Jun 3, 2024
8e75f24
Merge remote-tracking branch 'origin/sparrowDom/nativeStaking' into n…
naddison36 Jun 3, 2024
2081919
bumped the deploy script number
naddison36 Jun 3, 2024
6ecf222
Cap the validators a Native Staking Strategy can hold (#2087)
naddison36 Jun 3, 2024
c807e8d
don't format Defender Action code in dist folder
naddison36 Jun 4, 2024
8ab4317
Merge remote-tracking branch 'origin/sparrowDom/nativeStaking' into n…
naddison36 Jun 4, 2024
7f54c94
Deployed latest NativeStakingSSVStrategy contract to Holesky
naddison36 Jun 4, 2024
c4f2a30
Merge remote-tracking branch 'origin/sparrowDom/nativeStaking' into n…
naddison36 Jun 4, 2024
2c90f9f
Fix deployment file
shahthepro Jun 28, 2024
35c4848
Merge remote-tracking branch 'origin/master' into nicka/oeth-arm
naddison36 Jul 3, 2024
7849b81
Merge remote-tracking branch 'origin/nicka/oeth-arm' into nicka/oeth-arm
naddison36 Jul 3, 2024
d8b0fea
updated deploy number for OETH withdrawal queue
naddison36 Jul 3, 2024
a2dada1
Fixed unit tests
naddison36 Jul 3, 2024
532e9b9
Remove stETH from Vault in OETH Withdrawal Queue deployment is not al…
naddison36 Jul 3, 2024
2075e66
Skipping OETH Vault collateral swaps
naddison36 Jul 3, 2024
4ecffac
Skipping OETH whale redeem in fork tests
naddison36 Jul 3, 2024
f2c278b
Fixed spelling in comments of VaultStorage
naddison36 Jul 3, 2024
8f46a2b
Fail CI if any mainnet fork tests fail
naddison36 Jul 3, 2024
2f90d78
Continue with fork tests if any fail but still fail the CI job
naddison36 Jul 3, 2024
bafeff1
Merge remote-tracking branch 'origin/master' into nicka/oeth-arm
naddison36 Jul 3, 2024
faf9521
increment deploy script number
naddison36 Jul 3, 2024
8094ddd
restore Github Actions config
naddison36 Jul 3, 2024
e811fc7
Updated OETHVaultCore comments
naddison36 Jul 4, 2024
0cd7ac2
Upgraded OETH Vault on Holesky to include the withdrawal queue
naddison36 Jul 4, 2024
ba3c28c
Added Vault requestWithdrawal andclaimWithdrawal Hardhat tasks
naddison36 Jul 4, 2024
39d9a86
OETHVaultCore Natspec updates
naddison36 Jul 4, 2024
4e3a58d
Merge remote-tracking branch 'origin/master' into nicka/oeth-arm
naddison36 Jul 5, 2024
99f17e5
Merge remote-tracking branch 'origin/master' into nicka/oeth-arm
naddison36 Jul 10, 2024
f8d4974
Add 30 minute time delay between request and claim from the OETH With…
clement-ux Jul 12, 2024
b277f36
Merge remote-tracking branch 'origin/master' into nicka/oeth-arm
naddison36 Jul 12, 2024
937a084
fix: test expectRevert with new error message
clement-ux Jul 12, 2024
ae24a1f
Merge remote-tracking branch 'origin/nicka/oeth-arm' into nicka/oeth-arm
naddison36 Jul 12, 2024
b07ce57
Fixed unit tests
naddison36 Jul 12, 2024
bdeb1de
Remove stETH and rETH asset from OETH Vault
naddison36 Jul 14, 2024
25f1b53
Skip legacy strategy tests
naddison36 Jul 14, 2024
3049eff
Skiped legacy Oracle prices
naddison36 Jul 14, 2024
3c9c9ec
Skipped Aura price tests
naddison36 Jul 14, 2024
14746bb
Merge remote-tracking branch 'origin/master' into nicka/oeth-arm
naddison36 Jul 14, 2024
b7a6a10
Merge remote-tracking branch 'origin/master' into nicka/oeth-arm
naddison36 Jul 14, 2024
dc58a1c
Remove rETH as an asset from the Vault
naddison36 Jul 15, 2024
5815778
Merge remote-tracking branch 'origin/master' into nicka/oeth-arm
naddison36 Jul 15, 2024
c607bc7
Added call to cacheWETHAssetIndex after stETH is removed from the Vault
naddison36 Jul 15, 2024
33a5678
Updated vault storage diagrams
naddison36 Jul 15, 2024
cbd6764
Added second native staking strategy as the default for WETH
naddison36 Jul 15, 2024
f93f6ab
Add solvency check. (#2131)
clement-ux Jul 15, 2024
d3de400
Fixed claim Natspec now the delay is in place
naddison36 Jul 16, 2024
ecc2773
Changed console debug in assertUpgradeIsSafe to use logger
naddison36 Jul 16, 2024
74875cd
Updated Natspec
naddison36 Jul 16, 2024
5c2ab55
Assert totalValue in withdrawal queue unit tests
naddison36 Jul 16, 2024
cccc048
Merge remote-tracking branch 'origin/nicka/oeth-arm' into nicka/oeth-arm
naddison36 Jul 16, 2024
6ba210a
Fixed prettier
naddison36 Jul 16, 2024
52b2fe3
Asset vault checkBalance of WETH to OETH Vault unit tests
naddison36 Jul 16, 2024
f9e9fdd
_checkBalance and _totalValue on OETH Vault to protect against insolv…
naddison36 Jul 16, 2024
e85f4fb
Override _totalValueInVault in OETH Vault
naddison36 Jul 16, 2024
8c77769
Removed super._totalValue call
naddison36 Jul 16, 2024
6eda2ed
Fix AMO fork tests
naddison36 Jul 16, 2024
1ab9752
Merge remote-tracking branch 'origin/master' into nicka/oeth-arm
naddison36 Jul 16, 2024
28e3ead
Generated latest OETH Vault diagrams
naddison36 Jul 16, 2024
e86fa11
Don't account for WETH reserved for withdrawal during allocation (#2138)
shahthepro Jul 16, 2024
0f383e0
WIP more unit tests
naddison36 Jul 16, 2024
e66dc12
Added more unit tests
naddison36 Jul 16, 2024
d67d1bf
Merge remote-tracking branch 'origin/nicka/oeth-arm' into nicka/oeth-arm
naddison36 Jul 16, 2024
61ead28
Added more withdrawal unit tests
naddison36 Jul 16, 2024
b0cd078
Fix skipped test
shahthepro Jul 16, 2024
5ac4175
Add extra test to OETH ARM. (#2139)
clement-ux Jul 17, 2024
5b61c2b
fix: reduce delay period between request and claim to 10min. (#2140)
clement-ux Jul 17, 2024
975c3c6
Refactor OETH Vault's `_allocate()` (#2141)
naddison36 Jul 17, 2024
5422808
Add extra test for OETH Withdraw Queue (#2142)
clement-ux Jul 17, 2024
839bde2
Override allocate on OETH Vault so _addWithdrawalQueueLiquidity is no…
naddison36 Jul 18, 2024
5d29d45
Skip waiting for confirmation on Tenderly testnets
shahthepro Jul 18, 2024
bb5a82a
Fix unit tests
shahthepro Jul 18, 2024
8bd687b
Merge remote-tracking branch 'origin/master' into nicka/oeth-arm
naddison36 Jul 22, 2024
9135275
Add snapVault hardhat task
naddison36 Jul 25, 2024
cc6f2f3
Updated insolvency unit tests
naddison36 Jul 26, 2024
133ddcb
Added more insolvency unit tests
naddison36 Jul 26, 2024
fb765e1
Fix _totalValue so it handles when vault value is less than the outst…
naddison36 Jul 26, 2024
f3053f2
Added SafeCast to unit128
naddison36 Jul 26, 2024
22b8b2b
Reject redeems and withdrawals if no available assets due to insolvency
naddison36 Jul 26, 2024
e59268f
Redeem to no longer try and get liquidity from the default strategy i…
naddison36 Jul 26, 2024
74afa41
Simplify _wethAvailable
naddison36 Jul 26, 2024
dc46164
refactor of _claimWithdrawal
naddison36 Jul 26, 2024
4f5a57d
Generated latest OETHVaultCore diagram
naddison36 Jul 26, 2024
193ad6d
Fix Slither
naddison36 Jul 26, 2024
f4de2e6
Updated the other _wethAvailable function
naddison36 Jul 26, 2024
b9d5e00
Set Vault buffer to 0.2%
naddison36 Jul 26, 2024
acf271d
Swapped order in deploy script
naddison36 Jul 26, 2024
5978d6d
Simplify _totalValue logic
naddison36 Jul 29, 2024
6b26be9
Merge remote-tracking branch 'origin/master' into nicka/oeth-arm
naddison36 Jul 29, 2024
faa060a
Moved the burn of OETH lower in the request withdrawal
naddison36 Jul 29, 2024
d16970d
Added reentrant protection to addWithdrawalQueueLiquidity
naddison36 Jul 29, 2024
b6a2fbb
Refactor _addWithdrawalQueueLiquidity
naddison36 Jul 29, 2024
0ad9592
Added vault buffer to snapVault Hardhat task
naddison36 Jul 29, 2024
eca6ffa
Merge remote-tracking branch 'origin/master' into nicka/oeth-arm
naddison36 Jul 29, 2024
f9a2c80
M-01 _checkBalance Returns an Incorrect Value During Insolvency (#2166)
naddison36 Aug 6, 2024
f82a54d
Fix vault storage slots (#2167)
naddison36 Aug 6, 2024
b2d3e9c
L-03 Missing Docstrings (#2169)
naddison36 Aug 6, 2024
ecd480f
Fixed Natspec on requestWithdrawal (#2170)
naddison36 Aug 6, 2024
4c746ae
Changed _requestIds param in claimWithdrawals be of type calldata (#2…
naddison36 Aug 6, 2024
7bdbfd8
Remove unnecessary address cast (#2172)
naddison36 Aug 6, 2024
3b66f03
Updated Natpsec of _checkBalance and _checkBalance (#2173)
naddison36 Aug 6, 2024
afb03d8
made constant CLAIM_DELAY public (#2174)
naddison36 Aug 6, 2024
edaf36e
Removed unused MAX_UINT constant (#2175)
naddison36 Aug 6, 2024
3e6b68e
N-08 Variables Are Initialized to Their Default Values (#2176)
naddison36 Aug 6, 2024
49f15a5
Merge remote-tracking branch 'origin/master' into nicka/oz-audit-fixe…
naddison36 Aug 6, 2024
c59070f
Generated latest Vault contract diagrams
naddison36 Aug 6, 2024
b9a2d81
Merge remote-tracking branch 'origin/master' into nicka/oz-audit-fixe…
naddison36 Aug 6, 2024
f69efcb
Merge remote-tracking branch 'origin/master' into nicka/oz-audit-fixe…
naddison36 Aug 19, 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
14 changes: 7 additions & 7 deletions contracts/contracts/vault/OETHVaultCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contract OETHVaultCore is VaultCore {
*/
function cacheWETHAssetIndex() external onlyGovernor {
uint256 assetCount = allAssets.length;
for (uint256 i = 0; i < assetCount; ++i) {
for (uint256 i; i < assetCount; ++i) {
if (allAssets[i] == weth) {
wethAssetIndex = i;
break;
Expand Down Expand Up @@ -158,12 +158,12 @@ contract OETHVaultCore is VaultCore {
* The OETH is burned on request and the WETH is transferred to the withdrawer on claim.
* This request can be claimed once the withdrawal queue's `claimable` amount
* is greater than or equal this request's `queued` amount.
* There is no minimum time or block number before a request can be claimed. It just needs
* There is a minimum of 10 minutes before a request can be claimed. After that, the request just needs
* enough WETH liquidity in the Vault to satisfy all the outstanding requests to that point in the queue.
* OETH is converted to WETH at 1:1.
* @param _amount Amount of OETH to burn.
* @param requestId Unique ID for the withdrawal request
* @param queued Cumulative total of all WETH queued including already claimed requests.
* @return requestId Unique ID for the withdrawal request
* @return queued Cumulative total of all WETH queued including already claimed requests.
*/
function requestWithdrawal(uint256 _amount)
external
Expand Down Expand Up @@ -252,7 +252,7 @@ contract OETHVaultCore is VaultCore {
* @return amounts Amount of WETH received for each request
* @return totalAmount Total amount of WETH transferred to the withdrawer
*/
function claimWithdrawals(uint256[] memory _requestIds)
function claimWithdrawals(uint256[] calldata _requestIds)
external
whenNotCapitalPaused
nonReentrant
Expand All @@ -268,7 +268,7 @@ contract OETHVaultCore is VaultCore {
_addWithdrawalQueueLiquidity();

amounts = new uint256[](_requestIds.length);
for (uint256 i = 0; i < _requestIds.length; ++i) {
for (uint256 i; i < _requestIds.length; ++i) {
amounts[i] = _claimWithdrawal(_requestIds[i]);
totalAmount += amounts[i];
}
Expand Down Expand Up @@ -385,7 +385,7 @@ contract OETHVaultCore is VaultCore {

/// @dev Get the balance of an asset held in Vault and all strategies
/// less any WETH that is reserved for the withdrawal queue.
/// This will only return a non-zero balance for WETH.
/// WETH is the only asset that can return a non-zero balance.
/// All other assets will return 0 even if there is some dust amounts left in the Vault.
/// For example, there is 1 wei left of stETH in the OETH Vault but will return 0 in this function.
///
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/vault/VaultAdmin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ contract VaultAdmin is VaultStorage {
bytes calldata _data
) internal virtual returns (uint256 toAssetAmount) {
// Check fromAsset and toAsset are valid
Asset memory fromAssetConfig = assets[address(_fromAsset)];
Asset memory fromAssetConfig = assets[_fromAsset];
Asset memory toAssetConfig = assets[_toAsset];
require(fromAssetConfig.isSupported, "From asset is not supported");
require(toAssetConfig.isSupported, "To asset is not supported");
Expand Down
24 changes: 18 additions & 6 deletions contracts/contracts/vault/VaultCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ import "./VaultInitializer.sol";
contract VaultCore is VaultInitializer {
using SafeERC20 for IERC20;
using StableMath for uint256;
// max signed int
/// @dev max signed int
uint256 internal constant MAX_INT = 2**255 - 1;
// max un-signed int
uint256 internal constant MAX_UINT =
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;

/**
* @dev Verifies that the rebasing is not paused.
Expand All @@ -45,6 +42,9 @@ contract VaultCore is VaultInitializer {
_;
}

/**
* @dev Verifies that the caller is the AMO strategy.
*/
modifier onlyOusdMetaStrategy() {
require(
msg.sender == ousdMetaStrategy,
Expand All @@ -67,6 +67,12 @@ contract VaultCore is VaultInitializer {
_mint(_asset, _amount, _minimumOusdAmount);
}

/**
* @dev Deposit a supported asset and mint OTokens.
* @param _asset Address of the asset being deposited
* @param _amount Amount of the asset being deposited
* @param _minimumOusdAmount Minimum OTokens to mint
*/
function _mint(
address _asset,
uint256 _amount,
Expand Down Expand Up @@ -433,7 +439,7 @@ contract VaultCore is VaultInitializer {
returns (uint256 value)
{
uint256 assetCount = allAssets.length;
for (uint256 y = 0; y < assetCount; ++y) {
for (uint256 y; y < assetCount; ++y) {
address assetAddr = allAssets[y];
uint256 balance = IERC20(assetAddr).balanceOf(address(this));
if (balance > 0) {
Expand Down Expand Up @@ -465,7 +471,7 @@ contract VaultCore is VaultInitializer {
{
IStrategy strategy = IStrategy(_strategyAddr);
uint256 assetCount = allAssets.length;
for (uint256 y = 0; y < assetCount; ++y) {
for (uint256 y; y < assetCount; ++y) {
address assetAddr = allAssets[y];
if (strategy.supportsAsset(assetAddr)) {
uint256 balance = strategy.checkBalance(assetAddr);
Expand Down Expand Up @@ -733,6 +739,11 @@ contract VaultCore is VaultInitializer {
}
}

/**
* @dev Get the number of decimals of a token asset
* @param _asset Address of the asset
* @return decimals number of decimals
*/
function _getDecimals(address _asset)
internal
view
Expand All @@ -751,6 +762,7 @@ contract VaultCore is VaultInitializer {

/**
* @notice Gets the vault configuration of a supported asset.
* @param _asset Address of the token asset
*/
function getAssetConfig(address _asset)
public
Expand Down
7 changes: 4 additions & 3 deletions contracts/contracts/vault/VaultStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,15 @@ contract VaultStorage is Initializable, Governable {
// slither-disable-next-line uninitialized-state
OUSD internal oUSD;

//keccak256("OUSD.vault.governor.admin.impl");
/// @dev Storage slot for the address of the VaultAdmin contract that is delegated to
// keccak256("OUSD.vault.governor.admin.impl");
bytes32 constant adminImplPosition =
0xa2bd3d3cf188a41358c8b401076eb59066b09dec5775650c0de4c55187d17bd9;

// Address of the contract responsible for post rebase syncs with AMMs
/// @dev Address of the contract responsible for post rebase syncs with AMMs
address private _deprecated_rebaseHooksAddr = address(0);

// Deprecated: Address of Uniswap
/// @dev Deprecated: Address of Uniswap
// slither-disable-next-line constable-states
address private _deprecated_uniswapAddr = address(0);

Expand Down
6 changes: 3 additions & 3 deletions contracts/docs/OETHVaultAdminSquashed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 30 additions & 31 deletions contracts/docs/OETHVaultCoreSquashed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading