microwavedcola1
e47e17d79f
reduce only flag for perp place order ( #286 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-11-09 09:59:34 +01:00
microwavedcola1
e8ba511c45
mc/flash loan for delegate ( #271 )
...
* flash loan for delegates
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix rust client
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* prettier
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-11-09 09:35:13 +01:00
Christian Kamm
5731ce8faa
Perp oracle peg feature ( #264 )
...
This introduces the ability to use oracle peg orders on perp markets.
This PR has significant non-backwards compatible changes, for example all
order trees are now in a single account instead of separate.
2022-11-08 15:27:56 +01:00
microwavedcola1
ccc1d43a55
Port new fields on accounts from program to ts client
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-11-02 12:13:29 +00:00
microwavedcola1
a66177a77e
ts: match client class definitions 1-1 to program state struct definitions ( #268 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-10-11 09:34:02 +02:00
Christian Kamm
f2cc869795
Perps: Prepare for settlement token != oracle token
...
Make sure the setting is available and that the needed accounts are
passed to the perp instructions.
2022-10-06 08:32:58 +02:00
Christian Kamm
b906e3dc78
Token deposit: Split into signed and permissionless ix
...
Token accounts are a limited resource, so allowing other users to make
use of them can cause problems.
2022-10-02 16:06:39 +02:00
Christian Kamm
7e180c7b3a
Perps: Support trusted markets
2022-09-29 15:40:31 +02:00
Christian Kamm
8ba52f46c2
Perp settle pnl: incentive for settler ( #252 )
...
This adds three new options to perp markets:
- a flat fee, that is paid for all perp settlements
- given that they exceed the configured min settle amount threshold to
be eligible for fees
- and a fractional fee, that only applies when the benefiting account
has low health and gradually becomes bigger as the account slides
towards liquidation
2022-09-29 12:59:55 +02:00
Nicholas Clarke
01a958cd22
Clarkeni/onchain interest ( #244 )
...
* Onchain interest calculation
* Fix to TokenBalanceLog for token_liq_bankruptcy (was previously using liqee liab position for liqor liab position).
* Log cumulative interest when token position is deactivated.
2022-09-28 23:04:33 -07:00
conj0iner
a97b40a521
Merge pull request #234 from blockworks-foundation/cj/ioc_fees
...
Extra fees for IOC orders
2022-09-28 00:05:25 +08:00
Nicholas Clarke
1320451e1a
Add serum open orders balance logging. Remove price from token and perp balances. ( #236 )
2022-09-23 10:42:43 -07:00
Conj0iner
a8ae59f0fe
IDL and client changes
2022-09-23 01:03:45 +08:00
Christian Kamm
96218fb7ba
Update IDL and merge issue fixups
2022-09-21 10:19:23 +02:00
Christian Kamm
a41a245e24
PerpLiqBankruptcy instruction
2022-09-21 09:46:54 +02:00
conj0iner
1c67b8ed5f
remove base_token_index from perps and include oracles ( #224 )
...
Co-authored-by: Conj0iner <conj0iner@users.noreply.github.com>
2022-09-21 09:42:45 +02:00
Christian Kamm
6399e6cb6c
Fix PerpMarket data layout breakage
...
The new fees_settled must be added at the end and the reserved amount
needs to be reduced.
2022-09-20 16:58:07 +02:00
microwavedcola1
b7e79a4663
WIP: ts/perps ( #220 )
...
* ts: further fleshing out of perps code
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* cleanup scripts
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from reviews
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-09-20 12:57:01 +02:00
Christian Kamm
1b3a2b07db
Update idl
2022-09-15 09:24:35 +02:00
Christian Kamm
3fbc3ca32d
TokenEdit: remove bank_num arg
2022-09-02 13:55:00 +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
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
microwavedcola1
453248bbe5
token_deregister: remove redundant token index and add doc ( #192 )
...
* token_deregister: remove redundant token index
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix test
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-25 19:25:56 +02:00
Christian Kamm
38b349a401
Rename PerpOpenOrders -> PerpOpenOrder, since it's a single one
2022-08-24 15:22:55 +02:00
Christian Kamm
2d2cef35a0
Add HealthRegion instructions
...
You can do
- HealthRegionBegin
- ... mango instructions ...
- HealthRegionEnd
and the account health will only be checked at the start and end
instead of for every instruction.
2022-08-24 10:07:45 +02:00
Nicholas Clarke
704dfcaa27
Clarkeni/loan fee logging ( #180 )
...
Logging for loan origination fees and token bankruptcy
2022-08-19 18:50:54 -07:00
Christian Kamm
09fc5f716b
Renames in MangoAccount
...
- Accessors in MangoAccountValue
- PerpPositions -> PerpPosition
2022-08-19 14:58:20 +02:00
Christian Kamm
ec850b7bd3
Fix size of account_num in idl
2022-08-19 14:52:31 +02:00
microwavedcola1
9b2f4e7b18
upgradel idl
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-18 17:19:12 +02:00
Nicholas Clarke
8a1c58e723
FlashLoan: Add flash_loan_type ( #164 )
...
Co-authored-by: Christian Kamm <mail@ckamm.de>
2022-08-17 12:36:55 +02:00
Christian Kamm
4c65204c19
Liquidator: Fix condition for starting to liquidate
2022-08-16 16:19:04 +02:00
Christian Kamm
421b2d3d19
FlashLoan: Fix validation holes
...
- Pass the group to Begin and End and ensure it is the same.
- Enforce target token accounts can't be group-owned.
- Now End can consistently derive the number of vaults/token accounts.
2022-08-16 13:10:05 +02:00
Christian Kamm
54222c5b3f
liq_token_bankruptcy: don't pass redundant index
2022-08-16 13:08:57 +02:00
Christian Kamm
0265b9b0a9
Account: Change type of net_deposts / net_settled
...
Because f32 doesn't have enough significant digits for large deposits.
2022-08-15 10:48:43 +02:00
Christian Kamm
ccba4ee597
Cleanups and bugfixes from the audit ( #163 )
...
* AccountExpand: cleanups from audit
* Group instructions: cleanups from audit
* AccountClose: cleanups from audit
* TokenAddBank: Audit fixes, including significant bugs
Must not take collected_fees and bump from the existing bank.
* Instruction comment updates
* GroupEdit: Add version/testing flag changes
Ported from mc/vanity
2022-08-13 19:54:58 +02:00
Christian Kamm
21815612ae
Let all PDA seeds start with a unique prefix ( #166 )
...
This is mostly paranoia. Now it's guaranteed that different PDA types
have unique seeds.
2022-08-13 19:30:35 +02:00
Christian Kamm
92a37f23ed
Remove is_bankrupt
...
Instead, check for any liquidatable assets in liq_token_bankruptcy.
Bankrupt accounts may use the same operations as any other
negative-health account.
2022-08-11 22:57:53 +02:00
microwavedcola1
c490ab6965
update changelog and IDL
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-08 19:06:13 +02:00
microwavedcola1
d8340ba594
update idl
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-08 17:07:57 +02:00
microwavedcola1
4f72985f2d
also allow editing group insurance fund ( #149 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-07 14:16:23 +02:00
microwavedcola1
e06736660a
remove account size, make mango account feature position counts explicit ( #148 )
...
* remove account size from program, make position counts explicit
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* cargo-fix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-07 14:16:06 +02:00
microwavedcola1
59d28c97a1
fix name and error message check in flash loan ( #145 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-06 12:59:13 +02:00
Nicholas Clarke
e4a073c83b
Clarkeni/group logging ( #142 )
...
* Add group logging and updateIndexAndRate anchor test
* Bugfix on health account ordering
2022-08-05 10:11:44 -07:00
microwavedcola1
331bb7ebf0
refactor,format
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-04 12:13:36 +02:00
microwavedcola1
e6fe7bd8cc
update idl, cleanup code
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-04 08:50:48 +02:00
microwavedcola1
505cbd48aa
fixes from review
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-03 15:45:10 +02:00
microwavedcola1
e31ad9ce34
token register trustless
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-03 15:45:10 +02:00
microwavedcola1
a7654f43a1
update idl, and fix tsc errors
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-02 11:28:39 +02:00