The following instructions now allow skipping banks and oracles if health
and the token position balance is not negative:
- token_withdraw
- token_deposit
- serum3_place_order
- perp_place_order
- flash_loan
They also allow skipping oracles that are stale.
* 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>
* 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
The identity
a * b = -((-a) * b)
does not hold for I80F48, probably it's rounding to -inf.
This meant that withdrawing the full native token balance could
fail because the magnitude of -position * price was bigger than
position * price.
* Make health/oracle functions usable from clients
By creating a shared trait that is implementable for AccountInfo and
AccountSharedData.
* Health: fixup tests
The latter is important when we want to compute health for two different
accounts. Then the remainingAccounts would hold the union of the
necessary accounts, and each health check would need to look for the
accounts that it needs.
This patch al so reduces the compute needs for fixed-layout health
checks significantly (Deposit for an account with 8 tokens and 7 markets
takes 65k instead of 70k cu)
bad benchmark of compute needs for 100 add-assigns of I80F48:
3465 a + b
3465 a.checked_add(b).unwrap()
3465 cm with unwrap() <- maybe future if we fix panics
4366 cm with ok_or_else() <- now
56494 cm with ok_or() <- old