Skip to content

[DOCS] Merge payable FAQ item #5796

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

Merged
merged 1 commit into from
Jan 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/contracts/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ functions match the given function identifier (or if no data was supplied at
all).

Furthermore, this function is executed whenever the contract receives plain
Ether (without data). Additionally, in order to receive Ether, the fallback function
Ether (without data). To receive Ether and add it to the total balance of the contract, the fallback function
must be marked ``payable``. If no such function exists, the contract cannot receive
Ether through regular transactions.
Ether through regular transactions and throws an exception.

In the worst case, the fallback function can only rely on 2300 gas being
available (for example when `send` or `transfer` is used), leaving little
Expand Down
7 changes: 0 additions & 7 deletions docs/frequently-asked-questions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ Yes, you can use ``abi.encodePacked``::
}
}

What happens if you send ether along with a function call to a contract?
========================================================================

It gets added to the total balance of the contract, just like when you send ether when creating a contract.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd add this to https://solidity.readthedocs.io/en/v0.5.2/structure-of-a-contract.html#functions. Or is this explained somewhere else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel like it's mentioned enough in docs/contracts/functions.rst (See the commits), but let me know what you think. When that's done I'll rebase @ekpyron

Copy link
Member

@axic axic Jan 18, 2019

Choose a reason for hiding this comment

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

This is the current functions sections:

Function Calls can happen internally or externally and have different levels of visibility towards other contracts. Functions accept parameters and return variables to pass parameters and values between them.

I'd say it would be reasonable to include something along the lines "Functions can also have special attributes (modifiers?), like payable [link here]"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@axic In the section below this paragraph is a section about function modifiers. Thing is, in your suggestion you mention linking to a list of function modifiers, and I agree, there isn't really a list (in one place) of what's available. So I think creating one is a good idea, but perhaps out of scope of this PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ChrisChinchilla That sounds like a good idea. Let's create an issue for that and merge this one :)

You can only send ether along to a function that has the ``payable`` modifier,
otherwise an exception is thrown.

******************
Advanced Questions
******************
Expand Down