Created
September 19, 2023 12:22
-
-
Save DoguD/5e952aad6d316a3f681ab7fe31ccfc6d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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