@sentio/sdk 1.8.2 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/base-processor-template.d.ts +6 -0
- package/lib/base-processor-template.js +5 -0
- package/lib/base-processor-template.js.map +1 -1
- package/lib/base-processor.d.ts +1 -1
- package/lib/base-processor.js +9 -2
- package/lib/base-processor.js.map +1 -1
- package/lib/builtin/internal/erc20_processor.d.ts +148 -14
- package/lib/builtin/internal/erc20_processor.js +114 -6
- package/lib/builtin/internal/erc20_processor.js.map +1 -1
- package/lib/builtin/internal/erc20bytes_processor.d.ts +80 -12
- package/lib/builtin/internal/erc20bytes_processor.js +58 -4
- package/lib/builtin/internal/erc20bytes_processor.js.map +1 -1
- package/lib/builtin/internal/weth9_processor.d.ts +92 -16
- package/lib/builtin/internal/weth9_processor.js +74 -8
- package/lib/builtin/internal/weth9_processor.js.map +1 -1
- package/lib/context.js +1 -0
- package/lib/context.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js.map +1 -1
- package/lib/target-ethers-sentio/codegen.js +13 -1
- package/lib/target-ethers-sentio/codegen.js.map +1 -1
- package/lib/target-ethers-sentio/functions.d.ts +3 -0
- package/lib/target-ethers-sentio/functions.js +61 -0
- package/lib/target-ethers-sentio/functions.js.map +1 -0
- package/lib/test/erc20-template.js +2 -2
- package/lib/test/erc20-template.js.map +1 -1
- package/lib/test/erc20.js +6 -4
- package/lib/test/erc20.js.map +1 -1
- package/lib/test/erc20.test.js +25 -0
- package/lib/test/erc20.test.js.map +1 -1
- package/lib/test/test-processor-server.d.ts +5 -1
- package/lib/test/test-processor-server.js +41 -0
- package/lib/test/test-processor-server.js.map +1 -1
- package/lib/trace.d.ts +5 -5
- package/lib/trace.js +21 -0
- package/lib/trace.js.map +1 -1
- package/package.json +1 -1
- package/src/base-processor-template.ts +13 -0
- package/src/base-processor.ts +10 -3
- package/src/builtin/internal/erc20_processor.ts +330 -7
- package/src/builtin/internal/erc20bytes_processor.ts +174 -5
- package/src/builtin/internal/weth9_processor.ts +195 -9
- package/src/context.ts +1 -0
- package/src/index.ts +1 -0
- package/src/target-ethers-sentio/codegen.ts +13 -1
- package/src/target-ethers-sentio/functions.ts +68 -0
- package/src/test/erc20-template.ts +2 -2
- package/src/test/erc20.test.ts +29 -0
- package/src/test/erc20.ts +6 -4
- package/src/test/test-processor-server.ts +47 -0
- package/src/trace.ts +27 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-processor-server.js","sourceRoot":"","sources":["../../src/test/test-processor-server.ts"],"names":[],"mappings":";;;;;;AAAA,qCAqBoB;AAIpB,gDAA6C;AAE7C,gDAAuB;AACvB,wDAAiE;AAEjE,MAAM,YAAY,GAA6B,EAAE,CAAA;AAEjD,SAAS,SAAS;IAChB,MAAM,CAAC,eAAe,GAAG,IAAI,oBAAc,EAAE,CAAA;AAC/C,CAAC;AAED,MAAa,mBAAmB;IAC9B,OAAO,CAAsB;IAC7B,cAAc,CAAkB;IAEhC,YAAY,MAAkB,EAAE,gBAAwC,EAAE;QACxE,SAAS,EAAE,CAAA;QAEX,IAAI,CAAC,OAAO,GAAG,IAAI,0BAAoB,CAAC,MAAM,CAAC,CAAA;QAC/C,MAAM,WAAW,GAAgC,EAAE,CAAA;QAEnD,KAAK,MAAM,CAAC,IAAI,oBAAS,EAAE;YACzB,MAAM,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;YACnC,WAAW,CAAC,CAAC,CAAC,GAAG;gBACf,OAAO,EAAE,CAAC;gBACV,KAAK,EAAE,CAAC,IAAI,CAAC;aACd,CAAA;SACF;QAED,IAAA,iBAAW,EAAC,WAAW,CAAC,CAAA;IAC1B,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,UAAwB,EAAE,iBAAiB,EAAE,EAAE,EAAE,EAAE,OAAO,GAAG,YAAY;QACnF,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAA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\n ProcessBlocksResponse,\n ProcessConfigRequest,\n ProcessConfigResponse,\n ProcessInstructionsRequest,\n ProcessInstructionsResponse,\n ProcessLogsRequest,\n ProcessLogsResponse,\n ProcessorServiceImpl,\n ProcessorServiceImplementation,\n ProcessorState,\n ProcessTracesRequest,\n ProcessTracesResponse,\n ProcessTransactionsRequest,\n ProcessTransactionsResponse,\n setProvider,\n StartRequest,\n} from '@sentio/sdk'\nimport { CallContext } from 'nice-grpc-common'\nimport { Empty } from '../gen/google/protobuf/empty'\nimport { ChainConfig } from '../chain-config'\nimport { CHAIN_MAP } from '../utils/chainmap'\nimport { Block, Log } from '@ethersproject/abstract-provider'\nimport Long from 'long'\nimport { getNetwork, Networkish } from '@ethersproject/providers'\n\nconst TEST_CONTEXT: CallContext = <CallContext>{}\n\nfunction cleanTest() {\n global.PROCESSOR_STATE = new ProcessorState()\n}\n\nexport class TestProcessorServer implements ProcessorServiceImplementation {\n service: ProcessorServiceImpl\n contractConfig: ContractConfig[]\n\n constructor(loader: () => void, httpEndpoints: Record<string, string> = {}) {\n cleanTest()\n\n this.service = new ProcessorServiceImpl(loader)\n const dummyConfig: Record<string, ChainConfig> = {}\n\n for (const k in CHAIN_MAP) {\n const http = httpEndpoints[k] || ''\n dummyConfig[k] = {\n ChainID: k,\n Https: [http],\n }\n }\n\n setProvider(dummyConfig)\n }\n\n async start(request: StartRequest = { templateInstances: [] }, context = TEST_CONTEXT): Promise<Empty> {\n const res = await this.service.start(request, context)\n this.contractConfig = (await this.getConfig({})).contractConfigs\n return res\n }\n\n stop(request: Empty, context = TEST_CONTEXT): Promise<Empty> {\n return this.service.stop(request, context)\n }\n\n getConfig(request: ProcessConfigRequest, context = TEST_CONTEXT): Promise<ProcessConfigResponse> {\n return this.service.getConfig(request, context)\n }\n\n processBlocks(request: ProcessBlocksRequest, context = TEST_CONTEXT): Promise<ProcessBlocksResponse> {\n return this.service.processBlocks(request, context)\n }\n\n processInstructions(\n request: ProcessInstructionsRequest,\n context = TEST_CONTEXT\n ): Promise<ProcessInstructionsResponse> {\n return this.service.processInstructions(request, context)\n }\n\n processLogs(request: ProcessLogsRequest, context = TEST_CONTEXT): Promise<ProcessLogsResponse> {\n return this.service.processLogs(request, context)\n }\n\n processTraces(request: ProcessTracesRequest, context: CallContext = TEST_CONTEXT): Promise<ProcessTracesResponse> {\n return this.service.processTraces(request, context)\n }\n\n processTransactions(\n request: ProcessTransactionsRequest,\n context = TEST_CONTEXT\n ): Promise<ProcessTransactionsResponse> {\n return this.service.processTransactions(request, context)\n }\n\n testLog(log: Log, network: Networkish = 1): Promise<ProcessLogsResponse> {\n return this.testLogs([log], network)\n }\n\n testLogs(logs: Log[], network: Networkish = 1): Promise<ProcessLogsResponse> {\n const bindings = []\n for (const log of logs) {\n const binding = this.buildLogBinding(log, network)\n if (!binding) {\n throw Error('Invalid test log: ' + JSON.stringify(log))\n }\n bindings.push(binding)\n }\n return this.processLogs({\n logBindings: bindings,\n })\n }\n\n buildLogBinding(log: Log, network: Networkish = 1): LogBinding | undefined {\n for (const contract of this.contractConfig) {\n if (contract.contract?.chainId !== getNetwork(network).chainId.toString()) {\n continue\n }\n if (log.address.toLowerCase() !== contract.contract?.address.toLowerCase()) {\n continue\n }\n for (const config of contract.logConfigs) {\n for (const filter of config.filters) {\n // if (filter.topics.length != log.topics.length) {\n // continue\n // }\n\n let match = true\n for (const topicIdx in filter.topics) {\n const logTopic = log.topics[topicIdx]\n const possibleTopic = filter.topics[topicIdx].hashes\n if (possibleTopic.length === 0) {\n // match all\n continue\n }\n if (possibleTopic.find((e) => e.toLowerCase() === logTopic.toLowerCase())) {\n // find one\n continue\n }\n match = false\n break\n }\n if (match) {\n return {\n log: {\n raw: toBytes(log),\n },\n handlerId: config.handlerId,\n }\n }\n }\n }\n }\n return undefined\n }\n\n testBlock(block: Partial<Block> & { number: number }, network: Networkish = 1): Promise<ProcessBlocksResponse> {\n return this.testBlocks([block], network)\n }\n\n testBlocks(blocks: Partial<Block> & { number: number }[], network: Networkish = 1) {\n const bindings = []\n for (const block of blocks) {\n const binding = this.buildBlockBinding(block, network)\n if (!binding) {\n throw Error('Invalid test block: ' + JSON.stringify(block))\n }\n bindings.push(binding)\n }\n return this.processBlocks({\n blockBindings: bindings,\n })\n }\n\n buildBlockBinding(block: Partial<Block> & { number: number }, network: Networkish = 1): BlockBinding {\n const binding: BlockBinding = {\n block: {\n raw: toBytes(block),\n },\n handlerIds: [],\n }\n for (const contract of this.contractConfig) {\n if (contract.contract?.chainId !== getNetwork(network).chainId.toString()) {\n continue\n }\n const longBlockNumber = Long.fromNumber(block.number)\n if (longBlockNumber < contract.startBlock) {\n continue\n }\n if (contract.endBlock !== Long.ZERO && longBlockNumber >= contract.endBlock) {\n continue\n }\n\n for (const config of contract.blockConfigs) {\n binding.handlerIds.push(config.handlerId)\n }\n }\n return binding\n }\n}\n\nfunction toBytes(obj: any): Uint8Array {\n const logJsonStr = JSON.stringify(obj)\n const raw = new Uint8Array(logJsonStr.length)\n for (let i = 0; i < logJsonStr.length; i++) {\n raw[i] = logJsonStr.charCodeAt(i)\n }\n return raw\n}\n"]}
|
|
1
|
+
{"version":3,"file":"test-processor-server.js","sourceRoot":"","sources":["../../src/test/test-processor-server.ts"],"names":[],"mappings":";;;;;;AAAA,qCAsBoB;AAIpB,gDAA6C;AAE7C,gDAAuB;AACvB,wDAAiE;AAGjE,MAAM,YAAY,GAA6B,EAAE,CAAA;AAEjD,SAAS,SAAS;IAChB,MAAM,CAAC,eAAe,GAAG,IAAI,oBAAc,EAAE,CAAA;AAC/C,CAAC;AAED,MAAa,mBAAmB;IAC9B,OAAO,CAAsB;IAC7B,cAAc,CAAkB;IAEhC,YAAY,MAAkB,EAAE,gBAAwC,EAAE;QACxE,SAAS,EAAE,CAAA;QAEX,IAAI,CAAC,OAAO,GAAG,IAAI,0BAAoB,CAAC,MAAM,CAAC,CAAA;QAC/C,MAAM,WAAW,GAAgC,EAAE,CAAA;QAEnD,KAAK,MAAM,CAAC,IAAI,oBAAS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C,IAAI,IAAI,eAAe,IAAI,QAAQ,CAAC,QAAQ,EAAE;gBAC3E,SAAQ;aACT;YAED,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,YAAY,EAAE;gBAC1C,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;aAC1C;SACF;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AAlND,kDAkNC;AAED,SAAS,OAAO,CAAC,GAAQ;IACvB,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IACtC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;IAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,GAAG,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;KAClC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import {\n BlockBinding,\n ContractConfig,\n LogBinding,\n ProcessBlocksRequest,\n ProcessBlocksResponse,\n ProcessConfigRequest,\n ProcessConfigResponse,\n ProcessInstructionsRequest,\n ProcessInstructionsResponse,\n ProcessLogsRequest,\n ProcessLogsResponse,\n ProcessorServiceImpl,\n ProcessorServiceImplementation,\n ProcessorState,\n ProcessTracesRequest,\n ProcessTracesResponse,\n ProcessTransactionsRequest,\n ProcessTransactionsResponse,\n setProvider,\n StartRequest,\n TraceBinding,\n} from '@sentio/sdk'\nimport { CallContext } from 'nice-grpc-common'\nimport { Empty } from '../gen/google/protobuf/empty'\nimport { ChainConfig } from '../chain-config'\nimport { CHAIN_MAP } from '../utils/chainmap'\nimport { Block, Log } from '@ethersproject/abstract-provider'\nimport Long from 'long'\nimport { getNetwork, Networkish } from '@ethersproject/providers'\nimport { Trace } from '../trace'\n\nconst TEST_CONTEXT: CallContext = <CallContext>{}\n\nfunction cleanTest() {\n global.PROCESSOR_STATE = new ProcessorState()\n}\n\nexport class TestProcessorServer implements ProcessorServiceImplementation {\n service: ProcessorServiceImpl\n contractConfig: ContractConfig[]\n\n constructor(loader: () => void, httpEndpoints: Record<string, string> = {}) {\n cleanTest()\n\n this.service = new ProcessorServiceImpl(loader)\n const dummyConfig: Record<string, ChainConfig> = {}\n\n for (const k in CHAIN_MAP) {\n const http = httpEndpoints[k] || ''\n dummyConfig[k] = {\n ChainID: k,\n Https: [http],\n }\n }\n\n setProvider(dummyConfig)\n }\n\n async start(request: StartRequest = { templateInstances: [] }, context = TEST_CONTEXT): Promise<Empty> {\n const res = await this.service.start(request, context)\n this.contractConfig = (await this.getConfig({})).contractConfigs\n return res\n }\n\n stop(request: Empty, context = TEST_CONTEXT): Promise<Empty> {\n return this.service.stop(request, context)\n }\n\n getConfig(request: ProcessConfigRequest, context = TEST_CONTEXT): Promise<ProcessConfigResponse> {\n return this.service.getConfig(request, context)\n }\n\n processBlocks(request: ProcessBlocksRequest, context = TEST_CONTEXT): Promise<ProcessBlocksResponse> {\n return this.service.processBlocks(request, context)\n }\n\n processInstructions(\n request: ProcessInstructionsRequest,\n context = TEST_CONTEXT\n ): Promise<ProcessInstructionsResponse> {\n return this.service.processInstructions(request, context)\n }\n\n processLogs(request: ProcessLogsRequest, context = TEST_CONTEXT): Promise<ProcessLogsResponse> {\n return this.service.processLogs(request, context)\n }\n\n processTraces(request: ProcessTracesRequest, context: CallContext = TEST_CONTEXT): Promise<ProcessTracesResponse> {\n return this.service.processTraces(request, context)\n }\n\n processTransactions(\n request: ProcessTransactionsRequest,\n context = TEST_CONTEXT\n ): Promise<ProcessTransactionsResponse> {\n return this.service.processTransactions(request, context)\n }\n\n testTrace(trace: Trace, network: Networkish = 1): Promise<ProcessTracesResponse> {\n return this.testTraces([trace], network)\n }\n\n testTraces(traces: Trace[], network: Networkish = 1): Promise<ProcessTracesResponse> {\n const bindings = []\n for (const trace of traces) {\n const binding = this.buildTraceBinding(trace, network)\n if (!binding) {\n throw Error('Invalid test trace: ' + JSON.stringify(trace))\n }\n bindings.push(binding)\n }\n return this.processTraces({\n traceBindings: bindings,\n })\n }\n\n buildTraceBinding(trace: Trace, network: Networkish = 1): TraceBinding | undefined {\n if (trace.type !== 'call' || !trace.action.input) {\n throw Error('Invalid test trace: ' + JSON.stringify(trace))\n }\n const signature = trace.action.input.slice(0, 10)\n\n for (const contract of this.contractConfig) {\n if (contract.contract?.chainId !== getNetwork(network).chainId.toString()) {\n continue\n }\n if (trace.action.to?.toLowerCase() !== contract.contract?.address.toLowerCase()) {\n continue\n }\n for (const config of contract.traceConfigs) {\n if (config.signature == signature) {\n return {\n trace: {\n raw: toBytes(trace),\n },\n handlerId: config.handlerId,\n }\n }\n }\n }\n return undefined\n }\n\n testLog(log: Log, network: Networkish = 1): Promise<ProcessLogsResponse> {\n return this.testLogs([log], network)\n }\n\n testLogs(logs: Log[], network: Networkish = 1): Promise<ProcessLogsResponse> {\n const bindings = []\n for (const log of logs) {\n const binding = this.buildLogBinding(log, network)\n if (!binding) {\n throw Error('Invalid test log: ' + JSON.stringify(log))\n }\n bindings.push(binding)\n }\n return this.processLogs({\n logBindings: bindings,\n })\n }\n\n buildLogBinding(log: Log, network: Networkish = 1): LogBinding | undefined {\n for (const contract of this.contractConfig) {\n if (contract.contract?.chainId !== getNetwork(network).chainId.toString()) {\n continue\n }\n if (log.address.toLowerCase() !== contract.contract?.address.toLowerCase()) {\n continue\n }\n for (const config of contract.logConfigs) {\n for (const filter of config.filters) {\n // if (filter.topics.length != log.topics.length) {\n // continue\n // }\n\n let match = true\n for (const topicIdx in filter.topics) {\n const logTopic = log.topics[topicIdx]\n const possibleTopic = filter.topics[topicIdx].hashes\n if (possibleTopic.length === 0) {\n // match all\n continue\n }\n if (possibleTopic.find((e) => e.toLowerCase() === logTopic.toLowerCase())) {\n // find one\n continue\n }\n match = false\n break\n }\n if (match) {\n return {\n log: {\n raw: toBytes(log),\n },\n handlerId: config.handlerId,\n }\n }\n }\n }\n }\n return undefined\n }\n\n testBlock(block: Partial<Block> & { number: number }, network: Networkish = 1): Promise<ProcessBlocksResponse> {\n return this.testBlocks([block], network)\n }\n\n testBlocks(blocks: Partial<Block> & { number: number }[], network: Networkish = 1) {\n const bindings = []\n for (const block of blocks) {\n const binding = this.buildBlockBinding(block, network)\n if (!binding) {\n throw Error('Invalid test block: ' + JSON.stringify(block))\n }\n bindings.push(binding)\n }\n return this.processBlocks({\n blockBindings: bindings,\n })\n }\n\n buildBlockBinding(block: Partial<Block> & { number: number }, network: Networkish = 1): BlockBinding {\n const binding: BlockBinding = {\n block: {\n raw: toBytes(block),\n },\n handlerIds: [],\n }\n for (const contract of this.contractConfig) {\n if (contract.contract?.chainId !== getNetwork(network).chainId.toString()) {\n continue\n }\n const longBlockNumber = Long.fromNumber(block.number)\n if (longBlockNumber < contract.startBlock) {\n continue\n }\n if (contract.endBlock !== Long.ZERO && longBlockNumber >= contract.endBlock) {\n continue\n }\n\n for (const config of contract.blockConfigs) {\n binding.handlerIds.push(config.handlerId)\n }\n }\n return binding\n }\n}\n\nfunction toBytes(obj: any): Uint8Array {\n const logJsonStr = JSON.stringify(obj)\n const raw = new Uint8Array(logJsonStr.length)\n for (let i = 0; i < logJsonStr.length; i++) {\n raw[i] = logJsonStr.charCodeAt(i)\n }\n return raw\n}\n"]}
|
package/lib/trace.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Result } from '@ethersproject/abi';
|
|
2
|
-
export interface
|
|
2
|
+
export interface TypedCallTrace<TArgsArray extends Array<any> = any, TArgsObject = any> extends Trace {
|
|
3
3
|
args: TArgsArray & TArgsObject;
|
|
4
4
|
}
|
|
5
5
|
export interface Trace {
|
|
@@ -17,11 +17,11 @@ export interface Trace {
|
|
|
17
17
|
}
|
|
18
18
|
export interface TraceAction {
|
|
19
19
|
from: string;
|
|
20
|
-
to
|
|
20
|
+
to?: string;
|
|
21
21
|
value: number;
|
|
22
22
|
gas: number;
|
|
23
|
-
input
|
|
24
|
-
callType
|
|
23
|
+
input?: string;
|
|
24
|
+
callType?: string;
|
|
25
25
|
init?: string;
|
|
26
26
|
address?: string;
|
|
27
27
|
balance?: string;
|
|
@@ -29,7 +29,7 @@ export interface TraceAction {
|
|
|
29
29
|
}
|
|
30
30
|
export interface TraceResult {
|
|
31
31
|
gasUsed: number;
|
|
32
|
-
output
|
|
32
|
+
output?: string;
|
|
33
33
|
address?: string;
|
|
34
34
|
code?: string;
|
|
35
35
|
}
|
package/lib/trace.js
CHANGED
|
@@ -19,4 +19,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
// transactionPosition: 73,
|
|
20
20
|
// type: 'call',
|
|
21
21
|
// }
|
|
22
|
+
// const trac2: Trace =
|
|
23
|
+
// {
|
|
24
|
+
// "action": {
|
|
25
|
+
// "from": "0x95ba4cf87d6723ad9c0db21737d862be80e93911",
|
|
26
|
+
// "gas": 0x630d0b,
|
|
27
|
+
// "init": "0x608060405234801561001057600080fd5b50604051602080610b2983398101806040528101908080519060200190929190505050808060405180807f6f72672e7a657070656c696e6f732e70726f78792e696d706c656d656e74617481526020017f696f6e000000000000000000000000000000000000000000000000000000000081525060230190506040518091039020600019167f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3600102600019161415156100c657fe5b6100de81610169640100000000026401000000009004565b5060405180807f6f72672e7a657070656c696e6f732e70726f78792e61646d696e000000000000815250601a0190506040518091039020600019167f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b6001026000191614151561014a57fe5b6101623361024e640100000000026401000000009004565b5050610290565b60006101878261027d6401000000000261084b176401000000009004565b1515610221576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001807f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f81526020017f6e20746f2061206e6f6e2d636f6e74726163742061646472657373000000000081525060400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c360010290508181555050565b60007f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b60010290508181555050565b600080823b905060008111915050919050565b61088a8061029f6000396000f30060806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633659cfe6146100775780634f1ef286146100ba5780635c60da1b146101085780638f2839701461015f578063f851a440146101a2575b6100756101f9565b005b34801561008357600080fd5b506100b8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610213565b005b610106600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001919091929391929390505050610268565b005b34801561011457600080fd5b5061011d610308565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561016b57600080fd5b506101a0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610360565b005b3480156101ae57600080fd5b506101b761051e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610201610576565b61021161020c610651565b610682565b565b61021b6106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025c57610257816106d9565b610265565b6102646101f9565b5b50565b6102706106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102fa576102ac836106d9565b3073ffffffffffffffffffffffffffffffffffffffff163483836040518083838082843782019150509250505060006040518083038185875af19250505015156102f557600080fd5b610303565b6103026101f9565b5b505050565b60006103126106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103545761034d610651565b905061035d565b61035c6101f9565b5b90565b6103686106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561051257600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610466576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001807f43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f81526020017f787920746f20746865207a65726f20616464726573730000000000000000000081525060400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61048f6106a8565b82604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a161050d81610748565b61051b565b61051a6101f9565b5b50565b60006105286106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561056a576105636106a8565b9050610573565b6105726101f9565b5b90565b61057e6106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610647576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001807f43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e20667281526020017f6f6d207468652070726f78792061646d696e000000000000000000000000000081525060400191505060405180910390fd5b61064f610777565b565b6000807f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c36001029050805491505090565b3660008037600080366000845af43d6000803e80600081146106a3573d6000f35b3d6000fd5b6000807f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b6001029050805491505090565b6106e281610779565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b60007f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b60010290508181555050565b565b60006107848261084b565b151561081e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001807f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f81526020017f6e20746f2061206e6f6e2d636f6e74726163742061646472657373000000000081525060400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c360010290508181555050565b600080823b9050600081119150509190505600a165627a7a72305820a4a547cfc7202c5acaaae74d428e988bc62ad5024eb0165532d3a8f91db4ed2400290000000000000000000000000882477e7895bdc5cea7cb1552ed914ab157fe56",
|
|
28
|
+
// "value": 0x0
|
|
29
|
+
// },
|
|
30
|
+
// "blockHash": "0xb2f6986457f5a24ff088a0beb5567c8c1fe2da02687c78e743507ee7c982b977",
|
|
31
|
+
// "blockNumber": 6082465,
|
|
32
|
+
// "result": {
|
|
33
|
+
// "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
34
|
+
// "code": "0x60806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633659cfe6146100775780634f1ef286146100ba5780635c60da1b146101085780638f2839701461015f578063f851a440146101a2575b6100756101f9565b005b34801561008357600080fd5b506100b8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610213565b005b610106600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001919091929391929390505050610268565b005b34801561011457600080fd5b5061011d610308565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561016b57600080fd5b506101a0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610360565b005b3480156101ae57600080fd5b506101b761051e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610201610576565b61021161020c610651565b610682565b565b61021b6106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025c57610257816106d9565b610265565b6102646101f9565b5b50565b6102706106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102fa576102ac836106d9565b3073ffffffffffffffffffffffffffffffffffffffff163483836040518083838082843782019150509250505060006040518083038185875af19250505015156102f557600080fd5b610303565b6103026101f9565b5b505050565b60006103126106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103545761034d610651565b905061035d565b61035c6101f9565b5b90565b6103686106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561051257600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610466576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001807f43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f81526020017f787920746f20746865207a65726f20616464726573730000000000000000000081525060400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61048f6106a8565b82604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a161050d81610748565b61051b565b61051a6101f9565b5b50565b60006105286106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561056a576105636106a8565b9050610573565b6105726101f9565b5b90565b61057e6106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610647576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001807f43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e20667281526020017f6f6d207468652070726f78792061646d696e000000000000000000000000000081525060400191505060405180910390fd5b61064f610777565b565b6000807f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c36001029050805491505090565b3660008037600080366000845af43d6000803e80600081146106a3573d6000f35b3d6000fd5b6000807f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b6001029050805491505090565b6106e281610779565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b60007f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b60010290508181555050565b565b60006107848261084b565b151561081e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001807f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f81526020017f6e20746f2061206e6f6e2d636f6e74726163742061646472657373000000000081525060400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c360010290508181555050565b600080823b9050600081119150509190505600a165627a7a72305820a4a547cfc7202c5acaaae74d428e988bc62ad5024eb0165532d3a8f91db4ed240029",
|
|
35
|
+
// "gasUsed": 0x74f42
|
|
36
|
+
// },
|
|
37
|
+
// "subtraces": 0,
|
|
38
|
+
// "traceAddress": [],
|
|
39
|
+
// "transactionHash": "0xe7e0fe390354509cd08c9a0168536938600ddc552b3f7cb96030ebef62e75895",
|
|
40
|
+
// "transactionPosition": 22,
|
|
41
|
+
// "type": "create"
|
|
42
|
+
// }
|
|
22
43
|
//# sourceMappingURL=trace.js.map
|
package/lib/trace.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../src/trace.ts"],"names":[],"mappings":";;AA6CA,yBAAyB;AACzB,cAAc;AACd,0DAA0D;AAC1D,wBAAwB;AACxB,oBAAoB;AACpB,aAAa;AACb,sZAAsZ;AACtZ,wDAAwD;AACxD,gCAAgC;AAChC,OAAO;AACP,qFAAqF;AACrF,2BAA2B;AAC3B,gDAAgD;AAChD,kBAAkB;AAClB,sBAAsB;AACtB,2FAA2F;AAC3F,6BAA6B;AAC7B,kBAAkB;AAClB,IAAI","sourcesContent":["// https://github.com/openethereum/parity-ethereum/blob/55c90d4016505317034e3e98f699af07f5404b63/rpc/src/v1/types/trace.rs#L482\nimport { Result } from '@ethersproject/abi'\n\nexport interface TypedTrace<TArgsArray extends Array<any> = any, TArgsObject = any> extends Trace {\n args: TArgsArray & TArgsObject\n}\n\nexport interface Trace {\n args?: Result\n\n action: TraceAction\n blockHash: string\n blockNumber: number\n result: TraceResult\n subtraces: number\n traceAddress: number[]\n transactionHash: string\n transactionPosition: number\n type: string\n error?: string\n}\n// export type CallType = \"call\" | \"callcode\" | \"delegatecall\" | \"staticcall\"\n\nexport interface TraceAction {\n from: string\n to: string\n value: number\n gas: number\n input: string\n callType: string\n\n init?: string\n address?: string\n balance?: string\n refundAddress?: string\n}\n\n// TODO are more field missing for FailedCall, FailedCreate\nexport interface TraceResult {\n gasUsed: number\n output: string\n address?: string\n code?: string\n}\n\n// const TRACE: Trace = {\n// action: {\n// from: '0xd771111cbfa2bbdafbf9f0e58b49b3f827da31f5',\n// callType: 'call',\n// gas: 0x12154,\n// input:\n// '0xb1a417f4000000000000000000000000d771111cbfa2bbdafbf9f0e58b49b3f827da31f5000000000000000000000000d771111cbfa2bbdafbf9f0e58b49b3f827da31f500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000131888b5aaf000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000',\n// to: '0x0baba1ad5be3a5c0a66e7ac838a129bf948f1ea4',\n// value: 0x131888b5aaf0000,\n// },\n// blockHash: '0x5451711bc530a7c04128fedbe149eb359c10eccd44a83909d448c5244c7eea26',\n// blockNumber: 15533908,\n// result: { gasUsed: 0x114c1, output: '0x' },\n// subtraces: 1,\n// traceAddress: [],\n// transactionHash: '0x66dce11d6217042ed709a38e507e7762c93b1bde4a0447ae7a243493bbdffc0e',\n// transactionPosition: 73,\n// type: 'call',\n// }\n"]}
|
|
1
|
+
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../src/trace.ts"],"names":[],"mappings":";;AA6CA,yBAAyB;AACzB,cAAc;AACd,0DAA0D;AAC1D,wBAAwB;AACxB,oBAAoB;AACpB,aAAa;AACb,sZAAsZ;AACtZ,wDAAwD;AACxD,gCAAgC;AAChC,OAAO;AACP,qFAAqF;AACrF,2BAA2B;AAC3B,gDAAgD;AAChD,kBAAkB;AAClB,sBAAsB;AACtB,2FAA2F;AAC3F,6BAA6B;AAC7B,kBAAkB;AAClB,IAAI;AAEJ,uBAAuB;AACvB,QAAQ;AACR,oBAAoB;AACpB,gEAAgE;AAChE,2BAA2B;AAC3B,0qLAA0qL;AAC1qL,uBAAuB;AACvB,WAAW;AACX,2FAA2F;AAC3F,gCAAgC;AAChC,oBAAoB;AACpB,mEAAmE;AACnE,4yIAA4yI;AAC5yI,6BAA6B;AAC7B,WAAW;AACX,wBAAwB;AACxB,4BAA4B;AAC5B,iGAAiG;AACjG,mCAAmC;AACnC,yBAAyB;AACzB,QAAQ","sourcesContent":["// https://github.com/openethereum/parity-ethereum/blob/55c90d4016505317034e3e98f699af07f5404b63/rpc/src/v1/types/trace.rs#L482\nimport { Result } from '@ethersproject/abi'\n\nexport interface TypedCallTrace<TArgsArray extends Array<any> = any, TArgsObject = any> extends Trace {\n args: TArgsArray & TArgsObject\n}\n\nexport interface Trace {\n args?: Result\n\n action: TraceAction\n blockHash: string\n blockNumber: number\n result: TraceResult\n subtraces: number\n traceAddress: number[]\n transactionHash: string\n transactionPosition: number\n type: string\n error?: string\n}\n// export type CallType = \"call\" | \"callcode\" | \"delegatecall\" | \"staticcall\"\n\nexport interface TraceAction {\n from: string\n to?: string\n value: number\n gas: number\n input?: string\n callType?: string\n\n init?: string\n address?: string\n balance?: string\n refundAddress?: string\n}\n\n// TODO are more field missing for FailedCall, FailedCreate\nexport interface TraceResult {\n gasUsed: number\n output?: string\n address?: string\n code?: string\n}\n\n// const TRACE: Trace = {\n// action: {\n// from: '0xd771111cbfa2bbdafbf9f0e58b49b3f827da31f5',\n// callType: 'call',\n// gas: 0x12154,\n// input:\n// '0xb1a417f4000000000000000000000000d771111cbfa2bbdafbf9f0e58b49b3f827da31f5000000000000000000000000d771111cbfa2bbdafbf9f0e58b49b3f827da31f500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000131888b5aaf000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000',\n// to: '0x0baba1ad5be3a5c0a66e7ac838a129bf948f1ea4',\n// value: 0x131888b5aaf0000,\n// },\n// blockHash: '0x5451711bc530a7c04128fedbe149eb359c10eccd44a83909d448c5244c7eea26',\n// blockNumber: 15533908,\n// result: { gasUsed: 0x114c1, output: '0x' },\n// subtraces: 1,\n// traceAddress: [],\n// transactionHash: '0x66dce11d6217042ed709a38e507e7762c93b1bde4a0447ae7a243493bbdffc0e',\n// transactionPosition: 73,\n// type: 'call',\n// }\n\n// const trac2: Trace =\n// {\n// \"action\": {\n// \"from\": \"0x95ba4cf87d6723ad9c0db21737d862be80e93911\",\n// \"gas\": 0x630d0b,\n// \"init\": \"0x608060405234801561001057600080fd5b50604051602080610b2983398101806040528101908080519060200190929190505050808060405180807f6f72672e7a657070656c696e6f732e70726f78792e696d706c656d656e74617481526020017f696f6e000000000000000000000000000000000000000000000000000000000081525060230190506040518091039020600019167f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3600102600019161415156100c657fe5b6100de81610169640100000000026401000000009004565b5060405180807f6f72672e7a657070656c696e6f732e70726f78792e61646d696e000000000000815250601a0190506040518091039020600019167f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b6001026000191614151561014a57fe5b6101623361024e640100000000026401000000009004565b5050610290565b60006101878261027d6401000000000261084b176401000000009004565b1515610221576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001807f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f81526020017f6e20746f2061206e6f6e2d636f6e74726163742061646472657373000000000081525060400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c360010290508181555050565b60007f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b60010290508181555050565b600080823b905060008111915050919050565b61088a8061029f6000396000f30060806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633659cfe6146100775780634f1ef286146100ba5780635c60da1b146101085780638f2839701461015f578063f851a440146101a2575b6100756101f9565b005b34801561008357600080fd5b506100b8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610213565b005b610106600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001919091929391929390505050610268565b005b34801561011457600080fd5b5061011d610308565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561016b57600080fd5b506101a0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610360565b005b3480156101ae57600080fd5b506101b761051e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610201610576565b61021161020c610651565b610682565b565b61021b6106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025c57610257816106d9565b610265565b6102646101f9565b5b50565b6102706106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102fa576102ac836106d9565b3073ffffffffffffffffffffffffffffffffffffffff163483836040518083838082843782019150509250505060006040518083038185875af19250505015156102f557600080fd5b610303565b6103026101f9565b5b505050565b60006103126106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103545761034d610651565b905061035d565b61035c6101f9565b5b90565b6103686106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561051257600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610466576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001807f43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f81526020017f787920746f20746865207a65726f20616464726573730000000000000000000081525060400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61048f6106a8565b82604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a161050d81610748565b61051b565b61051a6101f9565b5b50565b60006105286106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561056a576105636106a8565b9050610573565b6105726101f9565b5b90565b61057e6106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610647576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001807f43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e20667281526020017f6f6d207468652070726f78792061646d696e000000000000000000000000000081525060400191505060405180910390fd5b61064f610777565b565b6000807f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c36001029050805491505090565b3660008037600080366000845af43d6000803e80600081146106a3573d6000f35b3d6000fd5b6000807f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b6001029050805491505090565b6106e281610779565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b60007f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b60010290508181555050565b565b60006107848261084b565b151561081e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001807f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f81526020017f6e20746f2061206e6f6e2d636f6e74726163742061646472657373000000000081525060400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c360010290508181555050565b600080823b9050600081119150509190505600a165627a7a72305820a4a547cfc7202c5acaaae74d428e988bc62ad5024eb0165532d3a8f91db4ed2400290000000000000000000000000882477e7895bdc5cea7cb1552ed914ab157fe56\",\n// \"value\": 0x0\n// },\n// \"blockHash\": \"0xb2f6986457f5a24ff088a0beb5567c8c1fe2da02687c78e743507ee7c982b977\",\n// \"blockNumber\": 6082465,\n// \"result\": {\n// \"address\": \"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n// \"code\": \"0x60806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633659cfe6146100775780634f1ef286146100ba5780635c60da1b146101085780638f2839701461015f578063f851a440146101a2575b6100756101f9565b005b34801561008357600080fd5b506100b8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610213565b005b610106600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001919091929391929390505050610268565b005b34801561011457600080fd5b5061011d610308565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561016b57600080fd5b506101a0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610360565b005b3480156101ae57600080fd5b506101b761051e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610201610576565b61021161020c610651565b610682565b565b61021b6106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025c57610257816106d9565b610265565b6102646101f9565b5b50565b6102706106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102fa576102ac836106d9565b3073ffffffffffffffffffffffffffffffffffffffff163483836040518083838082843782019150509250505060006040518083038185875af19250505015156102f557600080fd5b610303565b6103026101f9565b5b505050565b60006103126106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103545761034d610651565b905061035d565b61035c6101f9565b5b90565b6103686106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561051257600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610466576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001807f43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f81526020017f787920746f20746865207a65726f20616464726573730000000000000000000081525060400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61048f6106a8565b82604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a161050d81610748565b61051b565b61051a6101f9565b5b50565b60006105286106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561056a576105636106a8565b9050610573565b6105726101f9565b5b90565b61057e6106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610647576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001807f43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e20667281526020017f6f6d207468652070726f78792061646d696e000000000000000000000000000081525060400191505060405180910390fd5b61064f610777565b565b6000807f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c36001029050805491505090565b3660008037600080366000845af43d6000803e80600081146106a3573d6000f35b3d6000fd5b6000807f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b6001029050805491505090565b6106e281610779565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b60007f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b60010290508181555050565b565b60006107848261084b565b151561081e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001807f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f81526020017f6e20746f2061206e6f6e2d636f6e74726163742061646472657373000000000081525060400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c360010290508181555050565b600080823b9050600081119150509190505600a165627a7a72305820a4a547cfc7202c5acaaae74d428e988bc62ad5024eb0165532d3a8f91db4ed240029\",\n// \"gasUsed\": 0x74f42\n// },\n// \"subtraces\": 0,\n// \"traceAddress\": [],\n// \"transactionHash\": \"0xe7e0fe390354509cd08c9a0168536938600ddc552b3f7cb96030ebef62e75895\",\n// \"transactionPosition\": 22,\n// \"type\": \"create\"\n// }\n"]}
|
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ import { TemplateInstance } from './gen/processor/protos/processor'
|
|
|
8
8
|
import Long from 'long'
|
|
9
9
|
import { getNetwork } from '@ethersproject/providers'
|
|
10
10
|
import { PromiseOrVoid } from './promise-or-void'
|
|
11
|
+
import { Trace } from './trace'
|
|
11
12
|
|
|
12
13
|
export abstract class BaseProcessorTemplate<
|
|
13
14
|
TContract extends BaseContract,
|
|
@@ -16,6 +17,10 @@ export abstract class BaseProcessorTemplate<
|
|
|
16
17
|
id: number
|
|
17
18
|
binds = new Set<string>()
|
|
18
19
|
blockHandlers: ((block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid)[] = []
|
|
20
|
+
traceHandlers: {
|
|
21
|
+
signature: string
|
|
22
|
+
handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid
|
|
23
|
+
}[] = []
|
|
19
24
|
eventHandlers: {
|
|
20
25
|
handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid
|
|
21
26
|
filter: EventFilter | EventFilter[]
|
|
@@ -88,5 +93,13 @@ export abstract class BaseProcessorTemplate<
|
|
|
88
93
|
return this
|
|
89
94
|
}
|
|
90
95
|
|
|
96
|
+
public onTrace(
|
|
97
|
+
signature: string,
|
|
98
|
+
handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid
|
|
99
|
+
) {
|
|
100
|
+
this.traceHandlers.push({ signature, handler })
|
|
101
|
+
return this
|
|
102
|
+
}
|
|
103
|
+
|
|
91
104
|
protected abstract bindInternal(options: BindOptions): BaseProcessor<TContract, TBoundContractView>
|
|
92
105
|
}
|
package/src/base-processor.ts
CHANGED
|
@@ -9,7 +9,6 @@ import { ProcessResult } from './gen/processor/protos/processor'
|
|
|
9
9
|
import { BindInternalOptions, BindOptions } from './bind-options'
|
|
10
10
|
import { PromiseOrVoid } from './promise-or-void'
|
|
11
11
|
import { Trace } from './trace'
|
|
12
|
-
import { utils } from 'ethers'
|
|
13
12
|
|
|
14
13
|
export class EventsHandler {
|
|
15
14
|
filters: EventFilter[]
|
|
@@ -137,7 +136,7 @@ export abstract class BaseProcessor<
|
|
|
137
136
|
}, _filters)
|
|
138
137
|
}
|
|
139
138
|
|
|
140
|
-
|
|
139
|
+
protected onTrace(
|
|
141
140
|
signature: string,
|
|
142
141
|
handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid
|
|
143
142
|
) {
|
|
@@ -149,7 +148,15 @@ export abstract class BaseProcessor<
|
|
|
149
148
|
handler: async function (trace: Trace) {
|
|
150
149
|
const contractInterface = contractView.rawContract.interface
|
|
151
150
|
const fragment = contractInterface.getFunction(signature)
|
|
152
|
-
|
|
151
|
+
if (!trace.action.input) {
|
|
152
|
+
return {
|
|
153
|
+
gauges: [],
|
|
154
|
+
counters: [],
|
|
155
|
+
logs: [],
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const traceData = '0x' + trace.action.input.slice(10)
|
|
159
|
+
trace.args = contractInterface._abiCoder.decode(fragment.inputs, traceData)
|
|
153
160
|
|
|
154
161
|
const ctx = new Context<TContract, TBoundContractView>(contractView, chainId, undefined, undefined, trace)
|
|
155
162
|
await handler(trace, ctx)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* Autogenerated file. Do not edit manually. */
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
|
-
import { CallOverrides } from "ethers";
|
|
4
|
+
import { BigNumber, CallOverrides } from "ethers";
|
|
5
5
|
import { Networkish } from "@ethersproject/providers";
|
|
6
6
|
import {
|
|
7
7
|
addContractByABI,
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
ContractView,
|
|
19
19
|
DummyProvider,
|
|
20
20
|
getContractName,
|
|
21
|
+
TypedCallTrace,
|
|
21
22
|
} from "@sentio/sdk";
|
|
22
23
|
import { PromiseOrValue } from "./common";
|
|
23
24
|
import { ERC20, ERC20__factory } from "./index";
|
|
@@ -29,6 +30,136 @@ import {
|
|
|
29
30
|
TransferEvent,
|
|
30
31
|
TransferEventFilter,
|
|
31
32
|
} from "./ERC20";
|
|
33
|
+
|
|
34
|
+
export interface AllowanceCallObject {
|
|
35
|
+
owner: string;
|
|
36
|
+
spender: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type AllowanceCallTrace = TypedCallTrace<
|
|
40
|
+
[string, string],
|
|
41
|
+
AllowanceCallObject
|
|
42
|
+
>;
|
|
43
|
+
|
|
44
|
+
export interface ApproveCallObject {
|
|
45
|
+
spender: string;
|
|
46
|
+
amount: BigNumber;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type ApproveCallTrace = TypedCallTrace<
|
|
50
|
+
[string, BigNumber],
|
|
51
|
+
ApproveCallObject
|
|
52
|
+
>;
|
|
53
|
+
|
|
54
|
+
export interface BalanceOfCallObject {
|
|
55
|
+
account: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type BalanceOfCallTrace = TypedCallTrace<[string], BalanceOfCallObject>;
|
|
59
|
+
|
|
60
|
+
export interface BurnCallObject {
|
|
61
|
+
amount: BigNumber;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type BurnCallTrace = TypedCallTrace<[BigNumber], BurnCallObject>;
|
|
65
|
+
|
|
66
|
+
export interface BurnFromCallObject {
|
|
67
|
+
account: string;
|
|
68
|
+
amount: BigNumber;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type BurnFromCallTrace = TypedCallTrace<
|
|
72
|
+
[string, BigNumber],
|
|
73
|
+
BurnFromCallObject
|
|
74
|
+
>;
|
|
75
|
+
|
|
76
|
+
export interface DecimalsCallObject {}
|
|
77
|
+
|
|
78
|
+
export type DecimalsCallTrace = TypedCallTrace<[], DecimalsCallObject>;
|
|
79
|
+
|
|
80
|
+
export interface DecreaseAllowanceCallObject {
|
|
81
|
+
spender: string;
|
|
82
|
+
subtractedValue: BigNumber;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type DecreaseAllowanceCallTrace = TypedCallTrace<
|
|
86
|
+
[string, BigNumber],
|
|
87
|
+
DecreaseAllowanceCallObject
|
|
88
|
+
>;
|
|
89
|
+
|
|
90
|
+
export interface IncreaseAllowanceCallObject {
|
|
91
|
+
spender: string;
|
|
92
|
+
addedValue: BigNumber;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export type IncreaseAllowanceCallTrace = TypedCallTrace<
|
|
96
|
+
[string, BigNumber],
|
|
97
|
+
IncreaseAllowanceCallObject
|
|
98
|
+
>;
|
|
99
|
+
|
|
100
|
+
export interface LockerCallObject {}
|
|
101
|
+
|
|
102
|
+
export type LockerCallTrace = TypedCallTrace<[], LockerCallObject>;
|
|
103
|
+
|
|
104
|
+
export interface NameCallObject {}
|
|
105
|
+
|
|
106
|
+
export type NameCallTrace = TypedCallTrace<[], NameCallObject>;
|
|
107
|
+
|
|
108
|
+
export interface OwnerCallObject {}
|
|
109
|
+
|
|
110
|
+
export type OwnerCallTrace = TypedCallTrace<[], OwnerCallObject>;
|
|
111
|
+
|
|
112
|
+
export interface RenounceOwnershipCallObject {}
|
|
113
|
+
|
|
114
|
+
export type RenounceOwnershipCallTrace = TypedCallTrace<
|
|
115
|
+
[],
|
|
116
|
+
RenounceOwnershipCallObject
|
|
117
|
+
>;
|
|
118
|
+
|
|
119
|
+
export interface SetLockerCallObject {
|
|
120
|
+
_locker: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export type SetLockerCallTrace = TypedCallTrace<[string], SetLockerCallObject>;
|
|
124
|
+
|
|
125
|
+
export interface SymbolCallObject {}
|
|
126
|
+
|
|
127
|
+
export type SymbolCallTrace = TypedCallTrace<[], SymbolCallObject>;
|
|
128
|
+
|
|
129
|
+
export interface TotalSupplyCallObject {}
|
|
130
|
+
|
|
131
|
+
export type TotalSupplyCallTrace = TypedCallTrace<[], TotalSupplyCallObject>;
|
|
132
|
+
|
|
133
|
+
export interface TransferCallObject {
|
|
134
|
+
recipient: string;
|
|
135
|
+
amount: BigNumber;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export type TransferCallTrace = TypedCallTrace<
|
|
139
|
+
[string, BigNumber],
|
|
140
|
+
TransferCallObject
|
|
141
|
+
>;
|
|
142
|
+
|
|
143
|
+
export interface TransferFromCallObject {
|
|
144
|
+
sender: string;
|
|
145
|
+
recipient: string;
|
|
146
|
+
amount: BigNumber;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export type TransferFromCallTrace = TypedCallTrace<
|
|
150
|
+
[string, string, BigNumber],
|
|
151
|
+
TransferFromCallObject
|
|
152
|
+
>;
|
|
153
|
+
|
|
154
|
+
export interface TransferOwnershipCallObject {
|
|
155
|
+
newOwner: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export type TransferOwnershipCallTrace = TypedCallTrace<
|
|
159
|
+
[string],
|
|
160
|
+
TransferOwnershipCallObject
|
|
161
|
+
>;
|
|
162
|
+
|
|
32
163
|
const templateContract = ERC20__factory.connect("", DummyProvider);
|
|
33
164
|
|
|
34
165
|
export class ERC20ContractView extends ContractView<ERC20> {
|
|
@@ -308,7 +439,7 @@ export class ERC20ProcessorTemplate extends BaseProcessorTemplate<
|
|
|
308
439
|
return processor;
|
|
309
440
|
}
|
|
310
441
|
|
|
311
|
-
|
|
442
|
+
onEventApproval(
|
|
312
443
|
handler: (event: ApprovalEvent, ctx: ERC20Context) => void,
|
|
313
444
|
filter?: ApprovalEventFilter | ApprovalEventFilter[]
|
|
314
445
|
) {
|
|
@@ -322,7 +453,7 @@ export class ERC20ProcessorTemplate extends BaseProcessorTemplate<
|
|
|
322
453
|
return super.onEvent(handler, filter);
|
|
323
454
|
}
|
|
324
455
|
|
|
325
|
-
|
|
456
|
+
onEventOwnershipTransferred(
|
|
326
457
|
handler: (event: OwnershipTransferredEvent, ctx: ERC20Context) => void,
|
|
327
458
|
filter?: OwnershipTransferredEventFilter | OwnershipTransferredEventFilter[]
|
|
328
459
|
) {
|
|
@@ -335,7 +466,7 @@ export class ERC20ProcessorTemplate extends BaseProcessorTemplate<
|
|
|
335
466
|
return super.onEvent(handler, filter);
|
|
336
467
|
}
|
|
337
468
|
|
|
338
|
-
|
|
469
|
+
onEventTransfer(
|
|
339
470
|
handler: (event: TransferEvent, ctx: ERC20Context) => void,
|
|
340
471
|
filter?: TransferEventFilter | TransferEventFilter[]
|
|
341
472
|
) {
|
|
@@ -348,13 +479,109 @@ export class ERC20ProcessorTemplate extends BaseProcessorTemplate<
|
|
|
348
479
|
}
|
|
349
480
|
return super.onEvent(handler, filter);
|
|
350
481
|
}
|
|
482
|
+
|
|
483
|
+
onCallAllowance(
|
|
484
|
+
handler: (call: AllowanceCallTrace, ctx: ERC20Context) => void
|
|
485
|
+
) {
|
|
486
|
+
return super.onTrace("0xdd62ed3e", handler);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
onCallApprove(handler: (call: ApproveCallTrace, ctx: ERC20Context) => void) {
|
|
490
|
+
return super.onTrace("0x095ea7b3", handler);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
onCallBalanceOf(
|
|
494
|
+
handler: (call: BalanceOfCallTrace, ctx: ERC20Context) => void
|
|
495
|
+
) {
|
|
496
|
+
return super.onTrace("0x70a08231", handler);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
onCallBurn(handler: (call: BurnCallTrace, ctx: ERC20Context) => void) {
|
|
500
|
+
return super.onTrace("0x42966c68", handler);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
onCallBurnFrom(
|
|
504
|
+
handler: (call: BurnFromCallTrace, ctx: ERC20Context) => void
|
|
505
|
+
) {
|
|
506
|
+
return super.onTrace("0x79cc6790", handler);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
onCallDecimals(
|
|
510
|
+
handler: (call: DecimalsCallTrace, ctx: ERC20Context) => void
|
|
511
|
+
) {
|
|
512
|
+
return super.onTrace("0x313ce567", handler);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
onCallDecreaseAllowance(
|
|
516
|
+
handler: (call: DecreaseAllowanceCallTrace, ctx: ERC20Context) => void
|
|
517
|
+
) {
|
|
518
|
+
return super.onTrace("0xa457c2d7", handler);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
onCallIncreaseAllowance(
|
|
522
|
+
handler: (call: IncreaseAllowanceCallTrace, ctx: ERC20Context) => void
|
|
523
|
+
) {
|
|
524
|
+
return super.onTrace("0x39509351", handler);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
onCallLocker(handler: (call: LockerCallTrace, ctx: ERC20Context) => void) {
|
|
528
|
+
return super.onTrace("0xd7b96d4e", handler);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
onCallName(handler: (call: NameCallTrace, ctx: ERC20Context) => void) {
|
|
532
|
+
return super.onTrace("0x06fdde03", handler);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
onCallOwner(handler: (call: OwnerCallTrace, ctx: ERC20Context) => void) {
|
|
536
|
+
return super.onTrace("0x8da5cb5b", handler);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
onCallRenounceOwnership(
|
|
540
|
+
handler: (call: RenounceOwnershipCallTrace, ctx: ERC20Context) => void
|
|
541
|
+
) {
|
|
542
|
+
return super.onTrace("0x715018a6", handler);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
onCallSetLocker(
|
|
546
|
+
handler: (call: SetLockerCallTrace, ctx: ERC20Context) => void
|
|
547
|
+
) {
|
|
548
|
+
return super.onTrace("0x171060ec", handler);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
onCallSymbol(handler: (call: SymbolCallTrace, ctx: ERC20Context) => void) {
|
|
552
|
+
return super.onTrace("0x95d89b41", handler);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
onCallTotalSupply(
|
|
556
|
+
handler: (call: TotalSupplyCallTrace, ctx: ERC20Context) => void
|
|
557
|
+
) {
|
|
558
|
+
return super.onTrace("0x18160ddd", handler);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
onCallTransfer(
|
|
562
|
+
handler: (call: TransferCallTrace, ctx: ERC20Context) => void
|
|
563
|
+
) {
|
|
564
|
+
return super.onTrace("0xa9059cbb", handler);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
onCallTransferFrom(
|
|
568
|
+
handler: (call: TransferFromCallTrace, ctx: ERC20Context) => void
|
|
569
|
+
) {
|
|
570
|
+
return super.onTrace("0x23b872dd", handler);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
onCallTransferOwnership(
|
|
574
|
+
handler: (call: TransferOwnershipCallTrace, ctx: ERC20Context) => void
|
|
575
|
+
) {
|
|
576
|
+
return super.onTrace("0xf2fde38b", handler);
|
|
577
|
+
}
|
|
351
578
|
}
|
|
352
579
|
|
|
353
580
|
export class ERC20Processor extends BaseProcessor<
|
|
354
581
|
ERC20,
|
|
355
582
|
ERC20BoundContractView
|
|
356
583
|
> {
|
|
357
|
-
|
|
584
|
+
onEventApproval(
|
|
358
585
|
handler: (event: ApprovalEvent, ctx: ERC20Context) => void,
|
|
359
586
|
filter?: ApprovalEventFilter | ApprovalEventFilter[]
|
|
360
587
|
) {
|
|
@@ -368,7 +595,7 @@ export class ERC20Processor extends BaseProcessor<
|
|
|
368
595
|
return super.onEvent(handler, filter);
|
|
369
596
|
}
|
|
370
597
|
|
|
371
|
-
|
|
598
|
+
onEventOwnershipTransferred(
|
|
372
599
|
handler: (event: OwnershipTransferredEvent, ctx: ERC20Context) => void,
|
|
373
600
|
filter?: OwnershipTransferredEventFilter | OwnershipTransferredEventFilter[]
|
|
374
601
|
) {
|
|
@@ -381,7 +608,7 @@ export class ERC20Processor extends BaseProcessor<
|
|
|
381
608
|
return super.onEvent(handler, filter);
|
|
382
609
|
}
|
|
383
610
|
|
|
384
|
-
|
|
611
|
+
onEventTransfer(
|
|
385
612
|
handler: (event: TransferEvent, ctx: ERC20Context) => void,
|
|
386
613
|
filter?: TransferEventFilter | TransferEventFilter[]
|
|
387
614
|
) {
|
|
@@ -395,6 +622,102 @@ export class ERC20Processor extends BaseProcessor<
|
|
|
395
622
|
return super.onEvent(handler, filter);
|
|
396
623
|
}
|
|
397
624
|
|
|
625
|
+
onCallAllowance(
|
|
626
|
+
handler: (call: AllowanceCallTrace, ctx: ERC20Context) => void
|
|
627
|
+
) {
|
|
628
|
+
return super.onTrace("0xdd62ed3e", handler);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
onCallApprove(handler: (call: ApproveCallTrace, ctx: ERC20Context) => void) {
|
|
632
|
+
return super.onTrace("0x095ea7b3", handler);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
onCallBalanceOf(
|
|
636
|
+
handler: (call: BalanceOfCallTrace, ctx: ERC20Context) => void
|
|
637
|
+
) {
|
|
638
|
+
return super.onTrace("0x70a08231", handler);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
onCallBurn(handler: (call: BurnCallTrace, ctx: ERC20Context) => void) {
|
|
642
|
+
return super.onTrace("0x42966c68", handler);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
onCallBurnFrom(
|
|
646
|
+
handler: (call: BurnFromCallTrace, ctx: ERC20Context) => void
|
|
647
|
+
) {
|
|
648
|
+
return super.onTrace("0x79cc6790", handler);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
onCallDecimals(
|
|
652
|
+
handler: (call: DecimalsCallTrace, ctx: ERC20Context) => void
|
|
653
|
+
) {
|
|
654
|
+
return super.onTrace("0x313ce567", handler);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
onCallDecreaseAllowance(
|
|
658
|
+
handler: (call: DecreaseAllowanceCallTrace, ctx: ERC20Context) => void
|
|
659
|
+
) {
|
|
660
|
+
return super.onTrace("0xa457c2d7", handler);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
onCallIncreaseAllowance(
|
|
664
|
+
handler: (call: IncreaseAllowanceCallTrace, ctx: ERC20Context) => void
|
|
665
|
+
) {
|
|
666
|
+
return super.onTrace("0x39509351", handler);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
onCallLocker(handler: (call: LockerCallTrace, ctx: ERC20Context) => void) {
|
|
670
|
+
return super.onTrace("0xd7b96d4e", handler);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
onCallName(handler: (call: NameCallTrace, ctx: ERC20Context) => void) {
|
|
674
|
+
return super.onTrace("0x06fdde03", handler);
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
onCallOwner(handler: (call: OwnerCallTrace, ctx: ERC20Context) => void) {
|
|
678
|
+
return super.onTrace("0x8da5cb5b", handler);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
onCallRenounceOwnership(
|
|
682
|
+
handler: (call: RenounceOwnershipCallTrace, ctx: ERC20Context) => void
|
|
683
|
+
) {
|
|
684
|
+
return super.onTrace("0x715018a6", handler);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
onCallSetLocker(
|
|
688
|
+
handler: (call: SetLockerCallTrace, ctx: ERC20Context) => void
|
|
689
|
+
) {
|
|
690
|
+
return super.onTrace("0x171060ec", handler);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
onCallSymbol(handler: (call: SymbolCallTrace, ctx: ERC20Context) => void) {
|
|
694
|
+
return super.onTrace("0x95d89b41", handler);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
onCallTotalSupply(
|
|
698
|
+
handler: (call: TotalSupplyCallTrace, ctx: ERC20Context) => void
|
|
699
|
+
) {
|
|
700
|
+
return super.onTrace("0x18160ddd", handler);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
onCallTransfer(
|
|
704
|
+
handler: (call: TransferCallTrace, ctx: ERC20Context) => void
|
|
705
|
+
) {
|
|
706
|
+
return super.onTrace("0xa9059cbb", handler);
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
onCallTransferFrom(
|
|
710
|
+
handler: (call: TransferFromCallTrace, ctx: ERC20Context) => void
|
|
711
|
+
) {
|
|
712
|
+
return super.onTrace("0x23b872dd", handler);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
onCallTransferOwnership(
|
|
716
|
+
handler: (call: TransferOwnershipCallTrace, ctx: ERC20Context) => void
|
|
717
|
+
) {
|
|
718
|
+
return super.onTrace("0xf2fde38b", handler);
|
|
719
|
+
}
|
|
720
|
+
|
|
398
721
|
public static filters = templateContract.filters;
|
|
399
722
|
|
|
400
723
|
protected CreateBoundContractView(): ERC20BoundContractView {
|