ajna-finance / ajna-core

The Ajna protocol is a non-custodial, peer-to-peer, permissionless lending, borrowing and trading system that requires no governance or external price feeds to function.
https://www.ajna.finance/
Other
31 stars 11 forks source link

Sherlock-88: In `moveQuoteToken` ensure pool debt is less than deposits (if deposit fee applied) #901

Closed grandizzy closed 1 year ago

grandizzy commented 1 year ago

Description of change

High level

Contract size

Pre Change

 LenderActions            -  10,603B  (43.14%)

Post Change

LenderActions            -  10,635B  (43.27%)

Gas usage

Pre Change

| moveQuoteToken                       | 847             | 143618 | 102184 | 632650 | 24      |
| moveQuoteToken                         | 40229           | 40326  | 40330  | 40417    | 4       |

Post Change

| moveQuoteToken                       | 847             | 137806 | 102184 | 632831 | 24      |
| moveQuoteToken                         | 40229           | 40326  | 40330  | 40417    | 4       |
grandizzy commented 1 year ago

lgtm (although I think the name of the PR is reversed -- we are ensuring that the debt is less than the deposit)

thanks, makes sense, I updated it

grandizzy commented 1 year ago

This PR appropriately restricts the HTP from being above the LUP && the debt exceeding deposit if a lender moves from a higher index to a lower index.

I suggest we add a simple test which proves this functionality is working as expected

yep, makes sense! mind to add such to existing PR? @ith-harvey

grandizzy commented 1 year ago

LGTM

The links that summarize the issue may die... please copy and paste the issue into the description directly

updated