The UsdTokenSwapConfig.getPremiumDiscountFactor()
function implements an inverted logic for applying premiums and discounts during USD
token swaps. This causes economic incentives to work against the protocol's stability goals, leading to increased vault debt and inefficient capital utilization.
fullfillSwap
fulfills a USD token swap request of the user by converting the specified amount of USD tokens to a collateral asset.
It calls getAmountOfAssetOut
to calculate the amount of swapped assets:
StabilityBranch.sol#L373
The getAmountOfAssetOut
function calculates the amount of assets to be received in a swap based on the input USD amount, its current price, and a premium or discount. The premium or discount is determined by the vault's debt/TVL ratio:
StabilityBranch.sol#L97-L125
The premium/discount is calculated using the getPremiumDiscountFactor
function from UsdTokenSwapConfig
, and then applied as a multiplier to the output asset.
UsdTokenSwapConfig.sol#L137-L139
the getPremiumDiscountFactor
returns the premium or discount to be applied to the amount out of a swap, based on the vault's debt and the system configured premium / discount curve parameters:
Credit Scenario (Debt < 0):
vaultDebtUsdX18.lt(SD59x18_ZERO)
is true
Factor = UD60x18_UNIT.sub(pdCurveYX18) < 1
When multiplied with output: User gets FEWER assets (discount on price)
Debt Scenario (Debt > 0):
vaultDebtUsdX18.lt(SD59x18_ZERO)
is false
Factor = UD60x18_UNIT.add(pdCurveYX18) > 1
When multiplied with output: User gets MORE assets (premium on price)
The economic incentives are currently misaligned because:
When a vault is in debt:
Current: Users get MORE assets for their USD (discount)
Should: Users should get FEWER assets for their USD (premium) to incentivize USD deposits and discourage asset withdrawals, helping reduce the debt
When a vault has excess collateral:
Current: Users get FEWER assets for their USD (premium)
Should: Users should get MORE assets for their USD (discount) to incentivize asset withdrawals and reduce excess collateral
It creates wrong economic incentives that work against the protocol's stability. Vaults in debt will become more indebted as users are incentivized to withdraw more assets.
Vaults with excess collateral will accumulate even more collateral as users are disincentivized from withdrawing assets.
Manual Review
The logic in getPremiumDiscountFactor
should be reversed:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.