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 6 forks source link

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

Closed crypto-vincent closed 10 months ago

crypto-vincent commented 10 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 10 months ago

Deployed on main-net, merging this branch now.