You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tax is added onto borrowed amount, not reduced from what is sent to the user as per @cupOJoseph
Example: 200 is borrowed, 200 OD is minted and sent to user, debt is incremented so they must pay back 200.01
Problem:
Example: When user's create a vault, and borrow 200 OD, only 199.98 is sent to their wallet, making it impossible for them to pay their debt without making a new vault, or obtaining OD.
We've investigate the Frontend, and SDK, the problem begins with the method: Contract & line
Which calculates _deltaDebt, however _deltaDebt is slightly off wad, potentially due to solidity precision loss issues. As seen below:
// If there was already enough COIN in the safeEngine balance, just exits it without adding more debtif(_coinAmount<_deltaWad*RAY){// Calculates the needed deltaDebt so together with the existing coins in the safeEngine is enough to exit wad amount of COIN tokens_deltaDebt=((_deltaWad*RAY-_coinAmount)/_rate).toInt();// This is neeeded due lack of precision. It might need to sum an extra deltaDebt wei (for the given COIN wad amount)_deltaDebt=uint256(_deltaDebt)*_rate<_deltaWad*RAY ? _deltaDebt+1 : _deltaDebt;}
Notes:
Maybe use hardhat console.log to print out every value within _getGeneratedDeltaDebt to see where the issue lies.
This is intended. You have to obtain OD on the open market to pay off all your debt. The protocol takes taxes any time the safe debt or collateral is modified.
Intended behaviour:
Tax is added onto borrowed amount, not reduced from what is sent to the user as per @cupOJoseph
Example: 200 is borrowed, 200 OD is minted and sent to user, debt is incremented so they must pay back 200.01
Problem:
Example: When user's create a vault, and borrow 200 OD, only 199.98 is sent to their wallet, making it impossible for them to pay their debt without making a new vault, or obtaining OD.
We've investigate the Frontend, and SDK, the problem begins with the method:
Contract & line
_lockTokenCollateralAndGenerateDebt
calls_getGeneratedDeltaDebt
Which calculates _deltaDebt, however _deltaDebt is slightly off wad, potentially due to solidity precision loss issues. As seen below:

Notes:
Maybe use hardhat console.log to print out every value within _getGeneratedDeltaDebt to see where the issue lies.
Resources:
The text was updated successfully, but these errors were encountered: