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"; | |
const web3 = new Web3(Web3.givenProvider); | |
const web3Events = new Web3(new Web3.providers.WebsocketProvider("wss://mainnet.infura.io/ws")); | |
const Contract = new web3.eth.Contract(ABI, ADDRESS); | |
const ContractEvents = new web3Events.eth.Contract(ABI, ADDRESS); |
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.24; | |
import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol"; | |
/// @title Scalable Reward Distribution | |
/// @dev ref. http://batog.info/papers/scalable-reward-distribution.pdf | |
contract ScalableRewardDistribution { | |
using SafeMath for uint256; |
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 { performance } from "perf_hooks"; | |
import { SHA256 as sha256 } from "crypto-js"; | |
function calculateTarget(difficulty: number): number { | |
return Math.ceil(2 ** 256 / difficulty); | |
} | |
function padLeft(str: string, to: number, chr: string): string { | |
return str.length < to ? padLeft(chr + str, to, chr) : str; | |
} |
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 SimpleToken = artifacts.require("./SimpleToken.sol"); | |
const PresaleCrowdsale = artifacts.require("./02-presale-multiple-rounds/PresaleCrowdsale.sol"); | |
module.exports = (deployer, network, [owner]) => { | |
return deployer | |
.then(() => deployer.deploy(SimpleToken, "Tooploox", "TPX", 18, 21000000)) | |
.then(() => deployer.deploy(PresaleCrowdsale, 10000, owner, SimpleToken.address, owner)) | |
.then(() => SimpleToken.deployed()) | |
.then(token => token.increaseApproval(PresaleCrowdsale.address, 1000000 * (10 ** 18))); | |
}; |
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 toPairs(obj) { | |
return Object.entries(obj); // ES2017 | |
} | |
describe("toPairs", () => { | |
it("transforms object to key-value pairs", () => { | |
expect(toPairs({ foo: "bar", foz: "baz" })).toEqual([ | |
["foo", "bar"], | |
["foz", "baz"] | |
]); |
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
export default function validateType(accepts) { | |
const typeExps = accepts.split(/ *, */).map(type => new RegExp(type)); | |
return file => Boolean(typeExps.find(exp => exp.test(file.type))); | |
} | |
// function onChange({ target }) { | |
// const acceptedFiles = target.files.filter(validateType("images/*, application/pdf")); | |
// } |
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 React, { PropTypes, Component } from "react"; | |
import ReactDOM from "react-dom"; | |
import { makeDOMDriver } from "@cycle/dom"; | |
import { run } from "@cycle/xstream-run"; | |
class CycleRun extends Component { | |
static propTypes = { | |
main: PropTypes.func.isRequired, | |
drivers: PropTypes.object, | |
}; |
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
root=true | |
[*] | |
indent_style = space | |
indent_size = 2 | |
end_of_line = lf | |
trim_trailing_whitespace = true | |
insert_final_newline = true |
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 hi() { | |
console.log(`Hi ${this.name}!`); | |
} | |
function by() { | |
console.log(`By ${this.name}!`); | |
} | |
function mixin(fn, name = fn.name) { | |
return target => { |
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
Show hidden characters
{ | |
"extends": "airbnb", | |
"parser": "babel-eslint", | |
"settings": { | |
"import/resolver": { | |
"webpack": { "config": "./webpack/webpack.prod.config.js" } | |
} | |
}, | |
"rules": { | |
"quotes": ["error", "double"], |