Assert in a transaction that operation run on a mango account does not reduce it's health below a specified amount.
- Add a sequence check instruction (#909)
Assert that a transaction was emitted and run with a correct view of the current mango state.
### v0.23.0, 2024-3-8
Deployment: Mar 8, 2024 at 12:10:52 Central European Standard Time, https://explorer.solana.com/tx/6MXGookZoYGMYb7tWrrmgZzVA13HJimHNqwHRVFeqL9YpQD7YasH1pQn4MSQTK1o13ixKTGFxwZsviUzmHzzP9m
- Allow disabling asset liquidations for tokens (#867)
This allows listing tokens that have no reliable oracle. Those tokens could be
traded through mango but can't be borrowed, can't have asset weight and can't
even be liquidated.
- Add configurable collateral fees for tokens (#868, #880, #894)
Collateral fees allow the DAO to regularly charge users for using particular
types of collateral to back their liabilities.
- Add force_withdraw token state (#884)
There already is a force_close_borrows state, but for a full delisting user
deposits need to be removed too. In force_withdraw, user deposits can be
permissionlessly withdrawn to their owners' token accounts.
- Flash loan: Add a "swap without flash loan fees" option (#882)
- Cleanup, tests and minor (#878, #875, #854, #838, #895)
### v0.22.0, 2024-3-3
Deployment: Mar 3, 2024 at 23:52:08 Central European Standard Time, https://explorer.solana.com/tx/3MpEMU12Pv7RpSnwfShoM9sbyr41KAEeJFCVx9ypkq8nuK8Q5vm7CRLkdhH3u91yQ4k44a32armZHaoYguX6NqsY
- Perp: Allow reusing your own perp order slots immediately (#817)
Previously users who placed a lot of perp orders and used time-in-force needed
to wait for out-event cranking if their perp order before reusing an order
slot. Now perp order slots can be reused even when the out-event is still on
the event queue.
- Introduce fallback oracles (#790, #813)
Fallback oracles can be used when the primary oracle is stale or not confident.
These oracles need to configured by the DAO to be usable by clients.
Fallback oracles may be based on Orca in addition to the other supported types.
Deployment: Feb 9, 2024 at 11:21:58 Central European Standard Time, https://explorer.solana.com/tx/44f2wcLyLiic1aycdaPTdfwXJBMeGeuA984kvCByg4L5iGprH6xW3D35gd3bvZ6kU3SipEtoY3kDuexJghbxL89T
- Remove deposit limit check on Openbook v1 when placing an order to sell
deposits (#869)
### v0.21.2, 2024-1-30
Deployment: Jan 30, 2024 at 12:36:09 Central European Standard Time, https://explorer.solana.com/tx/2kw6XhRUpLbh1fsPyQimCgNWjhy717qnUvxNMtLcBS4VNu8i59AJK4wY7wfZV62gT3GkSRTyaDNyD7Dkrg2gUFxC
Deployment: Jan 3, 2024 at 14:35:10 Central European Standard Time, https://explorer.solana.com/tx/345NMQAvvtXeuGENz8icErXjGNmgkdU84JpvAMJFWXEGYZ2BNxFFcyZsHp5ELwLNUzY4s2hLa6wxHWPBFsTBLspA
- Prevent withdraw operations from bringing token utilization over 100%.
- Prevent extreme interest rates for tokens with borrows but near zero deposits.
### v0.21.0, 2023-12-13
Deployment: Dec 13, 2023 at 09:02:46 Central European Standard Time, https://explorer.solana.com/tx/47BBFEugtHYciK5jHVzVtXawc7oyXKzX8o5V4ERXX3Cb7AZqmr8w6uDrFPRpyJRDccRWtuno8g2micqaFoSLC1EL
The DAO can now configure hard deposit limits per token. They can be used in
conjunction with the previous soft limits to restrict how much of a token can
be on the platform providing collateral weight.
- Improve OpenBook order tracking and price bands (#805)
In order for hard deposit limits to work, OpenBook orders need to be tracked
and potentially restricted. The DAO can now configure a band around the oracle
price and new bids and asks that don't fall within this band will be rejected.
- SerumPlaceOrderV2 breaking change (#805)
A new instruction for placing orders on OpenBook markets is introduced. The
old instruction should be disabled shortly after release.
- Changing token maint weights over time (#780)
The DAO can now trigger a gradual change in token maint weights. This allows
it to make maint weights less favorable without potentially causing many
liquidations at the same time.
- Changed perp settlement incentives (#771)
The incentives were too high when the user account was close to liquidation.
The DAO had previously reduced the percentage amount as a mitigation.
With this change:
- low-health settlement incentives are capped at 2x the flat fee, removing
unlimited percentual incentive fees entirely
- incentives are only paid if at least 1% of position value is settled,
avoiding the incentive to settle accounts with large positions very frequently
- More configurable token interest rate curve (#755)
The scaling factor and target utilization are now stored separately, giving the
DAO more flexibility for configuration.
- Delegates can now deposit even when a new token position needs to be created (#775)
- TokenRegister: Add argument for insurance (#782)
- Close zero token positions when user asks to withdraw everything (#793)
- Fix default parameters for fast listing tokens (#804)
- Disable TokenAddBank instruction, which was unused (#803)
- Significantly reduce program heap use (#787, #785)
- Reduce compute use of OpenBook health computations (#750)
### v0.20.0, 2023-11-8
Deployment: Nov 8, 2023 at 10:44:24 Central European Standard Time, https://explorer.solana.com/tx/4LM5NJAa71tjjKT4a7MXVVsautU1DNvszbXp2ufeps9gMrksRh9pURRiacoyCEgW9gdBYJb1W3TL6o7dzDcUVmVH
Deployment: Sep 16, 2023 at 11:20:20 Central European Summer Time, https://explorer.solana.com/tx/K9BJ1uDBH6Xe8erhS6C8Rmz6k6V1cKJ8z6wNmf4DV2aF5Woin4H5xXKj1ypTNDSTccNvcsAUTHStoai3k2hYY5E
- Fix a health overestimation with OpenBook open orders
When bids or asks crossed the oracle price, the serum3 health would be
overestimated before.
Now we track an account's max bid and min ask in each market and use that
as a worst-case price. The tracking isn't perfect for technical reasons
(compute cost, no notifications on fill) but produces an upper bound on
bids (lower bound on asks) that is sufficient to make health not
overestimate.
### v0.19.0, 2023-9-7
Deployment: Sep 7, 2023 at 13:10:08 Central European Summer Time, https://explorer.solana.com/tx/3xcQWmAinBjFF4QgUCS7v5KxS7CjUQMJmENBHMyMMoeNCdKpLQL6fJXcKRRDmzW4ajPUywgPxBzMoYJn9c8CteEP
Deployment: Jul 28, 2023 at 08:29:46 Central European Summer Time, https://explorer.solana.com/tx/TaPcQ8dUDyFEaqprasGVEeG3x4Z2nMT7jY9tr2G8KVVf3kvDUQv8TRTjzDirasx3YkyYq3PmQcmcMbCcHsAnUNT
Deployment: Jul 6, 2023 at 20:26:34 Central European Summer Time, https://explorer.solana.com/tx/4kiVtR1G3xNh8bTP4FetfG7rjPjLThFjrQNzMMs2TfQHnw7Ezp6JX4rboQbGrJsfZDd6zaMuEa1ZTxahRwPPb9JR
- Remove extra Pyth oracle status check added in v0.17.0
The Pyth oracle status also reverts to Unknown if not enough publishers have
reported in a 25 slot window. So checking for the "Trading" status means an
implicit staleness limit of 25 slots.
This staleness limit is much more strict than the ones configured on the
oracles currently used by Mango and caused occasional transaction failures.
### v0.17.0, 2023-7-3
Deployment: Jul 3, 2023 at 09:46:14 Central European Summer Time, https://explorer.solana.com/tx/4G6b1uihopkHqp968sq3RYacYHn5ND8mMmeNd1RfswTCmiqeappTN2747JTvswVXxs7oqgfU6M3VKPGVRFPGJYuL
Deployment: May 19, 2023 at 15:35:12 Central European Summer Time, https://explorer.solana.com/tx/22fEcghPGgAnYCZkfjTxTeKQwX5rzWSx3c5CV9TikJmaAKWCpubCZYBx5ZJJPeNG1xWUPWMw3ooDhFBRYCR3tKYU
Deployment: May 11, 2023 at 09:29:12 Central European Summer Time, https://explorer.solana.com/tx/3h6KFxLEAvifNGDBNcQrWdc6cRkpHTzFzL8VradfAXBYNfScrLJzDxm52N4RNmS9dmE84zDuwbErQ75RcxDcihY3
- Change TokenRegisterTrustless instruction to disable borrows by default (#567)
The instruction is intended to use very conservative defaults for listing
tokens. It now lists new tokens with zero asset weights and without allowing
borrowing, which should leave oracle staleness and potential bugs as the main
risks of listing new tokens.
- OpenBook place order instruction: Respect reduce-only flags on the base and
quote bank (#569)
This way the DAO can potentially leave related OpenBook markets open when it
marks a token as reduce-only.
- FlashLoan: Whitelist the ComputeBudget program when called by delegates (#572)
For convenience. When constructing a flash loan instruction for a delegated
account, users no longer need to take care to remove compute budget
instructions from the flash loan scope.
- Perp Order Matching: Exit when no lots can be filled due to the quote limit (#576)
Previously it would keep looping unnecessarily.
- Improve error message for incorrect number of accounts in FixedAccountRetriever (#566)
- Add oracle confidence and type information to perp update funding logs (#568)
### v0.14.0, 2023-4-29
Deployment: Apr 29, 2023 at 11:58:43 Central European Summer Time, https://explorer.solana.com/tx/2iaLQTT6PqFjFQr94j5g2iUhDT9v6CJk5rNC9mY7cY7BfRjn6pWixnUF5Wv2qAAUq4hmEvM7WyajDxQjq6QbufSk
When a perp markets is set to "force-close" by the DAO, anyone can close open
perp orders and positions on the market. This allows the DAO to wind down perp
markets if needed.
- Force-closing of OpenBook market use via Mango (#551)
When an OpenBook market's Mango integration is set to "force-close" by the DAO,
anyone can close open orders on that market that were placed via Mango.
This allows the DAO to wind down interactions with an OpenBook market.
- Fix exception for the Jupiter program in flash loan (#552)
Account delegates cannot execute generic flash loans, but were supposed to be
able to use whitelisted Jupiter programs during a flash loan. The bug that
prevented the exception from working was fixed.
- Allow the DAO to withdraw from the insurance fund token account (#561)
- Fix a bug with settle limit accounting when liqors take over positive pnl (#562)
- Improve logging on force-close instructions (#555)
- Fix perp order seqnum logging (#556)
- Fix build when using mango-v4 code with the "no-entrypoint" feature (#558)
### v0.13.0, 2023-4-18
Deployment: Apr 18, 2023 at 17:33:15 Central European Summer Time, https://explorer.solana.com/tx/4WWVHCAheTRBhzyXUjsV1Kqfn8LdnkupiVbK4qaPNqby8P5vv7hY6HS3rHHL9bMu1RGdCZvqsd2MHjdawLYQ6Pxi
Deployment: Apr 17, 2023 at 15:49:33 Central European Summer Time, https://explorer.solana.com/tx/2PbaCRMGgpGiysxk5y8x3TdFRZbGEAKZdyAzEQhAMXfCxS4bPN96YZ4Pp6hHfp17fd7RYUd13t4vtjpaFb4ccYRm
Required to have a full picture of total perp market fees.
- Net borrow limit: Separate out tracking from checking (#534)
That way it's easier to be specific about where the limit should be checked.
### v0.11.0, 2023-4-4
Deployment: Apr 4, 2023 at 21:43:18 Central European Summer Time, https://explorer.solana.com/tx/5Z36iV6VhAfmxwZubQduV1hNyUyyB9AyjovAwNrWLb5cdAqGm4F3NGmz6V8VpHT6yUwCEDxm2hWMrdJXNkZ8RSPR
Deployment: Apr 3, 2023 at 20:10:26 Central European Summer Time, https://explorer.solana.com/tx/3Rvv7hxqYQ7mPXE7jopzq1RAAoEwPi1pRPY7EubzEiZih8zMVhTMe1AsuYNJq3gwpM8BVVC3CXkAWcsFdd7SE6zC
The security council had disabled the HealthRegion instructions after the audit
found a vulnerability. The issue has been resolved by restricting which other
instructions may be called in a health region. That way it's still usable to
save compute units, but its attack surface is significantly reduced.
- Use insurance fund token oracle for bankruptcies (#503)
This is in preparation for using an oracle for the USDC price instead of fixing
its value to $1. The insurance fund is in USDC, so the oracle price needs to
be taken into account once a real oracle is provided.
- Fee buyback: Use the USDC oracle (#504)
- Perp settle fees: Return early instead of error on failure (#526)
- Net borrow limits: Fixed accounting of deposits (#513)
- Better logging in IxGateSet instruction
- Sanity check token_index in TokenRegister instruction
- Allow using all available bytes for bank and market names
### v0.9.0, 2023-3-16
Deployment: Mar 16, 2023 at 11:07:30 Central European Standard Time, https://explorer.solana.com/tx/2hVqFQhxC9BGzDvH7y9bWChrMRvzsBGMPcMepHLBamK4vKJMJG48Fv8ZB54b46qErH1aGRy9YVhFnVnpaKgnoP3c
- Downgrade the "fixed" dependency to v1.11.0 (#500)
The dependency had a regression. This downgrades to the previous version that
had been in use with Mango v3, while backporting the safety improvements done
for release v0.8.0.
- Improvements to perp position docstrings (#497)
### v0.8.0, 2023-3-11
Deployment: Mar 11, 2023 at 08:06:22 Central European Standard Time, https://explorer.solana.com/tx/61CbcyDaCV1DKHEGxkfNfx9nCUfsH3RgUU7mivTjtqbHJ3YVPX6vNAzn91CZYRsjohVc5LdcZCZtteDKrCiKjYEi
Deployment: Feb 22, 2023 at 14:45:12 Central European Standard Time, https://explorer.solana.com/tx/2KjMd2GLggSTJGSBQ3T96KK8Pj8XEXSDad65b8AN9gtCo6XdWmaFtewUJbPFvXK8WnKgdTxUNJjftpbtRJNEVhDg
Deployment: Feb 14, 2023 at 16:06:03 Central European Standard Time, https://explorer.solana.com/tx/4vpjuiESQZn5t6XErHeSX76dCng4P4KPrr5pMGuYv9LhA3EcLgTw1bYxg8aRmBt1rfJCTqqYLws1cr4EvnrrETue
Deployment: Feb 2, 2023 at 10:51:02 Central European Standard Time, https://explorer.solana.com/tx/eVGLcy3y8Vi9sMDKQbKdRKZa6dpjTjdP5HyDFXXQFqAaS1CXCg2QnFC1hgE8F8unWfgpmXC8PvmuRMhmQEE1YzK
Deployment: Jan 24, 2023 at 10:21:59 Central European Standard Time, https://explorer.solana.com/tx/3C5vSUrC2xJhAeaDjRMuhE1Gnbj72gDKPRibpFk2gP2afoaFquY8GgUeBwhNoP25QtPvTJG3NZmZBoHoSgvrEWGH
Deployment: Jan 17, 2023 at 14:57:12 Central European Standard Time, https://explorer.solana.com/tx/5uGKvLwcBjPkUAKtFGqKdwm6pHXFaMGkF44P8rhJrRbmTGwgKShkSoVvLvqDNvJYa4iMftiQgZW7gG9tQaXjmrEk
Deployment: Jan 13, 2023 at 11:31:05 Central European Standard Time, https://explorer.solana.com/tx/4yGRUk6QwntvC4umECDPDZJNcbevSJ1fdZi75Mz9rGa9SHKzUtjMF3V5FCTkzBZqAETQTccqv63BYw6yX8JNxiur
- Renamed `getGroupForAdmin` to `getGroupForCreator`.
- Renamd `getInNativeUsdcUnits` to `getEquivalentNativeUsdcPosition`.
- Renamd `getMangoAccountForOwner` to `getMangoAccountsForOwner`.
-`getOrCreateMangoAccount` and c`reateMangoAccount` take an explicit payer, previously it was just implicitly using the client provider's wallet
- Upgraded anchor npm package to latest.
- Anchor is now a git submodule.
New features
- Many rust liquidator improvements.
- MangoAccount is now dynamically sized and is expandable, there is a new `AccountExpand` ix, default size of account is 8 token positions, and 2 serum3 and 2 perp positions, expanded account has 16 token positions and 8 serum3 and 8 perps for now.
- Group account - has a `creator` field which is set on creation and should never change, is used for pda derivation, has a new `fast_listing_admin` field for governance, and also has a `GroupEdit` ix to change both the admin keys.
- Group account - has a `version` field, version 0 which is used in the setup scripts for now, means serum3 and perp market registration is forbidden, and multiple banks are prevented from been added.
- Each account now has a reserved space of around 256 bytes.
- flash_loan ix 1 and 2 are removed, flash loan 3 has been renamed to just `FlashLoan`.
-`MintInfo`, `Serum3Market`, and `PerpMarket` have a field called `registration_time` which is seconds from epoch, e.g. use case how freshly has the market been added, if it was recently added then liquidity might need some time to improve
- Removed fields and commented out code for address lookup tables.
- New `TokenRegisterTrustless` ix to register tokens trustlessly.
- Insurance fund is now disabled for trustless tokens.
-`TokenRegistration` and `TokenRegisterTrustless` ixs dont take a bank_num anymore, hardcoded to 0.
- Enforced a minimum maximum rate of 50% so that rates don't fall so low that they cannot recover.