Skip to content

Instantly share code, notes, and snippets.

Philippe Castonguay PhABC

View GitHub Profile
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 DonationControlledAccessWeb3.js
// Addresses
var contractAddress = "0xContractAddress";
var userAddress = "0xUserAddress";
// 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 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;
@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);
You can’t perform that action at this time.