Christian Kamm
c9fb4c7133
Tests: Fix program log capture
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
Christian Kamm
403226dc28
BeingLiquidated: Deactivate flag on positive health
2022-08-18 13:12:13 +02:00
Christian Kamm
a23afed7de
Fix computation of utilization time-weighted average
2022-08-17 15:29:11 +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
e8bbfbef83
Bank: fix collection of loan fee
...
Instead of changing indexed_borrows, change borrow_index!
2022-08-16 16:27:45 +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
e92561d32e
Liquidation: Fix rounding issues in liq_token_bankruptcy
...
By explicitly dusting trace positive positions.
2022-08-16 13:08:43 +02:00
Christian Kamm
961a81b94f
Liquidation: Fix positive dust issues
2022-08-16 13:08:43 +02:00
Christian Kamm
af5f622bd8
Liquidator: bankruptcy requires borrows
2022-08-16 12:13:54 +02:00
Christian Kamm
c9a5fb5fc1
ScanningAccountRetriever: Don't mut-borrow oracles ( #170 )
...
This allows using the same oracle for different banks, like for ETH and
soETH.
2022-08-15 11:32:54 +02:00
Christian Kamm
58105207af
Make anchor's lint pass
2022-08-15 10:48:43 +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
18857c7b72
Add "client" feature annoations
2022-08-15 10:48:43 +02:00
Christian Kamm
6a77a5c349
tests: fix compilation warnings
2022-08-15 10:48:43 +02:00
Christian Kamm
fcecd21cdb
health: remove duplicated code
2022-08-15 10:48:43 +02:00
microwavedcola1
1b6ed725be
over explaining the code ( #168 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-14 20:45:57 +02:00
Christian Kamm
7a343a9a8d
checked_math: support casts and I80F48::from
2022-08-14 15:01:15 +02:00
Christian Kamm
d91a676e3d
Oracle: Decimal constant cleanup
2022-08-14 15:01:15 +02:00
Christian Kamm
724824d21a
Bank: small fixes from audit
2022-08-14 15:01:15 +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
a3067e2448
Avoid custom Debug impls by using derivative crate
2022-08-13 10:18:04 +02:00
microwavedcola1
261c856bb2
reduce max source swap targetError so that we dont error out
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-12 11:08:08 +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
Conj0iner
02c19a6eb4
Optimise entry price calculations
2022-08-11 22:58:47 +08:00
Christian Kamm
ac58081430
Audit: Fix some account constraints
2022-08-11 13:30:04 +02:00
Christian Kamm
e8479e2e7c
liq_token_with_token: Correctly adjust health cache for dusting
...
Previously the health cache adjustments didn't take into account that
positions between 0 and 1 native token would be dusted to 0.
This makes a difference for valuable tokens with few decimals. For
example 1 BTC-native token is currently worth 500k SOL-native tokens.
That means 0.9 BTC-native would easily be enough collateral for a 10k
SOL-native borrow -- but if the 0.9 get dusted, then the whole account
is bankrupt instead.
2022-08-10 16:24:48 +02:00
Christian Kamm
7c72a1956a
Withdraw: Allow withdrawing all funds with allow_borrow=false
...
We should also add the ability to withdraw as much as possible without
borrowing and without specifying the exact amount, for convenience.
2022-08-09 11:56:08 +02:00
microwavedcola1
5516ecb132
remove unused param in context
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-08 21:11:15 +02:00
microwavedcola1
d594286266
reserve for ALTs ( #152 )
...
* reserve for ALTs
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* add explicit padding
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>
2022-08-08 18:50:59 +02:00
microwavedcola1
b8bf3a1c40
reorder mango account fields in idl to match on chain order according to MangoAccountFixed
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-08 17:04:54 +02:00
microwavedcola1
ca790c9ef3
add prioritization for token rate update ix in keeper ( #153 )
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-08 16:31:59 +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
conj0iner
ff19940ee7
Merge pull request #140 from blockworks-foundation/cj/avgentryprice
...
Added avg entry + break even price
2022-08-07 12:20:33 +08:00
Christian Kamm
dded844693
Update dynamic interest and default token parameters
2022-08-06 21:06:34 +02:00
Conj0iner
dc4a770835
Merge remote-tracking branch 'origin/dev' into cj/avgentryprice
2022-08-06 22:32:59 +08:00
microwavedcola1
6f5f53c1d8
update comment
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-06 13:36:21 +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
Christian Kamm
2880a2ec88
Instruction introspection: don't hardcode discriminators
...
Patch anchor to allow access to the generated discriminators.
2022-08-05 23:24:17 +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
dd22ca2ad6
format
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-05 16:17:29 +02:00
Conj0iner
977e85dcf0
Added avg entry + break even price
2022-08-04 22:53:14 +08:00
microwavedcola1
331bb7ebf0
refactor,format
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-04 12:13:36 +02:00
microwavedcola1
dd8086d8eb
format
...
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2022-08-04 12:04:08 +02:00