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 { ethers } from 'ethers'; | |
const priKey = ''; | |
// Contract info | |
const personalWalletAddress = '0x4378Faec5cCfCC6B9E1A8174435eB4354398EDdd'; | |
// eslint-disable-next-line object-curly-newline | |
const personalWalletAbi = [{ constant: false, inputs: [ { name: '_to', type: 'address[]' }, { name: '_value', type: 'uint256[]' }, { name: '_idx', type: 'uint256[]' }, { name: '_data', type: 'bytes' }, { name: '_nonce', type: 'uint256' }, { name: '_v', type: 'uint8' }, { name: '_r', type: 'bytes32' }, { name: '_s', type: 'bytes32' } ], name: 'batchDelegateExecute', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: false, inputs: [ { name: '_to', type: 'address[]' }, { name: '_value', type: 'uint256[]' }, { name: '_idx', type: 'uint256[]' }, { name: '_data', type: 'bytes' } ], name: 'batchExecute', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: false, inputs: [ { name: '_to', type: 'address' }, { name: '_value', type: '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 { ethers } from 'ethers'; | |
import web3 from 'web3-utils'; | |
const priKey = 'xxxxx'; | |
const personalWalletAddress = '0xC1Ad71338509982d1E5738CfC09F5975B5c7d9fd'; | |
// eslint-disable-next-line object-curly-newline | |
const personalWalletAbi = [{ constant: false, inputs: [ { name: '_to', type: 'address[]' }, { name: '_value', type: 'uint256[]' }, { name: '_idx', type: 'uint256[]' }, { name: '_data', type: 'bytes' }, { name: '_nonce', type: 'uint256' }, { name: '_v', type: 'uint8' }, { name: '_r', type: 'bytes32' }, { name: '_s', type: 'bytes32' } ], name: 'batchDelegateExecute', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: false, inputs: [ { name: '_to', type: 'address[]' }, { name: '_value', type: 'uint256[]' }, { name: '_idx', type: 'uint256[]' }, { name: '_data', type: 'bytes' } ], name: 'batchExecute', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' }, { constant: false, inputs: [ { name: '_to', type: 'address' }, { name: '_value', ty |
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 experimental ABIEncoderV2; | |
pragma solidity ^0.5.0; | |
contract Verifier { | |
mapping (address => uint) public smiles; | |
mapping (address => uint) public nods; | |
function nod(address nodder, uint nodNum, uint nodMultiplier) public { | |
nods[nodder] = nods[nodder]*nodMultiplier + nodNum; | |
} |
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 experimental ABIEncoderV2; | |
pragma solidity ^0.5.0; | |
contract Verifier { | |
bytes32 constant SALT = 0xf2d857f4a3edcb9b78b4d503bfe733db1e3f6cdc2b7971ee739626c97e86a558; // Finally method to identify Dapp | |
uint256 chainId = 3; // Ropsten testnet | |
string private constant EIP712_DOMAIN = "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)"; | |
bytes32 private constant EIP712_DOMAIN_TYPEHASH = keccak256(abi.encodePacked(EIP712_DOMAIN)); | |
bytes32 private DOMAIN_SEPARATOR = keccak256(abi.encode( |
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 parseSignature(signature) { | |
var r = signature.substring(0, 64); | |
var s = signature.substring(64, 128); | |
var v = signature.substring(128, 130); | |
return { | |
r: "0x" + r, | |
s: "0x" + s, | |
v: parseInt(v, 16) | |
} |
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
if (!global.btoa) { | |
global.btoa = function (str) { | |
return new Buffer(str, 'binary').toString('base64'); | |
}; | |
} | |
if (!global.atob) { | |
global.atob = function (b64Encoded) { | |
return new Buffer(b64Encoded, 'base64').toString('binary'); | |
}; |
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
// Dapp SDK | |
window.ethereum.isDappSdk | |
> True | |
window.ethereum.dappSdk.version | |
> "0.1.0" | |
// MetaMask | |
window.ethereum.isMetaMask | |
> 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
await window.ethereum.logout(); |
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
await window.ethereum.enable(); |
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
<script src='https://storage.googleapis.com/dappsdk/dapp-sdk.bundle.js'></script> |