Commit 397c690
feat: migrate hub restore tests (#488)
* refactor: internal methods, errors, resolve tests
* test: hub remove
* test: debugging test_remove_all_with_interest
* test: resolve test_remove_all_with_interest
* test: resolve test_remove_fuzz
* test: resolve test_remove_fuzz_all_liquidity_with_interest
* test: test_remove_fuzz_multi_spoke_with_interest
* chore: gas report
* fix: hub names
* chore: pr comments
* chore: pr comments
* test: restore test_restore_revertsWith_SurplusAmountRestored
* chore: assertEq helpers
* test: resolve test_restore_partial_same_block
* test: resolve test_restore_revertsWith_SurplusAmountRestored_with_interest
* test: resolve
* test: resolve test_restore_full_amount_with_interest
* test: resolve test_restore_full_amount_with_interest_and_premium
* test: resolve test_restore_partial_base
* test: resolve test_restore_fuzz_full_amount_with_interest
* test: resolve test_restore_fuzz_full_amount_with_interest_and_premium
* test: rm unused tests
* test: resolve remaining restore tests
* fix: rm test struct; clean up
* fix: tests with premium debt, unchanged
* chore: comments, rm unused
* test: cleanup
* test: resolve
* Fix Hub Restore Tests (#629)
* feat: Refactor flags (#553)
* feat: remove collateral flag
* feat: refactor hub flags
* feat: refactor spoke flags
* feat: update hub configurator
* fix: check spoke active on payFee
* fix: order operation nit
* fix: comments
* fix: nits
* fix: gas reports
* fix: comments
* feat: keep feeReceiver active flag constant in configurator
* fix: comments
* fix: comments
* fix: Address comments
* fix: address comments
* chore: gas snapshots
* fix: Fix draw validation
* chore: gas
---------
Co-authored-by: miguelmtzinf <[email protected]>
Co-authored-by: YBM <[email protected]>
* feat: Allow DAO to update any user dynamic risk configuration (#564)
* feat: allow dao to upd user dyn config
* chore: reorder for readability
* fix: pr comments
* feat: Add Hub Conversion Functions (#540)
* feat: Add previews for basic actions
* feat: Add preview shares functions
* feat: Adjust conversion functions
* fix: Use preview functions in src
* fix: Use preview where possible
* fix: Remove using preview where unneeded
* fix: Internalize previewOffset
* fix: Pr comments
* fix: Add natspec to _previewOffset
* fix: Simplify dev comment
* fix: Revert natspec change on previewOffset
* fix: Rename other preview getters
* fix: fix docs
---------
Co-authored-by: miguelmtzinf <[email protected]>
* feat: update existing dyn config (#541)
* feat: update existing dyn config
* wip: config tests cleanup
* chore: snapshots
* chore: finalise merge
* fix: rename and tests
* fix: revert to uint16 input, cleanup
* chore: reorder
* chore: finalise merge
* feat: rm safeCast, resolve shadowing in tests
* feat: distinguish dyn conf update with new added event
* feat: rm abstraction, fix event on add reserve, natspec
* fix: apply explicit rounding direction on all math operations (#543)
* rft: explicit rounding
* fix: round up on getUserDebtInBaseCurrency
* chore: finalise merge
* fix: pr comments
* chore: rm dup
* fix: rename wadify -> toWad, dewadify -> fromWad
* feat: Add more equivalent fees calc in previewFeeShares (#458)
* feat: Add more equivalent fees calc in previewFeeShares
* chore: disables gas checks
* tmp: skip snapshot check (revert before merging)
* fix: separate impl of fee shares
* test: multi-user case
* fix: test
* feat: underestimate treasury fees and fix tests
* test: multi spoke
* fix: treasury spoke tests
* fix: treasury spoke tests
* fix: pr comment
---------
Co-authored-by: dhairya <[email protected]>
Co-authored-by: YBM <[email protected]>
* feat: Deficit accounting via dedicated hub method (#472)
* feat: simplify restore flow (#574)
* feat: simplify restore flow
* feat: make restore like its now
* feat: emit premium amt
* fix: hub._validateRestore after accrual & before state changes
* fix: settle premium debt in reportDeficit
* test: _checkDeficitReportedEvents
* chore: bring back test
* chore: consolidate settlePremiumDebt
* chore: bring back fee share comment
* feat: Eliminate deficit (#583)
* feat: clear deficit
* fix: pr comments
* chore: rename to eliminate deficit
* feat: simplify restore flow (#574)
* feat: simplify restore flow
* feat: make restore like its now
* feat: emit premium amt
* fix: hub._validateRestore after accrual & before state changes
* fix: settle premium debt in reportDeficit
* test: _checkDeficitReportedEvents
* chore: bring back test
* chore: consolidate settlePremiumDebt
* chore: bring back fee share comment
chore: finalise merge
* chore: disallow excess eliminate deficit in, reorder fn
* feat: rm reserve accounting on spoke (#468)
* feat: rm reserve accounting on spoke
* chore: snapshots
* chore: snapshot
* feat: rm reserve list
* chore: finalise merge
* fix: rm unnecessary liquidation accounting
---------
Co-authored-by: YBM <[email protected]>
* feat: spoke/base minimal interfaces (#589)
* feat: Transfer added shares between spokes (#590)
* feat: rm reserve accounting on spoke
* chore: snapshots
* chore: snapshot
* feat: rm reserve list
* chore: finalise merge
* fix: rm unnecessary liquidation accounting
* feat: Initial implementation
* test: Basic tests
* test: Basic functionalities and reverts
* fix: Address pr comments
* fix: Address pr comments
* fix: Remove unchecked
* fix: pr comments
* feat: Internal helper for transfer shares
* fix: Move accrue outside helper
---------
Co-authored-by: DhairyaSethi <[email protected]>
Co-authored-by: YBM <[email protected]>
* rft: rename, cleanup (#563)
* rft: rename, cleanup
* feat: supplied -> added in hub
* fix: debt/borrow -> drawn; repay -> restore
* feat: baseDebt/premiumDebt rename
* fix: pr comments, cleanup
* feat: LH -> hub; cleanup
* chore: periods on natspec
* chore: final clean up
* fix: include deficit
* fix: more renaming
* fix: availableLiquidity -> liquidity
* fix: clean up PremiumDelta struct
* fix: debtIndex -> drawnIndex
* fix: baseDebt -> drawnDebt
* fix: base -> drawn; availLiq -> liq
* fix: base -> drawn; clarify shares
* test: hub -> hub1
* fix: ref correct input hub
* fix: rename liqHub
* chore: rm comment
* fix: pr comments
* fix: clean up, address pr comments
* fix: pr comments
* fix: availableliquidity -> liquidity
* fix: use preview conversions
* fix: link
* fix: base -> drawn, clean up
* feat: Pack Hub Structs (#591)
* Fix: present tense on events (#595)
* feat: Add Inflation Attack Protection (#588)
* feat: add inflation attack protection
* feat: add rounding test
* fix: comments
* chore: remove hub rp tests
* fix: added share price calculation
* fix: add cap tests
* fix: comments
* feat: Check existence when adding reserve (#593)
* test: Add Hub Configurator Tests (#575)
* feat: Remove existence check on spokes
* fix: Comments
* test: Can still withdraw from old fee receiver
* fix: Simplify test
* test: New fee receiver receiving funds
* chore: Clean tests
* fix: Pr comments
* fix: Keep old fee receiver config
* fix: Use existing fee receiver config
* fix: Address pr comments
* fix: Consistent fuzzing on access control tests
* chore: Cleanup test comments
* wip: Determine diff
* fix: Names and comments
* feat: Add natspec to addSpoke
* fix: Address pr comments
* fix: Address pr comments
* feat: Pack Spoke Structs (#602)
* feat: pack spoke structs
* fix: comments
* fix: cleanup
* fix: lint
* fix: small cleanup
* fix: use safecast in tests
* fix: lint
* fix: tests cleanup
* fix: comments
* feat: Add remaining configurator functions (#578)
* feat: add updateInterestRateData in HubConfigurator
* feat: Add updateLiquiationConfig in SpokeConfigurator
* feat: add updatePoisitionManager in SpokeConfigurator
* fix: change prefix to add for dyn config fns
* feat: add granular fns to update existing dyn config
* fix: comments
* fix: add missing hub configurator fns
* fix: comments
* feat: Add premiumDelta to Repay event (#610)
* fix: Stack too deep error
* style: Revert ternary condition change
* fix: fee share calc (#606)
* fix: fee share calc
* chore: cleanup
* test: more accurate accrual
* chore: rename smt script
* doc: AssetLogic.getFeeShares
* chore: snapshot
* doc: AssetLogic.getFeeShares
* feat: reinvestment (adds Sweep & Reclaim on Hub) (#619)
* feat: added reinvestment config vars
* feat: added sweeped to the shares accounting
* feat: updated addAsset() and tests
* feat: implemented implemented sweep and reclaim
* chore: fixed additional merge changes
* feat: fixed validation on sweep and reclaim
* refactor: renamed sweeped in swept
* chore: removed ILiquidityHub.sol leftover from merge
* feat: cleanup, events, upd borrow rate
* feat: fix restore preview, minor cleanup
* chore: fix failing test
* feat: remove reinvestment strat from addAsset
* chore: docs
* test: addAsset, updateReinvestmentStrategy on configurator
* chore: init tests
* feat: update borrow rate on hub.refresh, more tests for hub.sweep
* feat: disallow resetting reinvestment strategy if there is non zero amount reinvested
* chore: napspec, error name
* chore: natspec
* feat: rm updateBorrowRate on hub.refreshPremium
---------
Co-authored-by: [email protected] <[email protected]>
* feat: Prevent Liquidations Resulting in Dust Debt (#605)
* feat: initial impl of dust
* test: resolve current actualDebt, with assumption of no dust
* fix: refactor to minimimize internal calls; simplify testing
* test: cleanup
* test: dust tests
* test: test_calculateActualDebtToLiquidate_fuzz_debtToCover_dust
* test: dust scenario
* test: test_calculateActualDebtToLiquidate_fuzz_debtToRestoreCloseFactor_dust
* test: test_calculateActualDebtToLiquidate_fuzz_debtToRestoreCloseFactor_dust_totalBorrowerReserveDebt_lte_minLeftoverAmount
* test: test_calculateActualDebtToLiquidate_fuzz_debtToRestoreCloseFactor_dust_revertsWith_MustNotLeaveDust
* test: clean up
* fix: update liquidation event
* test: cleanup and dust tests
* test: debug prior tests
* test: resolve failing
* fix: resolve remaining tests
* test: initial fix for specific scenario
* test: resolve LiquidationAvailableCollateralToLiquidateTest
* test: fix test_calculateAvailableCollateralToLiquidate_fuzz_borrowerCollateralBalance_lt_maxCollateralToLiquidate
* chore: gas report
* fix: allow for debt reserve dust if collateral side is fully liq
* fix: comment
* test: initial dust scenarios
* test: test_liquidationCall_fuzz_dust_scenario1_revertsWith_MustNotLeaveDust
* test: clean up test_liquidationCall_fuzz_dust_scenario1_revertsWith_MustNotLeaveDust
* test: test_liquidationCall_fuzz_dust_scenario1_revertsWith_MustNotLeaveDust_debtToRestoreCloseFactor
* test: test_liquidationCall_fuzz_dust_scenario1_deficit
* test: isolate test scenarios
* test: deficits when debt is above the min leftover base threshold
* test: reverting on dust
* fix: emit reserveIds in event
* tests: additional LiquidationAvailableCollateralToLiquidateTest
* test: test_liquidationCall_borrowerReserveDebtThreshold_valid
* fix: test_calculateAvailableCollateralToLiquidate_fuzz_borrowerCollateralBalance_lt_maxCollateralToLiquidate
* test: remaining minLeftoverBase scenarios
* chore: clean up, rm logs, add comments
* chore: gas snapshot
* fix: rm logging
* chore: comments, cleanup
* fix: tests
* fix: comments
* fix: replace assume with bound
* fix: comments
---------
Co-authored-by: Alexandru Niculae <[email protected]>
* opt: pack drawnRate within 96 bits (#623)
* opt: shrink drawn rate to 96 bits
* fix: revert unneeded
* chore: avoid caching if read once
* feat: Add deficit and swept to IR Strategy (#624)
* feat: added reinvestment config vars
* feat: added sweeped to the shares accounting
* feat: updated addAsset() and tests
* feat: implemented implemented sweep and reclaim
* chore: fixed additional merge changes
* feat: fixed validation on sweep and reclaim
* refactor: renamed sweeped in swept
* chore: removed ILiquidityHub.sol leftover from merge
* feat: cleanup, events, upd borrow rate
* feat: fix restore preview, minor cleanup
* chore: fix failing test
* feat: remove reinvestment strat from addAsset
* chore: docs
* test: addAsset, updateReinvestmentStrategy on configurator
* chore: init tests
* feat: update borrow rate on hub.refresh, more tests for hub.sweep
* feat: disallow resetting reinvestment strategy if there is non zero amount reinvested
* chore: napspec, error name
* chore: natspec
* feat: rm updateBorrowRate on hub.refreshPremium
* wip: Add swept and deficit to ir strategy
* chore: fix swept test, minor cleanup
* fix: Remove drawn from liquidity in tests
* fix: Pr comments
* fix: Change test name
---------
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: DhairyaSethi <[email protected]>
* wip: merge in main, debugging tests
* wip: Fix more tests
* wip: Fix tests
* feat: Fix tests
* fix: Restore tests
---------
Co-authored-by: Alexandru-Vlad Niculae <[email protected]>
Co-authored-by: miguelmtzinf <[email protected]>
Co-authored-by: YBM <[email protected]>
Co-authored-by: dhairya <[email protected]>
Co-authored-by: miguelmtz <[email protected]>
Co-authored-by: [email protected] <[email protected]>
* fix: Rename variables in tests
* fix: Namings
* test: Paused and frozen restore cases
* test: Premium deltas differing
* fix: Pr comments
* chore: Remove health factor tests
* fix: Remove todo comments
---------
Co-authored-by: Cheyenne Atapour <[email protected]>
Co-authored-by: Alexandru-Vlad Niculae <[email protected]>
Co-authored-by: miguelmtzinf <[email protected]>
Co-authored-by: dhairya <[email protected]>
Co-authored-by: miguelmtz <[email protected]>
Co-authored-by: [email protected] <[email protected]>1 parent 7d9a4aa commit 397c690
File tree
9 files changed
+855
-1594
lines changed- src
- contracts
- libraries
- helpers
- logic
- tests
- unit
- Hub
- Spoke
9 files changed
+855
-1594
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
613 | | - | |
614 | 613 | | |
615 | 614 | | |
616 | 615 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| |||
130 | 129 | | |
131 | 130 | | |
132 | 131 | | |
133 | | - | |
134 | 132 | | |
135 | 133 | | |
136 | 134 | | |
| |||
506 | 504 | | |
507 | 505 | | |
508 | 506 | | |
509 | | - | |
510 | 507 | | |
511 | 508 | | |
512 | 509 | | |
| |||
582 | 579 | | |
583 | 580 | | |
584 | 581 | | |
585 | | - | |
586 | 582 | | |
587 | 583 | | |
588 | 584 | | |
589 | | - | |
590 | | - | |
591 | 585 | | |
592 | 586 | | |
593 | 587 | | |
| |||
890 | 884 | | |
891 | 885 | | |
892 | 886 | | |
893 | | - | |
894 | 887 | | |
895 | 888 | | |
896 | 889 | | |
| |||
905 | 898 | | |
906 | 899 | | |
907 | 900 | | |
908 | | - | |
909 | 901 | | |
910 | 902 | | |
911 | 903 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
46 | | - | |
47 | 45 | | |
48 | 46 | | |
49 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | 21 | | |
24 | 22 | | |
25 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
173 | 180 | | |
174 | 181 | | |
175 | 182 | | |
| |||
1177 | 1184 | | |
1178 | 1185 | | |
1179 | 1186 | | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
1180 | 1196 | | |
1181 | 1197 | | |
1182 | 1198 | | |
| |||
This file was deleted.
0 commit comments