Commit Graph

15 Commits

Author SHA1 Message Date
Christian Kamm 5a05e9cb2e
Update anchor to v0.27.0, stop using submodule (#582) 2023-05-12 13:54:53 +02:00
Maximilian Schneider 7bfdb0af47
Add more instruction generators to client (#575)
* Add more instruction generators to client
* fmt
2023-05-09 12:46:45 +02:00
Christian Kamm 953e2f76b2
Ckamm/liq fixes (#571)
* liquidator: Don't attempt to close in-use token positions

This could happen if the user manually used serum on the liquidator
account.

* Client: Move jup's CU ix outside of flash loan

That makes a flash loan based jup swap usable with delegates.
2023-05-05 09:11:12 +02:00
microwavedcola1 81571664bd clippy
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-04-19 14:15:32 +02:00
microwavedcola1 a40ceedc97
Fix bug where if no insurance fund position was present, ix would err… (#522)
* Fix bug where if no insurance fund position was present, ix would error out

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>

* prettier

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

---------

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-04-17 11:30:27 +02:00
Christian Kamm 98a79505e1
FlashLoan: Don't deduce vault_len, add more checks (#542)
It looks like it wasn't possible to exploit the program by
re-initializing the user-owned token accounts used in flash loan because
the later use of health_ais with the health computation would error out
if any token account was included there.

However, the check and a few others were too indirect. In this patch:
- We pass the number of loans into FlashLoanEnd explicitly (verified
  from FlashLoanBegin)
- Add explicit checks for token mints, so it's no longer possible to use
  token accounts for foreign mints in Begin when the loan amount is zero,
  and it's clearer to see that the bookkeeping in End won't break if the
  user reinited the account for a different mint.
- Also add a few other extra comments and checks.

The updated FlashLoanEnd instruction is called FlashLoanEndV2
2023-04-14 15:18:02 +02:00
Christian Kamm 8d18e55eee Update mango-feeds-connector dependency 2023-04-08 08:37:08 +02:00
Christian Kamm 30984bbef1
Use new shared mango-feeds-connector crate for chain_data (#515) 2023-03-29 09:46:06 +02:00
microwavedcola1 00e467b2c0
workaround where rpc rejects base58 encoded pubkeys (#502)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
2023-03-14 17:38:02 +01:00
Christian Kamm 0349ace3b6
Downgrade the `fixed` crate to v1.11.0 (#500) 2023-03-12 08:50:42 +01:00
Christian Kamm 5c7a2e3e10
Use the overflow-checks=true equivalent with the fixed crate (#476)
* Vendor `fixed` crate to have checked math in release mode
* remove all cm!()
* drop superfluous parens
* drop use of checked_math crate
* manual removal of redundant checked_* functions
2023-02-24 11:56:33 +01:00
Christian Kamm 7b9e19cc08
Organize paths, rename crates (#466)
liquidator, keeper, cli and settle-bot moved to bin/
client moved to lib/client

All crates have a "mango-v4-" prefix
2023-02-20 14:08:38 +01:00
Christian Kamm 79a7bdc299 Checked math: support cm!(a += b) 2022-09-06 08:55:27 +02:00
Christian Kamm 7a343a9a8d checked_math: support casts and I80F48::from 2022-08-14 15:01:15 +02:00
Christian Kamm 449fe4dc6d Add checked_math library for convenient overflow checking
Instead of
    x.checked_add(y).ok_or(error!(MangoError::MathError))?
we can write
    cm!(x + y)
2022-03-13 15:45:50 +01:00