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

Non payable message in Ask! ? #249

Open
shunsukew opened this issue Feb 6, 2023 · 3 comments
Open

Non payable message in Ask! ? #249

shunsukew opened this issue Feb 6, 2023 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@shunsukew
Copy link
Contributor

In Ask! message is payable even if there's no modifiers.
For example,

@message({ mutates: true })
  flip(): void {
    this.data.flag = !this.data.flag;
    let event = new FlipEvent(this.data.flag);
    // @ts-ignore
    env().emitEvent(event);
  }

This will generate metadata.json payable true, and it is actually payable.

"messages": [
        {
          "mutates": true,
          "payable": true,
          "args": [],
          "docs": [],
          "label": "flip",
          "selector": "0x633aa551"
        }
]

Is there a way to specify message to be non-payable?

@shunsukew shunsukew changed the title Non payable function in Ask! ? Non payable message in Ask! ? Feb 6, 2023
@yjhmelody
Copy link
Contributor

yjhmelody commented Feb 6, 2023

Some things need to be considered first when support non-payable.

The logic of checking non-payable need to make sure Balance type first in decorator.
So we need to make sure the abstract level of Balance type.

BTW, the ability of payable is super class of non-payble in actually.

@shunsukew
Copy link
Contributor Author

shunsukew commented Feb 6, 2023

I see,
I raised the PR #250, but there were some considerations and this line is intentional to
stop users from using payable: false?

@shunsukew
Copy link
Contributor Author

I missed TODO comment in the source code for some reason, I recognize it intentional and non-payable hasn't not supported yet.

@yjhmelody yjhmelody added enhancement New feature or request good first issue Good for newcomers labels Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants