Skip to content

Instantly share code, notes, and snippets.

Philippe Castonguay PhABC

View GitHub Profile
@PhABC
PhABC / 0x_Tutorial_1.js
Last active Oct 26, 2017
0x.js Tutorial on how to create, validate and fill an order
View 0x_Tutorial_1.js
const Web3 = require('web3');
const ZeroEx = require('0x.js').ZeroEx;
const BigNumber = require('bignumber.js');
// Default provider for TestRPC
const provider = new Web3.providers.HttpProvider('http://localhost:8545')
// Instantiate 0x.js instance
const zeroEx = new ZeroEx(provider);
View accessMessageHash.js
// Message to sign : contract address + address to give access
var message = web3.sha3(contractAddress.substr(2) + userAddress.substr(2), {encoding: 'hex'})
// Signing message (with "\x19Ethereum Signed Message:\n32" as prefix by default)
web3.personal.sign(message, web3.eth.defaultAccount, (err, res) => sign = res)
View ECDSAparameters.js
//Extracting ECDSA variables
var r = sign.substr(0, 66);
var s = '0x' + sign.substr(66, 64);
var v = '0x' + sign.substr(130,2);
View ControlledAccess.sol
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
View ControlledAccessDonation.sol
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
View OZWhitelist.sol
pragma solidity ^ 0.4.18;
import "../../ownership/Ownable.sol";
/**
* @title WhitelistedCrowdsale
* @dev Crowdsale in which only whitelisted users can contribute.
*/
contract Whitelisted is Ownable {
View DelayedDestructible.sol
pragma solidity ^ 0.4.18;
import "../ownership/Ownable.sol";
/**
* @title DelayedDestructible
* @dev Contract that can be selfdestructed after a delay period.
*/
contract DelayedDestructible is Ownable {
View contractStorageSize.js
//Imports
var Trie = require('merkle-patricia-tree');
var rlp = require('rlp');
var levelup = require('levelup');
var leveldown = require('leveldown');
var keccak256 = require('js-sha3').keccak256;
// Chains' path
var dbPathRinkeby = '/home/user/.ethereum/rinkeby/geth/chaindata';
var dbPathMainnet = '/home/user/.ethereum/geth/chaindata';
View Transcripts.sol
pragma solidity ^0.4.21;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
View TokenSale_GasTokenFactory.sol
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale,
* allowing investors to purchase tokens with ether. This contract implements
You can’t perform that action at this time.