- New permissionless instruction to regularly charge collateral fees
- Bank and group configuration to set rate and interval
- Keeper addition to call the instruction
Previously, we tried to keep track of "other" and "trade" realized pnl.
An issue occured when a perp base position went to zero: the way we
computed the trade pnl included potential non-trade unsettled pnl.
That caused follow-up trouble because the value could change sign and
reset the settle limit for trade pnl.
This change aims to simplify in some ways:
- explicitly talk about oneshot-settleable pnl (fees, funding,
liquidation) and recurring-settleable pnl (materialization of settle
limit derived from the stable value of the base position when reducing
the base position)
- instead of directly tracking realized settleable amounts (which
doesn't really work), just decrease the recurring settleable amount
when it exceeds the remaining unsettled pnl
- get rid of the directionality to avoid bugs of that kind
- stop tracking unsettled-realized trade pnl (it was wrong before, and
no client uses it) - we already track position-lifetime realized trade
pnl
(cherry picked from commit ae5907ba3a)
Previously, we tried to keep track of "other" and "trade" realized pnl.
An issue occured when a perp base position went to zero: the way we
computed the trade pnl included potential non-trade unsettled pnl.
That caused follow-up trouble because the value could change sign and
reset the settle limit for trade pnl.
This change aims to simplify in some ways:
- explicitly talk about oneshot-settleable pnl (fees, funding,
liquidation) and recurring-settleable pnl (materialization of settle
limit derived from the stable value of the base position when reducing
the base position)
- instead of directly tracking realized settleable amounts (which
doesn't really work), just decrease the recurring settleable amount
when it exceeds the remaining unsettled pnl
- get rid of the directionality to avoid bugs of that kind
- stop tracking unsettled-realized trade pnl (it was wrong before, and
no client uses it) - we already track position-lifetime realized trade
pnl
The liqor liquidation fee and platform liquidation fee for the asset and
liab token are both payed by the liqee.
The platform liquidation fee is added to the Bank's
collected_fees_native and tracked in collected_liquidation_fees.
(cherry picked from commit 8383109f0d)
The liqor liquidation fee and platform liquidation fee for the asset and
liab token are both payed by the liqee.
The platform liquidation fee is added to the Bank's
collected_fees_native and tracked in collected_liquidation_fees.