Christian Kamm
5fc7aa1092
Configurable perp settle token ( #550 )
...
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>
2023-05-17 15:50:05 +02:00
Christian Kamm
e3dec81876
Changelog for program v0.16.0 and idl update ( #585 )
2023-05-16 12:57:42 +02:00
Maximilian Schneider
c006948319
Enable self-trading protection ( #533 )
...
Co-authored-by: Christian Kamm <mail@ckamm.de>
2023-05-15 10:40:41 +02:00
Maximilian Schneider
9166b761e9
log taker trade summary ( #579 )
...
* 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>
2023-05-13 17:54:27 +02:00
Christian Kamm
5a05e9cb2e
Update anchor to v0.27.0, stop using submodule ( #582 )
2023-05-12 13:54:53 +02:00
Christian Kamm
2205fe7260
Changelog for program v0.15.0, version bump, idl update ( #577 )
2023-05-08 08:13:50 +02:00
Nicholas Clarke
c0ea9970b6
Clarkeni/oracle confidence ( #568 )
...
* Add oracle confidence and oracle type to update funding logs.
* Return price and OracleState struct from oracle_price_and_state.
2023-05-05 23:44:14 -07:00
Christian Kamm
4504ed8ff9
Compile fix and idl update
2023-04-26 09:07:05 +02:00
Nicholas Clarke
2dce1398d3
Fix to seq num logging. Seq num was incremented between event and logging ( #556 )
2023-04-25 13:38:31 +02:00
Nicholas Clarke
5d77ba6834
Add PerpForceClosePositionLog and TokenForceCloseBorrowsWithTokenLog ( #555 )
2023-04-25 13:38:08 +02:00
microwavedcola1
f0d8d404ca
update idl, fix ts errors
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-04-25 10:14:38 +02:00
microwavedcola1
6ac9f19287
Perp force close positions in a market ( #525 )
...
* force close tokens
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* add test
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* reset
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* force close perp market
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* rename
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* test
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* add back staleness slot check
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-04-19 17:42:01 +02:00
Christian Kamm
98a79505e1
FlashLoan: Don't deduce vault_len, add more checks ( #542 )
...
It looks like it wasn't possible to exploit the program by
re-initializing the user-owned token accounts used in flash loan because
the later use of health_ais with the health computation would error out
if any token account was included there.
However, the check and a few others were too indirect. In this patch:
- We pass the number of loans into FlashLoanEnd explicitly (verified
from FlashLoanBegin)
- Add explicit checks for token mints, so it's no longer possible to use
token accounts for foreign mints in Begin when the loan amount is zero,
and it's clearer to see that the bookkeeping in End won't break if the
user reinited the account for a different mint.
- Also add a few other extra comments and checks.
The updated FlashLoanEnd instruction is called FlashLoanEndV2
2023-04-14 15:18:02 +02:00
microwavedcola1
b07857c696
force close tokens program part ( #518 )
...
* force close tokens
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* add test
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* reset
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-04-13 12:44:12 +02:00
Christian Kamm
61a4f62ea4
Bump program version to v0.13.0 and update idl
2023-04-13 09:53:15 +02:00
Christian Kamm
74f7282d4e
Bump program version to v0.12.0 and update idl
2023-04-13 09:46:58 +02:00
Nicholas Clarke
0ba41e3471
Emit perp fees settled on update_funding. Required to have a full picture of total perp market fees. ( #530 )
2023-04-06 22:09:50 -07:00
Christian Kamm
535b0b2d0c
Changelog for program-v0.11.0, bump version, update idl
2023-03-31 18:47:34 +02:00
Christian Kamm
ec48db01bb
Changelog for program-v0.10.0 and idl update
2023-03-30 17:28:14 +02:00
Christian Kamm
b7dd8e0663
Fee buyback: Respect USDC oracle ( #504 )
2023-03-20 11:18:11 +01:00
Christian Kamm
68f9f38a3c
Update idl for v0.9.0
2023-03-12 08:37:52 +01:00
microwavedcola1
09c8be1c61
add idl to repo ( #494 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-03-07 09:18:19 +01:00