joicygiore - Due to the token decimal conversion involved, `mTBILL::mint()` and `mTBILL::mint()` should add additional checks, otherwise the 1:1 price ratio will be broken #95
Due to the token decimal conversion involved, mTBILL::mint() and mTBILL::mint() should add additional checks, otherwise the 1:1 price ratio will be broken
Summary
Due to the token decimal conversion involved, mTBILL::mint() and mTBILL::mint() should add additional checks, otherwise the 1:1 price ratio will be broken and some dust will be generated.
Vulnerability Detail
1e6 USDC can be exchanged for 1e18 mTBILL. Due to the limitation of decimal points, 99999999999999999999 mTBILL can only be exchanged for 99999999 USDC, and 99999999 USDC can only be exchanged for 999999990000000000000 mTBILL, so the actual mint and burn amounts should be integer multiples of 1e12. Although this is a small difference, it is more in line with the 1:1 price required by the sponsor.
Due to the token decimal conversion involved, mTBILL::mint() and mTBILL::mint() should add additional checks, otherwise the 1:1 price ratio will be broken and some dust will be generated.
The same check can be applied to DepositVault::deposit(), and the deposit amount is also an integer multiple of 1e12. Otherwise, due to decimal conversion, there will be a deviation between the content in the event and the amount received by tokensReceiver, which is not conducive to data query
joicygiore
medium
Due to the token decimal conversion involved,
mTBILL::mint()
andmTBILL::mint()
should add additional checks, otherwise the 1:1 price ratio will be brokenSummary
Due to the token decimal conversion involved,
mTBILL::mint()
andmTBILL::mint()
should add additional checks, otherwise the 1:1 price ratio will be broken and some dust will be generated.Vulnerability Detail
1e6 USDC can be exchanged for 1e18 mTBILL. Due to the limitation of decimal points, 99999999999999999999 mTBILL can only be exchanged for 99999999 USDC, and 99999999 USDC can only be exchanged for 999999990000000000000 mTBILL, so the actual mint and burn amounts should be integer multiples of 1e12. Although this is a small difference, it is more in line with the 1:1 price required by the sponsor.
Impact
Due to the token decimal conversion involved,
mTBILL::mint()
andmTBILL::mint()
should add additional checks, otherwise the 1:1 price ratio will be broken and some dust will be generated.Code Snippet
https://github.com/sherlock-audit/2024-05-midas/blob/main/midas-contracts/contracts/mTBILL.sol#L37-L52
Tool used
Manual Review
Recommendation
Add amount check
The same check can be applied to
DepositVault::deposit()
, and the deposit amount is also an integer multiple of 1e12. Otherwise, due to decimal conversion, there will be a deviation between the content in the event and the amount received by tokensReceiver, which is not conducive to data query