Skip to content

Commit

Permalink
Add event hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
MrLuit committed Jan 2, 2019
1 parent 150cbc5 commit 8ddd29f
Show file tree
Hide file tree
Showing 12 changed files with 299 additions and 60 deletions.
41 changes: 41 additions & 0 deletions data/eventHashes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"aa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe3": "ABIChanged(bytes32,uint256)",
"52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2": "AddrChanged(bytes32,address)",
"8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": "Approval(address,address,uint256)",
"2809c7e17bf978fbc7194c0a694b638c4215e9140cacc6c38ca36010b45697df": "AuctionCancelled(uint256)",
"a9c8dfcda5664a5a124c713e386da27de87432d5b668e79458501eb296389ba7": "AuctionCreated(uint256,uint256,uint256,uint256)",
"b3206507ac590902082eecf5f32a17f00f2e6cbaa5edce5b71710ae47ce8201e": "AuctionStarted(bytes32,uint)",
"4fcc30d90a842164dd58501ab874a101a3749c3d4747139cefe7c876f4ccebd2": "AuctionSuccessful(uint256,uint256,address)",
"e6ec0d657ac170810910d3664715f387488d3f550204bb29ee14de6b6c2a6d8f": "BidRevealed(bytes32,address,uint,uint8)",
"0a5311bd2a6608f08a180df2ee7c5946819a649b204b554bb8e39825b2c50ad5": "Birth(address,uint256,uint256,uint256,uint256)",
"4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef": "Confirmation(address,uint256)",
"0424b6fe0d9c3bdbece0e7879dc241bb0c22e900be8b6c168b4ee08bd9bf83bc": "ContentChanged(bytes32,bytes32)",
"450db8da6efbe9c22f2347f7c2021231df1fc58d3ae9a2fa75d39fa446199305": "ContractUpgrade(address)",
"bb2ce2f51803bba16bc85282b47deeea9a5c6223eabea1077be696b3f265cf13": "DeedClosed()",
"e1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c": "Deposit(address,uint256)",
"33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed75": "Execution(uint256)",
"315c76cede76876c882277f551c0fa4f5c22f7b9926741f3d15ebc7ab8d47368": "HashInvalidated(bytes32,string,uint,uint)",
"003d271a6fc03c34b26140ca9135e6c1adafdd1dc6e9abdda3039561a80215e0": "HashRegistered(bytes32,address,uint,uint)",
"fa2ff02c2b770f52a17a0a7e0aab10b0f9056f5773641d3b7c7bcaec4dd79cea": "HashReleased(bytes32,uint)",
"0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885": "Mint(address,uint256)",
"9fe3b115926e3bb197b8ced407894c848a87d0ceda9bc8effb5c69dacc291deb": "Move(address,address)",
"c0b0fc07269fc2749adada3221c095a1d2187b2d075b51c915857b520f3a5021": "MultihashChanged(bytes32,bytes)",
"b7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f7": "NameChanged(bytes32,string)",
"7306ee10e48edb532f758294e8dc1a3e2ae65e0d7b8f0abea150704533fc166f": "NewBid(bytes32,address,uint)",
"0e04c8e83a5595ba6381972e5e9fe2926bb0a7439dace880c83ccc34b99c5477": "NewDonation(address,uint256)",
"ce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82": "NewOwner(bytes32,bytes32,address)",
"335721b01866dc23fbee8b6b2c7b1e14d6f05c28cd35a2c934239f94095602a0": "NewResolver(bytes32,address)",
"1d4f9bbfc9cab89d66e1a1562f2233ccbf1308cb4f63de2ead5787adddb8fa68": "NewTTL(bytes32,uint64)",
"a2ea9883a321a3e97b8266c2b078bfeec6d50c711ed71f874a90d500ae2eaf36": "OwnerChanged(address)",
"6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff625": "Pause()",
"241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80": "Pregnant(address,uint256,uint256,uint256)",
"1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e46": "PubkeyChanged(bytes32,bytes32,bytes32)",
"f6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9": "Revocation(address,uint256)",
"92ca3a80853e6663fa31fa10b99225f18d4902939b4c53a9caae9043f6efd004": "SingleTransact(address,uint256,address,bytes)",
"c0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e51": "Submission(uint256)",
"d8c9334b1a9c2f9da342a0a2b32629c1a229b6445dad78947f674b44444a7550": "TextChanged(bytes32,string,string)",
"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": "Transfer(address,address,uint256)",
"d4735d920b0f87494915f556dd9b54c8f309026070caea5c737245152564d266": "Transfer(bytes32,address)",
"7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b33": "Unpause()",
"7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65": "Withdrawal(address,uint256)"
}
41 changes: 41 additions & 0 deletions data/events.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[
"ABIChanged(bytes32,uint256)",
"AddrChanged(bytes32,address)",
"Approval(address,address,uint256)",
"AuctionCancelled(uint256)",
"AuctionCreated(uint256,uint256,uint256,uint256)",
"AuctionStarted(bytes32,uint)",
"AuctionSuccessful(uint256,uint256,address)",
"BidRevealed(bytes32,address,uint,uint8)",
"Birth(address,uint256,uint256,uint256,uint256)",
"Confirmation(address,uint256)",
"ContentChanged(bytes32,bytes32)",
"ContractUpgrade(address)",
"DeedClosed()",
"Deposit(address,uint256)",
"Execution(uint256)",
"HashInvalidated(bytes32,string,uint,uint)",
"HashRegistered(bytes32,address,uint,uint)",
"HashReleased(bytes32,uint)",
"Mint(address,uint256)",
"Move(address,address)",
"MultihashChanged(bytes32,bytes)",
"NameChanged(bytes32,string)",
"NewBid(bytes32,address,uint)",
"NewDonation(address,uint256)",
"NewOwner(bytes32,bytes32,address)",
"NewResolver(bytes32,address)",
"NewTTL(bytes32,uint64)",
"OwnerChanged(address)",
"Pause()",
"Pregnant(address,uint256,uint256,uint256)",
"PubkeyChanged(bytes32,bytes32,bytes32)",
"Revocation(address,uint256)",
"SingleTransact(address,uint256,address,bytes)",
"Submission(uint256)",
"TextChanged(bytes32,string,string)",
"Transfer(address,address,uint256)",
"Transfer(bytes32,address)",
"Unpause()",
"Withdrawal(address,uint256)"
]
58 changes: 58 additions & 0 deletions data/functionHashes.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"23628464": "setBalance(uint,bool)",
"29710388": "isProxy(address)",
"77372213": "setName(bytes32,string)",
"2203ab56": "ABI(bytes32,uint256)",
"b2f625f3": "acceptRegistrarTransfer(bytes32,Deed,uint)",
"3b3b57de": "addr(bytes32)",
"dd62ed3e": "allowance(address,address)",
"095ea7b3": "approve(address,uint256)",
"daea85c5": "approve(address)",
Expand All @@ -14,57 +19,110 @@
"b7009613": "canCall(address,address,bytes4)",
"96b5a755": "cancelAuction(uint256)",
"878eb368": "cancelAuctionWhenPaused(uint256)",
"2525f5c1": "cancelBid(address,bytes32)",
"0a0f8168": "ceoAddress()",
"0519ce79": "cfoAddress()",
"1e83409a": "claim(address)",
"0f5a5466": "claimWithResolver(address,address)",
"2e2311df": "closeDeed(uint)",
"2dff6941": "content(bytes32)",
"b047fb50": "cooAddress()",
"27ebe40a": "createAuction(uint256,uint256,uint256,uint256,address)",
"05b34410": "creationDate()",
"02d05d3f": "creator()",
"313ce567": "decimals()",
"0b5ab3d5": "destroyDeed()",
"666b7d32": "disableICO()",
"126a710e": "dnsrr(bytes32)",
"ed88c68e": "donate()",
"440f19ba": "draw(bytes32,uint256)",
"cee401ef": "enableICO()",
"267b6922": "entries(bytes32)",
"de10f04b": "eraseNode(bytes32[])",
"7f8661a1": "exit(uint256)",
"983b94fb": "finalizeAuction(bytes32)",
"13c89a8f": "getAllowedTime(bytes32)",
"78bd7935": "getAuction(uint256)",
"c55d0f56": "getCurrentPrice(uint256)",
"cb4799f2": "getMetadata(uint256,string)",
"d8389dc5": "hash(bytes32)",
"273ba6bb": "ICO()",
"15f73331": "invalidateName(string)",
"4108a4e0": "isAllowed(bytes32,uint)",
"54c15b82": "isGeneScience()",
"b3b77a51": "lock(bytes32,uint256)",
"40c10f19": "mint(address,uint256)",
"a0712d68": "mint(uint256)",
"0d9f5aed": "mixGenes(uint256,uint256,uint256)",
"bb35783b": "move(address,address,uint256)",
"e89401a1": "multihash(bytes32)",
"06fdde03": "name()",
"691f3431": "name(bytes32)",
"ce92dced": "newBid(bytes32)",
"3e3ee859": "NewQuestion(string,bytes32)",
"bffbe61c": "node(address)",
"dd1b7a0f": "nonFungibleContract()",
"8da5cb5b": "owner()",
"02571be3": "owner(bytes32)",
"83b5ff8b": "ownerCut()",
"6352211e": "ownerOf(uint256)",
"8456cb59": "pause()",
"5c975abb": "paused()",
"674f220f": "previousOwner()",
"c8690233": "pubkey(bytes32)",
"ebb045fa": "PublicResolver(address)",
"f2d5d56b": "pull(address,uint256)",
"b753a98c": "push(address,uint256)",
"3fad9ae0": "question()",
"d22057a9": "register(bytes32,address)",
"0230a07c": "releaseDeed(bytes32)",
"0178b8bf": "resolver(bytes32)",
"623195b0": "setABI(bytes32,uint256,bytes)",
"d5fa2b00": "setAddr(bytes32,address)",
"7a9e5e4b": "setAuthority(address)",
"27d7874c": "setCEO(address)",
"4e0a3379": "setCFO(address)",
"b1ab762f": "setCompleted(uint)",
"c3d014d6": "setContent(bytes32,bytes32)",
"2ba73c15": "setCOO(address)",
"76196c88": "setDnsrr(bytes32,bytes)",
"d7fa1007": "setHash(bytes32,bytes32)",
"aa4cb547": "setMultihash(bytes32,bytes)",
"5ac801fe": "setName(bytes32)",
"c47f0027": "setName(string)",
"13af4035": "setOwner(address)",
"5b0fc9c3": "setOwner(bytes32,address)",
"29cd62ea": "setPubkey(bytes32,bytes32,bytes32)",
"faab9d39": "setRegistrar(address)",
"1896f70a": "setResolver(bytes32,address)",
"06ab5923": "setSubnodeOwner(bytes32,bytes32,address)",
"10f13a8c": "setText(bytes32,string,string)",
"14ab9038": "setTTL(bytes32,uint64)",
"8acf6746": "shaBid(bytes32,address,uint,bytes32)",
"1a5834aa": "start_game(string,string)",
"be9a6555": "start()",
"ede8acdb": "startAuction(bytes32)",
"e27fe50f": "startAuctions(bytes32[])",
"febefd61": "startAuctionsAndBid(bytes32[],bytes32)",
"61d585da": "state(bytes32)",
"07da68f5": "stop()",
"f50ab247": "StopGame()",
"75f12b21": "stopped()",
"01ffc9a7": "supportsInterface(bytes4)",
"95d89b41": "symbol()",
"59d1d43c": "text(bytes32,string)",
"18160ddd": "totalSupply()",
"a9059cbb": "transfer(address,uint256)",
"79ce9fac": "transfer(bytes32,address)",
"23b872dd": "transferFrom(address,address,uint256)",
"f2fde38b": "transferOwnership(address)",
"5ddae283": "transferRegistrars(bytes32)",
"3853682c": "Try(string)",
"16a25cbd": "ttl(bytes32)",
"3f4ba83a": "unpause()",
"91f2348e": "unsealBid(bytes32,uint,bytes32)",
"0900f010": "upgrade(address)",
"3fa4f245": "value()",
"3ccfd60b": "withdraw()",
"5fd8c710": "withdrawBalance()"
}
58 changes: 58 additions & 0 deletions data/functions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[
"ABI(bytes32,uint256)",
"acceptRegistrarTransfer(bytes32,Deed,uint)",
"addr(bytes32)",
"allowance(address,address)",
"approve(address,uint256)",
"approve(address)",
Expand All @@ -13,58 +16,113 @@
"canCall(address,address,bytes4)",
"cancelAuction(uint256)",
"cancelAuctionWhenPaused(uint256)",
"cancelBid(address,bytes32)",
"ceoAddress()",
"cfoAddress()",
"claim(address)",
"claimWithResolver(address,address)",
"closeDeed(uint)",
"content(bytes32)",
"cooAddress()",
"createAuction(uint256,uint256,uint256,uint256,address)",
"creationDate()",
"creator()",
"decimals()",
"destroyDeed()",
"disableICO()",
"dnsrr(bytes32)",
"donate()",
"draw(bytes32,uint256)",
"enableICO()",
"entries(bytes32)",
"eraseNode(bytes32[])",
"exit(uint256)",
"finalizeAuction(bytes32)",
"getAllowedTime(bytes32)",
"getAuction(uint256)",
"getCurrentPrice(uint256)",
"getMetadata(uint256,string)",
"hash(bytes32)",
"ICO()",
"invalidateName(string)",
"isAllowed(bytes32,uint)",
"isGeneScience()",
"isProxy(address)",
"lock(bytes32,uint256)",
"mint(address,uint256)",
"mint(uint256)",
"mixGenes(uint256,uint256,uint256)",
"move(address,address,uint256)",
"multihash(bytes32)",
"name()",
"name(bytes32)",
"newBid(bytes32)",
"NewQuestion(string,bytes32)",
"node(address)",
"nonFungibleContract()",
"owner()",
"owner(bytes32)",
"ownerCut()",
"ownerOf(uint256)",
"pause()",
"paused()",
"previousOwner()",
"pubkey(bytes32)",
"PublicResolver(address)",
"pull(address,uint256)",
"push(address,uint256)",
"question()",
"register(bytes32,address)",
"releaseDeed(bytes32)",
"resolver(bytes32)",
"setABI(bytes32,uint256,bytes)",
"setAddr(bytes32,address)",
"setAuthority(address)",
"setBalance(uint,bool)",
"setCEO(address)",
"setCFO(address)",
"setCompleted(uint)",
"setContent(bytes32,bytes32)",
"setCOO(address)",
"setDnsrr(bytes32,bytes)",
"setHash(bytes32,bytes32)",
"setMultihash(bytes32,bytes)",
"setName(bytes32,string)",
"setName(bytes32)",
"setName(string)",
"setOwner(address)",
"setOwner(bytes32,address)",
"setPubkey(bytes32,bytes32,bytes32)",
"setRegistrar(address)",
"setResolver(bytes32,address)",
"setSubnodeOwner(bytes32,bytes32,address)",
"setText(bytes32,string,string)",
"setTTL(bytes32,uint64)",
"shaBid(bytes32,address,uint,bytes32)",
"start_game(string,string)",
"start()",
"startAuction(bytes32)",
"startAuctions(bytes32[])",
"startAuctionsAndBid(bytes32[],bytes32)",
"state(bytes32)",
"stop()",
"StopGame()",
"stopped()",
"supportsInterface(bytes4)",
"symbol()",
"text(bytes32,string)",
"totalSupply()",
"transfer(address,uint256)",
"transfer(bytes32,address)",
"transferFrom(address,address,uint256)",
"transferOwnership(address)",
"transferRegistrars(bytes32)",
"Try(string)",
"ttl(bytes32)",
"unpause()",
"unsealBid(bytes32,uint,bytes32)",
"upgrade(address)",
"value()",
"withdraw()",
"withdrawBalance()"
]
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"tslint": "tslint --project .",
"prepublishOnly": "npm run clean && npm run build:prod",
"clean": "rimraf ./lib",
"build": "npm run build:functions && webpack",
"build": "npm run build:hashes && webpack",
"build:prod": "cross-env NODE_ENV=production npm run build",
"build:functions": "ts-node ./scripts/build.ts",
"build:hashes": "ts-node ./scripts/build.ts",
"prettier:diff": "prettier --write --config ./.prettierrc --list-different 'src/**/*.ts'"
},
"repository": {
Expand Down Expand Up @@ -59,7 +59,7 @@
"git add"
],
"*.json": [
"npm run build:functions",
"npm run build:hashes",
"git add"
]
},
Expand Down
15 changes: 12 additions & 3 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,24 @@ import * as fs from 'fs';
const web3 = require('web3');

import * as functions from '../data/functions.json';
import * as events from '../data/events.json';

functions.sort((a, b) => a.localeCompare(b));
events.sort((a, b) => a.localeCompare(b));

const hashes: any = functions.reduce((map: any, functionName: any) => {
const functionHashes: any = functions.reduce((map: any, functionName: any) => {
map[web3.utils.sha3(functionName).substring(2, 10)] = functionName;
return map;
}, {});

fs.writeFileSync('./data/functionHashes.json', JSON.stringify(hashes, null, 4));
const eventHashes: any = events.reduce((map: any, eventName: any) => {
map[web3.utils.sha3(eventName).substring(2)] = eventName;
return map;
}, {});

fs.writeFileSync('./data/functionHashes.json', JSON.stringify(functionHashes, null, 4));
fs.writeFileSync('./data/functions.json', JSON.stringify(functions, null, 4));
fs.writeFileSync('./data/eventHashes.json', JSON.stringify(eventHashes, null, 4));
fs.writeFileSync('./data/events.json', JSON.stringify(events, null, 4));

console.log('Updated functionHashes.json successfully');
console.log('Updated hashes successfully');
7 changes: 7 additions & 0 deletions src/classes/evm.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ class EVM {
const opCodes = this.getOpcodes();
for (this.pc; this.pc < opCodes.length; this.pc++) {
const opCode = opCodes[this.pc];
//console.log(this.pc + ':' + opCode.pc + ' ' + Object.keys(this.jumps).length);
/*console.log(
opCode.pc +
': ' +
opCode.name +
(opCode.pushData ? ' 0x' + opCode.pushData.toString('hex') : '')
);*/
if (!(opCode.name in allOpcodes)) {
throw new Error('Unknown OPCODE: ' + opCode.name);
} else {
Expand Down
Loading

0 comments on commit 8ddd29f

Please sign in to comment.