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.10; | |
import 'browser/SafeMath.sol'; | |
contract ERC20 { | |
uint256 public totalSupply; | |
function name() constant returns (string _name); | |
function symbol() constant returns (string _symbol); | |
function decimals() constant returns (uint8 _decimals); | |
function totalSupply() constant returns (uint256 _totalSupply); |
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.10; | |
interface ERC20 { | |
function balanceOf(address who) public view returns (uint256); | |
function transfer(address to, uint256 value) public returns (bool); | |
function allowance(address owner, address spender) public view returns (uint256); | |
function transferFrom(address from, address to, uint256 value) public returns (bool); | |
function approve(address spender, uint256 value) public returns (bool); | |
event Transfer(address indexed from, address indexed to, uint256 value); | |
event Approval(address indexed owner, address indexed spender, uint256 value); |
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.10; | |
library SafeMath { | |
function mul(uint256 a, uint256 b) internal pure returns (uint256) { | |
if (a == 0) { | |
return 0; | |
} | |
uint256 c = a * b; | |
assert(c / a == b); | |
return c; |
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.10; | |
import 'browser/SafeMath.sol'; | |
import 'browser/ERC20.sol'; | |
contract StandardToken is ERC20 { | |
using SafeMath for uint; | |
string internal _name; | |
string internal _symbol; |
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.10; | |
contract ERC223ReceivingContract { | |
function tokenFallback(address _from, uint _value, bytes _data) public; | |
} |
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.10; | |
interface ERC223 { | |
function transfer(address to, uint value, bytes data) public; | |
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data); | |
} |
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.10; | |
import 'gist/ERC223ReceivingContract.sol'; | |
import 'gist/SafeMath.sol'; | |
import 'gist/StandardToken.sol'; | |
import 'gist/Ownable.sol'; | |
contract Crowdsale is Ownable { | |
using SafeMath for uint; | |
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
import Web3 from 'web3' | |
/* | |
* 1. Check for injected web3 (mist/metamask) | |
* 2. If metamask/mist create a new web3 instance and pass on result | |
* 3. Get networkId - Now we can check the user is connected to the right network to use our dApp | |
* 4. Get user account from metamask | |
* 5. Get user balance | |
*/ |
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
import Web3 from 'web3' | |
import {store} from '../store/' | |
let pollWeb3 = function (state) { | |
let web3 = window.web3 | |
web3 = new Web3(web3.currentProvider) | |
setInterval(() => { | |
if (web3 && store.state.web3.web3Instance) { | |
if (web3.eth.coinbase !== store.state.web3.coinbase) { |
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
methods: { | |
clickNumber (event) { | |
console.log(event.target.innerHTML, this.amount) | |
this.winEvent = null | |
this.pending = true | |
this.$store.state.contractInstance().bet(event.target.innerHTML, { | |
gas: 300000, | |
value: this.$store.state.web3.web3Instance().toWei(this.amount, 'ether'), | |
from: this.$store.state.web3.coinbase | |
}, (err, result) => { |
OlderNewer