keeperFee may be Insufficient due to implicit assumption of DSU price
Summary
There is an implicit assumption of DSU price to be $1 USD while calculating keeperFee. Though DSU is 1:1 backed by USDC, but USDC itself is not strictly worth $1. Actually, just a few months ago, there was a significant depegging between USDC and USD. Hence, pay of keeperFee may be insufficient while depegging occurs. Keepers would get no enough premium or even lead to loss.
Vulnerability Detail
First, let's look at L46~50, the calculation result is keeperFee amount of USD. Then, we look at L54, keeperFee amount of DSU is sent to keeper with implicit assumption of 1 USD = 1 DSU. But, if DSU depegs, then 1 USD > 1 DSU, keepers receive insufficient fee.
KingNFT
medium
keeperFee
may be Insufficient due to implicit assumption ofDSU
priceSummary
There is an implicit assumption of DSU price to be
$1
USD while calculatingkeeperFee
. Though DSU is 1:1 backed by USDC, but USDC itself is not strictly worth$1
. Actually, just a few months ago, there was a significant depegging between USDC and USD. Hence, pay ofkeeperFee
may be insufficient while depegging occurs. Keepers would get no enough premium or even lead to loss.Vulnerability Detail
First, let's look at L46~50, the calculation result is
keeperFee
amount of USD. Then, we look at L54,keeperFee
amount of DSU is sent to keeper with implicit assumption of1 USD = 1 DSU
. But, if DSU depegs, then1 USD > 1 DSU
, keepers receive insufficient fee.Impact
Keepers would get no enough premium or even lead to loss while depeg occurs.
Code Snippet
https://github.com/sherlock-audit/2023-07-perennial/blob/main/root/contracts/attribute/Kept.sol#L54
Tool used
Manual Review
Recommendation
Using chainlink
USDC/USD
feed to calculate accurate DSU amount.https://data.chain.link/ethereum/mainnet/stablecoins/usdc-usd