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

Explain that contracts return excessive funds upon deployment with Deployable trait #889

Open
novusnota opened this issue Jun 2, 2024 · 1 comment
Assignees
Labels
docs: Book /book section of the docs: Guides, Cheatsheets, and a streamlined sequence of educational materials feature: receivers Process internal, external, bounced incoming messages kind: docs Documentation for docs.tact-lang.org kept in docs folder
Milestone

Comments

@novusnota
Copy link
Member

novusnota commented Jun 2, 2024

And that it's done automatically when the contract uses the Deployable trait.

Also, mention that receivers don't do that by default — in order to do refunds in receivers one has to use, say, self.notify("Cashback".asComment()); or alike by the end of their body.

P.S.: Without inheriting the Deployable trait, the contract can still handle the Deploy message like so:

import "@stdlib/deploy"; // to populate ctx and have Deploy msg in sight

contract Example {
    receive(msg: Deploy) {} // no-op, won't return the funds now
}
@novusnota novusnota added the docs: Book /book section of the docs: Guides, Cheatsheets, and a streamlined sequence of educational materials label Jun 2, 2024
@novusnota novusnota self-assigned this Jun 2, 2024
@anton-trunov
Copy link
Member

Actually, refunding on deployment should not be done, this is a bug and should be fixed. The contract should manage its gas so that it has enough funds to pay for storage at all times. And a good practice is to introduce a "topup" receiver that can be used to top up the contract's balance in case there is still not enough gas to pay for storage.

@novusnota novusnota transferred this issue from tact-lang/tact-docs Oct 1, 2024
@novusnota novusnota added this to the v1.6.0 milestone Oct 1, 2024
@novusnota novusnota added the kind: docs Documentation for docs.tact-lang.org kept in docs folder label Oct 3, 2024
@anton-trunov anton-trunov modified the milestones: v1.6.0, Doc: 2024-12 Nov 28, 2024
@novusnota novusnota modified the milestones: Doc: 2024-12, Doc: 2025-01 Jan 2, 2025
@anton-trunov anton-trunov changed the title Explain that contracts return excessive funds upon deployment Explain that contracts return excessive funds upon deployment with Deployable trait Feb 1, 2025
@anton-trunov anton-trunov added the feature: receivers Process internal, external, bounced incoming messages label Feb 25, 2025
@novusnota novusnota modified the milestones: Doc: 2025-02, Doc: 2025-03 Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs: Book /book section of the docs: Guides, Cheatsheets, and a streamlined sequence of educational materials feature: receivers Process internal, external, bounced incoming messages kind: docs Documentation for docs.tact-lang.org kept in docs folder
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants