Skip to content

Instantly share code, notes, and snippets.

@blutarche
Last active July 6, 2022 00:24
Show Gist options
  • Save blutarche/47b9794b9fb6d4902cbf32167fa09acf to your computer and use it in GitHub Desktop.
Save blutarche/47b9794b9fb6d4902cbf32167fa09acf to your computer and use it in GitHub Desktop.
contract LoveLetter {
...
function send(address to, string memory message)
external
payable
returns (uint256 id)
{
id = totalLetters;
senders[id] = msg.sender;
receivers[id] = to;
letters[id] = Letter({
message: message,
etherAmount: msg.value,
opened: false
});
console.log("[send]", id, msg.value);
totalLetters++;
emit Sent(msg.sender, to, id, msg.value);
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment