Skip to content

Instantly share code, notes, and snippets.

@DoguD
Created September 19, 2023 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DoguD/5e952aad6d316a3f681ab7fe31ccfc6d to your computer and use it in GitHub Desktop.
Save DoguD/5e952aad6d316a3f681ab7fe31ccfc6d to your computer and use it in GitHub Desktop.
function buy(uint256 tokenId) payable {
require(msg.value >= price, "Payment not enough");
address _currentOwner = ownerOf(tokenId);
_transfer(_currentOwner, msg.sender, tokenId);
bool sent = _currentOwner.send(msg.value);
require(sent, "Failed to send Ether");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment