microwavedcola1
56eb48904a
Merge tag 'program-v0.19.0'
2023-09-07 10:46:37 +02:00
Christian Kamm
e37f1ed996
update idl
2023-08-30 10:59:14 +02:00
Christian Kamm
2d392c8fff
FlashLoan: fee fixes ( #693 )
...
- Rename the new "swap fee" to "deposit fee" and let it apply to all
deposits, not just for Swap-type flash loans.
- But don't apply it to withdrawals (effectively giving rebates!)
Result of audit feedback
(cherry picked from commit 1d6ce550f3
)
2023-08-29 10:03:53 +02:00
Christian Kamm
3480b62945
Changelog and version bump for program v0.19.0 ( #683 )
2023-08-18 15:38:28 +02:00
Christian Kamm
a244c27df6
Add account_create_v2 instruction ( #680 )
...
This one allows specifying the number of tcs slots. That way accounts
can be created without needing a separate extend instruction afterwards.
2023-08-18 15:36:36 +02:00
Christian Kamm
e4a9a56f89
Pass all params to token_register ( #665 )
...
Makes governance a little easier
2023-08-09 13:55:53 +02:00
Christian Kamm
6dcd5c925c
FlashLoan swaps: Allow charging a fee ( #660 )
...
To give more flexibility to the DAO.
The fee is deducted from any deposits that happen during the flash loan
and controlled per-bank with TokenEdit.
2023-08-09 13:27:25 +02:00
microwavedcola1
8d924a8b9b
Delegate with expiry ( #663 )
...
* delegate with expiry
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* update idl
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>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-08-09 12:05:16 +02:00
Christian Kamm
4810b6afbc
Tcs: store a display-only intention enum ( #667 )
...
This way the ui can know what the user created the tcs order for.
Introduces tcs create and trigger v2 logs.
2023-08-08 18:16:59 +02:00
Christian Kamm
785e6353c1
Fix compile after merges
2023-08-08 10:36:21 +02:00
Christian Kamm
774c67909e
Tcs: Use fees config from Bank instead of Group ( #659 )
...
To give more flexibility to the DAO, the maximum tcs fees from
the buy and sell banks will be used.
2023-08-08 10:21:13 +02:00
Christian Kamm
1be38d14cb
Tcs: Add price display style enum ( #654 )
...
Tcs orders always store prices in a fixed "sell per buy" style, but users
can create them in either price direction. When they look at them later,
the ui needs to know what their preferred style is for this order.
2023-08-03 12:37:01 +02:00
Christian Kamm
06f6d75b98
Fix typo in admin_token_withdraw_fees ix ( #655 )
2023-08-03 12:34:33 +02:00
microwavedcola1
d98bf2357b
update idl
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-07-21 08:46:24 +02:00
Christian Kamm
348fef80f3
Tcs: reserve token positions while tcs is open ( #647 )
...
- 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
)
2023-07-17 13:23:16 +02:00
Christian Kamm
5dd5c507f2
Tcs: reserve token positions while tcs is open ( #647 )
...
- 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
2023-07-17 13:14:53 +02:00
Christian Kamm
6b2f6af6e4
Idl: remove references to undefined openbook_v2 enums
2023-07-11 13:01:55 +02:00
Christian Kamm
a7ac6f8dfb
Update Cargo.lock and IDL after merge
2023-07-11 10:39:06 +02:00
galactus
6461743f35
Openbook v2 integration: instructions and accounts ( #628 )
2023-07-11 09:59:50 +02:00
Christian Kamm
30cb4d7753
Tcs: Switch prices from f32 to f64 ( #634 )
...
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.
2023-07-06 14:48:49 +02:00
Christian Kamm
3867d902d2
Bump program version to v0.18.0
2023-07-04 11:10:31 +02:00
Christian Kamm
cc4a39850a
Bump version and idl to v0.17.1
2023-07-04 11:08:59 +02:00
Christian Kamm
35064d4ab0
Token conditional swaps ( #604 )
...
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>
2023-07-03 14:09:11 +02:00
Christian Kamm
7eedcbae0d
Serum3 edit market: Allow changing the name ( #621 )
2023-06-21 15:38:27 +02:00
Christian Kamm
1cc77af7fa
Bump version to 0.17.0, changelog updates, idl update
2023-05-31 09:11:56 +02:00
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