Closed naddison36 closed 2 months ago
Warnings | |
---|---|
:warning: | :eyes: This PR needs at least 2 reviewers |
Generated by :no_entry_sign: dangerJS against 0324e4146c0036ccd73c2ce67fa881bc36f422c4
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 59.47%. Comparing base (
d4c84aa
) to head (8c25150
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Generated at commit: 0324e4146c0036ccd73c2ce67fa881bc36f422c4
🚨 Report Summary
Severity Level Results Contracts Critical High Medium Low Note Total 3 3 0 18 42 66 Dependencies Critical High Medium Low Note Total 0 0 0 0 0 0
For more details view the full report in OpenZeppelin Code Inspector
The counters are beautiful in this PR. Nice way to solve the fairness issues.
Thinking in invariants:
queue.queued >= queue.claimable => queue.claimed
This does basically add instant 1:1 redeems in certain situations. Fortunately our vault side mint math is now very simple, and vault side burn math is simple too.
The real question then is if there are any possible problems in the OETH token itself that would make mint->burn or burn->mint a profitable cycle.
@DanielVF I've fixed OETHVaultAdmin._wethAvailable
for it matches OETHVaultCore._wethAvailable
. But I'm in favour of moving _wethAvailable
and _addWithdrawalQueueLiquidity
to a new compile time library OETHVaultLibrary
that is called by both OETHVaultAdmin
and OETHVaultCore
. I've put this in a separate PR https://github.com/OriginProtocol/origin-dollar/pull/2161
Contract Changes
requestWithdrawal
,claimWithdrawal
andaddWithdrawalQueueLiquidity
.allocate
,mint
,redeem
,depositToStrategy
,withdrawFromStrategy
,withdrawAllFromStrategy
,withdrawAllFromStrategies
andswapCollateral
.redeem
will only work if there is enough WETH liquidity in the Vault to satisfy all outstanding withdrawal requests.allocate
changed to use the OETH total supply rather than calculating the vault's total assets when calculating the vault buffer.rebaseThreshold
(1 OETH) will call theDripper
to collect any streamed rewards to that point. The minter's OETH is calculated after the rewards are collected. This prevents someone minting with a large amount and then withdrawing 10 minutes later collecting most of the yield from the Dripper.Dependencies
Interfaces
Test Chains
The OETH Vault on Holesky has been upgraded to include the withdrawal queue 0x19d2bAaBA949eFfa163bFB9efB53ed8701aA5dD9
Tenderly testnet OETH ARM is an older fork of mainnet.
Tenderly testnet OETH ARM 2 is a newer fork of mainnet with the last Vault code.
Processes
requestWithdrawal
claimWithdrawal
Deployment
Holesky
The Holesky deploy script to upgrade the OETHVault is
contracts/deploy/holesky/017_upgrade_vault.js
Mainnet
The deploy script for the OETH Withdrawal Queue is
contracts/deploy/mainnet/103_oeth_withdraw_queue.js
.Testing
Unit Tests
The OETH Vault unit tests are in
contracts/test/vault/oeth-vault.js
.Fork Tests
The mainnet OETH Vault fork tests are in
contracts/test/vault/oeth-vault.mainnet.fork-test.js
Holesky using Hardhat
Security
If you made a contract change, make sure to complete the checklist below before merging it in master.
Refer to our documentation for more details about contract security best practices.
Contract change checklist: