Skip to content

Instantly share code, notes, and snippets.

@nathan-websculpt
nathan-websculpt / rpsv1.sol
Created September 27, 2021 20:11
Very basic representation of Rock, Paper, Scissors logic on Solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.3/contracts/security/ReentrancyGuard.sol";
//for testing/learning purposes only -- not production code
contract rpsv1 is ReentrancyGuard{
mapping (address => uint) public playerBalances;
event Received(address, uint);
@nathan-websculpt
nathan-websculpt / RPSv2.sol
Last active October 20, 2021 12:07
Two Player Rock, Paper, Scissors in Solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "../node_modules/@OpenZeppelin/contracts/utils/math/SafeMath.sol";
import "../node_modules/@OpenZeppelin/contracts/security/ReentrancyGuard.sol";
//for use in this blog post: https://medium.com/@websculpt/rock-paper-scissors-in-solidity-part-3-commit-reveal-4d56a84cbe97
contract RPSv2 is ReentrancyGuard {
using SafeMath for uint;