Skip to content

syntax: Does anyone know how to send a payable function with a fixed amount? #420

Answered by PatrickAlphaC
mattjaf asked this question in Q&A
Discussion options

You must be logged in to vote

Something like this would require 1 ETH

   function donate() public payable {
        require(msg.value == 1 ether, 'Amount must be equal to 1 ether');
            //remaining logic
    }

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@mattjaf
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@mattjaf
Comment options

@PatrickAlphaC
Comment options

Answer selected by PatrickAlphaC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants