Questions tagged [receive]

`receive` is a keyword that was introduced in Solidity 0.6.x that is used as a fallback function that is only able to receive ether.

Filter by
Sorted by
Tagged with
0
votes
0answers
32 views

Contract does not have fallback nor receive functions

In what circumstances a test can fail with the error "Contract does not have fallback nor receive functions" ? My contract already contains both a fallback and a receive function: event ...
0
votes
0answers
39 views

receive() keyword

How can I execute methods in receive? receive() external payable{ address _userAddress = msg.sender; uint256 _amount = msg.value; weth.deposit{value: msg.value}(); if(_amount>5){ ...
0
votes
1answer
101 views

Receiving ETH payments

As someone more familiar with bitcoin than ethereum I'd like to ask what would be the best way to accept ETH payments as a merchant? With bitcoin I can do following and my question is if it makes ...
0
votes
1answer
112 views

Receive keyword in solidity

I was making a smart contract in which I wanted to send and receive ether. My code: contract coin_transfer_to { function() public payable { } function get_balance() public returns (uint) ...
1
vote
1answer
278 views

How to trigger receive() fallback function | web3 geth

So Im pretty new to Solidity and I was looking into the receive and fallback functions and came across this very helpful post: What is the receive keyword in solidity? Then I read this: The receive ...
0
votes
1answer
43 views

Contract address payable issue

If i remove payable from: then i get this error with my receive function. Not sure how to fix this. I have an erc20 token contract that has a receive function and this contract inherits from it, that'...
0
votes
0answers
83 views

Failing to send() 1 wei from one contract to another

The following code is supposed to send 1 wei from the current contract to a newly created contract. The recipient contract gets created successfully and the sending contract has a positive balance, ...
0
votes
1answer
137 views

Transfer money between contracts

I'm quite new at smart contracts/Solidity, which I'm learning for a postgraduate course. In one of the assignments, we have to implement a little competitive game (something like the game of Seven ...
13
votes
1answer
9k views

What is the receive keyword in solidity?

Solidity has a receive keyword. What is it and how do I use it?