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

New standard: Coin Receiver #106

Open
damip opened this issue Jul 24, 2023 · 0 comments
Open

New standard: Coin Receiver #106

damip opened this issue Jul 24, 2023 · 0 comments

Comments

@damip
Copy link
Member

damip commented Jul 24, 2023

Context

In Massa we allow native coin transfers (transfer_coins):

  • from:
    • any User account on which the current context has write access
    • any Smart Contract account on which the current context has write access
  • towards:
    • any User account
    • any Smart Contract account on which the current context has write access

Not allowing foreign Smart Contract accounts to receive native tokens without going through the coins parameter of call is deliberate: it allows Smart Contracts to filter and refuse incoming coin transfers.

This document defines an interface that is exposed by all Smart Contract accounts that need to receive native coins.

User flow

To transfer native coins towards a foreign Smart Contract account, one can call the coin reception function that account exposes if it implements this proposal. If the Smart Contract does not implement this proposal, it means that it is not meant to receive native coins directly.

Technical details

Prefix to all exposed methods: cr1 ("Coin Receiver V1")

Expose a single, parameter-less function named cr1_receive_coins that does not return anything.

QA testing

Try sending coins to a Smart Contract implementing this.

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

No branches or pull requests

1 participant