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
const Web3 = require('web3'); | |
/* | |
* connect to ethereum node | |
*/ | |
const ethereumUri = 'http://localhost:8540'; | |
let web3 = new Web3(); | |
web3.setProvider(new web3.providers.HttpProvider(ethereumUri)); |
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
/* | |
* connect to ethereum node | |
*/ | |
const ethereumUri = 'http://localhost:8540'; | |
const address = '0x004ec07d2329997267Ec62b4166639513386F32E'; // user | |
let web3 = new Web3(); | |
web3.setProvider(new web3.providers.HttpProvider(ethereumUri)); | |
if(!web3.isConnected()){ |
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.13; | |
contract TLV { | |
function transfer(address to, uint value) returns (bool ok); | |
} | |
contract Faucet { | |
function getToken(); | |
} |
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 PushButton from '../build/contracts/PushButton.json' | |
import getWeb3 from './utils/getWeb3' | |
//其餘省略 | |
componentWillMount() { | |
getWeb3.then(results => { | |
this.setState({ | |
web3: results.web3 | |
}) |
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.22 <0.6.0; | |
// THIS CONTRACT CONTAINS A BUG - DO NOT USE | |
contract EtherDice { | |
event LOG_RESULT(uint _number, uint _dice, address _winner); | |
constructor() public payable { | |
require(msg.value > 0.1 ether); |
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.22 <0.6.0; | |
interface etherDice { | |
function bet(uint _number) external payable returns(bool); | |
} | |
contract diceHack { | |
etherDice dice; | |
constructor (address _etherDice) 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.22 <0.6.0; | |
// THIS CONTRACT CONTAINS A BUG - DO NOT USE | |
contract EtherDice { | |
event LOG_RESULT(uint _number, uint _dice, address _winner); | |
constructor() public payable { | |
require(msg.value > 0.1 ether); |
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.22 <0.6.0; | |
interface etherDice { | |
function bet(uint _number) external payable returns(bool); | |
} | |
contract diceHack2 { | |
constructor (address _etherDice) public payable { | |
etherDice dice = etherDice(_etherDice); | |
uint number = block.timestamp % 6; |