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
receivemethod is used as a fallback function in a contract and is called when ether is sent to a contract with no calldata.
So how does one call a function of a contract with no calldata (but with some value) such that the receive function is triggered in web3 and geth?
I know how to call functions like so:
await contract.methods.methodAB().call();
await contract.methods.methodXY(ARGUMENTS).send({from: MY_ADDRESS, value: 'SOME_VALUE_IN_GWEI'});
But how do I call a contract without calldata, or is it just as simple as doing
eth.sendTransaction({
from: MY_ADDRESS,
to: TARGET_ADDRESS,
value: 'SOME_VALUE_IN_GWEI'
}, function(err, value){
console.log(err ? err : 'Transaction was sent! txhash: '+ value);
}
);
Can anybody specify what is meant with calldata? Thanks in advance