Skip to content
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

[sui framework] Adds mint_and_transfer and burn_ entrypoints, changes argument order in mint() #2655

Merged
merged 7 commits into from
Jun 23, 2022

Conversation

damirka
Copy link
Contributor

@damirka damirka commented Jun 22, 2022

Closes #2653
Closes #2654

@damirka damirka added the move label Jun 22, 2022
@damirka damirka self-assigned this Jun 22, 2022
@damirka damirka requested a review from emmazzz June 22, 2022 11:02
@@ -170,9 +170,23 @@ module sui::coin {

// === Entrypoints ===

/// Mint `amount` of `Coin` and send it to `recipient`. Invokes `mint()`.
public entry fun mint_<T>(

Choose a reason for hiding this comment

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

I totally agree with the requirement of having entry functions for these flows (as it will help new Coins to be created in just a few lines of code), but we need to agree on the naming convention. Is the _ the pattern we're looking for as best practice here or mint_to_sender etc? @tnowacki

Copy link
Contributor

Choose a reason for hiding this comment

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

The _ convention was from when you actually needed a separate function for visibility reasons.

This feels a bit different though since the functionality is actually different. I would advise something like mint_and_transfer

Copy link
Contributor Author

@damirka damirka Jun 22, 2022

Choose a reason for hiding this comment

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

@tnowacki what do you think about burn_ in that context?

Copy link
Contributor

Choose a reason for hiding this comment

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

The one where it drops the u64? Feels okay.

I would ask yourself, What would the and_<verb> version be? If it is un-interesting, just an _ is fine. If its something like and_transfer_to_someone, you probably want a different name or suffix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the way!

crates/sui-framework/sources/coin.move Show resolved Hide resolved
Copy link
Collaborator

@sblackshear sblackshear left a comment

Choose a reason for hiding this comment

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

Accepting to unblock you for the demo!

Copy link
Collaborator

@kchalkias kchalkias left a comment

Choose a reason for hiding this comment

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

@damirka agree with Sam re accepting this to unblock, can you work on the test failures? Maybe we should either have a separate PR with the field swapping on the old api refactoring that breaks tests, so this PR only deals with the new api OR we resolve all failed tests (in order to be able to merge)

@damirka damirka changed the title [sui framework] Adds mint_ and burn_ entrypoints, changes argument order in mint() [sui framework] Adds mint_and_transfer and burn_ entrypoints, changes argument order in mint() Jun 23, 2022
Copy link
Collaborator

@kchalkias kchalkias left a comment

Choose a reason for hiding this comment

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

Awesome!

@damirka damirka enabled auto-merge (squash) June 23, 2022 09:07
@damirka damirka merged commit bfa5384 into main Jun 23, 2022
@damirka damirka deleted the ds/coin-improvements branch June 23, 2022 10:24
punwai pushed a commit that referenced this pull request Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants