iotex-core
iotex-core copied to clipboard
Call fallback function in transfer actions
https://github.com/iotexproject/iotex-core/blob/7c758ab75007a17606563303816229b3d252778f/action/protocol/account/transfer.go#L73
What would you like to be added: Enable transfer to a smart contract and trigger fallback function if any
Why is this needed: Be compatible with more dapps
I think that transfer to contract has already been supported by execution. please refer to the commit, https://github.com/iotexproject/pebble-contracts/commit/122498880907af062b7652ed8801b4f00315227d
My testing example
pragma solidity 0.7.3;
contract Receiver {
event Received(address, uint);
uint256 cnt = 0;
function getcount() public view returns (uint256) {
return cnt;
}
receive() external payable {
cnt += 1;
emit Received(msg.sender, msg.value);
}
}
Verified that every transfer of IOTX to this contract increases count by 1, indicating it works.
Pending on #1600