Commit Graph

1818 Commits

Author SHA1 Message Date
microwavedcola1 d599daf5d7 update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-05-30 09:30:17 +02:00
microwavedcola1 d0e7c54216 script for off chain data
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-05-30 08:37:18 +02:00
microwavedcola1 6a76476acd
referrerRebatesAccrued - these accrue to the ui now (#596)
* these accrue to the ui now

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-05-28 07:44:45 +02:00
Christian Kamm 56b010eb71
HealthRegion: Whitelist new perp_place_order_(pegged_)v2 ix (#597) 2023-05-26 16:48:19 +02:00
microwavedcola1 7a7dd1cdf8 no-cors
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-05-25 14:26:53 +02:00
Britt Cyr 2ea8f73ad1
Fix typo in token_liq_with_token comment (#594) 2023-05-25 12:35:22 +02:00
Christian Kamm 9f9f3d257c
Docs: improve HealthCache comments (#590) 2023-05-19 14:42:14 +02:00
Maximilian Schneider 0b22e41acd
manage dependencies in workspace (#588)
* move important dependencies to workspace
* enable workspace inheritance
2023-05-17 20:48:14 +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
microwavedcola1 5d31d6bf32
merge deploy changes to dev (#586)
* expose perp order type on perp order

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.9.17

* Fix funding rate method

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* Fix scrript

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.9.18

* ts-client v0.9.19

* fix script

* update reduce only and force close flags in ts client

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.13.1

* expose underlying property

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.13.2

* Fix bug in closing mango account (#559)

* reafactor code for collecting health accounts, fix bug where bank oracle was skipped while closing account

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>

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.13.3

* fix client code for building health accounts

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.13.4

* Fix bug in sim max serum3 bid

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.13.5

* increase charge

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* ts-client v0.14.0

* Fix getBorrowRate() to include loan upkeep

* ts-client v0.14.1

* Client: Move jup's CU ix outside of flash loan

That makes a flash loan based jup swap usable with delegates.

* liquidator: Don't attempt to close in-use token positions

This could happen if the user manually used serum on the liquidator
account.

* Mc/ci cd (#570)

* prettier

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* Fix branch

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* rename

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* Increase iterations for max swap to fix some edge case, fix debug script since fees are already accounted for

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.14.2

* Risk notification bot (#565)

* risk stuff

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>

* cleanup

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* client function

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* fix

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.15.0

* fix risk computati

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* Fixes from review

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.15.2

* Fix units

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* dont drop or rally stable assets

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* dont skip usdc

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* Fixes from review

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.15.3

* Fix

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.15.4

* update

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.15.5

* update

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.15.6

* add highlight

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.15.7

* Fix math

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* Fix

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.15.10

* Fix

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* v0.15.12

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
2023-05-16 19:20:43 +02:00
Christian Kamm 163f42e998 CI: Fix verifiable build workflow 2023-05-16 13:31:30 +02:00
Christian Kamm e3dec81876
Changelog for program v0.16.0 and idl update (#585) 2023-05-16 12:57:42 +02:00
Christian Kamm be5618aa2b
PerpTakerTradeLog: Add decremented base lots (#584) 2023-05-16 11:10:26 +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
microwavedcola1 08dfb0ddba
Risk notification bot (#565)
* risk stuff

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>

* cleanup

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* client function

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-05-13 11:55:08 +02:00
microwavedcola1 784ef88927
document unused (#581)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-05-13 10:03:28 +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 9429d3991d Bump program version to v0.16.0 and add deploy info 2023-05-11 13:46:43 +02:00
microwavedcola1 13ac422875 Increase iterations for max swap to fix some edge case, fix debug script since fees are already accounted for
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-05-10 11:18:46 +02:00
Christian Kamm 450f446032
Make clippy happy (#580) 2023-05-09 21:08:55 +02:00
galactus d2b5bffb65
Merge pull request #578 from blockworks-foundation/using_correct_rustc
using correct rust compiler version so that tests pass
2023-05-09 15:00:23 +02:00
Godmode Galactus 9263403c39
using correct rust compiler version so that tests pass 2023-05-09 14:49:58 +02:00
Maximilian Schneider 7bfdb0af47
Add more instruction generators to client (#575)
* Add more instruction generators to client
* fmt
2023-05-09 12:46:45 +02:00
Christian Kamm 2205fe7260
Changelog for program v0.15.0, version bump, idl update (#577) 2023-05-08 08:13:50 +02:00
Christian Kamm d20ae0abcb
Perp: Exit matching loop when no more base lots can be filled (#576) 2023-05-08 06:40:38 +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 3600b6592c
ts-client: Fix serum taker fee computation (#573) 2023-05-05 09:11:47 +02:00
Christian Kamm 2f4976e81f
Improve error message for FixedAccountRetriever (#566)
When an invalid number of accounts is passed in, which is one of the
most common error messages new integrators will see.
2023-05-05 09:11:25 +02:00
Christian Kamm 953e2f76b2
Ckamm/liq fixes (#571)
* liquidator: Don't attempt to close in-use token positions

This could happen if the user manually used serum on the liquidator
account.

* Client: Move jup's CU ix outside of flash loan

That makes a flash loan based jup swap usable with delegates.
2023-05-05 09:11:12 +02:00
microwavedcola1 5792731ead rename
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-05-04 16:13:04 +02:00
microwavedcola1 abba3de4ce
Fix bug in flash loan for delegates where compute budget program was not allowed, also improved logging (#572)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-05-04 14:46:09 +02:00
microwavedcola1 7a2f957d1b
Mc/ci cd (#570)
* prettier

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* Fix branch

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-05-04 14:16:05 +02:00
Christian Kamm 0da1b6728b
OpenBook place order: respect bank reduce_only flags (#569) 2023-05-04 08:02:28 +02:00
Christian Kamm 6f47ad92d6
token_register_trustless: Disable borrowing by default (#567)
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.
2023-05-04 07:59:39 +02:00
Christian Kamm 4504ed8ff9 Compile fix and idl update 2023-04-26 09:07:05 +02:00
Christian Kamm ea357f2e95
Changelog for v0.14.0 (#563) 2023-04-25 19:08:29 +02:00
microwavedcola1 4e4af83d98
Fix bugs for release (#564)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-04-25 16:18:35 +02:00
Christian Kamm 7ec8fbffe5 Fix build without enable-gpl 2023-04-25 13:39:01 +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
Christian Kamm 507cb500e9
Fix settle limit accounting for positive pnl takeover (#562) 2023-04-25 13:37:34 +02:00
microwavedcola1 77f04d62c1 update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-04-25 12:33:36 +02:00
microwavedcola1 1699d53acd update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-04-25 12:32:43 +02:00
microwavedcola1 7b33e42ed4 add script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-04-25 12:29:24 +02:00
microwavedcola1 f0d8d404ca update idl, fix ts errors
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-04-25 10:14:38 +02:00
Christian Kamm ff9a79a95f
Add OtterSec audit document (#560)
For 5c7a2e3e10, slightly past the
program-v0.7.0 tag.
2023-04-25 09:38:42 +02:00
microwavedcola1 3741f78da5
insurance fund withdraw ix (#561)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-04-25 09:20:44 +02:00
microwavedcola1 2305a160d0
Various force close bots (#554)
* wip: force close perp positions

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* wip: force close cancel serum3 orders

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* wip: force close token borrows

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>

* 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-04-25 08:12:42 +02:00
microwavedcola1 1bf1a8deb5
Fix bug in closing mango account (#559)
* reafactor code for collecting health accounts, fix bug where bank oracle was skipped while closing account

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>

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-04-24 14:48:53 +02:00