Skip to content

PROTO-409:Just Mint It extension#63

Open
ith-harvey wants to merge 28 commits into
mainfrom
feat/JMI
Open

PROTO-409:Just Mint It extension#63
ith-harvey wants to merge 28 commits into
mainfrom
feat/JMI

Conversation

@ith-harvey

@ith-harvey ith-harvey commented Jan 12, 2026

Copy link
Copy Markdown

Description
This PR introduces Just-in-Time M Issuance (JMI) support across the m_ext and ext_swap programs. It enables wrapping and unwrapping of approved non-M assets into M with explicit accounting, authorization, and safety controls. The implementation ensures correct backing semantics for JMI flows while remaining feature-gated and backward-compatible with non-JMI deployments.

Adapted from JMI EVM specification: https://www.notion.so/JMI-Just-Mint-It-Extension-2bc858df176a803790b2f7edacecdf06

Motivation
JMI requires the ability to mint and redeem M against non-M collateral while preserving strict supply invariants and preventing over-issuance. Existing flows assumed M-native assets and did not account for external asset backing, pausing, or per-asset limits. This change provides the necessary primitives to safely support JMI-style issuance, enforce operational controls, and allow controlled rollout through feature flags.

Changes (High Level)

  • Added wrap_asset and unwrap_asset instructions to m_ext and ext_swap for non-M asset flows.
  • Implemented JMI-specific backing math that accounts for total non-M assets when minting or redeeming M.
  • Introduced pausability and per-asset cap enforcement via asset configuration.
  • Added replace-authority support and standardized PDA signer behavior for wrap/unwrap operations.
  • Defined new error cases for paused state, asset restrictions, cap violations, and backing insufficiency.
  • Added jmi feature flag and updated build outputs to support feature-scoped deployments.

Comment thread programs/ext_swap/Cargo.toml
@ith-harvey ith-harvey marked this pull request as draft January 12, 2026 19:36

@Oighty Oighty left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decent start. There are some rough edges with mapping some of the EVM concepts to SVM. I left a few comments suggesting some changes.

Comment thread programs/m_ext/src/state/mod.rs Outdated
Comment thread programs/m_ext/src/instructions/wrap.rs
Comment thread programs/m_ext/src/instructions/wrap.rs
Comment thread programs/m_ext/src/instructions/wrap.rs Outdated
Comment thread programs/m_ext/src/instructions/wrap.rs
Comment thread programs/ext_swap/src/instructions/unwrap_asset.rs Outdated
Comment thread programs/ext_swap/src/lib.rs
Comment thread programs/m_ext/src/instructions/jmi/wrap_asset.rs Outdated
Comment thread programs/m_ext/src/instructions/jmi/replace_asset_with_m.rs Outdated
Comment thread programs/m_ext/src/state/asset_config.rs Outdated
Comment thread programs/m_ext/src/state/mod.rs
@ith-harvey

Copy link
Copy Markdown
Author

Worth noting that JMI if configured properly allows for all existing no-yield functionality. For that reason I'm thinking it makes sense to remove references of no-yield in the program aside from ensuring migrations work properly especially from no-yield -> jmi.

Adding more tests today which should verify this

Comment thread programs/ext_swap/src/instructions/wrap_asset.rs Outdated
Comment thread programs/ext_swap/src/instructions/wrap_asset.rs Outdated
Comment thread programs/m_ext/src/instructions/jmi/set_asset_cap.rs Outdated
@ith-harvey ith-harvey marked this pull request as ready for review January 17, 2026 00:08
@ith-harvey ith-harvey changed the title Feat/jmi PROTO-409:Just Mint It extension Jan 17, 2026

@Oighty Oighty left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting there. Left a more comments. I will probably need to do one more deep dive on all the constraints and validation checks. It would be good to go through that again and verify that the checks are consistent.

Comment thread programs/m_ext/src/lib.rs Outdated
Comment thread programs/m_ext/src/lib.rs Outdated
Comment thread programs/m_ext/src/lib.rs Outdated
Comment thread programs/m_ext/src/lib.rs Outdated
Comment thread programs/m_ext/src/instructions/jmi/wrap_asset.rs Outdated
Comment thread programs/m_ext/src/instructions/jmi/wrap_asset.rs Outdated
Comment thread programs/m_ext/src/instructions/jmi/wrap_asset.rs Outdated
Comment thread programs/m_ext/src/instructions/jmi/replace_asset_with_m.rs Outdated
Comment thread programs/ext_swap/src/instructions/wrap.rs
Comment thread programs/m_ext/src/instructions/jmi/replace_asset_with_m.rs Outdated
Comment thread programs/m_ext/src/instructions/jmi/set_asset_cap.rs Outdated
Comment thread programs/m_ext/src/instructions/jmi/set_asset_cap.rs Outdated
Comment thread programs/m_ext/src/instructions/jmi/replace_asset_with_m.rs Outdated
Comment thread programs/m_ext/src/instructions/jmi/wrap_asset.rs Outdated
Comment thread programs/m_ext/src/instructions/unwrap.rs Outdated
Comment thread programs/m_ext/src/utils/token.rs Outdated
Comment thread programs/m_ext/src/utils/token.rs Outdated
Comment thread programs/m_ext/src/lib.rs Outdated
Comment thread programs/m_ext/src/lib.rs Outdated
Comment thread programs/m_ext/Cargo.toml Outdated

@SC4RECOIN SC4RECOIN left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, would like to see the extensions check on the asset setup though

Comment thread programs/m_ext/src/instructions/jmi/wrap_asset.rs
Comment thread programs/m_ext/src/instructions/jmi/set_asset_cap.rs
Comment thread programs/m_ext/src/errors.rs Outdated

@Oighty Oighty left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more comments, but getting close.

Comment thread programs/ext_swap/src/instructions/replace_asset_with_m.rs
Comment thread programs/ext_swap/src/instructions/wrap_asset.rs
Comment thread programs/m_ext/src/instructions/jmi/wrap_asset.rs
Comment thread programs/m_ext/src/instructions/jmi/wrap_asset.rs Outdated
Comment thread programs/m_ext/src/instructions/jmi/replace_asset_with_m.rs Outdated
Comment thread programs/m_ext/src/state/mod.rs
@ith-harvey

Copy link
Copy Markdown
Author

@SC4RECOIN in response to: #63 (comment)

added additional checks for other extension types -> 8f12e00

Worth noting that whomever is whitelisting the asset in set_cap has the final say on protecting users from token specific design.

@Oighty Oighty left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve with one more minor change

Comment thread programs/m_ext/src/instructions/jmi/set_asset_cap.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants