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

[HOTFIX] Credix rebalancing - maths fix for zero-profit case #328

Closed crypto-vincent closed 8 months ago

crypto-vincent commented 8 months ago

Turns out having exactly zero profits trips up the computation for the precision loss 😢

Example: https://explorer.solana.com/tx/5wvq3AK3eViBtgbyhRNQL3TMNxzyVnbr4NJgeeRgtgiCtDb8ybMeG1168GuTzVnEYRKNP83uQ5u8fjxPsxrvVFJg

So this PR adds an additional protection and also adds an integration test to verify that this new version works for exactly zero profits

crypto-vincent commented 8 months ago

Deployed on main-net, merging this branch now.