-
Notifications
You must be signed in to change notification settings - Fork 12
V2 final updates #204
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
Merged
Merged
V2 final updates #204
Conversation
This file contains hidden or 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
Member
aalavandhan
commented
Apr 1, 2024
- Updated fee policy sigmoid bound to allow for 20% yearly rate
- Updated license
V2 final updates
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
nms-7
approved these changes
Apr 2, 2024
brandoniles
approved these changes
Apr 2, 2024
Member
brandoniles
left a comment
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.
LGTM
aalavandhan
added a commit
that referenced
this pull request
Apr 16, 2024
* updated sigmoid bound for 20% yearly rollover rate * updated LICENSE Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com>
aalavandhan
added a commit
that referenced
this pull request
Apr 16, 2024
* updated sigmoid bound for 20% yearly rollover rate * updated LICENSE Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com>
aalavandhan
added a commit
that referenced
this pull request
Apr 16, 2024
* Added perp redemption to vault recovery flow (#159) * added perp redemption to vault recovery flow * perp external functions returning ops data * added natspec comments and renamed rollover preview struct * refactors bond and tranche helpers, added a new method to compute proportional tranche balances Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * meld method on rollover vault Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * added todos Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Brandon Iles <brandon@fragments.org> Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed duplicate implementation Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * unit tests for meld Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * moved unused contracts to folder Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * imported sigmoid utility Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Fee strategy 2.0 Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * perp changes for fee strategy 2.0 Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated unit tests with the new fee scheme Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Brandon Iles <brandon@fragments.org> Co-authored-by: nms-7 <57442379+nms-7@users.noreply.github.com> Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated fee strategy Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * using a normalized factor to compute sigmoid, rather than using a different target Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Update spot-contracts/contracts/strategies/FeeStrategy.sol Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * using explicit cast instead of abs Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed holding pen and discount math from perp Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * perp cleanups, removed unused revert paramters Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated peripheral contracts with the new fee mechanism and rollover scheme Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated fee strategy to compute tranche ratios based on senior most tranche, rather than using discount adjusted ratios Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated unit test suite Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed deprecated fee strategy interface functions Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * deleted deprecated contracts Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Brandon Iles <brandon@fragments.org> Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated rollover math condition Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed dirty diff from rebase Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * deleted unused contracts Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated sigmoid utility, imported two pow code Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * replaced == 0 conditions with <= 0 Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * reverted exp val snapping Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * imported two pow tests Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * handling zero vault deposit/redeem Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * cleaned up error codes Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated fee (monetary) policy for spot Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated bond issuer Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated perp Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed meld from rollover vault Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault code cleanup and private fn refactor Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault v2 storage update, mint redeem and deployment fees Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * moved rollover vault to parent dir Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Brandon Iles <brandon@fragments.org> Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * fee policy terminology updates and review fixes Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * review pass, removed annualized rollover fees, comment and naming updates Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * code review updates Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault allows 2-way swap between perps and underlying Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * subscription aware fee policy for swapping, using minting bond as the source of truth for tranche ratios Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed unused interface fn from bond issuer Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * fee policy updates for perp, skipping fees when used by vault, reverting to only one authorized roller ie vault Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * utility to calculate ampl required to create x perps Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * error and comment cleanup Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated swap fee logic Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * code review fixes Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Brandon Iles <brandon@fragments.org> Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * code review fixes Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed perp as a vault asset, and redeeming perps only on swaps Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * simplified fee policy interface, accepts sr instead of computing it Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Perp removed external pricing strategy and optimized tranche value computation Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Vault clean up, function reorg and optimized tvl comp Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Assuming that incoming tranches withold no fees, thus removing all bw fee related math Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * interface cleanup Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * fee policy: code review fixes Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * perp: code review fixes Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault: code review fixes Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * interface: code review fixes Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed string require errors infavor of custom errors Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * feePolicy: updated fee policy interface Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * perp: new fee policy interface, view methods regorg, skipping update state when paused, optimized cdr Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault: handling dust Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault: new fee policy interface, variable caching and tvl optimization, recoverAndRedeem and view methods reorg Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * unit tests Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * fee policy: code review fix Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * perp: code review fix Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * fee policy: updated dr condition Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault : code review fix Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * code review fix: unit-tests, perp expects valid vault Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * reorg return data Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * redemption amt calc optimization, assuming bond has only 2 tranches Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * code review fix for commit 1&2 Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated lisc Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Renamed fee variable Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * moved keeper only methods to its own section Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * moved rollover vault Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * ran linter Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * bumped up solidity version to 0.8.20 Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated hyper-param methods, removed logs & zero checks Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * comment fix Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * nonReentrant updateState Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * set keeper in init method Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * comment update Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * made transfer fn nonReentrant Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * returning instead of reverting in deposit,redeem and rollover Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * moved value fn into perp Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed perp supply zero check on burn computation Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Removed reserve count method Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed multiple reads Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * refactored rollover condition Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed paramter from rollover amt Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed one time use variable Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed zero price check Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * added comment Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed zero check Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * added else if Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * flipped rollover condition Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * moved perp supply call into compute redemption amt method Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Renamed fee policy variable Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * added fee initiailzier Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * router preview deposit update return struct Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed approve 0 Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * added back perp rollover zero price check for safety Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * router assumming bond has only 2 tranches Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * fee policy update, dr bounds Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * moved rollover vault Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault init cleanup Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * minUnderlyingBal check Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed address(0) check in updateFeePolicy Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * non-reentrant transferERC20 Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed virtual updateKeeper Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed deployedAmt from deploy Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * rollover typo fix Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault sync refactor Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * rollover gas optimizaiton, removed storage read for Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * rollover performs tranche cleanup Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * made MAX_DEPLOYED_COUNT uint8 Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * recover comment fix Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault deposit/redeem return zero instead of reverting Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * renamed totalSupply_ to noteSupply Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed whenNotPaused from recover and redeem Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * using safeTransfer for transfer Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed _enforceVaultComposition Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed MIN_SWAP_UNITS check Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * min underlying perc in vault Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * renamed perp and vault share fee variables Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault get tvl cleanup Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * tranche helpers cleanup Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed deployed count and deployed at Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * comment update Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * assuming bond has only two tranches, thus bond-tranches data structure has fixed len arrays Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * increased vault's dust amt Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * meld perps style change Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault comment fix Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed comment vault n Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault using cached variable Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * cleaned up perp mint estimation, added comments Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * sync asset made into online fn Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed bond duration method Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * bond helpers using return val for getSeniorTranche Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * fixed sigmoid condition Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Ran linter Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed bond/tranche double check in favor of one check for bond validity Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * fixed bug, with underlying perc calc after swap Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * using cached value of reserve count Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * perp: renamed rollout condition and fixed order of checks in Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed duplicate comment in bond helpers Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * perp enforcing max len for reserve and using uint8 for reserve len, returning only tokens up for rollover Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * fee policy cleanup Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * perp defensive check on rollover Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault enforcing liquidity constraints on both swap functions Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * bond helper minor style fix Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated testcases, back to full coverage Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * vault: removed redundant sync with redeem tranches on meld and rollover Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * fixed router bug, with undeployed bonds Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * removed returns in bond helper Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Fee delta update Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated variable name Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * updated tasks with the new interface Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * testnet deployment Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * Pre release fixes (#199) * using fixed perc fees for ops * removed some unreachable code * added test case to check for dust recovery * removed vault deployment fee * pve002 router validation * pve004 preview deposit mature bond handling * Removed from paramters from asset transfer wrapper functions and using msg.sender directly, also using msg.sender instead of _msgSender * ran linter * updated unit tests * pve001 updating constructors * pve002-3 bond issuer tranche granularity check * Removed redundant computeDeviationRatio method from fee policy * openzeppelin defender report informational issues * Reverted pve002 * deployed to sepolia testnet (#201) Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * fixed liner issue Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * V2 final updates (#204) * updated sigmoid bound for 20% yearly rollover rate * updated LICENSE Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * natspec comment updates for variable reanmes Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * moved hyper paramter controls to keeper Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * a few more unit tests to improve coverage Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * upgrade tasks Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> * v2 deployment Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> --------- Signed-off-by: aalavandhann <6264334+aalavandhan@users.noreply.github.com> Co-authored-by: Brandon Iles <brandon@fragments.org> Co-authored-by: nms-7 <57442379+nms-7@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.