@sentio/sdk 1.9.0 → 1.10.1
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 -99
- package/lib/builtin/internal/erc20_processor.js +96 -42
- package/lib/builtin/internal/erc20_processor.js.map +1 -1
- package/lib/builtin/internal/erc20bytes_processor.d.ts +80 -52
- package/lib/builtin/internal/erc20bytes_processor.js +49 -22
- package/lib/builtin/internal/erc20bytes_processor.js.map +1 -1
- package/lib/builtin/internal/weth9_processor.d.ts +92 -64
- package/lib/builtin/internal/weth9_processor.js +63 -30
- 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 -1
- package/lib/index.js.map +1 -1
- package/lib/target-ethers-sentio/codegen.js +35 -15
- package/lib/target-ethers-sentio/codegen.js.map +1 -1
- package/lib/target-ethers-sentio/functions.js +13 -6
- package/lib/target-ethers-sentio/functions.js.map +1 -1
- package/lib/test/codegen.test.js +9 -7
- package/lib/test/codegen.test.js.map +1 -1
- 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 +264 -123
- package/src/builtin/internal/erc20bytes_processor.ts +139 -63
- package/src/builtin/internal/weth9_processor.ts +155 -76
- package/src/context.ts +1 -0
- package/src/index.ts +1 -1
- package/src/target-ethers-sentio/codegen.ts +34 -16
- package/src/target-ethers-sentio/functions.ts +20 -7
- package/src/test/abis/evm/CommitmentPool.json +1034 -0
- package/src/test/codegen.test.ts +10 -7
- 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
|
@@ -5,10 +5,15 @@ import { Event } from '@ethersproject/contracts';
|
|
|
5
5
|
import { BaseProcessor } from './base-processor';
|
|
6
6
|
import { BindOptions } from './bind-options';
|
|
7
7
|
import { PromiseOrVoid } from './promise-or-void';
|
|
8
|
+
import { Trace } from './trace';
|
|
8
9
|
export declare abstract class BaseProcessorTemplate<TContract extends BaseContract, TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>> {
|
|
9
10
|
id: number;
|
|
10
11
|
binds: Set<string>;
|
|
11
12
|
blockHandlers: ((block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid)[];
|
|
13
|
+
traceHandlers: {
|
|
14
|
+
signature: string;
|
|
15
|
+
handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid;
|
|
16
|
+
}[];
|
|
12
17
|
eventHandlers: {
|
|
13
18
|
handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid;
|
|
14
19
|
filter: EventFilter | EventFilter[];
|
|
@@ -17,5 +22,6 @@ export declare abstract class BaseProcessorTemplate<TContract extends BaseContra
|
|
|
17
22
|
bind(options: BindOptions): BaseProcessor<TContract, TBoundContractView> | undefined;
|
|
18
23
|
onEvent(handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid, filter: EventFilter | EventFilter[]): this;
|
|
19
24
|
onBlock(handler: (block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid): this;
|
|
25
|
+
onTrace(signature: string, handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid): this;
|
|
20
26
|
protected abstract bindInternal(options: BindOptions): BaseProcessor<TContract, TBoundContractView>;
|
|
21
27
|
}
|
|
@@ -11,6 +11,7 @@ class BaseProcessorTemplate {
|
|
|
11
11
|
id;
|
|
12
12
|
binds = new Set();
|
|
13
13
|
blockHandlers = [];
|
|
14
|
+
traceHandlers = [];
|
|
14
15
|
eventHandlers = [];
|
|
15
16
|
constructor() {
|
|
16
17
|
this.id = global.PROCESSOR_STATE.templates.length;
|
|
@@ -70,6 +71,10 @@ class BaseProcessorTemplate {
|
|
|
70
71
|
this.blockHandlers.push(handler);
|
|
71
72
|
return this;
|
|
72
73
|
}
|
|
74
|
+
onTrace(signature, handler) {
|
|
75
|
+
this.traceHandlers.push({ signature, handler });
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
73
78
|
}
|
|
74
79
|
exports.BaseProcessorTemplate = BaseProcessorTemplate;
|
|
75
80
|
//# sourceMappingURL=base-processor-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-processor-template.js","sourceRoot":"","sources":["../src/base-processor-template.ts"],"names":[],"mappings":";;;;;;AAKA,iDAAiE;AAEjE,gDAAuB;AACvB,wDAAqD;
|
|
1
|
+
{"version":3,"file":"base-processor-template.js","sourceRoot":"","sources":["../src/base-processor-template.ts"],"names":[],"mappings":";;;;;;AAKA,iDAAiE;AAEjE,gDAAuB;AACvB,wDAAqD;AAIrD,MAAsB,qBAAqB;IAIzC,EAAE,CAAQ;IACV,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IACzB,aAAa,GAAqF,EAAE,CAAA;IACpG,aAAa,GAGP,EAAE,CAAA;IACR,aAAa,GAGP,EAAE,CAAA;IAER;QACE,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,MAAM,CAAA;QACjD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,CAAC,CAAA;aAC1D;iBAAM;gBACL,QAAQ,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;aACzC;SACF;QACD,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpB,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;gBACxC,QAAQ,CAAC,QAAQ,GAAG,cAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;aACtD;iBAAM;gBACL,QAAQ,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;aACrC;SACF;QACD,MAAM,CAAC,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAExD,OAAO,SAAS,CAAA;IAClB,CAAC;IAEM,OAAO,CACZ,OAAqF,EACrF,MAAmC;QAEnC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;YACtB,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE,MAAM;SACf,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,OAAO,CAAC,OAAqF;QAClG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAChC,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,OAAO,CACZ,SAAiB,EACjB,OAAqF;QAErF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAA;QAC/C,OAAO,IAAI,CAAA;IACb,CAAC;CAGF;AA5FD,sDA4FC","sourcesContent":["import { BoundContractView, Context, ContractView } from './context'\nimport { Block } from '@ethersproject/abstract-provider'\nimport { BaseContract, EventFilter } from 'ethers'\nimport { Event } from '@ethersproject/contracts'\nimport { BaseProcessor } from './base-processor'\nimport { BindOptions, getOptionsSignature } from './bind-options'\nimport { TemplateInstance } from './gen/processor/protos/processor'\nimport Long from 'long'\nimport { getNetwork } from '@ethersproject/providers'\nimport { PromiseOrVoid } from './promise-or-void'\nimport { Trace } from './trace'\n\nexport abstract class BaseProcessorTemplate<\n TContract extends BaseContract,\n TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>\n> {\n id: number\n binds = new Set<string>()\n blockHandlers: ((block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid)[] = []\n traceHandlers: {\n signature: string\n handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid\n }[] = []\n eventHandlers: {\n handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid\n filter: EventFilter | EventFilter[]\n }[] = []\n\n constructor() {\n this.id = global.PROCESSOR_STATE.templates.length\n global.PROCESSOR_STATE.templates.push(this)\n }\n\n public bind(options: BindOptions) {\n const sig = getOptionsSignature(options)\n if (this.binds.has(sig)) {\n return\n }\n this.binds.add(sig)\n\n const processor = this.bindInternal(options)\n\n for (const eh of this.eventHandlers) {\n processor.onEvent(eh.handler, eh.filter)\n }\n for (const bh of this.blockHandlers) {\n processor.onBlock(bh)\n }\n\n const instance: TemplateInstance = {\n templateId: this.id,\n contract: {\n address: options.address,\n name: options.name || '',\n chainId: options.network ? getNetwork(options.network).chainId.toString() : '1',\n abi: '',\n },\n startBlock: Long.ZERO,\n endBlock: Long.ZERO,\n }\n if (options.startBlock) {\n if (typeof options.startBlock === 'number') {\n instance.startBlock = Long.fromNumber(options.startBlock)\n } else {\n instance.startBlock = options.startBlock\n }\n }\n if (options.endBlock) {\n if (typeof options.endBlock === 'number') {\n instance.endBlock = Long.fromNumber(options.endBlock)\n } else {\n instance.endBlock = options.endBlock\n }\n }\n global.PROCESSOR_STATE.templatesInstances.push(instance)\n\n return processor\n }\n\n public onEvent(\n handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid,\n filter: EventFilter | EventFilter[]\n ) {\n this.eventHandlers.push({\n handler: handler,\n filter: filter,\n })\n return this\n }\n\n public onBlock(handler: (block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid) {\n this.blockHandlers.push(handler)\n return this\n }\n\n public onTrace(\n signature: string,\n handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid\n ) {\n this.traceHandlers.push({ signature, handler })\n return this\n }\n\n protected abstract bindInternal(options: BindOptions): BaseProcessor<TContract, TBoundContractView>\n}\n"]}
|
package/lib/base-processor.d.ts
CHANGED
|
@@ -26,5 +26,5 @@ export declare abstract class BaseProcessor<TContract extends BaseContract, TBou
|
|
|
26
26
|
onEvent(handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid, filter: EventFilter | EventFilter[]): this;
|
|
27
27
|
onBlock(handler: (block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid): this;
|
|
28
28
|
onAllEvents(handler: (event: Log, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid): this;
|
|
29
|
-
onTrace(signature: string, handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid): this;
|
|
29
|
+
protected onTrace(signature: string, handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid): this;
|
|
30
30
|
}
|
package/lib/base-processor.js
CHANGED
|
@@ -7,7 +7,6 @@ exports.BaseProcessor = exports.TraceHandler = exports.EventsHandler = void 0;
|
|
|
7
7
|
const providers_1 = require("@ethersproject/providers");
|
|
8
8
|
const long_1 = __importDefault(require("long"));
|
|
9
9
|
const context_1 = require("./context");
|
|
10
|
-
const ethers_1 = require("ethers");
|
|
11
10
|
class EventsHandler {
|
|
12
11
|
filters;
|
|
13
12
|
handler;
|
|
@@ -124,7 +123,15 @@ class BaseProcessor {
|
|
|
124
123
|
handler: async function (trace) {
|
|
125
124
|
const contractInterface = contractView.rawContract.interface;
|
|
126
125
|
const fragment = contractInterface.getFunction(signature);
|
|
127
|
-
|
|
126
|
+
if (!trace.action.input) {
|
|
127
|
+
return {
|
|
128
|
+
gauges: [],
|
|
129
|
+
counters: [],
|
|
130
|
+
logs: [],
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const traceData = '0x' + trace.action.input.slice(10);
|
|
134
|
+
trace.args = contractInterface._abiCoder.decode(fragment.inputs, traceData);
|
|
128
135
|
const ctx = new context_1.Context(contractView, chainId, undefined, undefined, trace);
|
|
129
136
|
await handler(trace, ctx);
|
|
130
137
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-processor.js","sourceRoot":"","sources":["../src/base-processor.ts"],"names":[],"mappings":";;;;;;AAEA,wDAAiE;AAEjE,gDAAuB;AAEvB,uCAAoE;
|
|
1
|
+
{"version":3,"file":"base-processor.js","sourceRoot":"","sources":["../src/base-processor.ts"],"names":[],"mappings":";;;;;;AAEA,wDAAiE;AAEjE,gDAAuB;AAEvB,uCAAoE;AAMpE,MAAa,aAAa;IACxB,OAAO,CAAe;IACtB,OAAO,CAAwC;CAChD;AAHD,sCAGC;AAED,MAAa,YAAY;IACvB,SAAS,CAAQ;IACjB,OAAO,CAA0C;CAClD;AAHD,oCAGC;AAED,MAAsB,aAAa;IAIjC,aAAa,GAAiD,EAAE,CAAA;IAChE,aAAa,GAAoB,EAAE,CAAA;IACnC,aAAa,GAAmB,EAAE,CAAA;IAElC,IAAI,CAAQ;IACZ,MAAM,CAAqB;IAE3B,YAAY,MAAmB;QAC7B,IAAI,CAAC,MAAM,GAAG;YACZ,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;YACvB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC5C,UAAU,EAAE,IAAI,cAAI,CAAC,CAAC,CAAC;SACxB,CAAA;QACD,IAAI,MAAM,CAAC,UAAU,EAAE;YACrB,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,EAAE;gBACzC,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,cAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU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,GAAG,IAAI,iBAAO,CAAgC,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAA;gBAC1G,MAAM,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;gBACzB,OAAO;oBACL,MAAM,EAAE,GAAG,CAAC,MAAM;oBAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,IAAI,EAAE,EAAE;iBACT,CAAA;YACH,CAAC;SACF,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AArJD,sCAqJC","sourcesContent":["import { Event } from '@ethersproject/contracts'\nimport { BytesLike } from '@ethersproject/bytes'\nimport { Block, Log, getNetwork } from '@ethersproject/providers'\nimport { BaseContract, EventFilter } from '@ethersproject/contracts'\nimport Long from 'long'\n\nimport { BoundContractView, Context, ContractView } from './context'\nimport { ProcessResult } from './gen/processor/protos/processor'\nimport { BindInternalOptions, BindOptions } from './bind-options'\nimport { PromiseOrVoid } from './promise-or-void'\nimport { Trace } from './trace'\n\nexport class EventsHandler {\n filters: EventFilter[]\n handler: (event: Log) => Promise<ProcessResult>\n}\n\nexport class TraceHandler {\n signature: string\n handler: (trace: Trace) => Promise<ProcessResult>\n}\n\nexport abstract class BaseProcessor<\n TContract extends BaseContract,\n TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>\n> {\n blockHandlers: ((block: Block) => Promise<ProcessResult>)[] = []\n eventHandlers: EventsHandler[] = []\n traceHandlers: TraceHandler[] = []\n\n name: string\n config: BindInternalOptions\n\n constructor(config: BindOptions) {\n this.config = {\n address: config.address,\n name: config.name || '',\n network: config.network ? config.network : 1,\n startBlock: new Long(0),\n }\n if (config.startBlock) {\n if (typeof config.startBlock === 'number') {\n this.config.startBlock = Long.fromNumber(config.startBlock)\n } else {\n this.config.startBlock = config.startBlock\n }\n }\n if (config.endBlock) {\n if (typeof config.endBlock === 'number') {\n this.config.endBlock = Long.fromNumber(config.endBlock)\n } else {\n this.config.endBlock = config.endBlock\n }\n }\n }\n\n protected abstract CreateBoundContractView(): TBoundContractView\n\n public getChainId(): number {\n return getNetwork(this.config.network).chainId\n }\n\n public onEvent(\n handler: (event: Event, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid,\n filter: EventFilter | EventFilter[]\n ) {\n const chainId = this.getChainId()\n\n let _filters: EventFilter[] = []\n\n if (Array.isArray(filter)) {\n _filters = filter\n } else {\n _filters.push(filter)\n }\n\n const contractView = this.CreateBoundContractView()\n this.eventHandlers.push({\n filters: _filters,\n handler: async function (log) {\n const ctx = new Context<TContract, TBoundContractView>(contractView, chainId, undefined, log)\n // let event: Event = <Event>deepCopy(log);\n const event: Event = <Event>log\n const parsed = contractView.rawContract.interface.parseLog(log)\n if (parsed) {\n event.args = parsed.args\n event.decode = (data: BytesLike, topics?: Array<any>) => {\n return contractView.rawContract.interface.decodeEventLog(parsed.eventFragment, data, topics)\n }\n event.event = parsed.name\n event.eventSignature = parsed.signature\n\n // TODO fix this bug\n await handler(event, ctx)\n return {\n gauges: ctx.gauges,\n counters: ctx.counters,\n logs: [],\n }\n }\n return {\n gauges: [],\n counters: [],\n logs: [],\n }\n },\n })\n return this\n }\n\n public onBlock(handler: (block: Block, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid) {\n const chainId = this.getChainId()\n const contractView = this.CreateBoundContractView()\n\n this.blockHandlers.push(async function (block: Block) {\n const ctx = new Context<TContract, TBoundContractView>(contractView, chainId, block, undefined)\n await handler(block, ctx)\n return {\n gauges: ctx.gauges,\n counters: ctx.counters,\n logs: [],\n }\n })\n return this\n }\n\n public onAllEvents(handler: (event: Log, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid) {\n const _filters: EventFilter[] = []\n const tmpContract = this.CreateBoundContractView()\n\n for (const key in tmpContract.filters) {\n _filters.push(tmpContract.filters[key]())\n }\n return this.onEvent(function (log, ctx) {\n return handler(log, ctx)\n }, _filters)\n }\n\n protected onTrace(\n signature: string,\n handler: (trace: Trace, ctx: Context<TContract, TBoundContractView>) => PromiseOrVoid\n ) {\n const chainId = this.getChainId()\n const contractView = this.CreateBoundContractView()\n\n this.traceHandlers.push({\n signature,\n handler: async function (trace: Trace) {\n const contractInterface = contractView.rawContract.interface\n const fragment = contractInterface.getFunction(signature)\n if (!trace.action.input) {\n return {\n gauges: [],\n counters: [],\n logs: [],\n }\n }\n const traceData = '0x' + trace.action.input.slice(10)\n trace.args = contractInterface._abiCoder.decode(fragment.inputs, traceData)\n\n const ctx = new Context<TContract, TBoundContractView>(contractView, chainId, undefined, undefined, trace)\n await handler(trace, ctx)\n return {\n gauges: ctx.gauges,\n counters: ctx.counters,\n logs: [],\n }\n },\n })\n return this\n }\n}\n"]}
|
|
@@ -1,126 +1,175 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BigNumber, CallOverrides } from "ethers";
|
|
2
2
|
import { Networkish } from "@ethersproject/providers";
|
|
3
|
-
import { BindOptions, BaseProcessor, BaseProcessorTemplate, BoundContractView, Context, ContractView,
|
|
3
|
+
import { BindOptions, BaseProcessor, BaseProcessorTemplate, BoundContractView, Context, ContractView, TypedCallTrace } from "@sentio/sdk";
|
|
4
4
|
import { PromiseOrValue } from "./common";
|
|
5
5
|
import { ERC20 } from "./index";
|
|
6
6
|
import { ApprovalEvent, ApprovalEventFilter, OwnershipTransferredEvent, OwnershipTransferredEventFilter, TransferEvent, TransferEventFilter } from "./ERC20";
|
|
7
|
+
export interface AllowanceCallObject {
|
|
8
|
+
owner: string;
|
|
9
|
+
spender: string;
|
|
10
|
+
}
|
|
11
|
+
export declare type AllowanceCallTrace = TypedCallTrace<[
|
|
12
|
+
string,
|
|
13
|
+
string
|
|
14
|
+
], AllowanceCallObject>;
|
|
15
|
+
export interface ApproveCallObject {
|
|
16
|
+
spender: string;
|
|
17
|
+
amount: BigNumber;
|
|
18
|
+
}
|
|
19
|
+
export declare type ApproveCallTrace = TypedCallTrace<[
|
|
20
|
+
string,
|
|
21
|
+
BigNumber
|
|
22
|
+
], ApproveCallObject>;
|
|
23
|
+
export interface BalanceOfCallObject {
|
|
24
|
+
account: string;
|
|
25
|
+
}
|
|
26
|
+
export declare type BalanceOfCallTrace = TypedCallTrace<[string], BalanceOfCallObject>;
|
|
27
|
+
export interface BurnCallObject {
|
|
28
|
+
amount: BigNumber;
|
|
29
|
+
}
|
|
30
|
+
export declare type BurnCallTrace = TypedCallTrace<[BigNumber], BurnCallObject>;
|
|
31
|
+
export interface BurnFromCallObject {
|
|
32
|
+
account: string;
|
|
33
|
+
amount: BigNumber;
|
|
34
|
+
}
|
|
35
|
+
export declare type BurnFromCallTrace = TypedCallTrace<[
|
|
36
|
+
string,
|
|
37
|
+
BigNumber
|
|
38
|
+
], BurnFromCallObject>;
|
|
39
|
+
export interface DecimalsCallObject {
|
|
40
|
+
}
|
|
41
|
+
export declare type DecimalsCallTrace = TypedCallTrace<[], DecimalsCallObject>;
|
|
42
|
+
export interface DecreaseAllowanceCallObject {
|
|
43
|
+
spender: string;
|
|
44
|
+
subtractedValue: BigNumber;
|
|
45
|
+
}
|
|
46
|
+
export declare type DecreaseAllowanceCallTrace = TypedCallTrace<[
|
|
47
|
+
string,
|
|
48
|
+
BigNumber
|
|
49
|
+
], DecreaseAllowanceCallObject>;
|
|
50
|
+
export interface IncreaseAllowanceCallObject {
|
|
51
|
+
spender: string;
|
|
52
|
+
addedValue: BigNumber;
|
|
53
|
+
}
|
|
54
|
+
export declare type IncreaseAllowanceCallTrace = TypedCallTrace<[
|
|
55
|
+
string,
|
|
56
|
+
BigNumber
|
|
57
|
+
], IncreaseAllowanceCallObject>;
|
|
58
|
+
export interface LockerCallObject {
|
|
59
|
+
}
|
|
60
|
+
export declare type LockerCallTrace = TypedCallTrace<[], LockerCallObject>;
|
|
61
|
+
export interface NameCallObject {
|
|
62
|
+
}
|
|
63
|
+
export declare type NameCallTrace = TypedCallTrace<[], NameCallObject>;
|
|
64
|
+
export interface OwnerCallObject {
|
|
65
|
+
}
|
|
66
|
+
export declare type OwnerCallTrace = TypedCallTrace<[], OwnerCallObject>;
|
|
67
|
+
export interface RenounceOwnershipCallObject {
|
|
68
|
+
}
|
|
69
|
+
export declare type RenounceOwnershipCallTrace = TypedCallTrace<[
|
|
70
|
+
], RenounceOwnershipCallObject>;
|
|
71
|
+
export interface SetLockerCallObject {
|
|
72
|
+
_locker: string;
|
|
73
|
+
}
|
|
74
|
+
export declare type SetLockerCallTrace = TypedCallTrace<[string], SetLockerCallObject>;
|
|
75
|
+
export interface SymbolCallObject {
|
|
76
|
+
}
|
|
77
|
+
export declare type SymbolCallTrace = TypedCallTrace<[], SymbolCallObject>;
|
|
78
|
+
export interface TotalSupplyCallObject {
|
|
79
|
+
}
|
|
80
|
+
export declare type TotalSupplyCallTrace = TypedCallTrace<[], TotalSupplyCallObject>;
|
|
81
|
+
export interface TransferCallObject {
|
|
82
|
+
recipient: string;
|
|
83
|
+
amount: BigNumber;
|
|
84
|
+
}
|
|
85
|
+
export declare type TransferCallTrace = TypedCallTrace<[
|
|
86
|
+
string,
|
|
87
|
+
BigNumber
|
|
88
|
+
], TransferCallObject>;
|
|
89
|
+
export interface TransferFromCallObject {
|
|
90
|
+
sender: string;
|
|
91
|
+
recipient: string;
|
|
92
|
+
amount: BigNumber;
|
|
93
|
+
}
|
|
94
|
+
export declare type TransferFromCallTrace = TypedCallTrace<[
|
|
95
|
+
string,
|
|
96
|
+
string,
|
|
97
|
+
BigNumber
|
|
98
|
+
], TransferFromCallObject>;
|
|
99
|
+
export interface TransferOwnershipCallObject {
|
|
100
|
+
newOwner: string;
|
|
101
|
+
}
|
|
102
|
+
export declare type TransferOwnershipCallTrace = TypedCallTrace<[
|
|
103
|
+
string
|
|
104
|
+
], TransferOwnershipCallObject>;
|
|
7
105
|
export declare class ERC20ContractView extends ContractView<ERC20> {
|
|
8
106
|
constructor(contract: ERC20);
|
|
9
|
-
allowance(owner: PromiseOrValue<string>, spender: PromiseOrValue<string>, overrides?: CallOverrides): Promise<
|
|
10
|
-
balanceOf(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<
|
|
107
|
+
allowance(owner: PromiseOrValue<string>, spender: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
|
|
108
|
+
balanceOf(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
|
|
11
109
|
decimals(overrides?: CallOverrides): Promise<number>;
|
|
12
110
|
locker(overrides?: CallOverrides): Promise<string>;
|
|
13
111
|
name(overrides?: CallOverrides): Promise<string>;
|
|
14
112
|
owner(overrides?: CallOverrides): Promise<string>;
|
|
15
113
|
symbol(overrides?: CallOverrides): Promise<string>;
|
|
16
|
-
totalSupply(overrides?: CallOverrides): Promise<
|
|
114
|
+
totalSupply(overrides?: CallOverrides): Promise<BigNumber>;
|
|
17
115
|
}
|
|
18
116
|
export declare class ERC20BoundContractView extends BoundContractView<ERC20, ERC20ContractView> {
|
|
19
|
-
allowance(owner: PromiseOrValue<string>, spender: PromiseOrValue<string>, overrides?: CallOverrides): Promise<
|
|
20
|
-
balanceOf(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<
|
|
117
|
+
allowance(owner: PromiseOrValue<string>, spender: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
|
|
118
|
+
balanceOf(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
|
|
21
119
|
decimals(overrides?: CallOverrides): Promise<number>;
|
|
22
120
|
locker(overrides?: CallOverrides): Promise<string>;
|
|
23
121
|
name(overrides?: CallOverrides): Promise<string>;
|
|
24
122
|
owner(overrides?: CallOverrides): Promise<string>;
|
|
25
123
|
symbol(overrides?: CallOverrides): Promise<string>;
|
|
26
|
-
totalSupply(overrides?: CallOverrides): Promise<
|
|
124
|
+
totalSupply(overrides?: CallOverrides): Promise<BigNumber>;
|
|
27
125
|
}
|
|
28
126
|
export declare type ERC20Context = Context<ERC20, ERC20BoundContractView>;
|
|
29
127
|
export declare class ERC20ProcessorTemplate extends BaseProcessorTemplate<ERC20, ERC20BoundContractView> {
|
|
30
128
|
bindInternal(options: BindOptions): ERC20Processor;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
export interface DecreaseAllowanceCallTrace extends TypedTrace {
|
|
54
|
-
args: [
|
|
55
|
-
spender: PromiseOrValue<string>,
|
|
56
|
-
subtractedValue: PromiseOrValue<BigNumberish>
|
|
57
|
-
];
|
|
58
|
-
}
|
|
59
|
-
export interface IncreaseAllowanceCallTrace extends TypedTrace {
|
|
60
|
-
args: [
|
|
61
|
-
spender: PromiseOrValue<string>,
|
|
62
|
-
addedValue: PromiseOrValue<BigNumberish>
|
|
63
|
-
];
|
|
64
|
-
}
|
|
65
|
-
export interface LockerCallTrace extends TypedTrace {
|
|
66
|
-
args: [];
|
|
67
|
-
}
|
|
68
|
-
export interface NameCallTrace extends TypedTrace {
|
|
69
|
-
args: [];
|
|
70
|
-
}
|
|
71
|
-
export interface OwnerCallTrace extends TypedTrace {
|
|
72
|
-
args: [];
|
|
73
|
-
}
|
|
74
|
-
export interface RenounceOwnershipCallTrace extends TypedTrace {
|
|
75
|
-
args: [];
|
|
76
|
-
}
|
|
77
|
-
export interface SetLockerCallTrace extends TypedTrace {
|
|
78
|
-
args: [_locker: PromiseOrValue<string>];
|
|
79
|
-
}
|
|
80
|
-
export interface SymbolCallTrace extends TypedTrace {
|
|
81
|
-
args: [];
|
|
82
|
-
}
|
|
83
|
-
export interface TotalSupplyCallTrace extends TypedTrace {
|
|
84
|
-
args: [];
|
|
85
|
-
}
|
|
86
|
-
export interface TransferCallTrace extends TypedTrace {
|
|
87
|
-
args: [
|
|
88
|
-
recipient: PromiseOrValue<string>,
|
|
89
|
-
amount: PromiseOrValue<BigNumberish>
|
|
90
|
-
];
|
|
91
|
-
}
|
|
92
|
-
export interface TransferFromCallTrace extends TypedTrace {
|
|
93
|
-
args: [
|
|
94
|
-
sender: PromiseOrValue<string>,
|
|
95
|
-
recipient: PromiseOrValue<string>,
|
|
96
|
-
amount: PromiseOrValue<BigNumberish>
|
|
97
|
-
];
|
|
98
|
-
}
|
|
99
|
-
export interface TransferOwnershipCallTrace extends TypedTrace {
|
|
100
|
-
args: [newOwner: PromiseOrValue<string>];
|
|
129
|
+
onEventApproval(handler: (event: ApprovalEvent, ctx: ERC20Context) => void, filter?: ApprovalEventFilter | ApprovalEventFilter[]): this;
|
|
130
|
+
onEventOwnershipTransferred(handler: (event: OwnershipTransferredEvent, ctx: ERC20Context) => void, filter?: OwnershipTransferredEventFilter | OwnershipTransferredEventFilter[]): this;
|
|
131
|
+
onEventTransfer(handler: (event: TransferEvent, ctx: ERC20Context) => void, filter?: TransferEventFilter | TransferEventFilter[]): this;
|
|
132
|
+
onCallAllowance(handler: (call: AllowanceCallTrace, ctx: ERC20Context) => void): this;
|
|
133
|
+
onCallApprove(handler: (call: ApproveCallTrace, ctx: ERC20Context) => void): this;
|
|
134
|
+
onCallBalanceOf(handler: (call: BalanceOfCallTrace, ctx: ERC20Context) => void): this;
|
|
135
|
+
onCallBurn(handler: (call: BurnCallTrace, ctx: ERC20Context) => void): this;
|
|
136
|
+
onCallBurnFrom(handler: (call: BurnFromCallTrace, ctx: ERC20Context) => void): this;
|
|
137
|
+
onCallDecimals(handler: (call: DecimalsCallTrace, ctx: ERC20Context) => void): this;
|
|
138
|
+
onCallDecreaseAllowance(handler: (call: DecreaseAllowanceCallTrace, ctx: ERC20Context) => void): this;
|
|
139
|
+
onCallIncreaseAllowance(handler: (call: IncreaseAllowanceCallTrace, ctx: ERC20Context) => void): this;
|
|
140
|
+
onCallLocker(handler: (call: LockerCallTrace, ctx: ERC20Context) => void): this;
|
|
141
|
+
onCallName(handler: (call: NameCallTrace, ctx: ERC20Context) => void): this;
|
|
142
|
+
onCallOwner(handler: (call: OwnerCallTrace, ctx: ERC20Context) => void): this;
|
|
143
|
+
onCallRenounceOwnership(handler: (call: RenounceOwnershipCallTrace, ctx: ERC20Context) => void): this;
|
|
144
|
+
onCallSetLocker(handler: (call: SetLockerCallTrace, ctx: ERC20Context) => void): this;
|
|
145
|
+
onCallSymbol(handler: (call: SymbolCallTrace, ctx: ERC20Context) => void): this;
|
|
146
|
+
onCallTotalSupply(handler: (call: TotalSupplyCallTrace, ctx: ERC20Context) => void): this;
|
|
147
|
+
onCallTransfer(handler: (call: TransferCallTrace, ctx: ERC20Context) => void): this;
|
|
148
|
+
onCallTransferFrom(handler: (call: TransferFromCallTrace, ctx: ERC20Context) => void): this;
|
|
149
|
+
onCallTransferOwnership(handler: (call: TransferOwnershipCallTrace, ctx: ERC20Context) => void): this;
|
|
101
150
|
}
|
|
102
151
|
export declare class ERC20Processor extends BaseProcessor<ERC20, ERC20BoundContractView> {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
152
|
+
onEventApproval(handler: (event: ApprovalEvent, ctx: ERC20Context) => void, filter?: ApprovalEventFilter | ApprovalEventFilter[]): this;
|
|
153
|
+
onEventOwnershipTransferred(handler: (event: OwnershipTransferredEvent, ctx: ERC20Context) => void, filter?: OwnershipTransferredEventFilter | OwnershipTransferredEventFilter[]): this;
|
|
154
|
+
onEventTransfer(handler: (event: TransferEvent, ctx: ERC20Context) => void, filter?: TransferEventFilter | TransferEventFilter[]): this;
|
|
155
|
+
onCallAllowance(handler: (call: AllowanceCallTrace, ctx: ERC20Context) => void): this;
|
|
156
|
+
onCallApprove(handler: (call: ApproveCallTrace, ctx: ERC20Context) => void): this;
|
|
157
|
+
onCallBalanceOf(handler: (call: BalanceOfCallTrace, ctx: ERC20Context) => void): this;
|
|
158
|
+
onCallBurn(handler: (call: BurnCallTrace, ctx: ERC20Context) => void): this;
|
|
159
|
+
onCallBurnFrom(handler: (call: BurnFromCallTrace, ctx: ERC20Context) => void): this;
|
|
160
|
+
onCallDecimals(handler: (call: DecimalsCallTrace, ctx: ERC20Context) => void): this;
|
|
161
|
+
onCallDecreaseAllowance(handler: (call: DecreaseAllowanceCallTrace, ctx: ERC20Context) => void): this;
|
|
162
|
+
onCallIncreaseAllowance(handler: (call: IncreaseAllowanceCallTrace, ctx: ERC20Context) => void): this;
|
|
163
|
+
onCallLocker(handler: (call: LockerCallTrace, ctx: ERC20Context) => void): this;
|
|
164
|
+
onCallName(handler: (call: NameCallTrace, ctx: ERC20Context) => void): this;
|
|
165
|
+
onCallOwner(handler: (call: OwnerCallTrace, ctx: ERC20Context) => void): this;
|
|
166
|
+
onCallRenounceOwnership(handler: (call: RenounceOwnershipCallTrace, ctx: ERC20Context) => void): this;
|
|
167
|
+
onCallSetLocker(handler: (call: SetLockerCallTrace, ctx: ERC20Context) => void): this;
|
|
168
|
+
onCallSymbol(handler: (call: SymbolCallTrace, ctx: ERC20Context) => void): this;
|
|
169
|
+
onCallTotalSupply(handler: (call: TotalSupplyCallTrace, ctx: ERC20Context) => void): this;
|
|
170
|
+
onCallTransfer(handler: (call: TransferCallTrace, ctx: ERC20Context) => void): this;
|
|
171
|
+
onCallTransferFrom(handler: (call: TransferFromCallTrace, ctx: ERC20Context) => void): this;
|
|
172
|
+
onCallTransferOwnership(handler: (call: TransferOwnershipCallTrace, ctx: ERC20Context) => void): this;
|
|
124
173
|
static filters: {
|
|
125
174
|
"Approval(address,address,uint256)"(owner?: PromiseOrValue<string> | null | undefined, spender?: PromiseOrValue<string> | null | undefined, value?: null | undefined): ApprovalEventFilter;
|
|
126
175
|
Approval(owner?: PromiseOrValue<string> | null | undefined, spender?: PromiseOrValue<string> | null | undefined, value?: null | undefined): ApprovalEventFilter;
|
|
@@ -275,98 +275,152 @@ class ERC20ProcessorTemplate extends sdk_1.BaseProcessorTemplate {
|
|
|
275
275
|
}
|
|
276
276
|
return processor;
|
|
277
277
|
}
|
|
278
|
-
|
|
278
|
+
onEventApproval(handler, filter) {
|
|
279
279
|
if (!filter) {
|
|
280
280
|
filter = ERC20Processor.filters["Approval(address,address,uint256)"](null, null, null);
|
|
281
281
|
}
|
|
282
282
|
return super.onEvent(handler, filter);
|
|
283
283
|
}
|
|
284
|
-
|
|
284
|
+
onEventOwnershipTransferred(handler, filter) {
|
|
285
285
|
if (!filter) {
|
|
286
286
|
filter = ERC20Processor.filters["OwnershipTransferred(address,address)"](null, null);
|
|
287
287
|
}
|
|
288
288
|
return super.onEvent(handler, filter);
|
|
289
289
|
}
|
|
290
|
-
|
|
290
|
+
onEventTransfer(handler, filter) {
|
|
291
291
|
if (!filter) {
|
|
292
292
|
filter = ERC20Processor.filters["Transfer(address,address,uint256)"](null, null, null);
|
|
293
293
|
}
|
|
294
294
|
return super.onEvent(handler, filter);
|
|
295
295
|
}
|
|
296
|
+
onCallAllowance(handler) {
|
|
297
|
+
return super.onTrace("0xdd62ed3e", handler);
|
|
298
|
+
}
|
|
299
|
+
onCallApprove(handler) {
|
|
300
|
+
return super.onTrace("0x095ea7b3", handler);
|
|
301
|
+
}
|
|
302
|
+
onCallBalanceOf(handler) {
|
|
303
|
+
return super.onTrace("0x70a08231", handler);
|
|
304
|
+
}
|
|
305
|
+
onCallBurn(handler) {
|
|
306
|
+
return super.onTrace("0x42966c68", handler);
|
|
307
|
+
}
|
|
308
|
+
onCallBurnFrom(handler) {
|
|
309
|
+
return super.onTrace("0x79cc6790", handler);
|
|
310
|
+
}
|
|
311
|
+
onCallDecimals(handler) {
|
|
312
|
+
return super.onTrace("0x313ce567", handler);
|
|
313
|
+
}
|
|
314
|
+
onCallDecreaseAllowance(handler) {
|
|
315
|
+
return super.onTrace("0xa457c2d7", handler);
|
|
316
|
+
}
|
|
317
|
+
onCallIncreaseAllowance(handler) {
|
|
318
|
+
return super.onTrace("0x39509351", handler);
|
|
319
|
+
}
|
|
320
|
+
onCallLocker(handler) {
|
|
321
|
+
return super.onTrace("0xd7b96d4e", handler);
|
|
322
|
+
}
|
|
323
|
+
onCallName(handler) {
|
|
324
|
+
return super.onTrace("0x06fdde03", handler);
|
|
325
|
+
}
|
|
326
|
+
onCallOwner(handler) {
|
|
327
|
+
return super.onTrace("0x8da5cb5b", handler);
|
|
328
|
+
}
|
|
329
|
+
onCallRenounceOwnership(handler) {
|
|
330
|
+
return super.onTrace("0x715018a6", handler);
|
|
331
|
+
}
|
|
332
|
+
onCallSetLocker(handler) {
|
|
333
|
+
return super.onTrace("0x171060ec", handler);
|
|
334
|
+
}
|
|
335
|
+
onCallSymbol(handler) {
|
|
336
|
+
return super.onTrace("0x95d89b41", handler);
|
|
337
|
+
}
|
|
338
|
+
onCallTotalSupply(handler) {
|
|
339
|
+
return super.onTrace("0x18160ddd", handler);
|
|
340
|
+
}
|
|
341
|
+
onCallTransfer(handler) {
|
|
342
|
+
return super.onTrace("0xa9059cbb", handler);
|
|
343
|
+
}
|
|
344
|
+
onCallTransferFrom(handler) {
|
|
345
|
+
return super.onTrace("0x23b872dd", handler);
|
|
346
|
+
}
|
|
347
|
+
onCallTransferOwnership(handler) {
|
|
348
|
+
return super.onTrace("0xf2fde38b", handler);
|
|
349
|
+
}
|
|
296
350
|
}
|
|
297
351
|
exports.ERC20ProcessorTemplate = ERC20ProcessorTemplate;
|
|
298
352
|
class ERC20Processor extends sdk_1.BaseProcessor {
|
|
299
|
-
|
|
353
|
+
onEventApproval(handler, filter) {
|
|
300
354
|
if (!filter) {
|
|
301
355
|
filter = ERC20Processor.filters["Approval(address,address,uint256)"](null, null, null);
|
|
302
356
|
}
|
|
303
357
|
return super.onEvent(handler, filter);
|
|
304
358
|
}
|
|
305
|
-
|
|
359
|
+
onEventOwnershipTransferred(handler, filter) {
|
|
306
360
|
if (!filter) {
|
|
307
361
|
filter = ERC20Processor.filters["OwnershipTransferred(address,address)"](null, null);
|
|
308
362
|
}
|
|
309
363
|
return super.onEvent(handler, filter);
|
|
310
364
|
}
|
|
311
|
-
|
|
365
|
+
onEventTransfer(handler, filter) {
|
|
312
366
|
if (!filter) {
|
|
313
367
|
filter = ERC20Processor.filters["Transfer(address,address,uint256)"](null, null, null);
|
|
314
368
|
}
|
|
315
369
|
return super.onEvent(handler, filter);
|
|
316
370
|
}
|
|
317
|
-
|
|
318
|
-
return super.onTrace("
|
|
371
|
+
onCallAllowance(handler) {
|
|
372
|
+
return super.onTrace("0xdd62ed3e", handler);
|
|
319
373
|
}
|
|
320
|
-
|
|
321
|
-
return super.onTrace("
|
|
374
|
+
onCallApprove(handler) {
|
|
375
|
+
return super.onTrace("0x095ea7b3", handler);
|
|
322
376
|
}
|
|
323
|
-
|
|
324
|
-
return super.onTrace("
|
|
377
|
+
onCallBalanceOf(handler) {
|
|
378
|
+
return super.onTrace("0x70a08231", handler);
|
|
325
379
|
}
|
|
326
|
-
|
|
327
|
-
return super.onTrace("
|
|
380
|
+
onCallBurn(handler) {
|
|
381
|
+
return super.onTrace("0x42966c68", handler);
|
|
328
382
|
}
|
|
329
|
-
|
|
330
|
-
return super.onTrace("
|
|
383
|
+
onCallBurnFrom(handler) {
|
|
384
|
+
return super.onTrace("0x79cc6790", handler);
|
|
331
385
|
}
|
|
332
|
-
|
|
333
|
-
return super.onTrace("
|
|
386
|
+
onCallDecimals(handler) {
|
|
387
|
+
return super.onTrace("0x313ce567", handler);
|
|
334
388
|
}
|
|
335
|
-
|
|
336
|
-
return super.onTrace("
|
|
389
|
+
onCallDecreaseAllowance(handler) {
|
|
390
|
+
return super.onTrace("0xa457c2d7", handler);
|
|
337
391
|
}
|
|
338
|
-
|
|
339
|
-
return super.onTrace("
|
|
392
|
+
onCallIncreaseAllowance(handler) {
|
|
393
|
+
return super.onTrace("0x39509351", handler);
|
|
340
394
|
}
|
|
341
|
-
|
|
342
|
-
return super.onTrace("
|
|
395
|
+
onCallLocker(handler) {
|
|
396
|
+
return super.onTrace("0xd7b96d4e", handler);
|
|
343
397
|
}
|
|
344
|
-
|
|
345
|
-
return super.onTrace("
|
|
398
|
+
onCallName(handler) {
|
|
399
|
+
return super.onTrace("0x06fdde03", handler);
|
|
346
400
|
}
|
|
347
|
-
|
|
348
|
-
return super.onTrace("
|
|
401
|
+
onCallOwner(handler) {
|
|
402
|
+
return super.onTrace("0x8da5cb5b", handler);
|
|
349
403
|
}
|
|
350
|
-
|
|
351
|
-
return super.onTrace("
|
|
404
|
+
onCallRenounceOwnership(handler) {
|
|
405
|
+
return super.onTrace("0x715018a6", handler);
|
|
352
406
|
}
|
|
353
|
-
|
|
354
|
-
return super.onTrace("
|
|
407
|
+
onCallSetLocker(handler) {
|
|
408
|
+
return super.onTrace("0x171060ec", handler);
|
|
355
409
|
}
|
|
356
|
-
|
|
357
|
-
return super.onTrace("
|
|
410
|
+
onCallSymbol(handler) {
|
|
411
|
+
return super.onTrace("0x95d89b41", handler);
|
|
358
412
|
}
|
|
359
|
-
|
|
360
|
-
return super.onTrace("
|
|
413
|
+
onCallTotalSupply(handler) {
|
|
414
|
+
return super.onTrace("0x18160ddd", handler);
|
|
361
415
|
}
|
|
362
|
-
|
|
363
|
-
return super.onTrace("
|
|
416
|
+
onCallTransfer(handler) {
|
|
417
|
+
return super.onTrace("0xa9059cbb", handler);
|
|
364
418
|
}
|
|
365
|
-
|
|
366
|
-
return super.onTrace("
|
|
419
|
+
onCallTransferFrom(handler) {
|
|
420
|
+
return super.onTrace("0x23b872dd", handler);
|
|
367
421
|
}
|
|
368
|
-
|
|
369
|
-
return super.onTrace("
|
|
422
|
+
onCallTransferOwnership(handler) {
|
|
423
|
+
return super.onTrace("0xf2fde38b", handler);
|
|
370
424
|
}
|
|
371
425
|
static filters = templateContract.filters;
|
|
372
426
|
CreateBoundContractView() {
|