Skip to content

mrgn - 0.1.2

Compare
Choose a tag to compare
@jgur-psyops jgur-psyops released this 14 Mar 19:43

Summary of New Features

  • Implied anchor args everywhere - TS consumers rejoice, no more having to pass every account the instruction requires. Most instructions now require only a handful of accounts, and infer the rest.
  • Deposit up to limit - pass a flag to deposit up to the bank's deposit cap. No more guessing if a bank has capacity.
  • Permissionless incentives - program-level support to designate a wallet that can receive your earned incentives without any input from you. We'll crank users that opt-in on a regular basis, so no more missing out on rewards because you forgot to claim them (front end for this is coming soon at a date TBD)
  • Logging improvements everywhere
  • Health pulse instruction to view internal account health
  • Preparations for Arena permissionless pools launch

Breaking Changes

  • account.lending_account.balances[n] is now a u8 instead of bool (0 = false, 1 = true)
  • MarginfiAccount padding now split into padding0 and padding1
  • BankConfig padding now split into padding0 and padding1
  • Almost all instructions are now modified to use implied anchor args. Some argument names have changed (e.g. marginfi_group -> group), but order is maintained. This should be non-breaking to Rust clients passing simple account meta, but may be breaking to TS clients passing account manually, or to CPI consumers. All accounts that have undergone a name change will now be inferred and can be omitted. Use accountsPartial as a fallback if this fails.
  • deposit instruction now accepts one additional argument (an Option<bool>) to flag if the depositor wants to deposit up to the bank's available limit. Actual deposit will be min(amount specified in deposit arg, deposit limit remaining in bank)
  • Various Stale Oracle and Illegal Liquidation errors now emit a more specific custom error. Update is only required if you were checking for a specific error code.
  • marginfiGroupInitialize now takes an admin and a bool arg (true to set as an arena group)
  • marginfiGroupConfigure now takes an admin and a bool arg (true to set as an arena group)
  • MarginfiGroup now has a banks field which tracks the number of banks created under that group

New Instructions

  • marginfi_account_update_emissions_destination_account - allows a user to designate a wallet where their earned emissions can be permissionlessly withdrawn into. Users who do not opt into this feature can only withdraw manually
  • lending_account_withdraw_emissions_permissionless - a permissionless ix that withdraws emissions into an account users chose when they opted into permissionless emissions.
  • lending_account_health_pulse - a permissionless ix that caches the internal health information computed by the risk engine. Fetch the user account and read the health_cache to see information about prices used, net asset and liability prices, etc.

New Logging

  • On risk engine failure, now anchor logs various internal information.
  • Many new error messages, replacing existing generic errors like StaleOracle and IllegalLiquidation
  • On any add or config instruction (add bank, configure group, configure bank, etc) now echos the settings being changed in anchor logs

Known Bugs/limitations

  • group.banks only tracks the number of banks created after 0.1.2 goes live
  • Groups created prior to the 0.1.2 update can be incorrectly configured as arena groups since we do not count banks created prior to that update.
    • Since this basically only affects the mrgn-owned main group and mrgn-owned Arena group used for testing, this is a non-issue. We will, prior to Arena launch, double check that there are no other affected groups.

Deployment details

Deployed staging: March 14, 2025 ~3:00pm ET (hash 65bbbe)
Deployed mainnet: April 14, 2024 ~1:00pm ET (hash 65bbbe)