- Update in_use_count to u16
- Pass banks to TCS cancel instruction
- Increase the in_use_count when a tcs is created and decrease on
trigger/cancel
(cherry picked from commit 5dd5c507f2)
To have more precision when storing user supplied prices and ensure that
the rounding that will occur will be tiny compared to the user-provided
precision.
Users can request token swaps to happen when the oracle price
is within a price band. Once the price is right, an executor can
trigger the swap. The executors are rewarded with a premium
over the oracle price.
This allows limit and stop loss orders on arbitrary spot pairs.
The PR comes with basic ts support and adjustments to the liquidator,
to execute available token conditional swaps.
Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
* Stable Price: Reset on first price != 0
This helps when listing tokens or perp markets with an upcoming
oracle. Currently the stable price would be 0 and would need to be
manually reset by DAO proposal.
With this change, the first non-zero value will be used as the starting
point for the stable price instead.
* Listing instructions: Succeed even if oracle is invalid
But require the stable price to reset once it becomes valid.
Instead of requiring a strict increase when init health < 0.
This allows users to still place reducing limit orders on the spot and
perp orderbooks as long as these orders keep the health unchanged.
This changes perp market margining to no longer assume all pnl is in USD
while settlement is in USDC. Instead, a configurable settle token is used for
pnl and settlement, defaulting to USDC.
There is no difference while the USDC price is forced to $1 and the init and liab
weights are 1. But with this patch, it becomes possible to change that.
For now it is not recommended to use a token other than USDC or USDT (or
another USD targeting stable token) for perp settlement.
The patch also updates all insurance vault use to be aware that the insurance
fund is not in USD but in USDC and apply the USDC price before payouts.
To do this, the previous PerpLiqNegativePnlOrBankruptcy was replaced by
a new PerpLiqNegativePnlOrBankruptcyV2 instruction.
Co-authored-by: microwavedcola1 <89031858+microwavedcola1@users.noreply.github.com>
* add new event for taker trade so arb bots can verify their execution cost without waiting for consume events
Co-authored-by: Nicholas <nicholasgclarke@gmail.com>
Previously tokens listed this way could be borrowed. Now tokens start
with reduce-only set to the "no borrows" mode.
Also decrease the default soft borrow/deposit limits significantly, even
if they don't come into effect when there are no borrows and the deposit
weight is 0 anyway.