Commit Graph

981 Commits

Author SHA1 Message Date
tjs fc63328af1 set lastValidBlockHeight for tx confirmation 2022-09-05 17:36:42 -04:00
tjshipe 3e462c5530
Merge pull request #214 from blockworks-foundation/ts/reload-slot
reload mango account with slot
2022-09-05 14:06:36 -04:00
tjs 27c42e70e9 reload mango account with slot 2022-09-05 12:31:57 -04:00
tjs 2d0772833b filter out jupiter token ledger instruction to save space 2022-09-02 18:47:26 -04:00
tjs c359ce26a7 return new mango account instance from reload 2022-09-02 18:47:09 -04:00
tjs 3f456393a5 use custom sendTransaction in closeMangoAccount 2022-09-02 13:50:01 -04:00
Christian Kamm 511db72f8e Health token adjustment: Deal with odd I80F48 behavior
The identity
  a * b = -((-a) * b)
does not hold for I80F48, probably it's rounding to -inf.

This meant that withdrawing the full native token balance could
fail because the magnitude of -position * price was bigger than
position * price.
2022-09-01 14:38:48 +02:00
Christian Kamm 3b93a38395
Merge pull request #208 from blockworks-foundation/ckamm/fix-index-reservation
Serum: Index reservation account has 8 bytes
2022-09-01 13:23:27 +02:00
Christian Kamm 868c55fef1 Serum index reservation: use a real account
Makes it easier and more future-proof
2022-09-01 12:28:37 +02:00
Christian Kamm c31f11013f Serum deregister: Close index reservation account
Only safe because this is a testing-only instruction
2022-09-01 12:15:00 +02:00
microwavedcola1 c420d71943 ts: fix withdraw wrapped sol -> sol
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-01 12:11:31 +02:00
Christian Kamm 1f0cd62846 Don't panic if accounts are shorter than 8 bytes 2022-09-01 12:00:09 +02:00
Christian Kamm 5e0001afb8 Serum: Index reservation account has 8 bytes
otherwise all code needs to be able to deal with mango accounts that are
smaller than 8 bytes in size.
2022-09-01 11:49:33 +02:00
microwavedcola1 3a1f6f08ee Merge branch 'dev' 2022-09-01 11:34:42 +02:00
microwavedcola1 0f75baeadd comment in on demand
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-01 11:27:22 +02:00
microwavedcola1 0222ca8954
ts fixes (#207)
* ts: use gpa path if rest services has not caught up yet

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

* ts: convert wrapped sol to sol when withdrawing

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

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-01 11:25:58 +02:00
microwavedcola1 149e0eb0c7 Fix client and remove excessive logging in scripts
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-01 10:48:50 +02:00
microwavedcola1 38e3ea672e changelog
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-01 10:30:24 +02:00
microwavedcola1 2479107d9a
Prepare serum3 release (#206) 2022-09-01 10:18:47 +02:00
microwavedcola1 a889e6c206 Fix scripts
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-01 09:56:17 +02:00
microwavedcola1 5ff181d01d Merge branch 'dev' 2022-09-01 09:52:29 +02:00
microwavedcola1 b30b2f8870
program: serum3 should work when group has version 1, perps and multiple banks should be moved to version 2 or beyond (#205)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-01 09:48:38 +02:00
microwavedcola1 5f62f15549
mc/i80F48 in-place cleanups (#203)
* ts: use in place I80F48 wherever applicable

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

* ts: dont overwrite I80F48 constants

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

* Fix script

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

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-01 09:48:23 +02:00
tjs 8296d660d8 return mangoAccount after reloading 2022-08-31 15:33:07 -04:00
microwavedcola1 0c6cc16023
ts: serum display function for max leverage (#202)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-31 14:37:45 +02:00
microwavedcola1 cec0fcab99 patch script for strictness
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-31 13:55:15 +02:00
riordanp 4919364d67
Fix keeper dockerfile path 2022-08-31 12:52:30 +01:00
microwavedcola1 5e33c00ec8 Merge branch 'main' into dev 2022-08-31 11:55:54 +02:00
tjshipe 263bc6ff1f
turn on strict null checks and fix issues (#201) 2022-08-31 11:41:12 +02:00
microwavedcola1 42f22003d8
deployment script for vanity (#184)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-31 11:40:39 +02:00
riordanp 3cca63c735
Docker CI Improvements (#195)
* Push separate images for binaries to GCR

* Add base image version arg to heroku deployment

* Test docker build

* Try setting mode

* Fix tags

* switch back to dev

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

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-31 11:37:58 +02:00
microwavedcola1 c66dd882b6
ts: Additional serum3 support (#196)
* get bids and asks for a user on a serum3 market
* get orderbook for a market
* get max bid or ask that a user can place for a market
* simulate health if a bid or ask were to be placed

misc:
* fix remaining accounts list for health when placing perp bids

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

format

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

format

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

remove testing code

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>

script adjustment

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

comments

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

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-31 11:36:44 +02:00
microwavedcola1 4a1865be6c Merge branch 'main' into dev 2022-08-31 11:35:19 +02:00
microwavedcola1 2fb569cc75 make script net agnostic
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-30 17:01:17 +02:00
Christian Kamm d0fef4a586 Test: simplify allow(dead_code) to be per-file 2022-08-30 15:32:59 +02:00
Christian Kamm 8a2d54cce8 Fix some clippy warnings 2022-08-30 13:59:34 +02:00
Christian Kamm 801b68b93c MangoAccount: add unittests 2022-08-30 13:11:47 +02:00
Christian Kamm 77b8e6e8b9 SerumPlaceOrder: Fix vault balance check for base_lot_size
As spotted by microwavedcola
2022-08-30 12:05:07 +02:00
Christian Kamm 1f0138d1de SerumCloseOO: Reduce in_use_count of token positions 2022-08-30 12:05:07 +02:00
Christian Kamm 8e30870689 SerumLiqForceClose: Proper health/liq checking 2022-08-30 12:05:07 +02:00
Christian Kamm e0437305ee SerumPlaceOrder: Only pass the payer bank/vault 2022-08-30 12:05:07 +02:00
Christian Kamm 36723792a1 SerumRegister: Block using the same market index twice 2022-08-30 12:05:07 +02:00
Christian Kamm dc4acd0dd7 Serum: loan origination fee, don't auto-settle, fix vault check
- Loan origination fees: The previous approach of tracking the reserved
  amount did not work because OutEvents will also reduce the reserved
  amount. This means we can't know if it was an OutEvent-cancel or an
  order execution that caused the reduction.

  Instead, we now track the amount of borrows that was made (without
  applying origination fees) in place order. Whenever we try to settle
  and the amount of tokens on the oo account is less than the potential
  borrows, we can be certain that the borrow has actualized.

- Place order is no longer automatically followed by a settle.

  This can reduce compute use when people want to place multiple orders
  in sequence. Now they can use the HealthRegion instructions to place
  their orders, settle once at the end, and then have health checked.

- Vault check: Place order previously rejected valid orders because it
  didn't consider that there could be free tokens on the oo account.

- Tests: Some infrastructure for less verbose serum testing.
2022-08-30 08:38:13 +02:00
Christian Kamm e1adbf0217 Tests: Fix concurrent log capture 2022-08-30 08:37:29 +02:00
Christian Kamm d6d66402f7 Tests: Helper for create + fund 2022-08-30 08:37:29 +02:00
Christian Kamm 7d508e5df5 MangoAccount: Fixes after audit 2022-08-29 16:13:15 +02:00
tjs ff7638f04b throw error when reloading account if simulation fails 2022-08-27 03:55:55 -04:00
tjs a12457eeb5 log in getTokenVaultBalanceByMint 2022-08-27 01:58:20 -04:00
tjs b35bca95a1 improve transaction confirmation 2022-08-26 15:42:10 -04:00
tjs 2e88889043 remove async and unused arg in getTokenVaultBalanceByMint 2022-08-26 13:54:14 -04:00