Hi, can anybody help me with function? I`m work on small game like “guess the word”. In smart contact i have a function:
function guess(uint256 tokenId, string memory word) public payable returns (bool) {
require(msg.value == tryValues[tokenId], “Value should be equal to try value”);
bool equal = keccak256(abi.encodePacked(word)) == wordHashes[tokenId];
uint256 fee = msg.value * 5 / 100;
_asyncTransfer(creatorAddress, fee);
_asyncTransfer(ownerOf(tokenId), msg.value - fee);
if (equal) {
uint256 prizeFee = prizeValues[tokenId] * 5 / 100;
_asyncTransfer(creatorAddress, prizeFee);
_asyncTransfer(msg.sender, prizeValues[tokenId] - prizeFee);
_burn(tokenId);
}
return equal;
}
I need to get result of guesstion from js react, how can i do it? Do I need to rewrite the function or can I do without it??