-
Notifications
You must be signed in to change notification settings - Fork 125
Flexible Minting Policies for Token Standards #2559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
PhilippGackstatter
merged 39 commits into
0xMiden:next
from
onurinanc:onur-mint-policies
Mar 17, 2026
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
300aece
add mint_policies
onurinanc b22d4f3
add mint_policy_owner_only_per_cap
onurinanc 2a0aeb6
add ownable2step
onurinanc 5de4a82
merge upstream/next
onurinanc 6f1d526
merge
onurinanc 2add1a5
separate mint policies and policy manager
onurinanc 51f5900
Merge remote-tracking branch 'upstream/next' into onur-mint-policies
onurinanc a96e0bd
fix
onurinanc f6282ba
fix
onurinanc 6ba27ca
rename distribute to mint
onurinanc 6768626
Merge branch 'next' into onur-mint-policies
onurinanc e5e1809
fix comments
onurinanc d2de23c
prep merge
onurinanc 89f1716
merge next
onurinanc ecb8e35
merge
onurinanc be94473
Merge remote-tracking branch 'origin/onur-mint-policies' into onur-mi…
onurinanc 5dc6b6d
rename as mint_and_send
onurinanc c053466
fmt
onurinanc 00dcca7
add owner controlled
onurinanc 4ba4304
add auth_tx_controlled
onurinanc f9a5e17
refactor
onurinanc dc52903
typo
onurinanc 688d7c4
fix name
onurinanc 89cd101
typo
onurinanc 984c02d
typo
onurinanc c643c9c
fix tests
onurinanc 36b760e
Merge branch 'next' into onur-mint-policies
bobbinth f8be317
fix reviews
onurinanc 602d17e
rename AuthTxControlled -> AuthControlled
onurinanc b66aeff
rerun ci
onurinanc 0b6089a
Merge branch 'next' into onur-mint-policies
onurinanc 4b3aef5
fix comments
onurinanc baa1750
Merge remote-tracking branch 'origin/onur-mint-policies' into onur-mi…
onurinanc 9fdd4e2
apply comments
onurinanc 7266248
Merge branch 'next' into onur-mint-policies
bobbinth 372b5b7
Apply suggestion from @PhilippGackstatter
bobbinth 5c32e04
add MintPolicyAuthority comments
onurinanc 8386f14
Merge remote-tracking branch 'origin/onur-mint-policies' into
onurinanc bbf11c5
fix
onurinanc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
crates/miden-standards/asm/account_components/mint_policies/auth_controlled.masm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # The MASM code of the Mint Policy Auth Controlled Account Component. | ||
| # | ||
| # See the `AuthControlled` Rust type's documentation for more details. | ||
|
|
||
| pub use ::miden::standards::mint_policies::auth_controlled::allow_all | ||
| pub use ::miden::standards::mint_policies::policy_manager::set_mint_policy | ||
| pub use ::miden::standards::mint_policies::policy_manager::get_mint_policy |
7 changes: 7 additions & 0 deletions
7
crates/miden-standards/asm/account_components/mint_policies/owner_controlled.masm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # The MASM code of the Mint Policy Owner Controlled Account Component. | ||
| # | ||
| # See the `OwnerControlled` Rust type's documentation for more details. | ||
|
|
||
| pub use ::miden::standards::mint_policies::owner_controlled::owner_only | ||
| pub use ::miden::standards::mint_policies::policy_manager::set_mint_policy | ||
| pub use ::miden::standards::mint_policies::policy_manager::get_mint_policy | ||
|
bobbinth marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
bobbinth marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
crates/miden-standards/asm/standards/mint_policies/auth_controlled.masm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # POLICY PROCEDURES | ||
| # ================================================================================================ | ||
|
|
||
| #! Dummy mint predicate to allow all mints. | ||
| #! | ||
| #! Inputs: [amount, tag, note_type, RECIPIENT, pad(9)] | ||
| #! Outputs: [amount, tag, note_type, RECIPIENT, pad(9)] | ||
| #! Invocation: dynexec | ||
| pub proc allow_all | ||
| # Dummy predicate, no checks yet. | ||
| push.0 drop | ||
| end |
18 changes: 18 additions & 0 deletions
18
crates/miden-standards/asm/standards/mint_policies/owner_controlled.masm
|
bobbinth marked this conversation as resolved.
bobbinth marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| use miden::standards::access::ownable2step | ||
|
|
||
| # POLICY PROCEDURES | ||
| # ================================================================================================ | ||
|
|
||
| #! Owner-only mint predicate. | ||
| #! | ||
| #! Inputs: [amount, tag, note_type, RECIPIENT, pad(9)] | ||
| #! Outputs: [amount, tag, note_type, RECIPIENT, pad(9)] | ||
| #! | ||
| #! Panics if: | ||
| #! - note sender is not owner. | ||
| #! | ||
| #! Invocation: dynexec | ||
| pub proc owner_only | ||
| exec.ownable2step::assert_sender_is_owner | ||
| # => [amount, tag, note_type, RECIPIENT, pad(9)] | ||
| end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works, but I wonder if it is better to have policy manager be a separate component. Basically, this would export just:
And the policy manger would export:
On the Rust side, we'd have something like:
And then, when creating a faucet account, we'd do something like:
This is just a sketch - it may be better to do things a bit differently - but the overall idea is to split out policy manager into a separate component.
This does increase complexity somewhat - and we need to analyze whether it is worth it. But at least superficially, it feels like a cleaner separation of concerns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for outlining it! My first idea was to separate
MintPolicyManager, but it became more complex as I implemented it. Then, I decided to switch to this version of having policies tied to the policy manager. My preference is to implement this idea while designing and implementing the Role-Based Access Control as I believe we could see the bigger picture by using diffrent Access Control mechanisms thanOwnable2Step. That would be also the follow-up PR for Mint Policies. What do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally agreed that it seems better to have a base
MintPolicyManagercomponent that can be extended in plug & play fashion with additional mint policy components.Not a strong opinion whether we should do it in this PR or later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good - let's leave this for the follow up.