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

Fungible Token Minting Standard #249

Closed
wants to merge 5 commits into from

Conversation

robert-zaremba
Copy link
Contributor

@robert-zaremba robert-zaremba commented Aug 19, 2021

Summary

An interface for a fungible token minting, which is usually a part of a token life cycle,

Motivation

Token minting can be triggered by other smart contracts. Hence we need a standard interface for minting.

In a minting life cycle, token will be firstly minted and then transferred. Following scenarios are possible:

  • user can mint tokens for himself (faucet)
  • issuer will firstly mint tokens and then transfer
  • smart contract will mint tokens for a user

Moreover, there are tools which filter transactions to report user tokens in a dashboard (eg the NEAR Wallet).
These tools will usually check the first transaction. In case of NEAR Wallet it check for the ft_transfer, ft_transfer_call function calls. If a user will receive a token through minting, the it won't be reported (see Minted Tokens via Contract not showing in Wallet #468 issue). So, we need a standard interface in order to have a tool support.

Outcome

We decided to reject this proposal. Reason:

  • Most tokens don't just allow someone to mint them, they are minted as part of a more complex transaction, and this API is not suitable for this case. As a result, this API has very limited usability.
  • Scope for token minting tools is very limited.
  • User balance tracking should use events, not ft_mint calls. Tokens can be minted through various flows.

@mikedotexe
Copy link
Contributor

Tagging @MaximusHaximus on this. Perhaps we can jump on a call to discuss. I have an idea in my head of how this all works, but when it comes to implementation, I think Daryl knows way better. The thing I'm trying to understand here is the idea of "first you mint, then it transfers so it'll get caught by the indexer."
Ideally, we'd let the indexer know about the mint function and parameters so it can keep track of that. Would that be a heavy lift?
Is the implication that this mint function must use an ft_transfer or ft_transfer_call before assigning ownership?

@robert-zaremba
Copy link
Contributor Author

Coins are created by minting - and we would like to see that coins in the NEAR Wallet.
The issue is related to the wallet behavior. If you receive a token which doesn't match the required regexp then it won't be visible in the NEAR wallet.

Co-authored-by: Mike Purvis <mike@near.org>
@telezhnaya
Copy link
Contributor

@mikedotexe we have a new piece of information from the #249 and the call.
Could you please have a look at this PR again?

@ilblackdragon
Copy link
Member

As I have mentioned in #254 (comment), you can not and should not define minting or burning standard based on function names.

There are many times when tokens will be minted as a subsequent step of some other action:

  • user deposited another token
  • user swapped tokens via deposit of another token with ft_transfer_call
  • user called add_liquidity
  • user called liquidate
  • user burnt another token
  • some if statement when they get minted and when they dont'
    etc.

Function name based standard is impossible to define here.

Instead logs emitted when new tokens enter circulation and when they leave should be present.

@robert-zaremba
Copy link
Contributor Author

I like the log based approach. Although, I still think it's good to have a standard for minting: it's useful when one contract wants to request minting (eg in farming). Composibility can't be done with logs. Logs are good for indexer and off-chain tools. That being said - our initial issue came from a wallet not being able to find new user assets.

@frol frol added the WG-contract-standards Contract Standards Work Group should be accountable label Sep 5, 2022
@frol frol self-requested a review September 5, 2022 05:05
@frol frol added the S-voting/needs-wg-voting-indication A NEP in the VOTING stage that needs the working group voting indication. label Oct 5, 2022
@frol
Copy link
Collaborator

frol commented Oct 5, 2022

I like the log based approach.

Just for the readers' reference, since the time this NEP was proposed, NEP-297 was implemented, so the initial issue has already been resolved:

That being said - our initial issue came from a wallet not being able to find new user assets.

Wallet and Explorer extensively use the mint/transfer/burn logs these days (NFT and FT standards were also extended with the events).

Although, I still think it's good to have a standard for minting: it's useful when one contract wants to request minting (eg in farming). Composibility can't be done with logs. Logs are good for indexer and off-chain tools.

Most of the minting methods rely on some non-trivial logic that is hard to standardize, so I am leaning towards rejecting this NEP.

@near/wg-contract-standards Please, review this NEP

@frol frol requested a review from a team October 5, 2022 13:14
@ori-near ori-near added the A-NEP A NEAR Enhancement Proposal (NEP). label Oct 13, 2022
mfornet
mfornet previously approved these changes Oct 19, 2022
Copy link
Member

@mfornet mfornet left a comment

Choose a reason for hiding this comment

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

Looks good to me. It is very simple, and it naturally extends FT capabilities.

Comment on lines +14 to +17
In a minting life cycle, token will be firstly minted and then transferred. Following scenarios are possible:
* user can mint tokens for himself (faucet)
* issuer will firstly mint tokens and then transfer
* smart contract will mint tokens for a user
Copy link
Member

Choose a reason for hiding this comment

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

What about adding an extra method ft_mint_call (similar to ft_transfer_call). It can be an overkill, but it could simplify some scenarios where you need to mint and immediately react to these "transfers", potentially even burning part of the tokens that are not used on a callback.

I don't have any particular use case in mind.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, like minting for the smart contract? I think it will add more complexity, but if people think it's needed, then we can add it. We can always add it later to evaluate the need.

@mfornet mfornet self-requested a review October 19, 2022 10:57
Comment on lines +19 to +20
Moreover, there are tools which filter transactions to report user tokens in a dashboard (eg the NEAR Wallet).
These tools will usually check the first transaction. In case of NEAR Wallet it check for the `ft_transfer`, `ft_transfer_call` function calls. If a user will receive a token through minting, then it won't be reported (see Minted Tokens via Contract not showing in Wallet [#468](https://github.com/near/near-contract-helper/issues/468) issue). So, we need a standard interface in order to have a tool support.
Copy link
Member

Choose a reason for hiding this comment

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

@ilblackdragon I see this paragraph might be confusing.

you can not and should not define minting or burning standard based on function names.

As I read this standard, I don't think the goal is to enforce that all minting/burning goes through this method. It rather tries to consolidate a feature for some tokens that have a natural way of minting tokens (like faucets), so they can be used uniformly from external tools.

I agree that we should not rely on the ft_mint method to determine if users have some balance. In this case, I do suggest this standard enforce that the contract emits Mint events logs so that they can be used by indexers (wallet / explorer).

Copy link
Contributor

Choose a reason for hiding this comment

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

It rather tries to consolidate a feature for some tokens that have a natural way of minting tokens (like faucets), so they can be used uniformly from external tools.

If we fix the function name just for faucets, that will confuse users even more. It should be fixed for everyone, or, if we can't do that, we should NOT declare this in NEPs.

In this case, I do suggest this standard enforce that the contract emits Mint events logs so that they can be used by indexers (wallet / explorer).

It's already done in https://nomicon.io/Standards/Tokens/FungibleToken/Event

Copy link
Member

Choose a reason for hiding this comment

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

Some tokens won't expose the option to mint new tokens, and some will use a different approach. I'm thinking, for example, about bridged tokens, where you can "mint" new tokens after providing proof. I don't think this NEP is suitable for those use cases. The Mint event (log) needs to be emitted, though.

It should be fixed for everyone

For everyone interested in exposing the minting functionality.

In this regard @robert-zaremba, I suggest expanding the Motivation section with a real use case (maybe the one that motivated you to write this NEP).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, for balance tracking Events should be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The goal is really for composability. For example, in Cheddar we added contract to contract authorization to allow farm for minting.

@mfornet mfornet dismissed their stale review October 19, 2022 11:00

See comment about emitting Mint events.

@ori-near
Copy link
Contributor

@near/wg-contract-standards – We would like to schedule a working group meeting to review this NEP. Before we proceed, we would like to get closer to a consensus on this NEP.

@abacabadabacaba @mfornet Could you please fully read this NEP and comment in the thread if you are leaning with approving or rejecting it? Please make sure to include your rationale and any feedback that you have for the author. Thank you.

@robert-zaremba robert-zaremba requested a review from a team as a code owner October 25, 2022 22:53
Co-authored-by: Marcelo Fornet <mfornet94@gmail.com>
@abacabadabacaba
Copy link
Collaborator

I lean with rejecting this NEP. Most tokens don't just allow someone to mint them, they are minted as part of a more complex transaction, and this API is not suitable for this case. As a result, this API has very limited usability.

@robert-zaremba
Copy link
Contributor Author

OK, then let's close it. I will update the description of this PR with the outcome.

@ori-near ori-near added S-rejected A NEP that was rejected by a working group. S-retracted A NEP that was retracted by the author or had no activity for over two months. and removed S-voting/needs-wg-voting-indication A NEP in the VOTING stage that needs the working group voting indication. S-rejected A NEP that was rejected by a working group. labels Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-NEP A NEAR Enhancement Proposal (NEP). S-retracted A NEP that was retracted by the author or had no activity for over two months. WG-contract-standards Contract Standards Work Group should be accountable
Projects
Status: RETRACTED
Development

Successfully merging this pull request may close these issues.

8 participants