UXDProtocol / uxd-program

Implementation of a program that manages on chain accounts to mint and redeem Redeemables tokens (UXD), hedged by a delta neutral position on underlying DEXes.
https://uxd.fi/
Other
21 stars 5 forks source link

[Audit] Q-3 - Usage of saturating_sub vs checked_sub #321

Closed crypto-vincent closed 8 months ago

crypto-vincent commented 8 months ago

Replacing this kind of logic:

if a < b {
   return 0;
}
return checked_sub(a, b);

by:

return a.saturating_sub(b);

When possible

crypto-vincent commented 8 months ago

CI is broken due to mercurial's breaking change on devnet. Tested manually on localnet once again before merging to develop 👌 .