Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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 <[email protected]> * meld method on rollover vault Signed-off-by: aalavandhann <[email protected]> * added todos Signed-off-by: aalavandhann <[email protected]> * Apply suggestions from code review Co-authored-by: Brandon Iles <[email protected]> Signed-off-by: aalavandhann <[email protected]> * removed duplicate implementation Signed-off-by: aalavandhann <[email protected]> * unit tests for meld Signed-off-by: aalavandhann <[email protected]> * moved unused contracts to folder Signed-off-by: aalavandhann <[email protected]> * imported sigmoid utility Signed-off-by: aalavandhann <[email protected]> * Fee strategy 2.0 Signed-off-by: aalavandhann <[email protected]> * perp changes for fee strategy 2.0 Signed-off-by: aalavandhann <[email protected]> * updated unit tests with the new fee scheme Signed-off-by: aalavandhann <[email protected]> * Apply suggestions from code review Co-authored-by: Brandon Iles <[email protected]> Co-authored-by: nms-7 <[email protected]> Signed-off-by: aalavandhann <[email protected]> * updated fee strategy Signed-off-by: aalavandhann <[email protected]> * using a normalized factor to compute sigmoid, rather than using a different target Signed-off-by: aalavandhann <[email protected]> * Update spot-contracts/contracts/strategies/FeeStrategy.sol Signed-off-by: aalavandhann <[email protected]> * using explicit cast instead of abs Signed-off-by: aalavandhann <[email protected]> * removed holding pen and discount math from perp Signed-off-by: aalavandhann <[email protected]> * perp cleanups, removed unused revert paramters Signed-off-by: aalavandhann <[email protected]> * updated peripheral contracts with the new fee mechanism and rollover scheme Signed-off-by: aalavandhann <[email protected]> * updated fee strategy to compute tranche ratios based on senior most tranche, rather than using discount adjusted ratios Signed-off-by: aalavandhann <[email protected]> * updated unit test suite Signed-off-by: aalavandhann <[email protected]> * removed deprecated fee strategy interface functions Signed-off-by: aalavandhann <[email protected]> * deleted deprecated contracts Signed-off-by: aalavandhann <[email protected]> * Apply suggestions from code review Co-authored-by: Brandon Iles <[email protected]> Signed-off-by: aalavandhann <[email protected]> * updated rollover math condition Signed-off-by: aalavandhann <[email protected]> * removed dirty diff from rebase Signed-off-by: aalavandhann <[email protected]> * deleted unused contracts Signed-off-by: aalavandhann <[email protected]> * updated sigmoid utility, imported two pow code Signed-off-by: aalavandhann <[email protected]> * replaced == 0 conditions with <= 0 Signed-off-by: aalavandhann <[email protected]> * reverted exp val snapping Signed-off-by: aalavandhann <[email protected]> * imported two pow tests Signed-off-by: aalavandhann <[email protected]> * handling zero vault deposit/redeem Signed-off-by: aalavandhann <[email protected]> * cleaned up error codes Signed-off-by: aalavandhann <[email protected]> * updated fee (monetary) policy for spot Signed-off-by: aalavandhann <[email protected]> * updated bond issuer Signed-off-by: aalavandhann <[email protected]> * updated perp Signed-off-by: aalavandhann <[email protected]> * removed meld from rollover vault Signed-off-by: aalavandhann <[email protected]> * vault code cleanup and private fn refactor Signed-off-by: aalavandhann <[email protected]> * vault v2 storage update, mint redeem and deployment fees Signed-off-by: aalavandhann <[email protected]> * moved rollover vault to parent dir Signed-off-by: aalavandhann <[email protected]> * Apply suggestions from code review Co-authored-by: Brandon Iles <[email protected]> Signed-off-by: aalavandhann <[email protected]> * fee policy terminology updates and review fixes Signed-off-by: aalavandhann <[email protected]> * review pass, removed annualized rollover fees, comment and naming updates Signed-off-by: aalavandhann <[email protected]> * code review updates Signed-off-by: aalavandhann <[email protected]> * vault allows 2-way swap between perps and underlying Signed-off-by: aalavandhann <[email protected]> * subscription aware fee policy for swapping, using minting bond as the source of truth for tranche ratios Signed-off-by: aalavandhann <[email protected]> * removed unused interface fn from bond issuer Signed-off-by: aalavandhann <[email protected]> * fee policy updates for perp, skipping fees when used by vault, reverting to only one authorized roller ie vault Signed-off-by: aalavandhann <[email protected]> * utility to calculate ampl required to create x perps Signed-off-by: aalavandhann <[email protected]> * error and comment cleanup Signed-off-by: aalavandhann <[email protected]> * updated swap fee logic Signed-off-by: aalavandhann <[email protected]> * code review fixes Signed-off-by: aalavandhann <[email protected]> * Apply suggestions from code review Co-authored-by: Brandon Iles <[email protected]> Signed-off-by: aalavandhann <[email protected]> * code review fixes Signed-off-by: aalavandhann <[email protected]> * removed perp as a vault asset, and redeeming perps only on swaps Signed-off-by: aalavandhann <[email protected]> * simplified fee policy interface, accepts sr instead of computing it Signed-off-by: aalavandhann <[email protected]> * Perp removed external pricing strategy and optimized tranche value computation Signed-off-by: aalavandhann <[email protected]> * Vault clean up, function reorg and optimized tvl comp Signed-off-by: aalavandhann <[email protected]> * Assuming that incoming tranches withold no fees, thus removing all bw fee related math Signed-off-by: aalavandhann <[email protected]> * interface cleanup Signed-off-by: aalavandhann <[email protected]> * fee policy: code review fixes Signed-off-by: aalavandhann <[email protected]> * perp: code review fixes Signed-off-by: aalavandhann <[email protected]> * vault: code review fixes Signed-off-by: aalavandhann <[email protected]> * interface: code review fixes Signed-off-by: aalavandhann <[email protected]> * removed string require errors infavor of custom errors Signed-off-by: aalavandhann <[email protected]> * feePolicy: updated fee policy interface Signed-off-by: aalavandhann <[email protected]> * perp: new fee policy interface, view methods regorg, skipping update state when paused, optimized cdr Signed-off-by: aalavandhann <[email protected]> * vault: handling dust Signed-off-by: aalavandhann <[email protected]> * vault: new fee policy interface, variable caching and tvl optimization, recoverAndRedeem and view methods reorg Signed-off-by: aalavandhann <[email protected]> * unit tests Signed-off-by: aalavandhann <[email protected]> * fee policy: code review fix Signed-off-by: aalavandhann <[email protected]> * perp: code review fix Signed-off-by: aalavandhann <[email protected]> * fee policy: updated dr condition Signed-off-by: aalavandhann <[email protected]> * vault : code review fix Signed-off-by: aalavandhann <[email protected]> * code review fix: unit-tests, perp expects valid vault Signed-off-by: aalavandhann <[email protected]> * reorg return data Signed-off-by: aalavandhann <[email protected]> * redemption amt calc optimization, assuming bond has only 2 tranches Signed-off-by: aalavandhann <[email protected]> * code review fix for commit 1&2 Signed-off-by: aalavandhann <[email protected]> * updated lisc Signed-off-by: aalavandhann <[email protected]> * Renamed fee variable Signed-off-by: aalavandhann <[email protected]> * moved keeper only methods to its own section Signed-off-by: aalavandhann <[email protected]> * moved rollover vault Signed-off-by: aalavandhann <[email protected]> * ran linter Signed-off-by: aalavandhann <[email protected]> * bumped up solidity version to 0.8.20 Signed-off-by: aalavandhann <[email protected]> * updated hyper-param methods, removed logs & zero checks Signed-off-by: aalavandhann <[email protected]> * comment fix Signed-off-by: aalavandhann <[email protected]> * nonReentrant updateState Signed-off-by: aalavandhann <[email protected]> * set keeper in init method Signed-off-by: aalavandhann <[email protected]> * comment update Signed-off-by: aalavandhann <[email protected]> * made transfer fn nonReentrant Signed-off-by: aalavandhann <[email protected]> * returning instead of reverting in deposit,redeem and rollover Signed-off-by: aalavandhann <[email protected]> * moved value fn into perp Signed-off-by: aalavandhann <[email protected]> * removed perp supply zero check on burn computation Signed-off-by: aalavandhann <[email protected]> * Removed reserve count method Signed-off-by: aalavandhann <[email protected]> * removed multiple reads Signed-off-by: aalavandhann <[email protected]> * refactored rollover condition Signed-off-by: aalavandhann <[email protected]> * removed paramter from rollover amt Signed-off-by: aalavandhann <[email protected]> * removed one time use variable Signed-off-by: aalavandhann <[email protected]> * removed zero price check Signed-off-by: aalavandhann <[email protected]> * added comment Signed-off-by: aalavandhann <[email protected]> * removed zero check Signed-off-by: aalavandhann <[email protected]> * added else if Signed-off-by: aalavandhann <[email protected]> * flipped rollover condition Signed-off-by: aalavandhann <[email protected]> * moved perp supply call into compute redemption amt method Signed-off-by: aalavandhann <[email protected]> * Renamed fee policy variable Signed-off-by: aalavandhann <[email protected]> * added fee initiailzier Signed-off-by: aalavandhann <[email protected]> * router preview deposit update return struct Signed-off-by: aalavandhann <[email protected]> * removed approve 0 Signed-off-by: aalavandhann <[email protected]> * added back perp rollover zero price check for safety Signed-off-by: aalavandhann <[email protected]> * router assumming bond has only 2 tranches Signed-off-by: aalavandhann <[email protected]> * fee policy update, dr bounds Signed-off-by: aalavandhann <[email protected]> * moved rollover vault Signed-off-by: aalavandhann <[email protected]> * vault init cleanup Signed-off-by: aalavandhann <[email protected]> * minUnderlyingBal check Signed-off-by: aalavandhann <[email protected]> * removed address(0) check in updateFeePolicy Signed-off-by: aalavandhann <[email protected]> * non-reentrant transferERC20 Signed-off-by: aalavandhann <[email protected]> * removed virtual updateKeeper Signed-off-by: aalavandhann <[email protected]> * removed deployedAmt from deploy Signed-off-by: aalavandhann <[email protected]> * rollover typo fix Signed-off-by: aalavandhann <[email protected]> * vault sync refactor Signed-off-by: aalavandhann <[email protected]> * rollover gas optimizaiton, removed storage read for Signed-off-by: aalavandhann <[email protected]> * rollover performs tranche cleanup Signed-off-by: aalavandhann <[email protected]> * made MAX_DEPLOYED_COUNT uint8 Signed-off-by: aalavandhann <[email protected]> * recover comment fix Signed-off-by: aalavandhann <[email protected]> * vault deposit/redeem return zero instead of reverting Signed-off-by: aalavandhann <[email protected]> * renamed totalSupply_ to noteSupply Signed-off-by: aalavandhann <[email protected]> * removed whenNotPaused from recover and redeem Signed-off-by: aalavandhann <[email protected]> * using safeTransfer for transfer Signed-off-by: aalavandhann <[email protected]> * removed _enforceVaultComposition Signed-off-by: aalavandhann <[email protected]> * removed MIN_SWAP_UNITS check Signed-off-by: aalavandhann <[email protected]> * min underlying perc in vault Signed-off-by: aalavandhann <[email protected]> * renamed perp and vault share fee variables Signed-off-by: aalavandhann <[email protected]> * vault get tvl cleanup Signed-off-by: aalavandhann <[email protected]> * tranche helpers cleanup Signed-off-by: aalavandhann <[email protected]> * removed deployed count and deployed at Signed-off-by: aalavandhann <[email protected]> * comment update Signed-off-by: aalavandhann <[email protected]> * assuming bond has only two tranches, thus bond-tranches data structure has fixed len arrays Signed-off-by: aalavandhann <[email protected]> * increased vault's dust amt Signed-off-by: aalavandhann <[email protected]> * meld perps style change Signed-off-by: aalavandhann <[email protected]> * vault comment fix Signed-off-by: aalavandhann <[email protected]> * removed comment vault n Signed-off-by: aalavandhann <[email protected]> * vault using cached variable Signed-off-by: aalavandhann <[email protected]> * cleaned up perp mint estimation, added comments Signed-off-by: aalavandhann <[email protected]> * sync asset made into online fn Signed-off-by: aalavandhann <[email protected]> * removed bond duration method Signed-off-by: aalavandhann <[email protected]> * bond helpers using return val for getSeniorTranche Signed-off-by: aalavandhann <[email protected]> * fixed sigmoid condition Signed-off-by: aalavandhann <[email protected]> * Ran linter Signed-off-by: aalavandhann <[email protected]> * removed bond/tranche double check in favor of one check for bond validity Signed-off-by: aalavandhann <[email protected]> * fixed bug, with underlying perc calc after swap Signed-off-by: aalavandhann <[email protected]> * using cached value of reserve count Signed-off-by: aalavandhann <[email protected]> * perp: renamed rollout condition and fixed order of checks in Signed-off-by: aalavandhann <[email protected]> * removed duplicate comment in bond helpers Signed-off-by: aalavandhann <[email protected]> * perp enforcing max len for reserve and using uint8 for reserve len, returning only tokens up for rollover Signed-off-by: aalavandhann <[email protected]> * fee policy cleanup Signed-off-by: aalavandhann <[email protected]> * perp defensive check on rollover Signed-off-by: aalavandhann <[email protected]> * vault enforcing liquidity constraints on both swap functions Signed-off-by: aalavandhann <[email protected]> * bond helper minor style fix Signed-off-by: aalavandhann <[email protected]> * updated testcases, back to full coverage Signed-off-by: aalavandhann <[email protected]> * vault: removed redundant sync with redeem tranches on meld and rollover Signed-off-by: aalavandhann <[email protected]> * fixed router bug, with undeployed bonds Signed-off-by: aalavandhann <[email protected]> * removed returns in bond helper Signed-off-by: aalavandhann <[email protected]> * Fee delta update Signed-off-by: aalavandhann <[email protected]> * updated variable name Signed-off-by: aalavandhann <[email protected]> * updated tasks with the new interface Signed-off-by: aalavandhann <[email protected]> * testnet deployment Signed-off-by: aalavandhann <[email protected]> * 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 <[email protected]> * fixed liner issue Signed-off-by: aalavandhann <[email protected]> * V2 final updates (#204) * updated sigmoid bound for 20% yearly rollover rate * updated LICENSE Signed-off-by: aalavandhann <[email protected]> * natspec comment updates for variable reanmes Signed-off-by: aalavandhann <[email protected]> * moved hyper paramter controls to keeper Signed-off-by: aalavandhann <[email protected]> * a few more unit tests to improve coverage Signed-off-by: aalavandhann <[email protected]> * upgrade tasks Signed-off-by: aalavandhann <[email protected]> * v2 deployment Signed-off-by: aalavandhann <[email protected]> --------- Signed-off-by: aalavandhann <[email protected]> Co-authored-by: Brandon Iles <[email protected]> Co-authored-by: nms-7 <[email protected]>
- Loading branch information