Skip to content

mrgn - 0.1.4-rc3

Compare
Choose a tag to compare
@jgur-psyops jgur-psyops released this 27 Jul 01:22

Changes since rc2

  • Type crate now matches the release data (marginfi_account did not pick up the changes in rc2). No change to program, no update to staging program.

Changes since rc1

  • Fix account transfer logic to prevent the same account from being migrated to a new account twice.
  • add migrated_to field to accounts to indicate where they have been moved
  • 0.1.3 health caches are now still valid in 0.1.4 (previously were corrupted due to adding the migrated_from field prior to those accounts)

SUMMARY

  • Adds a new way to transfer your account: transfer_to_new_account transfers all of your positions to a new account, with an authority of your choosing. This allows you to give your positions to others or move them between your own wallets. The process incurs a nominal fee in SOL (~$1 today) to avoid spam.
    • We expect that points earned by the source of the transfer will go to the destination account. For example, if account A migrates to B, then B migrates to C, then C will earn all of the points combined for A and B. Currently, points will continue to display on A and B separately, we will figure out how to combine them at a later date.
  • Adds a bank cache, where consumers can view recent information about a bank's interest rates (APR), and interest recently earned.
  • Removes Pyth legacy (aka v1, pythnet, or "push") oracle support from the program.
  • Fixes a bug with the switchboard oracles where confidence was incorrectly either 0 or clamped at 5%. All users participating in swb banks should see a tiny improvement to their account health and corresponding increase in borrowing power
  • Oracle pricing is now totally suspended during periods of poor price confidence, where the allowed confidence is now configurable per bank. We expect this will reduce unfair liquidations during periods of extreme price volatility, but should not affect normal operation in the vast majority of cases.
  • Banks created after the release of 0.1.4 can now be closed by the group admin to recover rent, but only if they have no open positions, no emissions, and no assets. Banks created prior to 0.1.4 can never be closed.
  • Banks now track the total number of open positions, subsequent to the release of 0.1.4 (Note: for new banks, this will always be 0 or greater, for banks created prior to 0.1.4, this may be negative as closed positions reduce the count).
  • Adds delegate administrators for emissions, curve parameters, and deposit/borrow caps. These admins can modify only a small subset of settings, which makes them safe(r) to grant to a hot wallet or MS with limited signature threshold. The group admin is still free to modify most bank parameters.

Consolidates:

  • #349 (adds bank cache to record spot interest rates, etc)
  • #343 (removes Pyth legacy support from the program and test suite)
  • #344 (Restores Rust CLI functionality which was broken in 0.1.3)
  • #350 (Tests usage of multiple staked collateral banks at once)
  • #351 (minor TS error handling update)
  • #353 (remove pyth legacy from test suite)
  • #356 (fix swb std dev issue)
  • #354 (new account migration instruction)
  • #355 (minor fixes following second emode audit suggestion)
  • #356 (Fix usage of std dev aka confidence in swb oracles)
  • #358 (Pyth accounts store the feed directly instead of feed id)
  • #359 (Oracles fail when a confidence threshold is exceeded)
  • #360 (Banks track open positions and can be closed)
  • #361 (Delegate admins for setting various bank params)
  • #369 (minor fix to account transfer logic)

BREAKING CHANGES

  • Always remember to update your TS package to the latest version.
  • Removes the old account migration instruction, which required the group admin (the multisig) to sign. Users can now migrate their balances to a new account at any time without admin approval using the new transfer_to_new_account ix
  • If you were deriving the Pyth oracle using oracles[0] (formerly the feed id) and a shard id, this is no longer possible. Banks that have migrated (e.g. where bank.config.config_flags & 1 != 0`) now store the feed directly on oracles[0], use that key directly as the oracle instead.
  • If you were using your own feed (e.g. neither Pyth nor Mrgn sponsored), you may no longer do so.
  • Remember to update your Rust type-crate or program dependency.

BREAKING (ADMIN ONLY)

  • set/unset user flags ixes removed (all user flags are now deprecated)
  • When configuring banks with pyth oracles, pass the oracle directly instead of the feed id. You no longer ever need to worry about the feed id.
  • When configuring banks, an additional argument is passed (oracle_max_confidence). Oracle checks fail if this is exceeded. Pass 0 to use the default (10%).
  • changing emissions now requires delegate_emissions_admin instead of regular admin.

NEW FIELDS AND OTHER NOTES

  • Account authority is now immutable
  • Frozen fields still can't update even with a delegated admin right, e.g. the delegate curve admin cannot do anything if a bank is frozen.
  • Account gains migrated_to and migrated_from fields that indicate ithe key of the new/previous mrgnfi account when an account is migrated to a new authority. Accounts migrated like this form essentially a doubly linked list of accounts, so you can always follow these references to trace back to the "root" account or to the "current" one.
  • bank.config and the config input types added field oracle_max_confidence
  • bank added field bank.cache
  • bank added field lending_position_count and borrowing_position_count
  • Group added fields delegate_curve_admin, delegate_limit_admin, and delegate_emissions_admin

PYTH MIGRATION INSTRUCTIONS AND NOTES

  • Banks that have not migrated will continue to function as normal until they migrate.
  • Pyth banks that migrate will no longer store the feed id on oracles[0], instead they will store the key of the feed directly, just like switchboard oracles already do. After the ix completes, these banks will now accept that oracle and no other feeds.
  • Simply run migrate_pyth_push_oracle for all banks that existed prior to 0.1.4 going live. Non-Pyth banks will set the migration flag and do nothing. Pyth banks (excluding staked collateral) will accept either the Pyth or Mrgn sponsored oracle feed. The feed must exist (e.g. not be a blank account).
  • Staked collateral banks must use propagate_staked_settings instead. These will always use the Pyth sponsored oracle.
  • Next time edit_staked_settings runs, remember to also update the oracle to use the SOL feed. This can happen any time in the future, it does not have to happen to complete migration, but propagation of future settings will fail until it's done.
  • New banks will now take the feed instead of the feed id when being created.
  • Migration functionality will be removed in 0.1.5

Deployments

Staging - July 25, 2025 at ~7:15 ET
Mainnet - July 39, 2025 at ~11am ET, hash: 1229b8