This file contains 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
pragma solidity ^0.4.8; | |
contract Bet { | |
//jedi bet status | |
uint constant STATUS_WIN = 1; | |
uint constant STATUS_LOSE = 2; | |
uint constant STATUS_TIE = 3; | |
uint constant STATUS_PENDING = 4; | |
//game status |
This file contains 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
var Bet = artifacts.require("./contracts/Bet"); | |
const betAmountInEth = 0.25; | |
const wrongBetAmountInEth = 0.15; | |
const agreedUponBetAmount = web3.toWei(betAmountInEth, "ether"); | |
const wrongBetAmount = web3.toWei(wrongBetAmountInEth, "ether"); | |
contract("Bet", function(accounts) { | |
const betOriginator = accounts[0]; | |
const betTaker = accounts[1]; |
This file contains 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
... | |
class App extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
bet: {}, | |
web3: null, | |
}; |
This file contains 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
... | |
constructor(props) { | |
super(props); | |
this.state = this.generateStateFromProps(props); | |
} | |
componentWillReceiveProps(newProps) { | |
if (newProps.bet !== this.props.bet) { | |
this.setState(this.generateStateFromProps(newProps)); |
This file contains 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 payout() public payable { | |
checkPermissions(msg.sender); | |
if (game.originator.status == STATUS_TIE && game.taker.status == STATUS_TIE) { | |
game.originator.addr.transfer(game.betAmount); | |
game.taker.addr.transfer(game.betAmount); | |
} else { | |
if (game.originator.status == STATUS_WINNER) { |
This file contains 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
# Unity Cheatsheet | |
These are some helpful commands for navigating a scene in unity | |
- Hold right-click + WASD to fly around scene | |
- With a prefab and your mouse in the Scene view, Press F to focus on it | |
then use the scroll wheel to zoom in and out and hold the scroll wheel to pan | |
- Hold alt+left-click to rotate around the focal point or hold alt+right-click to zoom in and out | |
- If anything goes wrong, press Ctrl/Cmd+Z to Undo until it’s fixed | |
- ctrl-p enter/exit play mode | |
- qwerty keys select the move/rotate/etc tools |