Skip to content

Instantly share code, notes, and snippets.

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;
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);
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 {
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);
@iisaint
iisaint / App.js
Last active August 7, 2017 14:40
import PushButton from '../build/contracts/PushButton.json'
import getWeb3 from './utils/getWeb3'
//其餘省略
componentWillMount() {
getWeb3.then(results => {
this.setState({
web3: results.web3
})
pragma solidity ^0.4.13;
import '../../contracts/PushButton.sol';
// @dev PushButtonMock mocks current block number
contract PushButtonMock is PushButton {
uint mock_blockNumber = 1;
pragma solidity ^0.4.13;
contract PushButton {
uint public startBlock;
uint public interval = 108 * 60 / 4; // 108 minutes in Kovan testnet
uint public nextTimeoutBlock;
uint public totalPush;
string public title;
@iisaint
iisaint / FloodTLV.sol
Last active July 17, 2017 23:04
A smart contract for flooding Taipei Ethereum LogoVote
pragma solidity ^0.4.13;
contract TLV {
function transfer(address to, uint value) returns (bool ok);
}
contract Faucet {
function getToken();
}
@iisaint
iisaint / index.js
Last active April 13, 2017 07:57
myOracle service
const fs = require('fs');
const Web3 = require('web3');
const solc = require('solc');
const _ = require('lodash');
// config
const ethereumUri = 'http://localhost:8545';
const callbackAddr = '0x00A79a80Fb0ff9216AAC81AD416D8f8AA2a6dDB9';//替換成剛剛設定的cbAddress
const password = 'password'; //替換成可以unlock callbackAddr的密碼
const oracleAddr = '0xC4Eb879Cd65C4A2F4B4Afc50a657fF6Aee77Ba31';
@iisaint
iisaint / Dice.sol
Last active April 13, 2017 06:07
Dice.sol for My Oracle
pragma solidity ^0.4.10;
// Oracle interface
contract Oracle {
address public cbAddress;
function query(string _query) returns (bytes32 id);
}
// OracleResolver interface
contract OracleResolver {