* 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>
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
* Emit the slot corresponding to the oracle price to PerpUpdateFundingLog.
* Emit a new FilledPerpOrderLog consisting of just the group, perp market and seq num. This will be used to correlate perp fills to the transactions they were matched (not consumed).
* Fix script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix docs build job (#501)
* workaround where rpc rejects base58 encoded pubkeys (#502)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Rename settle-bot to settler, fix build (#492)
* Fix settler build, rename due to heroku not liking '-'
* Temporarily remove ref tag
* Remove temporary branch trigger
* Add oracleProvider to Bank and PerpMarket (#491)
* Add oracleProvider to Bank and PerpMarket
* v0.9.6
* Fix null checks on getters for PerpMarket and Bank (#505)
* Export OracleProvider
* Fix null checks on getters
* token_liq_bankruptcy: Use oracle for valuing insurance fund tokens (#503)
Previously a token from the insurance fund was valued at 1 USD. Now it
uses the oracle associated with it (USDC oracle).
* v0.9.7
* ts: Fix ix gate enum, add code for creating a disable-tx gov ix
* Fee buyback: Respect USDC oracle (#504)
* refactor script (#509)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* IxGateSet: Log AccountBuybackFeesWithMngo state
* TokenRegister: Sanity checks on token_index
* Allow token/market names to fill storage bytes completely
Previously the last byte was always zero.
* HealthRegion: Whitelist allowed instruction types (#508)
This fixes a security issue where bankruptcy related instructions could
be called inside a health region. Now health regions are limited to
compute optimization like when placing multiple orders in one
transaction.
This limitation also makes it impossible to abuse health regions for
flash loans. Use the FlashLoan instructions for that purpose.
* Add fly deploy scripts (#490)
* Bump program version to v0.10.0
* liquidator docs (#512)
* liquidator docs
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Quality of life fixes (#511)
* breaking: make pegLimit an optional arg
* pass externally cached blockhashes to sendTransaction
* convenience accessors for connection & walletPk on client
* add script to sim accounts with leverage change (#514)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix bug: only account for borrows we are offsetting (#513)
* Fix bug: only account for borrows we are offsetting
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Bank: Unittest for net borrow limits
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
* extend script, fix util function
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix interest rate computation in client (#520)
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* minor ts fixes
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Temporarily disable health region use on mm script (#507)
* Use new shared mango-feeds-connector crate for chain_data (#515)
* Add prometheus metrics to crank (#517)
* Add prometheus metrics to keeper
* update script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* fix bug where unrealised profit was not abs'ed
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* update script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* in perp settle fees, dont error, rather return early, this enables blindly concatenating perp settle fees to perp settle pnl (#526)
* in perp settle fees, dont error, rather return early
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fixes from review
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* update script
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Net borrow limits: Use correct price for check (#527)
* Changelog for program-v0.10.0 and idl update
* script for grabbing logs
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Perp funding: Fix logging in update funding + deactivate pos (#528)
* update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Fix test
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* sync rate params to latest proposal (#523)
* sync rate params to latest proposal
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>
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Limit funding and interest accrual during downtimes (#529)
Previously, if the funding or interest updating instruction wasn't
called for a long time (like for a solana downtime or the security
council halting the program), the next update would apply funding or
interest for the whole time interval since the last update.
This could lead to a bad downtime situation becoming worse. Instead,
limit the maximum funding and interest time interval to one hour.
* Changelog for program-v0.11.0, bump version, update idl
* Don't reload openorders if there's no active markets
* update
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* reorg
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
* Emit perp fees settled on update_funding. Required to have a full picture of total perp market fees. (#530)
---------
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: microwavedcola1 <89031858+microwavedcola1@users.noreply.github.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
Co-authored-by: Maximilian Schneider <mail@maximilianschneider.net>
Co-authored-by: tlrsssss <tjshipe@gmail.com>
Co-authored-by: Nicholas Clarke <nicholasgclarke@gmail.com>
Previously, if the funding or interest updating instruction wasn't
called for a long time (like for a solana downtime or the security
council halting the program), the next update would apply funding or
interest for the whole time interval since the last update.
This could lead to a bad downtime situation becoming worse. Instead,
limit the maximum funding and interest time interval to one hour.