Christian Kamm
b77af54f15
Fix tests
2022-07-11 22:31:00 +02:00
microwavedcola1
c76d3b1cd2
Update IDL
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-11 17:11:39 +02:00
microwavedcola1
ef7d2862da
wip: dynamic rates ( #98 )
...
* dynamic rates
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fmt
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-11 17:08:32 +02:00
Christian Kamm
f132f30874
Better error messages
2022-07-08 12:48:43 +02:00
Christian Kamm
420132cf89
Merge pull request #99 from blockworks-foundation/ckamm/deactivate-token-positions
...
Deactivate token positions for liquidation and serum instructions
2022-07-08 09:11:55 +02:00
Christian Kamm
469e7fd704
Use get() instead of get_mut() where possible
2022-07-08 09:10:08 +02:00
tjs
9bec0f3c23
remove console logs
2022-07-07 16:43:19 -04:00
tjs
f62b72cd1d
consistent naming for banks and vaults
2022-07-07 13:04:54 -04:00
Christian Kamm
c829fdf59d
Fix keeper build
2022-07-07 14:28:30 +02:00
Christian Kamm
6c7245adaa
Serum3 liq force cancel orders: Deactivate inactive token positions
2022-07-07 13:22:25 +02:00
Christian Kamm
693333b71e
Serum3 place/settle: deactivate inactive token positions
2022-07-07 13:16:23 +02:00
Christian Kamm
9f90c3982f
Fix serum3 loan origination fee withdrawal
...
Paying the loan origination fee must be like a withdrawal and can't be
charged as a borrow if the user has deposits.
2022-07-07 12:33:21 +02:00
Christian Kamm
45da68c6ac
LiqTokenWithToken: Close inactive token positions
2022-07-07 12:24:48 +02:00
Christian Kamm
31831454b4
Return raw position index from get_mut()
2022-07-07 12:01:18 +02:00
tjs
ab0b77f5f6
marginTrade3 with passed in jup instructions
2022-07-07 00:45:01 -04:00
microwavedcola1
0ff269c38c
Merge branch 'main' into dev
2022-07-06 17:47:45 +02:00
microwavedcola1
ab3abc69e7
Fix flash loan3 - fetching of bank from retriever
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-06 17:41:08 +02:00
microwavedcola1
b0f1585541
Merge branch 'main' into dev
2022-07-06 17:11:20 +02:00
microwavedcola1
8a1e9136a6
better error msg
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-06 17:11:12 +02:00
Christian Kamm
ffd83a7a05
Rename instructions to follow naming pattern ( #97 )
2022-07-06 14:51:15 +02:00
Christian Kamm
7d68378189
Add a CHANGELOG
2022-07-06 14:15:03 +02:00
Nicholas Clarke
348fbc1cb9
Track cumulative net deposits (deposits - withdraws) ( #91 )
...
Track cumulative net deposits (deposits - withdraws) using prices at the time of the deposit and withdraw.
This is used for calculating overall pnl (across all tokens).
I want to store UI amount * UI price = (native amount / base decimals) * (oracle price * base decimals / quote decimals) => native amount * oracle price / quote decimals.
I have used f32 here to reduce the space required on the mango account - we don't need so much precision for this as it's purely a display value.
I've also included a field for net_settled - this will be used for perp pnl but is not implemented yet (as perp settling instructions are not ready).
Co-authored-by: Christian Kamm <mail@ckamm.de>
2022-07-06 12:07:30 +02:00
Christian Kamm
5b72e85634
Merge pull request #95 from blockworks-foundation/ckamm/insurance-fund
...
liq_token_bankruptcy for socialized loss and insurance fund
2022-07-06 11:47:28 +02:00
Christian Kamm
de86b69e1a
Client/program interface changes
...
- rearrange structs to have gPA data in front and add comments about the
offsets being relevant
- add insuranceMint to group creation in client
- drop quoteTokenIndex storage on PerpMarket
- fixes to editAccount in example1-user and client
2022-07-06 11:34:07 +02:00
Christian Kamm
f2d8aceebe
Update idl
2022-07-06 11:34:04 +02:00
Christian Kamm
35517bdb75
Review fixes
2022-07-06 11:34:04 +02:00
Christian Kamm
b25f6d5f4f
Insurance fund
2022-07-06 09:07:50 +02:00
Christian Kamm
35ca4d31b3
liq_token_bankruptcy instruction for socialized loss
2022-07-06 09:07:49 +02:00
tjs
1b04f924e3
make jup-ag/core a devdependency
2022-07-05 23:38:53 -04:00
tjs
1451ebc2a1
Merge branch 'ts/deps' into dev
2022-07-05 21:36:45 -04:00
Nicholas Clarke
30fc7def77
Add oracle price to update_index logging. ( #89 )
...
* Add oracle price to update_index logging.
* Update IDL with changes to update_index instruction and logging.
2022-07-05 11:59:44 -07:00
microwavedcola1
d74cc78a84
edit tokens, perp markets, mango accounts, allow delegate to perform certain operations ( #94 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-05 19:31:47 +02:00
tjs
f3b0c883d6
export banks
2022-07-04 19:23:00 -04:00
microwavedcola1
dc4aee885b
add doc
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-04 15:52:32 +02:00
microwavedcola1
301b00a452
add exampole
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-04 15:34:16 +02:00
microwavedcola1
dff3f7cd8c
client functions via program simulation
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-04 14:11:38 +02:00
microwavedcola1
39284c5705
Flash loan 3 minimal example ( #90 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-04 12:09:33 +02:00
tjs
d7f84f6a8e
use price or previousPrice
2022-07-03 21:47:02 -04:00
tjs
9789ec00d6
export utils
2022-07-03 20:30:38 -04:00
microwavedcola1
6a99eb893b
Fix types
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-01 14:31:47 +02:00
Christian Kamm
30a221047c
Bank: rename indexed total deposits and schedule for removal
2022-07-01 14:08:28 +02:00
microwavedcola1
e8cb27610e
close mango account without checks when testing flag is set on the group, workaround weird issues when all dust cant be withdraw ( #92 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-07-01 13:38:50 +02:00
tjs
18a9877e5a
remove jup from client
2022-06-30 15:53:29 -04:00
tjs
97d45896b9
add yarn prepare
2022-06-30 13:32:55 -04:00
tjs
91b2e770e6
add esm tsconfig
2022-06-30 13:17:10 -04:00
Christian Kamm
6d05306859
Improve FlashLoan3 docs
2022-06-30 18:45:17 +02:00
Nicholas Clarke
f8da1f6a40
Clarkeni/logging ( #81 )
...
* Add logging
* Added new_fixed_order_account_retriever to allow us to more easily access oracle prices outside of health calculations for logging purposes
* Add token balances logging to token and token liquidation and add logging to margin trade
* rust format
* fix clippy errors
* Address PR requested changes
* fix flash_loan
* Recalculate raw_token_index in token withdraw to account for position becoming inactive
* Fix retrieving oracle for logging
in get_mut_or_create(), return the raw index into the account's token
positions as well as the index into active positions only. The latter
index is useful for indexing into banks in the health account list.
* Add logging flash_loan2 and flash_loan3
* Refactoring flash loan logging
Co-authored-by: Christian Kamm <mail@ckamm.de>
2022-06-30 14:35:05 +02:00
tjs
ecbffe499f
wip: add flash loan 3
2022-06-29 23:36:57 -04:00
tjs
273b8dd597
add deposits and borrows fn to mangoAccount
2022-06-29 15:55:42 -04:00
microwavedcola1
1c02ccd21d
Transfer dust from bank vaults to a dust account, without this we wont be able to close bank vaults ( #88 )
2022-06-29 09:11:14 +02:00