This file contains hidden or 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.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; |
This file contains hidden or 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
//Extracting ECDSA variables | |
var r = sign.substr(0, 66); | |
var s = '0x' + sign.substr(66, 64); | |
var v = '0x' + sign.substr(130,2); |
This file contains hidden or 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
// 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) |
This file contains hidden or 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
// 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) |
This file contains hidden or 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.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; |
This file contains hidden or 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'); | |
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); |
NewerOlder