Christian Kamm
820ab36209
Update idl
2023-02-14 16:04:37 +01:00
Adrian Brzeziński
02321e705f
excude perp oracle pk from helthaccount during close account inst
2023-02-13 16:54:14 +01:00
Christian Kamm
1f66bef88f
Change liquidation end target to a new, third health type ( #447 )
...
Due to the safety features in v4, the init health can differ from maint
health a lot more than it used to in v3. This is because of stable-price
adjusted oracle prices used in init health, and the weight scaling based
on total deposits and borrows used in init health.
The effect is that once an account becomes liquidatable, it could be
liquidated a lot until it reaches init>=0.
The original idea of liquidating until init>=0 was just to provide some
buffer, such that liquidated accounts wouldn't immediately become
liquidatable again.
This patch decouples the buffer idea explicit from init health by
creating a new LiquidationEnd health type. Liquidation proceeds until
the LiquidationEnd health becomes positive.
Co-authored-by: microwavedcola1 <89031858+microwavedcola1@users.noreply.github.com>
2023-02-10 09:00:36 +01:00
microwavedcola1
184cf82e22
update settle limit before returning settleable pnl ( #445 )
...
* update settle limit before returning settleable pnl
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Revert "update settle limit before returning settleable pnl"
This reverts commit 29e38a85ef
.
* provide a canSettlePnl to reflect constraints in perp settle pnl ix
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-02-09 13:31:56 +01:00
microwavedcola1
a1b3b8bfc0
set start quote on banks
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-08 10:41:58 +01:00
microwavedcola1
0639681c33
configure max staleness slots
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-08 10:29:11 +01:00
microwavedcola1
0dba464a28
make dai reduce only
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-08 10:19:47 +01:00
microwavedcola1
4e3a7f22b9
remove perp zero out, was only added to cleanup testing perp market, can be re-added if needed ( #430 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-06 11:59:12 +01:00
Christian Kamm
75ec640820
liqtest: script fixes
...
- perp market should have zero asset weight to allow positive pnl
takeover tests
- stable price should be reset, to allow better reasoning about health
2023-02-03 17:23:25 +01:00
Christian Kamm
cbd3d915ba
liqtest: Confirm ALT tx before proceeding
...
Not waiting can leave the alt-create and alt-extend in the same slot,
and ordered incorrectly.
2023-02-03 17:23:25 +01:00
Christian Kamm
3b9e8c7d2b
ts: Add new convenience sendAndConfirmTx function
2023-02-03 17:23:25 +01:00
Christian Kamm
6c8204e9ef
ts: Allow control over tx confirmation commitment level
...
When talking to a load balanced endpoint it can be useful to read data
from rpc nodes at processed while waiting for confirmed commitment
on transactions.
2023-02-03 17:23:25 +01:00
Christian Kamm
38d408126e
client: Increase binary search iter limit
2023-02-03 17:23:25 +01:00
microwavedcola1
0ba7ecd506
Fix health region ix code
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-02 19:02:30 +01:00
microwavedcola1
a6a07307b0
fix mm
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-02 18:58:08 +01:00
Christian Kamm
d9a253947c
ts: add back tokenWithdrawNative() ( #434 )
2023-02-02 15:08:57 +01:00
Christian Kamm
628feafcb0
ts: Use sendAndConfirmTransaction instead of anchor's .rpc() ( #432 )
...
This allows us to configure a prioritization fee for these calls.
2023-02-02 14:23:22 +01:00
Christian Kamm
40696f40a1
Bump program version to 0.6.0
2023-02-02 10:54:54 +01:00
Nicholas Clarke
4c93a2740a
Add market index to Serum3OpenOrdersBalanceLog ( #429 )
2023-02-02 10:01:19 +01:00
Christian Kamm
df1f7418af
update idl
2023-02-02 09:17:22 +01:00
Christian Kamm
a91a9ae998
Perp: Fix liq instructions ( #424 )
...
- Rename to perp_liq_base_or_positive_pnl and perp_liq_negative_pnl_or_bankruptcy
- Deal with situations where overall asset weight is zero and base position reduction
would not improve liqee health
- Add ability for liqors to take over positive unsettled pnl if that improves liqee health
2023-02-02 09:00:37 +01:00
Christian Kamm
50c820ddce
Perps: Rename pnl_asset_weight -> overall_asset_weight ( #428 )
...
Calling it "pnl" was confusing, because the thing that is weighted isn't
the pnl, but `(weighted base value + quote position)`.
2023-02-01 16:15:45 +01:00
microwavedcola1
66ac32fd4e
Fix script
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-01 13:41:19 +01:00
microwavedcola1
a11cbdba21
mm: improve logging ( #408 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-02-01 09:58:19 +01:00
microwavedcola1
9039e2c586
try exporting explicitly
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-30 14:55:25 +01:00
microwavedcola1
3ad0b39926
add export
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-30 14:37:01 +01:00
microwavedcola1
3d062e8edd
update idl
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-27 18:44:22 +01:00
microwavedcola1
0012907ee3
Mc/ix toggler ( #419 )
...
* add gating to individual ixs
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-01-26 20:27:39 +01:00
microwavedcola1
0192728efc
return order id from a perp place order ix ( #417 )
...
* return order id from a perp place order ix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix
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-01-25 09:03:35 +01:00
microwavedcola1
8f8f87727d
update script
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-25 09:00:38 +01:00
microwavedcola1
482f43d9ed
update script
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-24 18:05:37 +01:00
microwavedcola1
7ed6e03f34
update script
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-24 17:58:23 +01:00
microwavedcola1
0b3a69631c
update script
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-24 17:52:21 +01:00
microwavedcola1
64b0dd5fdb
Fix env var
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-24 17:44:43 +01:00
microwavedcola1
1e046685a9
small fix + helper method
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-24 17:44:22 +01:00
Christian Kamm
1224fa4297
Bump program version to v0.5.0
2023-01-24 10:24:50 +01:00
microwavedcola1
629eaafaf3
add alternative mngo oracle
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-24 07:20:38 +01:00
microwavedcola1
51e3a671e3
make public
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-23 17:31:50 +01:00
microwavedcola1
80f4bd8048
security admin can bring markets to reduce only ( #394 )
...
* security admin can bring markets to reduce only
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix from review; security admin can only turn on reduce only, security admin can only reduce init asset weight
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* --wip-- [skip ci]
* 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-01-23 15:02:48 +01:00
microwavedcola1
64dda20cb5
group level token deposit limit ( #415 )
...
* group level token deposit limit
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix
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-01-23 14:58:03 +01:00
microwavedcola1
f0c797a2e4
zero out perp position and orders for a broken market ( #413 )
...
* zero out perp position and orders for a broken market
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* client code
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-01-23 12:50:20 +01:00
microwavedcola1
c30fa1dbb3
client support for security admin ( #414 )
...
* client support for security admin
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* update script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-23 12:02:36 +01:00
microwavedcola1
308bc307fe
update idl
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-21 14:12:51 +01:00
microwavedcola1
469ace8265
Fix call
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-21 14:10:34 +01:00
microwavedcola1
5e934760c1
debug perp: observe that base positions cancel each other out, and un… ( #397 )
...
* debug perp: observe that base positions cancel each other out, and unsettled pnl also cancels each out
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* dont log account level details
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-01-21 12:43:25 +01:00
microwavedcola1
265f6a1a48
add helper method: settleTokenNativeToUi ( #405 )
...
* add helper method: settleTokenNativeToUi
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Revert "add helper method: settleTokenNativeToUi"
This reverts commit 43b19b3056
.
* we can assume that quote is always in usd
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-21 11:35:43 +01:00
microwavedcola1
bb35aa66dc
ensure that freshly fetched objects have valid prices until we fetch … ( #409 )
...
* ensure that freshly fetched objects have valid prices until we fetch oracles again
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix
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-01-20 14:52:43 +01:00
microwavedcola1
8bf6210991
better debug logs
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-20 09:15:03 +01:00
microwavedcola1
3fd8d7f615
add sim health calls to debug script
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-20 08:29:36 +01:00
microwavedcola1
919f09bb8c
fix bug where serum oo where not loaded ( #403 )
...
* fix bug where serum oo where not loaded
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-01-19 11:31:54 +01:00
tylersssss
8fb231f2fc
fix getAverageEntryPrice so it divides instead of multiplies ( #402 )
2023-01-19 10:52:49 +01:00
Christian Kamm
1a3d0da34a
Perp market edit: Separate out stable price resetting, like for tokens
2023-01-19 09:33:27 +01:00
microwavedcola1
fbbce98ec3
simply debug user
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-18 20:15:04 +01:00
riordanp
2f78bd336f
Add oracleLastUpdatedSlot to Bank and PerpMarket ( #395 )
...
* Parse last updated slot from oracle
* Fix typo
* Remove unused package
2023-01-17 18:03:16 +00:00
Christian Kamm
9346c8e546
Perps: track overall realized pnl relating to a position ( #392 )
...
This includes trade pnl, funding and fees. Tracking this makes it easier
for uis to display a consistent position overall pnl value that doesn't
decrease by settling.
Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-17 14:07:58 +01:00
Adrian Brzeziński
6206bbb953
Merge pull request #389 from blockworks-foundation/feature/close-mango-account
...
Feature/close mango account
2023-01-17 12:46:42 +01:00
Christian Kamm
ec99376a8f
Perp: Allow setting pnl asset weights ( #391 )
...
This replaces the previous distinction between trusted and untrusted
markets, they are equivalent to setting the asset weights to 1 or 0
instead.
This way, we can weigh positive pnl in the trusted case at less than 1
which is more correct from a risk point of view and allows for more
flexibility when it comes to liquidation.
Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-16 16:49:09 +01:00
Christian Kamm
da1dfb2c3c
Add a liquidation test case for negative pnl ( #388 )
2023-01-16 12:30:34 +01:00
microwavedcola1
6d801bb4b0
log oracle address for quickly identifying which oracle belongs to which bank, remove accounts since its spammy
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-16 12:26:44 +01:00
Adrian Brzeziński
572a80d1d0
review fix
2023-01-15 01:31:06 +01:00
microwavedcola1
13dc5c061d
builder pattern for edit ixs ( #387 )
...
* builder pattern for edit ixs
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-01-14 14:09:26 +01:00
Adrian Brzeziński
d2b8d76ab6
fix
2023-01-13 23:32:12 +01:00
Adrian Brzeziński
e3bf0adca2
fix
2023-01-13 18:59:22 +01:00
Adrian Brzeziński
448cdf7c09
fix
2023-01-13 18:54:25 +01:00
Adrian Brzeziński
c459c09451
fixes
2023-01-13 18:07:13 +01:00
Adrian Brzeziński
3077f57c2f
Merge branch 'dev' into feature/close-mango-account
2023-01-13 17:33:50 +01:00
Adrian Brzeziński
001a528a6e
fix
2023-01-13 17:33:24 +01:00
Adrian Brzeziński
80cf41ff5f
empty and close mango account
2023-01-13 13:19:04 +01:00
Christian Kamm
1dbf55991c
Changelog: update release time and tx
2023-01-13 11:35:31 +01:00
microwavedcola1
22ed8f2385
Ts client temp merge into dev ( #386 )
...
* fix buildHealthRemainingAccounts to not modify the mangoAccount obj
* Fix bug where health accounts were not packed correctly
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix bug in building health accounts
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: tjs <tjshipe@gmail.com>
2023-01-13 11:23:37 +01:00
Christian Kamm
70616f74dd
idl update ( #384 )
2023-01-13 10:42:31 +01:00
microwavedcola1
ecc22f85d0
make untrusted till we have figured out perp settling ( #379 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-13 10:08:40 +01:00
Adrian Brzeziński
6e3e72436f
withdraw
2023-01-13 01:38:02 +01:00
Adrian Brzeziński
f5cb67fb3b
start of close
2023-01-12 22:34:48 +01:00
microwavedcola1
60d3f8d403
Fix ids api ( #371 )
...
* Fix ids api
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-01-12 20:43:37 +01:00
microwavedcola1
a7a5c740c9
Fix typo ( #375 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-12 20:39:46 +01:00
microwavedcola1
7c69197505
mango account freeze ( #372 )
...
* mango account freeze
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* format
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-01-12 13:08:10 +01:00
microwavedcola1
5ef04d6d08
group halt ( #370 )
...
* group halt
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* format
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-12 09:12:55 +01:00
Christian Kamm
c5d875e04d
Perp settle limit extension to realized pnl ( #359 )
...
Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-11 14:32:15 +01:00
tylersssss
75593925aa
fix buildHealthRemainingAccounts to not modify the mangoAccount obj ( #369 )
2023-01-10 16:51:03 +01:00
tjs
57a563a2c4
include quote token fixes
2023-01-07 17:23:58 -05:00
tjs
9d168f56bd
- fix sort order of open order accounts in buildHealthRemainingAccounts
...
- refactor buildHealthRemainingAccounts to be more idiomatic
2023-01-07 17:06:35 -05:00
tjs
9efe95cc75
fix serum3PlaceOrder logic so health remaining accounts are in order
2023-01-07 00:10:50 -05:00
Adrian Brzeziński
c28f3cd07a
fixes for open order creation when placing order
2023-01-07 03:01:11 +01:00
microwavedcola1
b6996419ad
Merge branch 'dev'
2023-01-06 08:42:54 +01:00
microwavedcola1
e34f9be60a
Apply loan origination fee only on loans ( #364 )
...
* Apply loan origination fee only on loans
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-01-06 08:42:16 +01:00
microwavedcola1
85a33bde5b
setup fast listing admin required for trustless tokens
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-05 20:24:58 +01:00
microwavedcola1
a911a861f9
Merge branch 'dev'
2023-01-05 20:14:26 +01:00
microwavedcola1
292cc9a450
bonk ( #363 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-05 20:08:45 +01:00
tjs
65a31bcd5c
use the non deprecated prioritization fee ix
2023-01-05 12:58:20 -05:00
Adrian Brzeziński
e4f238f489
combine open orders create with place order ( #362 )
...
* wip
* place order fix
* fixes
* comment
* cleanup
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-05 08:31:07 +01:00
Adrian Brzeziński
068fad98f7
combine open orders create with place order ( #362 )
...
* wip
* place order fix
* fixes
* comment
* cleanup
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-05 08:30:15 +01:00
microwavedcola1
5019864b84
Update script to include perp market to reduce only
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-04 16:55:01 +01:00
microwavedcola1
5b41ff89a0
Update script to include perp market to reduce only
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-04 16:54:28 +01:00
microwavedcola1
3ab8c6072a
add reduce only field on ts classes
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-04 13:14:05 +01:00
microwavedcola1
86c9331647
reduce only order type and mode for tokens and perp markets ( #353 )
...
* reduce only order type and mode for tokens and perp markets
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* tests
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* remove token
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fixes
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-01-04 09:24:40 +01:00
microwavedcola1
b174ee13cc
update script for alts and new admin change
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-01-04 07:42:19 +01:00
tjs
ae615b7473
Merge branch 'main' into dev
2023-01-03 19:56:45 -05:00
tjs
57040b160a
use passed in prioritization fee
2023-01-03 19:56:33 -05:00
tjs
92f92cb967
Merge branch 'main' into dev
2023-01-02 15:36:08 -05:00
tjs
80f94166bd
add prioritization fee instruction
2023-01-02 15:35:39 -05:00
riordanp
89c024e9df
Setup MM for Heroku deployments ( #358 )
...
* Setup mm for heroku
* Update params
* Update Procfile
* Fix runtime dependencies
* Run linter
2023-01-02 19:21:08 +00:00
tjs
b0164113f0
support healthtype of undefined to calculate with a weight of 1
2022-12-30 15:26:53 -05:00
tjs
d2ed61328a
settle serum after placing order
2022-12-27 18:50:29 -05:00
microwavedcola1
f72c3cd0ae
Fix typings
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-27 08:26:19 +01:00
microwavedcola1
44fb1037cf
Mc/serum fees ( #350 )
...
* maker rebate shouldnt be applied to maxQuoteQuantity
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-21 10:21:24 +01:00
microwavedcola1
5def04f6ee
add price band helper ( #349 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-20 19:19:18 +01:00
microwavedcola1
ebeb2328b9
force close mango account script
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-20 10:32:33 +01:00
tjs
48b5b81a09
script to add spot market
2022-12-19 20:30:47 -05:00
microwavedcola1
0ba51e6324
move to new authority and admin
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-19 19:50:09 +01:00
microwavedcola1
f3dac89d3e
Fix bug in getMaxBaseForSerum3AskUi where base returned was wrong
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-19 18:30:26 +01:00
microwavedcola1
31f56d0e41
Fix BN creation ( #342 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-19 15:40:14 +01:00
microwavedcola1
6e8f6596e7
rename
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-19 14:46:39 +01:00
Christian Kamm
7231ceea53
ts client: Fix avg entry price and break even price
2022-12-19 13:34:20 +01:00
microwavedcola1
f68a11145f
Filter by account
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-19 09:42:05 +01:00
tjs
13f32c8bae
assume taker fees
2022-12-17 14:08:48 -05:00
tjs
08cc99790c
needs parenthesis in maxQuoteQuantity
2022-12-17 13:06:48 -05:00
tjs
9b0db13c10
fix maxQuoteQuantity in placeSpotOrder
2022-12-17 13:01:57 -05:00
Christian Kamm
071dc34ccc
Client: Rework max_swap function ( #340 )
...
* Client: Rework max_swap function
Determining the amounts at which the health function changes slope
becomes too difficult when serum3 open orders come in.
Instead, generally find the function's maximum and then work with that.
* max_swap: Add test for swapping into a trustless token
* ts port
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-16 16:33:37 +01:00
Christian Kamm
5a38506f04
Liquidator, liqtest and rust client fixes ( #336 )
...
Liquidator, liqtest and rust client fixes
- Make rust MangoClient fully async
- Update and improve liquidation test setup scripts
- Update liquidator to use versioned transactions
- Update liquidator to use mango and jupiter account lookup tables
- Use jupiter v4 api to get versioned transactions
Perp liquidation is still not fully good. See discussion aboult perp_liq_pnl_with_token.
2022-12-16 13:10:46 +01:00
tjs
5df60b48d9
support passing ALT in marginTrade client fn
2022-12-15 17:22:10 -05:00
tjs
95e8bf2d2c
Merge branch 'main' into dev
2022-12-15 15:30:18 -05:00
microwavedcola1
df4a48a558
dont do checks force close flag is used explicitly ( #341 )
...
* dont do checks force close flag is used explicitly
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* comment
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* comment
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix ts
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-15 21:10:56 +01:00
Adrian Brzeziński
5c329f8800
settle funds in serum3 cancel/modify
2022-12-15 20:06:10 +01:00
Adrian Brzeziński
1125002ba3
make settle funds serum3 ix
2022-12-15 13:41:45 +01:00
Adrian Brzeziński
f31ef4642d
Merge branch 'feature/modify-order'
2022-12-15 11:30:20 +01:00
Adrian Brzeziński
89c7ab7498
modify serum3 order
2022-12-15 10:40:45 +01:00
microwavedcola1
309f218c6e
more debugging
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-15 09:41:03 +01:00
microwavedcola1
2b2d777130
debug user small changes
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-14 21:05:05 +01:00
Adrian Brzeziński
8785d007bd
Merge branch 'main' into feature/modify-order
2022-12-14 16:58:55 +01:00
microwavedcola1
5c1304466b
add account number to toString for debugging
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-14 15:50:10 +01:00
microwavedcola1
f781241f90
Fix bug in porting from rust to ts
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-14 15:43:06 +01:00
Adrian Brzeziński
7949ce7d78
modify perp ix
2022-12-14 15:15:35 +01:00
microwavedcola1
2cd8c048f3
bump max iterations in max swap, for edge cases
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-14 14:55:37 +01:00
microwavedcola1
51cded4965
Mc/health max swap with serum effects ( #333 )
...
* rearrange, log before expect
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* rearrange, log before expect
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix test
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* health max swap with serum effects
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* max swap: Fix with serum reserved amounts
* port rust code to ts
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* port tests
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix method call
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
2022-12-14 09:21:45 +01:00
microwavedcola1
f4942fd674
cap max borrow in withdraw to safety constraint ( #335 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-13 19:41:19 +01:00
microwavedcola1
c77c3585ad
remove outdated todos
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-13 10:29:55 +01:00
tjs
35752ab99b
move calls inside reloadBanks in the group reloadAll fn
2022-12-13 00:44:07 -05:00
microwavedcola1
aa53cb95de
Fix test
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-12 14:54:18 +01:00
microwavedcola1
f745898a40
rearrange, log before expect
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-12 13:10:57 +01:00
microwavedcola1
9c65ea9456
rearrange, log before expect
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-12 13:03:57 +01:00
Christian Kamm
b5691e2381
ts: Fix toUiPrice() ( #332 )
...
For example, the SOL native price of 0.0136 should become the ui price
of 13.6 because SOL decimals are 9.
2022-12-11 17:22:43 +01:00
microwavedcola1
d0c85f14e6
make mm work with mango-perp, deposit some funds into shared wallet mango account, fixed some ts perp issues
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-09 20:23:30 +01:00
Christian Kamm
13f6fe2343
ts: Fix serum3PlaceOrder by passing payerOracle
2022-12-09 14:55:33 +01:00
Christian Kamm
29055199ae
ts: Make oracle arg optional in edit calls
2022-12-09 14:55:33 +01:00
Christian Kamm
a91ff847f2
ts: Fix tokenDeregister() when ATA is missing
2022-12-09 14:55:33 +01:00
Christian Kamm
37060d4192
ts: Fix sendTransaction to work with NodeWallet
2022-12-09 14:55:33 +01:00
microwavedcola1
c773262781
add perp markets
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-09 11:39:00 +01:00
microwavedcola1
9b173e95b5
perp market parameters for vanity address ( #327 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-09 11:16:47 +01:00
microwavedcola1
794f298ded
fix scaling of weights
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-09 06:08:23 +01:00
tjs
82a120df0d
Merge branch 'main' into dev
2022-12-08 17:23:17 -05:00
tjs
1c69d4edbb
default idsSource is get-program-accounts
2022-12-08 17:23:07 -05:00
tjs
af6e10a1cd
fix perp open order deserializing
2022-12-08 15:55:32 -05:00
tjs
b6605bd120
fix perp open order deserializing
2022-12-08 15:53:14 -05:00
Christian Kamm
57e4510b08
Remove mango-macro
2022-12-08 20:48:44 +01:00
Christian Kamm
a29a736ba2
Move src/state/health/ -> src/health/
2022-12-08 20:48:44 +01:00
tjs
227eea81c3
Merge branch 'main' into dev
2022-12-08 14:13:07 -05:00
tjs
fb8eb59355
add back getEquityUi for perp
2022-12-08 14:12:57 -05:00
tjs
cfc121cf1c
Merge branch 'main' into dev
2022-12-08 14:00:28 -05:00
tjs
4fc2b42f99
add back function to parse perp fill events
2022-12-08 14:00:12 -05:00
Christian Kamm
450007d34b
Perp: Drop client order id from LeafNodes ( #323 )
...
This saves 8 bytes and only the FillEvents, FillLogs were populated from
the data.
2022-12-08 19:55:32 +01:00
microwavedcola1
3e7f5487b7
add more info to debug bank scripts
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-08 16:50:11 +01:00
microwavedcola1
c2a0c8c920
fix
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-08 16:26:12 +01:00
microwavedcola1
d8d0d8e07c
Merge branch 'dev'
2022-12-08 16:05:51 +01:00
microwavedcola1
5cc88b0d97
mainnet setup script for vanity address ( #324 )
...
* mainnet setup script for vanity address
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* rename
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-08 16:04:58 +01:00
Christian Kamm
b66dc7ae80
IDL: Fix missing OrderTreeRoot
2022-12-08 11:22:37 +01:00
microwavedcola1
326515a07f
rename
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-08 10:49:00 +01:00
microwavedcola1
fa815f1c75
switch to new vanity address
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-08 10:23:12 +01:00
microwavedcola1
7d9c3616af
ts client changes ( #320 )
...
* cleanup + small sync with program
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Update lock file
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix tsc errors
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-08 10:16:06 +01:00
tjs
e9bcd0209a
fix settlerOwner in perpSettlePnl
2022-12-07 23:50:37 -05:00
Christian Kamm
947d9b2b60
Split into perp bids and perp asks ( #322 )
...
Separate, smaller accounts that are easy to extend if needed.
2022-12-07 21:03:28 +01:00
microwavedcola1
6aea3f97db
Merge branch 'main' into dev
2022-12-07 11:01:36 +01:00
tjs
660a733a95
divide by quote decimals to get funding rate
2022-12-06 16:41:42 -05:00
tjs
bc4d97d4d1
add confFilter and edit perp script
2022-12-06 10:58:47 -05:00
microwavedcola1
52d7509481
Fix tests
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-06 14:14:58 +01:00
microwavedcola1
dde9ca69e8
sync fields
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-12-06 14:05:12 +01:00
Christian Kamm
777c1a7804
Rename bank fields, make weight scale limits editable ( #319 )
2022-12-06 09:34:02 +01:00
tjs
20adf76aac
add dotenv for client config vars
2022-12-05 14:48:06 -05:00
tjs
0609adbe70
use quote decimal constant
2022-12-03 14:54:36 -05:00
tjs
55db713862
add getEquityUi
2022-12-03 14:47:01 -05:00
microwavedcola1
fa09c557a1
ts client sync with program ( #311 )
...
mostly health related code
2022-12-02 15:48:43 +01:00
Christian Kamm
c8f1f3c821
Net borrow limits: Limit in quote, not native ( #312 )
...
* Net borrow limits: Limit in quote, not native
* make perp settle limit disableable
2022-12-02 12:24:11 +01:00
Christian Kamm
512eef96ea
Perp pegged orders: Add stub max oracle staleness arg
2022-12-02 08:19:51 +01:00
microwavedcola1
d64d9285f4
limit settleable pnl ( #295 )
...
Co-authored-by: Christian Kamm <mail@ckamm.de>
2022-11-30 13:20:19 +01:00
microwavedcola1
95b03aa5ac
remove filter
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-11-29 10:40:18 +01:00
microwavedcola1
1732a5aff4
net borrow limits ( #301 )
...
* net borrow limits
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix client
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix tests
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
2022-11-25 13:45:17 +01:00
tjs
0192b16d90
slightly better errors
2022-11-21 17:03:11 -05:00
tjs
717d3f7711
use provider connection to fetch switchboard idl
2022-11-21 16:48:35 -05:00
tjs
20ff7c99c6
use sendRawTx in rpc.ts
2022-11-21 14:50:24 -05:00
microwavedcola1
44d0170ea9
mc/settle pnl ts client ( #292 )
...
* oracle peg client support
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>
* perp pnl settle, candidate finder, and example
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-11-21 20:36:13 +01:00
Nicholas Clarke
ff18ad6ba7
Add client function getCumulativeInterest ( #280 )
...
* Add client function getCumulativeInterest
2022-11-21 10:59:26 -08:00
microwavedcola1
d3661bac7b
mc/oracle peg ts client ( #290 )
...
* oracle peg client support
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>
* Fix from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-11-21 19:34:41 +01:00
tjs
ae7acbbc6b
Revert "fix get unsettled funding function"
...
This reverts commit 708ef68b85
.
2022-11-21 12:54:14 -05:00
tjs
708ef68b85
fix get unsettled funding function
2022-11-21 10:47:30 -05:00
tjs
256b948207
parse fill events
2022-11-20 23:50:08 -05:00
tjs
80809c6404
default seq num for load fills
2022-11-20 22:27:29 -05:00
tjs
57b05259f9
copy perp position functions from dev branch
2022-11-20 22:07:15 -05:00
tjs
26d65e9db9
fix mango account client layout
2022-11-20 22:05:09 -05:00
microwavedcola1
d82608ebee
Revert "add support for msrm vault for serum3 discounts ( #285 )"
...
This reverts commit 0a4f7150d6
.
2022-11-20 15:31:16 +01:00
tjs
14e20f9668
fix type error with version txs
2022-11-18 14:22:12 -05:00