Commit 1c2139a
Rebuild LH and BM based on last design (aave#42)
* feat: Add borrow module code
* fix: clean ups
* fix: Format IR
* test: Add borrow simple test
* refactor: rename borrow/repay methods to draw/restore
* feat: incorporate hub into borrow module constructor to access it
* feat: draw liquidity from BM instead of hub
* refactor: directly transfer liquidity so that approval does not need resetting
* refactor: remove direct call to onBorrow from hub
* refactor: rename method
* feat: incorporate interface
* fix: fix interface with args
* refactor: remove onBorrow
* refactor: rename validation method
fix: revert methods in bm, add method args for onBehalfOf
* feat: add events for bm
* fix: revert naming for bm validation
* refactor: move interface files
test: init mock basic bm credit line
* test: add credit line mock
* test: add borrow module credit line to base test
* test: clean up MockBorrowModuleCreditLine
* fix: resolve _accrueReserveInterest calcs
* test: test_first_borrow_credit_line
* test: resolve test_supply_index_increase
* test: test_first_borrow_credit_line
* test: init fuzz test for multiple borrow rounds with credit line
* test: fuzz test for multiple draws, different IRs
* refactor: add comments, re-order methods
* Liquidity Hub / Borrow Module Interest Rate Integration (aave#30)
* fix: comments for slope units of IR
* test: credit line read IR from storage, add setter, update tests
* test: incorporate default IR strategy into credit line; rename test errors library to resolve duplication
* feat: incorporate IR strategy into bm
* test: remove uneeded supply for credit line
* fix: resolve calculations of principalBalance and totalDebt in bm
* test: send credit line borrow amount to sender
* test: resolve
* fix: adjust getIR based on assetId, resolve debt calcs, update state in BM, adjust tests
* fix: clean up updateState
* refactor: set borrow rate during add reserve in bm
* fix: user debt calcs
* refactor: accrueInterest into updateState
test: bm assertions during borrow
* fix: don't separate interest from principal
* comments: todo for hub
* test: test_multi_borrow_credit_line
* chore: remove duplicate tests; clean up failed assertion msgs
* test: optimize address reference
* refactor: rename method
test: add assertion on reserve
* refactor: move credit line tests to separate file
* refactor: remove unneeded; re-order
* feat: check hub liquidity, add comments
* fix: resolve balance from struct in bm, clean up calcs
* comment: add todo around updateState
* fix: remove explicit check for balance
* test: add test errors
* fix: _validateSupply fix
* test: add revert tests
* test: move to liq hub test
* test: tests for emitted events
feat: indexed event args
* test: bm tests for updateReserve
* refactor: original bm to _accrueUserInterest in separate method
* refactor: rename vars in credit line for clarity
* fix: correct params for calculateCompoundedInterest
* chore: clean up comments according to feedback
* fix: apply changes to BM, update tests
* feat: add method to update IR strategy address
* refactor: move getInterestRate from governance-related
* comments: notes on credit line case
* comments: notes on ray for IR output
* feat: update reserve total debt before updating IR
* fix: remove onBehalfOf
* comments: add dev comments for bps units
* fix: remove calculateInterestRates from bm
* feat: incorporate borrow rate into reserve struct
* feat: update borrow rate on updateState
* fix: remove unneeded method for static IR credit line
* refactor: keep math operations consistent style
* fix: address PR comment
* fix: address PR comments
* feat: Change basic functions for architectural update
* feat: Architecture rework
* feat: Change names
* fix: Name changes
* fix: Misc fixes
* fix: Use shares for accounting
* feat: Moved supply caps to be per borrow module
* fix: Refactor borrow module
* Resolve conflicts from Main branch (aave#43)
* fix: merge main; resolve contract compile
* fix: address PR comments, retain newer changes
* fix: clean up comments, remove unneeded
* fix: remove updateState from bm
* fix: revert previous calcs for debt
* chore: comment placement
* fix: typo
* fix: comment out previous calcs which don't apply
* Implementation of Spoke/Liquidity Hub (aave#46)
* fix: merge main; resolve contract compile
* fix: address PR comments, retain newer changes
* fix: clean up comments, remove unneeded
* fix: remove updateState from bm
* fix: rename borrow module to spoke
* feat: skeleton for remaining methods for spoke
* fix: rename event so it is consistent
* feat: skeleton for method structure in spoke
* feat: accounting for borrow/repay methods
* feat: implement borrow to
* feat: getter functions for shares/asset conversions
* test: resolve compile with updated borrow input params
* feat: refactor to utilize convertAssetsToShares
* fix: transfer tokens to Spoke before calling supply on LH
* fix: draw method abstraction onBehalfOf
* feat: update ILiquidityHub, validateRepay
* fix: rename file to Spoke
* refactor: interface method order
* feat: implement _validateSupply, pass aggregatedRiskPremium to LH
* chore: add comments, move getter up
* refactor: maintain consistency - validate before updating state
* feat: implement draw onBehalfOf
* feat: getter for up-to-date balance
* feat: get updated asset balance in shares or in assets
* refactor: use the shares conversion getter
* refactor: move events to interface, add some todo
* chore: comment placement
* refactor: consistent naming conventions, data structures
* chore: add todo
* fix: re-arrange method order
* fix: rename method, add todo
* fix: split into 2 methods, rename method
* fix: update state before validation, to accrue interest first
* fix: onBehalfOf -> to
* fix: rename method, add some todo
* chore: add todo
* fix: rename error msg
* fix: onBehalfOf -> to
* fix: Rename onBehalfOf to to
* Finalize first implementation of Spoke/Liquidity Hub - resolve tests (aave#50)
* chore: borrow module refs -> spoke
* test: resolve test_first_supply, init SpokeTest
* test: emitted Supply event
* test: resolve test_first_supply
* fix: resolve supply cap - on spoke level only
* tes: utilize multiple spokes in LH tests as end users
* test: resolve test_first_borrow
* test: resolve test_revert_draw_cap_exceeded
* test: resolve test_revert_draw_not_available_liquidity
* test: resolve test_revert_draw_asset_not_active
* test: resolve test_withdraw
* test: resolve test_withdraw_more_than_supplied_reverts
* test: resolve test_supply_index_increase
* test: add spoke data assertions to test_withdraw
* test: clean up test_first_borrow, spoke assertions
* test: resolve test_fuzz_supply_events
* test: assertions on draw event
* test: assertion on withdraw event
* test: SpokeTest test_first_supply
* test: spoke test_first_borrow
* test: spoke test_withdraw
* chore: clean up unused tests
* test: LH test_restore
* test: assertion cleanup for test_restore
* test: spoke test_repay
* chore: clean up comments
* feat: addAsset, addSpoke to LH interface
* chore: add todo
* fix: update terminology on utils methods
* test: optimize expectEmit
* fix: explicit rounding in conversion methods
* test: revert expectEmits which were failing
* chore: todo comment
* feat: update forge-std
* chore: add todo comments
* test: optimize expectEmit
* chore: todo comments
* feat: functionality to add multiple spoke configs at once in LH
* test: implement addSpokes, unit tests and events
* chore: todo comments
* fix: token transfer directly from user to LH via spoke during supply
* fix: for restore also transfer tokens to hub directly
* test: helper function for test setup and LH config
* test: helper methods for init LH
* fix: clean up console imports
---------
Co-authored-by: DhairyaSethi <55102840+DhairyaSethi@users.noreply.github.com>
---------
Co-authored-by: YBM <yan@avara.xyz>
Co-authored-by: Cheyenne Atapour <cheyenneatapour@gmail.com>
Co-authored-by: DhairyaSethi <55102840+DhairyaSethi@users.noreply.github.com>1 parent f4938c6 commit 1c2139a
18 files changed
Lines changed: 1940 additions & 1245 deletions
File tree
- lib
- src
- contracts
- interfaces
- libraries/types
- tests
- invariant
- mocks
- unit
- .gitattributes+1
- .github/workflows/ci.yml+48-12
- .github/workflows/sync.yml+31
- .gitmodules-3
- CONTRIBUTING.md+193
- README.md+18-2
- foundry.toml+3-3
- lib/ds-test-1
- package.json+2-2
- scripts/vm.py+646
- src/Base.sol+5-3
- src/Script.sol+4-3
- src/StdAssertions.sol+558-214
- src/StdChains.sol+72-32
- src/StdCheats.sol+286-41
- src/StdInvariant.sol+38-8
- src/StdJson.sol+129-25
- src/StdStorage.sol+245-99
- src/StdStyle.sol+333
- src/StdToml.sol+283
- src/StdUtils.sol+92-34
- src/Test.sol+10-5
- src/Vm.sol+2.1k-336
- src/console.sol+635-608
- src/console2.sol+1-1.5k
- src/interfaces/IERC4626.sol+2-2
- src/mocks/MockERC20.sol+234
- src/mocks/MockERC721.sol+231
- src/safeconsole.sol+13.9k
- test/StdAssertions.t.sol+130-808
- test/StdChains.t.sol+134-54
- test/StdCheats.t.sol+335-46
- test/StdError.t.sol+15-13
- test/StdJson.t.sol+49
- test/StdMath.t.sol+31-26
- test/StdStorage.t.sol+232-44
- test/StdStyle.t.sol+110
- test/StdToml.t.sol+49
- test/StdUtils.t.sol+88-35
- test/Vm.t.sol+18
- test/fixtures/test.json+8
- test/fixtures/test.toml+6
- test/mocks/MockERC20.t.sol+441
- test/mocks/MockERC721.t.sol+721
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
116 | 120 | | |
117 | 121 | | |
118 | 122 | | |
| |||
0 commit comments