Skip to content
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

CS Note 8.6: Integration Notes for Smart Contract Devs #500

Open
bingen opened this issue Oct 9, 2024 · 0 comments
Open

CS Note 8.6: Integration Notes for Smart Contract Devs #500

bingen opened this issue Oct 9, 2024 · 0 comments

Comments

@bingen
Copy link
Collaborator

bingen commented Oct 9, 2024

The following function behaviors may be unexpected and must be taken into account when writing contracts that integrate with Liquity V2:

The repayBold and adjustTrove functions in BorrowerOperations can be used to repay debt. If the amount specified to repay would result in the trove falling below MIN_DEBT, then only the amount required to reach MIN_DEBT will be repaid. The remaining amount will be left with the caller. Integrators must not expect a revert if the amount specified is impossible to repay exactly and must return leftover amounts in the calling contract to the user.

The withdrawFromSP function in StabilityPool takes an _amount parameter. If the user has a BOLD deposit that is smaller than _amount, the user's full balance will be withdrawn. Integrators must not expect a revert if _amount is impossible to withdraw and must account for the actual withdrawal amount.

Any operation on a trove within a batch can influence other troves in the same batch. For instance, if we retrieve the data for Trove A by calling getLatestTroveData, then close another trove within the same batch, and subsequently call getLatestTroveData for Trove A again, the debt of trove A may have increased due to rounding errors. Integrators must expect that the state of a trove can change between calls, even if the trove itself is not directly modified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant