Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Conversation

@dissimilllate
Copy link
Contributor

No description provided.

@dissimilllate dissimilllate changed the title feat: show liquidator profit in usd Update Liquidation Jul 5, 2023

const liquidatorProfit = (summary.after.xcnLockedForSupply - amountToRepay) / 1e18;
const protocolSeizeShareMantissa = await oXCN.protocolSeizeShareMantissa() / 1e16;
const protocolSeizeShareCoefficient = await oXCN.protocolSeizeShareMantissa() / 1e18;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using additional variable to keep formulas simple, because:
protocolSeizeShareMantissa = await oXCN.protocolSeizeShareMantissa() / 1e16; // 2.8, whilst we need 0.028 for calculations

In javascript:
2.8 / 1e2 = 0.027999999999999997

// https://docs.onyx.org/comptroller/close-factor
const closeFactorPercentage = (await Comptroller.callStatic.closeFactorMantissa() / 1e16)
const liquidationIncentiveMantissa = (await Comptroller.callStatic.liquidationIncentiveMantissa() / 1e16);
const liquidationIncentiveCoefficient = (await Comptroller.callStatic.liquidationIncentiveMantissa() / 1e18);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using additional variable to keep formulas simple, because:
liquidationIncentiveCoefficient = (await Comptroller.callStatic.liquidationIncentiveMantissa() / 1e16); // 110, whilst we need 1.1 for calculations

In javascript:
1.1 / 1e2 = 0.011000000000000001

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants