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

🥝 Remove gas compensation #2

Merged
merged 8 commits into from
Apr 29, 2024
Merged

🥝 Remove gas compensation #2

merged 8 commits into from
Apr 29, 2024

Conversation

Szymx95
Copy link
Contributor

@Szymx95 Szymx95 commented Apr 22, 2024

No description provided.

@@ -90,8 +90,7 @@ contract BorrowerOperations is TrinityBase, ReentrancyGuardUpgradeable, UUPSUpgr
_requireAtLeastMinNetDebt(vars.asset, vars.netDebt);

// ICR is based on the composite debt, i.e. the requested debt token amount + borrowing fee + gas comp.
uint256 gasCompensation = IAdminContract(adminContract).getDebtTokenGasCompensation(vars.asset);
vars.compositeDebt = vars.netDebt + gasCompensation;
vars.compositeDebt = vars.netDebt;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove compositeDebt then?

@Szymx95 Szymx95 force-pushed the Remove_gas_compensation branch 2 times, most recently from dc134d7 to 5341d46 Compare April 24, 2024 12:30
@Szymx95 Szymx95 force-pushed the Remove_gas_compensation branch from 5341d46 to 742f56d Compare April 24, 2024 13:13
@Szymx95 Szymx95 marked this pull request as ready for review April 25, 2024 07:21
vars.compositeDebt = vars.netDebt + gasCompensation;
require(vars.compositeDebt != 0, "compositeDebt cannot be 0");
// ICR is based on the composite debt, i.e. the requested debt token amount + borrowing fee.
require(vars.netDebt != 0, "compositeDebt cannot be 0");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
require(vars.netDebt != 0, "compositeDebt cannot be 0");
require(vars.netDebt != 0, "Debt cannot be 0");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general should remove 'composite debt' from this file

@@ -85,7 +83,6 @@ interface IVesselManagerOperations is ITrinityBase {
struct LiquidationValues {
uint256 entireVesselDebt;
uint256 entireVesselColl;
uint256 collGasCompensation;
uint256 debtTokenGasCompensation;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other gas compensation is stil here?

@@ -237,7 +237,7 @@ contract VesselManager is IVesselManager, UUPSUpgradeable, ReentrancyGuardUpgrad
) external override nonReentrant onlyVesselManagerOperations {
_removeStake(_asset, _borrower);
_closeVessel(_asset, _borrower, Status.closedByRedemption);
_redeemCloseVessel(_asset, _borrower, IAdminContract(adminContract).getDebtTokenGasCompensation(_asset), _newColl);
_redeemCloseVessel(_asset, _borrower, 0, _newColl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this param is unused maybe it should be removed from function signature?

@@ -87,22 +87,16 @@ contract VesselManagerOperations is IVesselManagerOperations, UUPSUpgradeable, R
IActivePool(activePool).sendAsset(_asset, collSurplusPool, totals.totalCollSurplus);
}

IVesselManager(vesselManager).updateSystemSnapshots_excludeCollRemainder(_asset, totals.totalCollGasCompensation);
IVesselManager(vesselManager).updateSystemSnapshots_excludeCollRemainder(_asset, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Comment on lines 98 to 99
0,
0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

Comment on lines 149 to 150
0,
0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

@@ -144,22 +138,16 @@ contract VesselManagerOperations is IVesselManagerOperations, UUPSUpgradeable, R
}

// Update system snapshots
IVesselManager(vesselManager).updateSystemSnapshots_excludeCollRemainder(_asset, totals.totalCollGasCompensation);
IVesselManager(vesselManager).updateSystemSnapshots_excludeCollRemainder(_asset, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

@@ -319,18 +316,13 @@ class TestHelper {
// Virtual debt = 50 TRI.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we just get rid of these functions? Or keep them to preserve the least amount of changes?


// --- Vessel ordering by ICR tests ---

it("Vessel ordering: same collateral, decreasing debt. Price successively increases. Vessels should maintain ordering by ICR", async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be kept too, just adjust for no gas compensation?

@Szymx95 Szymx95 merged commit 76dbbdd into main Apr 29, 2024
1 check passed
@Szymx95 Szymx95 deleted the Remove_gas_compensation branch April 29, 2024 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants