+
Skip to content

Implement receive function to handle received ETH in Ethlance.sol #443

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
13 changes: 9 additions & 4 deletions contracts/Ethlance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -409,17 +409,22 @@ contract Ethlance is IERC721Receiver, IERC1155Receiver, DSAuth {
return bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"));
}


/**
* @dev This function is called automatically when this contract receives ETH
* It calls {_createJob} where:
* - passed `_offerer` is `msg.sender`
* - passed `_offeredValues` are constructed from `msg.value`
* - rest of arguments is obtained by decoding `msg.data`
* TODO: Needs implementation
*/
receive(
) external payable {
receive() external payable {
EthlanceStructs.TokenValue[] memory offeredValues = new EthlanceStructs.TokenValue[](1);
offeredValues[0] = EthlanceStructs.TokenValue({
token: address(0),
value: msg.value
});

bytes memory data = msg.data;
_createJobWithPassedData(data);
}

function supportsInterface(bytes4 interfaceId) external override pure returns (bool) {
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载