27/09/2024 - BE - Missing accounts reload during fee distribution

What

The smart contract uses an internal version of the swap to convert the collateral into USDC without fee in order to send them to the staking for rewards accrual. At some point in the code there are 2 successive calls to this internal swap, and so accounts must be reloaded in between to keep track with the state. We do so, but missed 2 accounts reloads after transfers. You swap open a Bonk long posting WBTC collateral, a swap is made to convert your WBTC to Bonk. You have generate 3 satoshis in swap fees, we swap these internally into USDC. These USDC are then sent to the reward vault for staking. The issue in the code would cause the total USDC sent to the rewards to be slightly higher or lower, but of the order of magnitude of a slight percentage on swap fees. (+/- ~10-100$).

Impact

This could cause issue if the amount was overall lesser, if all user were to theoretically claim reward for these rounds, as there would be missing a few $ for the last users. If this happen some day we will just send USDC to that account for resolution.

Details

issue found: Corto, trying to increase a Jitosol long with WBTC issue fix: Orex and Corto patch in: Release/5 - Adrena Program v1.0.3 on 27/29/2024 proposal url: https://dao.adrena.xyz/dao/AdrenaDAO/proposal/9YyYNWvHyzBzWRESq4dQV92uN7DJ4PsTCSX1Wq4kEMWn

Last updated