@sentio/sdk 2.40.0-rc.3 → 2.40.0-rc.31
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/aptos/aptos-processor.d.ts +1 -1
- package/lib/aptos/aptos-processor.d.ts.map +1 -1
- package/lib/aptos/aptos-processor.js +1 -1
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/aptos/context.d.ts +2 -2
- package/lib/aptos/context.d.ts.map +1 -1
- package/lib/aptos/context.js +1 -1
- package/lib/aptos/ext/aptos-dex.d.ts +1 -1
- package/lib/aptos/ext/aptos-dex.d.ts.map +1 -1
- package/lib/aptos/ext/aptos-dex.js +1 -1
- package/lib/aptos/ext/aptos-dex.js.map +1 -1
- package/lib/aptos/ext/coin-event.d.ts +1 -1
- package/lib/aptos/ext/coin-event.d.ts.map +1 -1
- package/lib/aptos/ext/coin.js +2 -2
- package/lib/aptos/ext/coin.js.map +1 -1
- package/lib/eth/account-processor.d.ts +21 -7
- package/lib/eth/account-processor.d.ts.map +1 -1
- package/lib/eth/account-processor.js +2 -2
- package/lib/eth/account-processor.js.map +1 -1
- package/lib/eth/base-processor-template.d.ts +24 -8
- package/lib/eth/base-processor-template.d.ts.map +1 -1
- package/lib/eth/base-processor-template.js.map +1 -1
- package/lib/eth/base-processor.d.ts +30 -10
- package/lib/eth/base-processor.d.ts.map +1 -1
- package/lib/eth/base-processor.js +6 -6
- package/lib/eth/base-processor.js.map +1 -1
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +100 -31
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +1295 -46
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.d.ts +55 -16
- package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.js +510 -16
- package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.d.ts +79 -24
- package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.js +1039 -36
- package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.d.ts +46 -13
- package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.js +512 -18
- package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.d.ts +67 -20
- package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.js +826 -28
- package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.d.ts +64 -19
- package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.js +607 -22
- package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
- package/lib/eth/codegen/event-handler.js +1 -1
- package/lib/eth/codegen/file.d.ts.map +1 -1
- package/lib/eth/codegen/file.js +21 -3
- package/lib/eth/codegen/file.js.map +1 -1
- package/lib/eth/codegen/function-calls.d.ts +4 -0
- package/lib/eth/codegen/function-calls.d.ts.map +1 -1
- package/lib/eth/codegen/function-calls.js +83 -5
- package/lib/eth/codegen/function-calls.js.map +1 -1
- package/lib/eth/codegen/types.d.ts +1 -0
- package/lib/eth/codegen/types.d.ts.map +1 -1
- package/lib/eth/codegen/types.js +13 -0
- package/lib/eth/codegen/types.js.map +1 -1
- package/lib/eth/context.d.ts +4 -0
- package/lib/eth/context.d.ts.map +1 -1
- package/lib/eth/context.js +4 -0
- package/lib/eth/context.js.map +1 -1
- package/lib/eth/eth-plugin.d.ts +27 -9
- package/lib/eth/eth-plugin.d.ts.map +1 -1
- package/lib/eth/eth-plugin.js +20 -17
- package/lib/eth/eth-plugin.js.map +1 -1
- package/lib/eth/eth.d.ts.map +1 -1
- package/lib/eth/eth.js +1 -1
- package/lib/eth/eth.js.map +1 -1
- package/lib/eth/generic-processor.js +1 -1
- package/lib/eth/generic-processor.js.map +1 -1
- package/lib/eth/generic-processor.test.js.map +1 -1
- package/lib/eth/index.d.ts +2 -1
- package/lib/eth/index.d.ts.map +1 -1
- package/lib/eth/index.js +2 -1
- package/lib/eth/index.js.map +1 -1
- package/lib/solana/builtin/spl-token-processor.d.ts +1 -1
- package/lib/solana/builtin/spl-token-processor.d.ts.map +1 -1
- package/lib/solana/builtin/spl-token-processor.js +1 -1
- package/lib/solana/builtin/spl-token-processor.js.map +1 -1
- package/lib/solana/solana-context.d.ts +1 -1
- package/lib/solana/solana-context.js +2 -2
- package/lib/store/cache.d.ts +14 -0
- package/lib/store/cache.d.ts.map +1 -0
- package/lib/store/cache.js +35 -0
- package/lib/store/cache.js.map +1 -0
- package/lib/store/store.d.ts +2 -3
- package/lib/store/store.d.ts.map +1 -1
- package/lib/store/store.js +34 -9
- package/lib/store/store.js.map +1 -1
- package/lib/sui/context.d.ts +1 -1
- package/lib/sui/context.d.ts.map +1 -1
- package/lib/sui/sui-processor.d.ts +1 -1
- package/lib/sui/sui-processor.d.ts.map +1 -1
- package/lib/sui/sui-processor.js +1 -1
- package/lib/sui/sui-processor.js.map +1 -1
- package/lib/testing/aptos-facet.d.ts +1 -1
- package/lib/testing/aptos-facet.js +2 -2
- package/lib/testing/sui-facet.js +1 -1
- package/lib/utils/dex-price.d.ts +1 -0
- package/lib/utils/dex-price.d.ts.map +1 -1
- package/lib/utils/dex-price.js +13 -2
- package/lib/utils/dex-price.js.map +1 -1
- package/package.json +8 -7
- package/src/aptos/aptos-processor.ts +1 -1
- package/src/aptos/context.ts +2 -2
- package/src/aptos/ext/aptos-dex.ts +1 -1
- package/src/aptos/ext/coin-event.ts +1 -1
- package/src/aptos/ext/coin.ts +2 -2
- package/src/eth/account-processor.ts +28 -12
- package/src/eth/base-processor-template.ts +16 -8
- package/src/eth/base-processor.ts +25 -16
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +1643 -123
- package/src/eth/builtin/internal/erc1155-processor.ts +724 -42
- package/src/eth/builtin/internal/erc20-processor.ts +1368 -90
- package/src/eth/builtin/internal/erc20bytes-processor.ts +685 -49
- package/src/eth/builtin/internal/erc721-processor.ts +1116 -70
- package/src/eth/builtin/internal/weth9-processor.ts +798 -63
- package/src/eth/codegen/event-handler.ts +1 -1
- package/src/eth/codegen/file.ts +26 -3
- package/src/eth/codegen/function-calls.ts +101 -8
- package/src/eth/codegen/types.ts +22 -1
- package/src/eth/context.ts +7 -0
- package/src/eth/eth-plugin.ts +34 -26
- package/src/eth/eth.ts +1 -2
- package/src/eth/generic-processor.ts +1 -1
- package/src/eth/index.ts +5 -1
- package/src/solana/builtin/spl-token-processor.ts +1 -1
- package/src/solana/solana-context.ts +2 -2
- package/src/store/cache.ts +46 -0
- package/src/store/store.ts +40 -22
- package/src/sui/context.ts +1 -1
- package/src/sui/sui-processor.ts +1 -1
- package/src/testing/aptos-facet.ts +2 -2
- package/src/testing/sui-facet.ts +1 -1
- package/src/utils/dex-price.ts +15 -2
- package/lib/eth/provider.d.ts +0 -5
- package/lib/eth/provider.d.ts.map +0 -1
- package/lib/eth/provider.js +0 -134
- package/lib/eth/provider.js.map +0 -1
- package/lib/utils/chainlink-oracles-sepolia.csv +0 -19
- package/lib/utils/chainlink-oracles.csv +0 -217
- package/src/eth/provider.ts +0 -163
@@ -1,7 +1,7 @@
|
|
1
1
|
/* Autogenerated file. Do not edit manually. */
|
2
2
|
/* tslint:disable */
|
3
3
|
/* eslint-disable */
|
4
|
-
import { BigNumberish, Overrides } from "ethers";
|
4
|
+
import { BigNumberish, Overrides, Interface } from "ethers";
|
5
5
|
import {
|
6
6
|
addContractByABI,
|
7
7
|
getContractByABI,
|
@@ -21,7 +21,9 @@ import {
|
|
21
21
|
EthContext,
|
22
22
|
EthFetchConfig,
|
23
23
|
PreprocessResult,
|
24
|
+
makeEthCallKey,
|
24
25
|
} from "@sentio/sdk/eth";
|
26
|
+
import { EthCallParam, EthCallContext, PreparedData } from "@sentio/protos";
|
25
27
|
|
26
28
|
import { ERC20__factory } from "./index.js";
|
27
29
|
import {
|
@@ -174,9 +176,38 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
174
176
|
async allowance(
|
175
177
|
owner: string,
|
176
178
|
spender: string,
|
177
|
-
overrides?: Overrides
|
179
|
+
overrides?: Overrides,
|
180
|
+
preparedData?: PreparedData,
|
181
|
+
ethCallContext?: EthCallContext
|
178
182
|
): Promise<bigint> {
|
179
183
|
try {
|
184
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
185
|
+
const iface = new Interface([
|
186
|
+
"function allowance(address,address) view returns (uint256)",
|
187
|
+
]);
|
188
|
+
const calldata = iface.encodeFunctionData("allowance", [
|
189
|
+
owner,
|
190
|
+
spender,
|
191
|
+
]);
|
192
|
+
const key = makeEthCallKey({
|
193
|
+
context: ethCallContext,
|
194
|
+
calldata,
|
195
|
+
});
|
196
|
+
console.debug("looking up eth call key:", key);
|
197
|
+
const ret = preparedData.ethCallResults[key];
|
198
|
+
if (ret) {
|
199
|
+
console.debug("prepared eth call found:", key);
|
200
|
+
const result = iface.decodeFunctionResult("allowance", ret).toArray();
|
201
|
+
return result.length == 1 ? result[0] : result;
|
202
|
+
}
|
203
|
+
console.debug(
|
204
|
+
"missing eth call key:",
|
205
|
+
"allowance",
|
206
|
+
owner,
|
207
|
+
spender,
|
208
|
+
key
|
209
|
+
);
|
210
|
+
}
|
180
211
|
return await this.contract.getFunction("allowance(address,address)")(
|
181
212
|
owner,
|
182
213
|
spender,
|
@@ -188,8 +219,31 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
188
219
|
}
|
189
220
|
}
|
190
221
|
|
191
|
-
async balanceOf(
|
222
|
+
async balanceOf(
|
223
|
+
account: string,
|
224
|
+
overrides?: Overrides,
|
225
|
+
preparedData?: PreparedData,
|
226
|
+
ethCallContext?: EthCallContext
|
227
|
+
): Promise<bigint> {
|
192
228
|
try {
|
229
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
230
|
+
const iface = new Interface([
|
231
|
+
"function balanceOf(address) view returns (uint256)",
|
232
|
+
]);
|
233
|
+
const calldata = iface.encodeFunctionData("balanceOf", [account]);
|
234
|
+
const key = makeEthCallKey({
|
235
|
+
context: ethCallContext,
|
236
|
+
calldata,
|
237
|
+
});
|
238
|
+
console.debug("looking up eth call key:", key);
|
239
|
+
const ret = preparedData.ethCallResults[key];
|
240
|
+
if (ret) {
|
241
|
+
console.debug("prepared eth call found:", key);
|
242
|
+
const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
|
243
|
+
return result.length == 1 ? result[0] : result;
|
244
|
+
}
|
245
|
+
console.debug("missing eth call key:", "balanceOf", account, key);
|
246
|
+
}
|
193
247
|
return await this.contract.getFunction("balanceOf(address)")(
|
194
248
|
account,
|
195
249
|
overrides || {}
|
@@ -200,8 +254,30 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
200
254
|
}
|
201
255
|
}
|
202
256
|
|
203
|
-
async decimals(
|
257
|
+
async decimals(
|
258
|
+
overrides?: Overrides,
|
259
|
+
preparedData?: PreparedData,
|
260
|
+
ethCallContext?: EthCallContext
|
261
|
+
): Promise<bigint> {
|
204
262
|
try {
|
263
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
264
|
+
const iface = new Interface([
|
265
|
+
"function decimals() view returns (uint8)",
|
266
|
+
]);
|
267
|
+
const calldata = iface.encodeFunctionData("decimals", []);
|
268
|
+
const key = makeEthCallKey({
|
269
|
+
context: ethCallContext,
|
270
|
+
calldata,
|
271
|
+
});
|
272
|
+
console.debug("looking up eth call key:", key);
|
273
|
+
const ret = preparedData.ethCallResults[key];
|
274
|
+
if (ret) {
|
275
|
+
console.debug("prepared eth call found:", key);
|
276
|
+
const result = iface.decodeFunctionResult("decimals", ret).toArray();
|
277
|
+
return result.length == 1 ? result[0] : result;
|
278
|
+
}
|
279
|
+
console.debug("missing eth call key:", "decimals", key);
|
280
|
+
}
|
205
281
|
return await this.contract.getFunction("decimals()")(overrides || {});
|
206
282
|
} catch (e) {
|
207
283
|
const stack = new Error().stack;
|
@@ -209,8 +285,30 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
209
285
|
}
|
210
286
|
}
|
211
287
|
|
212
|
-
async locker(
|
288
|
+
async locker(
|
289
|
+
overrides?: Overrides,
|
290
|
+
preparedData?: PreparedData,
|
291
|
+
ethCallContext?: EthCallContext
|
292
|
+
): Promise<string> {
|
213
293
|
try {
|
294
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
295
|
+
const iface = new Interface([
|
296
|
+
"function locker() view returns (address)",
|
297
|
+
]);
|
298
|
+
const calldata = iface.encodeFunctionData("locker", []);
|
299
|
+
const key = makeEthCallKey({
|
300
|
+
context: ethCallContext,
|
301
|
+
calldata,
|
302
|
+
});
|
303
|
+
console.debug("looking up eth call key:", key);
|
304
|
+
const ret = preparedData.ethCallResults[key];
|
305
|
+
if (ret) {
|
306
|
+
console.debug("prepared eth call found:", key);
|
307
|
+
const result = iface.decodeFunctionResult("locker", ret).toArray();
|
308
|
+
return result.length == 1 ? result[0] : result;
|
309
|
+
}
|
310
|
+
console.debug("missing eth call key:", "locker", key);
|
311
|
+
}
|
214
312
|
return await this.contract.getFunction("locker()")(overrides || {});
|
215
313
|
} catch (e) {
|
216
314
|
const stack = new Error().stack;
|
@@ -218,8 +316,28 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
218
316
|
}
|
219
317
|
}
|
220
318
|
|
221
|
-
async name(
|
319
|
+
async name(
|
320
|
+
overrides?: Overrides,
|
321
|
+
preparedData?: PreparedData,
|
322
|
+
ethCallContext?: EthCallContext
|
323
|
+
): Promise<string> {
|
222
324
|
try {
|
325
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
326
|
+
const iface = new Interface(["function name() view returns (string)"]);
|
327
|
+
const calldata = iface.encodeFunctionData("name", []);
|
328
|
+
const key = makeEthCallKey({
|
329
|
+
context: ethCallContext,
|
330
|
+
calldata,
|
331
|
+
});
|
332
|
+
console.debug("looking up eth call key:", key);
|
333
|
+
const ret = preparedData.ethCallResults[key];
|
334
|
+
if (ret) {
|
335
|
+
console.debug("prepared eth call found:", key);
|
336
|
+
const result = iface.decodeFunctionResult("name", ret).toArray();
|
337
|
+
return result.length == 1 ? result[0] : result;
|
338
|
+
}
|
339
|
+
console.debug("missing eth call key:", "name", key);
|
340
|
+
}
|
223
341
|
return await this.contract.getFunction("name()")(overrides || {});
|
224
342
|
} catch (e) {
|
225
343
|
const stack = new Error().stack;
|
@@ -227,8 +345,30 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
227
345
|
}
|
228
346
|
}
|
229
347
|
|
230
|
-
async owner(
|
348
|
+
async owner(
|
349
|
+
overrides?: Overrides,
|
350
|
+
preparedData?: PreparedData,
|
351
|
+
ethCallContext?: EthCallContext
|
352
|
+
): Promise<string> {
|
231
353
|
try {
|
354
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
355
|
+
const iface = new Interface([
|
356
|
+
"function owner() view returns (address)",
|
357
|
+
]);
|
358
|
+
const calldata = iface.encodeFunctionData("owner", []);
|
359
|
+
const key = makeEthCallKey({
|
360
|
+
context: ethCallContext,
|
361
|
+
calldata,
|
362
|
+
});
|
363
|
+
console.debug("looking up eth call key:", key);
|
364
|
+
const ret = preparedData.ethCallResults[key];
|
365
|
+
if (ret) {
|
366
|
+
console.debug("prepared eth call found:", key);
|
367
|
+
const result = iface.decodeFunctionResult("owner", ret).toArray();
|
368
|
+
return result.length == 1 ? result[0] : result;
|
369
|
+
}
|
370
|
+
console.debug("missing eth call key:", "owner", key);
|
371
|
+
}
|
232
372
|
return await this.contract.getFunction("owner()")(overrides || {});
|
233
373
|
} catch (e) {
|
234
374
|
const stack = new Error().stack;
|
@@ -236,8 +376,30 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
236
376
|
}
|
237
377
|
}
|
238
378
|
|
239
|
-
async symbol(
|
379
|
+
async symbol(
|
380
|
+
overrides?: Overrides,
|
381
|
+
preparedData?: PreparedData,
|
382
|
+
ethCallContext?: EthCallContext
|
383
|
+
): Promise<string> {
|
240
384
|
try {
|
385
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
386
|
+
const iface = new Interface([
|
387
|
+
"function symbol() view returns (string)",
|
388
|
+
]);
|
389
|
+
const calldata = iface.encodeFunctionData("symbol", []);
|
390
|
+
const key = makeEthCallKey({
|
391
|
+
context: ethCallContext,
|
392
|
+
calldata,
|
393
|
+
});
|
394
|
+
console.debug("looking up eth call key:", key);
|
395
|
+
const ret = preparedData.ethCallResults[key];
|
396
|
+
if (ret) {
|
397
|
+
console.debug("prepared eth call found:", key);
|
398
|
+
const result = iface.decodeFunctionResult("symbol", ret).toArray();
|
399
|
+
return result.length == 1 ? result[0] : result;
|
400
|
+
}
|
401
|
+
console.debug("missing eth call key:", "symbol", key);
|
402
|
+
}
|
241
403
|
return await this.contract.getFunction("symbol()")(overrides || {});
|
242
404
|
} catch (e) {
|
243
405
|
const stack = new Error().stack;
|
@@ -245,8 +407,32 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
245
407
|
}
|
246
408
|
}
|
247
409
|
|
248
|
-
async totalSupply(
|
410
|
+
async totalSupply(
|
411
|
+
overrides?: Overrides,
|
412
|
+
preparedData?: PreparedData,
|
413
|
+
ethCallContext?: EthCallContext
|
414
|
+
): Promise<bigint> {
|
249
415
|
try {
|
416
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
417
|
+
const iface = new Interface([
|
418
|
+
"function totalSupply() view returns (uint256)",
|
419
|
+
]);
|
420
|
+
const calldata = iface.encodeFunctionData("totalSupply", []);
|
421
|
+
const key = makeEthCallKey({
|
422
|
+
context: ethCallContext,
|
423
|
+
calldata,
|
424
|
+
});
|
425
|
+
console.debug("looking up eth call key:", key);
|
426
|
+
const ret = preparedData.ethCallResults[key];
|
427
|
+
if (ret) {
|
428
|
+
console.debug("prepared eth call found:", key);
|
429
|
+
const result = iface
|
430
|
+
.decodeFunctionResult("totalSupply", ret)
|
431
|
+
.toArray();
|
432
|
+
return result.length == 1 ? result[0] : result;
|
433
|
+
}
|
434
|
+
console.debug("missing eth call key:", "totalSupply", key);
|
435
|
+
}
|
250
436
|
return await this.contract.getFunction("totalSupply()")(overrides || {});
|
251
437
|
} catch (e) {
|
252
438
|
const stack = new Error().stack;
|
@@ -260,9 +446,38 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
260
446
|
async approve(
|
261
447
|
spender: string,
|
262
448
|
amount: BigNumberish,
|
263
|
-
overrides?: Overrides
|
449
|
+
overrides?: Overrides,
|
450
|
+
preparedData?: PreparedData,
|
451
|
+
ethCallContext?: EthCallContext
|
264
452
|
): Promise<boolean> {
|
265
453
|
try {
|
454
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
455
|
+
const iface = new Interface([
|
456
|
+
"function approve(address,uint256) nonpayable returns (bool)",
|
457
|
+
]);
|
458
|
+
const calldata = iface.encodeFunctionData("approve", [
|
459
|
+
spender,
|
460
|
+
amount,
|
461
|
+
]);
|
462
|
+
const key = makeEthCallKey({
|
463
|
+
context: ethCallContext,
|
464
|
+
calldata,
|
465
|
+
});
|
466
|
+
console.debug("looking up eth call key:", key);
|
467
|
+
const ret = preparedData.ethCallResults[key];
|
468
|
+
if (ret) {
|
469
|
+
console.debug("prepared eth call found:", key);
|
470
|
+
const result = iface.decodeFunctionResult("approve", ret).toArray();
|
471
|
+
return result.length == 1 ? result[0] : result;
|
472
|
+
}
|
473
|
+
console.debug(
|
474
|
+
"missing eth call key:",
|
475
|
+
"approve",
|
476
|
+
spender,
|
477
|
+
amount,
|
478
|
+
key
|
479
|
+
);
|
480
|
+
}
|
266
481
|
return await this.contract
|
267
482
|
.getFunction("approve(address,uint256)")
|
268
483
|
.staticCall(spender, amount, overrides || {});
|
@@ -271,8 +486,31 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
271
486
|
throw transformEtherError(e, undefined, stack);
|
272
487
|
}
|
273
488
|
},
|
274
|
-
async burn(
|
489
|
+
async burn(
|
490
|
+
amount: BigNumberish,
|
491
|
+
overrides?: Overrides,
|
492
|
+
preparedData?: PreparedData,
|
493
|
+
ethCallContext?: EthCallContext
|
494
|
+
): Promise<void> {
|
275
495
|
try {
|
496
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
497
|
+
const iface = new Interface([
|
498
|
+
"function burn(uint256) nonpayable returns ()",
|
499
|
+
]);
|
500
|
+
const calldata = iface.encodeFunctionData("burn", [amount]);
|
501
|
+
const key = makeEthCallKey({
|
502
|
+
context: ethCallContext,
|
503
|
+
calldata,
|
504
|
+
});
|
505
|
+
console.debug("looking up eth call key:", key);
|
506
|
+
const ret = preparedData.ethCallResults[key];
|
507
|
+
if (ret) {
|
508
|
+
console.debug("prepared eth call found:", key);
|
509
|
+
const result = iface.decodeFunctionResult("burn", ret).toArray();
|
510
|
+
return result.length == 1 ? result[0] : result;
|
511
|
+
}
|
512
|
+
console.debug("missing eth call key:", "burn", amount, key);
|
513
|
+
}
|
276
514
|
return await this.contract
|
277
515
|
.getFunction("burn(uint256)")
|
278
516
|
.staticCall(amount, overrides || {});
|
@@ -284,9 +522,40 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
284
522
|
async burnFrom(
|
285
523
|
account: string,
|
286
524
|
amount: BigNumberish,
|
287
|
-
overrides?: Overrides
|
525
|
+
overrides?: Overrides,
|
526
|
+
preparedData?: PreparedData,
|
527
|
+
ethCallContext?: EthCallContext
|
288
528
|
): Promise<void> {
|
289
529
|
try {
|
530
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
531
|
+
const iface = new Interface([
|
532
|
+
"function burnFrom(address,uint256) nonpayable returns ()",
|
533
|
+
]);
|
534
|
+
const calldata = iface.encodeFunctionData("burnFrom", [
|
535
|
+
account,
|
536
|
+
amount,
|
537
|
+
]);
|
538
|
+
const key = makeEthCallKey({
|
539
|
+
context: ethCallContext,
|
540
|
+
calldata,
|
541
|
+
});
|
542
|
+
console.debug("looking up eth call key:", key);
|
543
|
+
const ret = preparedData.ethCallResults[key];
|
544
|
+
if (ret) {
|
545
|
+
console.debug("prepared eth call found:", key);
|
546
|
+
const result = iface
|
547
|
+
.decodeFunctionResult("burnFrom", ret)
|
548
|
+
.toArray();
|
549
|
+
return result.length == 1 ? result[0] : result;
|
550
|
+
}
|
551
|
+
console.debug(
|
552
|
+
"missing eth call key:",
|
553
|
+
"burnFrom",
|
554
|
+
account,
|
555
|
+
amount,
|
556
|
+
key
|
557
|
+
);
|
558
|
+
}
|
290
559
|
return await this.contract
|
291
560
|
.getFunction("burnFrom(address,uint256)")
|
292
561
|
.staticCall(account, amount, overrides || {});
|
@@ -298,9 +567,40 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
298
567
|
async decreaseAllowance(
|
299
568
|
spender: string,
|
300
569
|
subtractedValue: BigNumberish,
|
301
|
-
overrides?: Overrides
|
570
|
+
overrides?: Overrides,
|
571
|
+
preparedData?: PreparedData,
|
572
|
+
ethCallContext?: EthCallContext
|
302
573
|
): Promise<boolean> {
|
303
574
|
try {
|
575
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
576
|
+
const iface = new Interface([
|
577
|
+
"function decreaseAllowance(address,uint256) nonpayable returns (bool)",
|
578
|
+
]);
|
579
|
+
const calldata = iface.encodeFunctionData("decreaseAllowance", [
|
580
|
+
spender,
|
581
|
+
subtractedValue,
|
582
|
+
]);
|
583
|
+
const key = makeEthCallKey({
|
584
|
+
context: ethCallContext,
|
585
|
+
calldata,
|
586
|
+
});
|
587
|
+
console.debug("looking up eth call key:", key);
|
588
|
+
const ret = preparedData.ethCallResults[key];
|
589
|
+
if (ret) {
|
590
|
+
console.debug("prepared eth call found:", key);
|
591
|
+
const result = iface
|
592
|
+
.decodeFunctionResult("decreaseAllowance", ret)
|
593
|
+
.toArray();
|
594
|
+
return result.length == 1 ? result[0] : result;
|
595
|
+
}
|
596
|
+
console.debug(
|
597
|
+
"missing eth call key:",
|
598
|
+
"decreaseAllowance",
|
599
|
+
spender,
|
600
|
+
subtractedValue,
|
601
|
+
key
|
602
|
+
);
|
603
|
+
}
|
304
604
|
return await this.contract
|
305
605
|
.getFunction("decreaseAllowance(address,uint256)")
|
306
606
|
.staticCall(spender, subtractedValue, overrides || {});
|
@@ -312,9 +612,40 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
312
612
|
async increaseAllowance(
|
313
613
|
spender: string,
|
314
614
|
addedValue: BigNumberish,
|
315
|
-
overrides?: Overrides
|
615
|
+
overrides?: Overrides,
|
616
|
+
preparedData?: PreparedData,
|
617
|
+
ethCallContext?: EthCallContext
|
316
618
|
): Promise<boolean> {
|
317
619
|
try {
|
620
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
621
|
+
const iface = new Interface([
|
622
|
+
"function increaseAllowance(address,uint256) nonpayable returns (bool)",
|
623
|
+
]);
|
624
|
+
const calldata = iface.encodeFunctionData("increaseAllowance", [
|
625
|
+
spender,
|
626
|
+
addedValue,
|
627
|
+
]);
|
628
|
+
const key = makeEthCallKey({
|
629
|
+
context: ethCallContext,
|
630
|
+
calldata,
|
631
|
+
});
|
632
|
+
console.debug("looking up eth call key:", key);
|
633
|
+
const ret = preparedData.ethCallResults[key];
|
634
|
+
if (ret) {
|
635
|
+
console.debug("prepared eth call found:", key);
|
636
|
+
const result = iface
|
637
|
+
.decodeFunctionResult("increaseAllowance", ret)
|
638
|
+
.toArray();
|
639
|
+
return result.length == 1 ? result[0] : result;
|
640
|
+
}
|
641
|
+
console.debug(
|
642
|
+
"missing eth call key:",
|
643
|
+
"increaseAllowance",
|
644
|
+
spender,
|
645
|
+
addedValue,
|
646
|
+
key
|
647
|
+
);
|
648
|
+
}
|
318
649
|
return await this.contract
|
319
650
|
.getFunction("increaseAllowance(address,uint256)")
|
320
651
|
.staticCall(spender, addedValue, overrides || {});
|
@@ -323,8 +654,32 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
323
654
|
throw transformEtherError(e, undefined, stack);
|
324
655
|
}
|
325
656
|
},
|
326
|
-
async renounceOwnership(
|
657
|
+
async renounceOwnership(
|
658
|
+
overrides?: Overrides,
|
659
|
+
preparedData?: PreparedData,
|
660
|
+
ethCallContext?: EthCallContext
|
661
|
+
): Promise<void> {
|
327
662
|
try {
|
663
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
664
|
+
const iface = new Interface([
|
665
|
+
"function renounceOwnership() nonpayable returns ()",
|
666
|
+
]);
|
667
|
+
const calldata = iface.encodeFunctionData("renounceOwnership", []);
|
668
|
+
const key = makeEthCallKey({
|
669
|
+
context: ethCallContext,
|
670
|
+
calldata,
|
671
|
+
});
|
672
|
+
console.debug("looking up eth call key:", key);
|
673
|
+
const ret = preparedData.ethCallResults[key];
|
674
|
+
if (ret) {
|
675
|
+
console.debug("prepared eth call found:", key);
|
676
|
+
const result = iface
|
677
|
+
.decodeFunctionResult("renounceOwnership", ret)
|
678
|
+
.toArray();
|
679
|
+
return result.length == 1 ? result[0] : result;
|
680
|
+
}
|
681
|
+
console.debug("missing eth call key:", "renounceOwnership", key);
|
682
|
+
}
|
328
683
|
return await this.contract
|
329
684
|
.getFunction("renounceOwnership()")
|
330
685
|
.staticCall(overrides || {});
|
@@ -333,8 +688,33 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
333
688
|
throw transformEtherError(e, undefined, stack);
|
334
689
|
}
|
335
690
|
},
|
336
|
-
async setLocker(
|
691
|
+
async setLocker(
|
692
|
+
_locker: string,
|
693
|
+
overrides?: Overrides,
|
694
|
+
preparedData?: PreparedData,
|
695
|
+
ethCallContext?: EthCallContext
|
696
|
+
): Promise<void> {
|
337
697
|
try {
|
698
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
699
|
+
const iface = new Interface([
|
700
|
+
"function setLocker(address) nonpayable returns ()",
|
701
|
+
]);
|
702
|
+
const calldata = iface.encodeFunctionData("setLocker", [_locker]);
|
703
|
+
const key = makeEthCallKey({
|
704
|
+
context: ethCallContext,
|
705
|
+
calldata,
|
706
|
+
});
|
707
|
+
console.debug("looking up eth call key:", key);
|
708
|
+
const ret = preparedData.ethCallResults[key];
|
709
|
+
if (ret) {
|
710
|
+
console.debug("prepared eth call found:", key);
|
711
|
+
const result = iface
|
712
|
+
.decodeFunctionResult("setLocker", ret)
|
713
|
+
.toArray();
|
714
|
+
return result.length == 1 ? result[0] : result;
|
715
|
+
}
|
716
|
+
console.debug("missing eth call key:", "setLocker", _locker, key);
|
717
|
+
}
|
338
718
|
return await this.contract
|
339
719
|
.getFunction("setLocker(address)")
|
340
720
|
.staticCall(_locker, overrides || {});
|
@@ -346,9 +726,40 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
346
726
|
async transfer(
|
347
727
|
recipient: string,
|
348
728
|
amount: BigNumberish,
|
349
|
-
overrides?: Overrides
|
729
|
+
overrides?: Overrides,
|
730
|
+
preparedData?: PreparedData,
|
731
|
+
ethCallContext?: EthCallContext
|
350
732
|
): Promise<boolean> {
|
351
733
|
try {
|
734
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
735
|
+
const iface = new Interface([
|
736
|
+
"function transfer(address,uint256) nonpayable returns (bool)",
|
737
|
+
]);
|
738
|
+
const calldata = iface.encodeFunctionData("transfer", [
|
739
|
+
recipient,
|
740
|
+
amount,
|
741
|
+
]);
|
742
|
+
const key = makeEthCallKey({
|
743
|
+
context: ethCallContext,
|
744
|
+
calldata,
|
745
|
+
});
|
746
|
+
console.debug("looking up eth call key:", key);
|
747
|
+
const ret = preparedData.ethCallResults[key];
|
748
|
+
if (ret) {
|
749
|
+
console.debug("prepared eth call found:", key);
|
750
|
+
const result = iface
|
751
|
+
.decodeFunctionResult("transfer", ret)
|
752
|
+
.toArray();
|
753
|
+
return result.length == 1 ? result[0] : result;
|
754
|
+
}
|
755
|
+
console.debug(
|
756
|
+
"missing eth call key:",
|
757
|
+
"transfer",
|
758
|
+
recipient,
|
759
|
+
amount,
|
760
|
+
key
|
761
|
+
);
|
762
|
+
}
|
352
763
|
return await this.contract
|
353
764
|
.getFunction("transfer(address,uint256)")
|
354
765
|
.staticCall(recipient, amount, overrides || {});
|
@@ -361,9 +772,42 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
361
772
|
sender: string,
|
362
773
|
recipient: string,
|
363
774
|
amount: BigNumberish,
|
364
|
-
overrides?: Overrides
|
775
|
+
overrides?: Overrides,
|
776
|
+
preparedData?: PreparedData,
|
777
|
+
ethCallContext?: EthCallContext
|
365
778
|
): Promise<boolean> {
|
366
779
|
try {
|
780
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
781
|
+
const iface = new Interface([
|
782
|
+
"function transferFrom(address,address,uint256) nonpayable returns (bool)",
|
783
|
+
]);
|
784
|
+
const calldata = iface.encodeFunctionData("transferFrom", [
|
785
|
+
sender,
|
786
|
+
recipient,
|
787
|
+
amount,
|
788
|
+
]);
|
789
|
+
const key = makeEthCallKey({
|
790
|
+
context: ethCallContext,
|
791
|
+
calldata,
|
792
|
+
});
|
793
|
+
console.debug("looking up eth call key:", key);
|
794
|
+
const ret = preparedData.ethCallResults[key];
|
795
|
+
if (ret) {
|
796
|
+
console.debug("prepared eth call found:", key);
|
797
|
+
const result = iface
|
798
|
+
.decodeFunctionResult("transferFrom", ret)
|
799
|
+
.toArray();
|
800
|
+
return result.length == 1 ? result[0] : result;
|
801
|
+
}
|
802
|
+
console.debug(
|
803
|
+
"missing eth call key:",
|
804
|
+
"transferFrom",
|
805
|
+
sender,
|
806
|
+
recipient,
|
807
|
+
amount,
|
808
|
+
key
|
809
|
+
);
|
810
|
+
}
|
367
811
|
return await this.contract
|
368
812
|
.getFunction("transferFrom(address,address,uint256)")
|
369
813
|
.staticCall(sender, recipient, amount, overrides || {});
|
@@ -374,9 +818,38 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
374
818
|
},
|
375
819
|
async transferOwnership(
|
376
820
|
newOwner: string,
|
377
|
-
overrides?: Overrides
|
821
|
+
overrides?: Overrides,
|
822
|
+
preparedData?: PreparedData,
|
823
|
+
ethCallContext?: EthCallContext
|
378
824
|
): Promise<void> {
|
379
825
|
try {
|
826
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
827
|
+
const iface = new Interface([
|
828
|
+
"function transferOwnership(address) nonpayable returns ()",
|
829
|
+
]);
|
830
|
+
const calldata = iface.encodeFunctionData("transferOwnership", [
|
831
|
+
newOwner,
|
832
|
+
]);
|
833
|
+
const key = makeEthCallKey({
|
834
|
+
context: ethCallContext,
|
835
|
+
calldata,
|
836
|
+
});
|
837
|
+
console.debug("looking up eth call key:", key);
|
838
|
+
const ret = preparedData.ethCallResults[key];
|
839
|
+
if (ret) {
|
840
|
+
console.debug("prepared eth call found:", key);
|
841
|
+
const result = iface
|
842
|
+
.decodeFunctionResult("transferOwnership", ret)
|
843
|
+
.toArray();
|
844
|
+
return result.length == 1 ? result[0] : result;
|
845
|
+
}
|
846
|
+
console.debug(
|
847
|
+
"missing eth call key:",
|
848
|
+
"transferOwnership",
|
849
|
+
newOwner,
|
850
|
+
key
|
851
|
+
);
|
852
|
+
}
|
380
853
|
return await this.contract
|
381
854
|
.getFunction("transferOwnership(address)")
|
382
855
|
.staticCall(newOwner, overrides || {});
|
@@ -386,6 +859,302 @@ export class ERC20ContractView extends ContractView<ERC20> {
|
|
386
859
|
}
|
387
860
|
},
|
388
861
|
};
|
862
|
+
|
863
|
+
encodeCall = {
|
864
|
+
allowance(
|
865
|
+
owner: string,
|
866
|
+
spender: string,
|
867
|
+
ethCallContext: EthCallContext
|
868
|
+
): EthCallParam {
|
869
|
+
try {
|
870
|
+
const iface = new Interface(["function allowance(address,address)"]);
|
871
|
+
const calldata = iface.encodeFunctionData("allowance", [
|
872
|
+
owner,
|
873
|
+
spender,
|
874
|
+
]);
|
875
|
+
return {
|
876
|
+
context: ethCallContext,
|
877
|
+
calldata,
|
878
|
+
};
|
879
|
+
} catch (e) {
|
880
|
+
const stack = new Error().stack;
|
881
|
+
throw transformEtherError(e, undefined, stack);
|
882
|
+
}
|
883
|
+
},
|
884
|
+
approve(
|
885
|
+
spender: string,
|
886
|
+
amount: BigNumberish,
|
887
|
+
ethCallContext: EthCallContext
|
888
|
+
): EthCallParam {
|
889
|
+
try {
|
890
|
+
const iface = new Interface(["function approve(address,uint256)"]);
|
891
|
+
const calldata = iface.encodeFunctionData("approve", [spender, amount]);
|
892
|
+
return {
|
893
|
+
context: ethCallContext,
|
894
|
+
calldata,
|
895
|
+
};
|
896
|
+
} catch (e) {
|
897
|
+
const stack = new Error().stack;
|
898
|
+
throw transformEtherError(e, undefined, stack);
|
899
|
+
}
|
900
|
+
},
|
901
|
+
balanceOf(account: string, ethCallContext: EthCallContext): EthCallParam {
|
902
|
+
try {
|
903
|
+
const iface = new Interface(["function balanceOf(address)"]);
|
904
|
+
const calldata = iface.encodeFunctionData("balanceOf", [account]);
|
905
|
+
return {
|
906
|
+
context: ethCallContext,
|
907
|
+
calldata,
|
908
|
+
};
|
909
|
+
} catch (e) {
|
910
|
+
const stack = new Error().stack;
|
911
|
+
throw transformEtherError(e, undefined, stack);
|
912
|
+
}
|
913
|
+
},
|
914
|
+
burn(amount: BigNumberish, ethCallContext: EthCallContext): EthCallParam {
|
915
|
+
try {
|
916
|
+
const iface = new Interface(["function burn(uint256)"]);
|
917
|
+
const calldata = iface.encodeFunctionData("burn", [amount]);
|
918
|
+
return {
|
919
|
+
context: ethCallContext,
|
920
|
+
calldata,
|
921
|
+
};
|
922
|
+
} catch (e) {
|
923
|
+
const stack = new Error().stack;
|
924
|
+
throw transformEtherError(e, undefined, stack);
|
925
|
+
}
|
926
|
+
},
|
927
|
+
burnFrom(
|
928
|
+
account: string,
|
929
|
+
amount: BigNumberish,
|
930
|
+
ethCallContext: EthCallContext
|
931
|
+
): EthCallParam {
|
932
|
+
try {
|
933
|
+
const iface = new Interface(["function burnFrom(address,uint256)"]);
|
934
|
+
const calldata = iface.encodeFunctionData("burnFrom", [
|
935
|
+
account,
|
936
|
+
amount,
|
937
|
+
]);
|
938
|
+
return {
|
939
|
+
context: ethCallContext,
|
940
|
+
calldata,
|
941
|
+
};
|
942
|
+
} catch (e) {
|
943
|
+
const stack = new Error().stack;
|
944
|
+
throw transformEtherError(e, undefined, stack);
|
945
|
+
}
|
946
|
+
},
|
947
|
+
decimals(ethCallContext: EthCallContext): EthCallParam {
|
948
|
+
try {
|
949
|
+
const iface = new Interface(["function decimals()"]);
|
950
|
+
const calldata = iface.encodeFunctionData("decimals", []);
|
951
|
+
return {
|
952
|
+
context: ethCallContext,
|
953
|
+
calldata,
|
954
|
+
};
|
955
|
+
} catch (e) {
|
956
|
+
const stack = new Error().stack;
|
957
|
+
throw transformEtherError(e, undefined, stack);
|
958
|
+
}
|
959
|
+
},
|
960
|
+
decreaseAllowance(
|
961
|
+
spender: string,
|
962
|
+
subtractedValue: BigNumberish,
|
963
|
+
ethCallContext: EthCallContext
|
964
|
+
): EthCallParam {
|
965
|
+
try {
|
966
|
+
const iface = new Interface([
|
967
|
+
"function decreaseAllowance(address,uint256)",
|
968
|
+
]);
|
969
|
+
const calldata = iface.encodeFunctionData("decreaseAllowance", [
|
970
|
+
spender,
|
971
|
+
subtractedValue,
|
972
|
+
]);
|
973
|
+
return {
|
974
|
+
context: ethCallContext,
|
975
|
+
calldata,
|
976
|
+
};
|
977
|
+
} catch (e) {
|
978
|
+
const stack = new Error().stack;
|
979
|
+
throw transformEtherError(e, undefined, stack);
|
980
|
+
}
|
981
|
+
},
|
982
|
+
increaseAllowance(
|
983
|
+
spender: string,
|
984
|
+
addedValue: BigNumberish,
|
985
|
+
ethCallContext: EthCallContext
|
986
|
+
): EthCallParam {
|
987
|
+
try {
|
988
|
+
const iface = new Interface([
|
989
|
+
"function increaseAllowance(address,uint256)",
|
990
|
+
]);
|
991
|
+
const calldata = iface.encodeFunctionData("increaseAllowance", [
|
992
|
+
spender,
|
993
|
+
addedValue,
|
994
|
+
]);
|
995
|
+
return {
|
996
|
+
context: ethCallContext,
|
997
|
+
calldata,
|
998
|
+
};
|
999
|
+
} catch (e) {
|
1000
|
+
const stack = new Error().stack;
|
1001
|
+
throw transformEtherError(e, undefined, stack);
|
1002
|
+
}
|
1003
|
+
},
|
1004
|
+
locker(ethCallContext: EthCallContext): EthCallParam {
|
1005
|
+
try {
|
1006
|
+
const iface = new Interface(["function locker()"]);
|
1007
|
+
const calldata = iface.encodeFunctionData("locker", []);
|
1008
|
+
return {
|
1009
|
+
context: ethCallContext,
|
1010
|
+
calldata,
|
1011
|
+
};
|
1012
|
+
} catch (e) {
|
1013
|
+
const stack = new Error().stack;
|
1014
|
+
throw transformEtherError(e, undefined, stack);
|
1015
|
+
}
|
1016
|
+
},
|
1017
|
+
name(ethCallContext: EthCallContext): EthCallParam {
|
1018
|
+
try {
|
1019
|
+
const iface = new Interface(["function name()"]);
|
1020
|
+
const calldata = iface.encodeFunctionData("name", []);
|
1021
|
+
return {
|
1022
|
+
context: ethCallContext,
|
1023
|
+
calldata,
|
1024
|
+
};
|
1025
|
+
} catch (e) {
|
1026
|
+
const stack = new Error().stack;
|
1027
|
+
throw transformEtherError(e, undefined, stack);
|
1028
|
+
}
|
1029
|
+
},
|
1030
|
+
owner(ethCallContext: EthCallContext): EthCallParam {
|
1031
|
+
try {
|
1032
|
+
const iface = new Interface(["function owner()"]);
|
1033
|
+
const calldata = iface.encodeFunctionData("owner", []);
|
1034
|
+
return {
|
1035
|
+
context: ethCallContext,
|
1036
|
+
calldata,
|
1037
|
+
};
|
1038
|
+
} catch (e) {
|
1039
|
+
const stack = new Error().stack;
|
1040
|
+
throw transformEtherError(e, undefined, stack);
|
1041
|
+
}
|
1042
|
+
},
|
1043
|
+
renounceOwnership(ethCallContext: EthCallContext): EthCallParam {
|
1044
|
+
try {
|
1045
|
+
const iface = new Interface(["function renounceOwnership()"]);
|
1046
|
+
const calldata = iface.encodeFunctionData("renounceOwnership", []);
|
1047
|
+
return {
|
1048
|
+
context: ethCallContext,
|
1049
|
+
calldata,
|
1050
|
+
};
|
1051
|
+
} catch (e) {
|
1052
|
+
const stack = new Error().stack;
|
1053
|
+
throw transformEtherError(e, undefined, stack);
|
1054
|
+
}
|
1055
|
+
},
|
1056
|
+
setLocker(_locker: string, ethCallContext: EthCallContext): EthCallParam {
|
1057
|
+
try {
|
1058
|
+
const iface = new Interface(["function setLocker(address)"]);
|
1059
|
+
const calldata = iface.encodeFunctionData("setLocker", [_locker]);
|
1060
|
+
return {
|
1061
|
+
context: ethCallContext,
|
1062
|
+
calldata,
|
1063
|
+
};
|
1064
|
+
} catch (e) {
|
1065
|
+
const stack = new Error().stack;
|
1066
|
+
throw transformEtherError(e, undefined, stack);
|
1067
|
+
}
|
1068
|
+
},
|
1069
|
+
symbol(ethCallContext: EthCallContext): EthCallParam {
|
1070
|
+
try {
|
1071
|
+
const iface = new Interface(["function symbol()"]);
|
1072
|
+
const calldata = iface.encodeFunctionData("symbol", []);
|
1073
|
+
return {
|
1074
|
+
context: ethCallContext,
|
1075
|
+
calldata,
|
1076
|
+
};
|
1077
|
+
} catch (e) {
|
1078
|
+
const stack = new Error().stack;
|
1079
|
+
throw transformEtherError(e, undefined, stack);
|
1080
|
+
}
|
1081
|
+
},
|
1082
|
+
totalSupply(ethCallContext: EthCallContext): EthCallParam {
|
1083
|
+
try {
|
1084
|
+
const iface = new Interface(["function totalSupply()"]);
|
1085
|
+
const calldata = iface.encodeFunctionData("totalSupply", []);
|
1086
|
+
return {
|
1087
|
+
context: ethCallContext,
|
1088
|
+
calldata,
|
1089
|
+
};
|
1090
|
+
} catch (e) {
|
1091
|
+
const stack = new Error().stack;
|
1092
|
+
throw transformEtherError(e, undefined, stack);
|
1093
|
+
}
|
1094
|
+
},
|
1095
|
+
transfer(
|
1096
|
+
recipient: string,
|
1097
|
+
amount: BigNumberish,
|
1098
|
+
ethCallContext: EthCallContext
|
1099
|
+
): EthCallParam {
|
1100
|
+
try {
|
1101
|
+
const iface = new Interface(["function transfer(address,uint256)"]);
|
1102
|
+
const calldata = iface.encodeFunctionData("transfer", [
|
1103
|
+
recipient,
|
1104
|
+
amount,
|
1105
|
+
]);
|
1106
|
+
return {
|
1107
|
+
context: ethCallContext,
|
1108
|
+
calldata,
|
1109
|
+
};
|
1110
|
+
} catch (e) {
|
1111
|
+
const stack = new Error().stack;
|
1112
|
+
throw transformEtherError(e, undefined, stack);
|
1113
|
+
}
|
1114
|
+
},
|
1115
|
+
transferFrom(
|
1116
|
+
sender: string,
|
1117
|
+
recipient: string,
|
1118
|
+
amount: BigNumberish,
|
1119
|
+
ethCallContext: EthCallContext
|
1120
|
+
): EthCallParam {
|
1121
|
+
try {
|
1122
|
+
const iface = new Interface([
|
1123
|
+
"function transferFrom(address,address,uint256)",
|
1124
|
+
]);
|
1125
|
+
const calldata = iface.encodeFunctionData("transferFrom", [
|
1126
|
+
sender,
|
1127
|
+
recipient,
|
1128
|
+
amount,
|
1129
|
+
]);
|
1130
|
+
return {
|
1131
|
+
context: ethCallContext,
|
1132
|
+
calldata,
|
1133
|
+
};
|
1134
|
+
} catch (e) {
|
1135
|
+
const stack = new Error().stack;
|
1136
|
+
throw transformEtherError(e, undefined, stack);
|
1137
|
+
}
|
1138
|
+
},
|
1139
|
+
transferOwnership(
|
1140
|
+
newOwner: string,
|
1141
|
+
ethCallContext: EthCallContext
|
1142
|
+
): EthCallParam {
|
1143
|
+
try {
|
1144
|
+
const iface = new Interface(["function transferOwnership(address)"]);
|
1145
|
+
const calldata = iface.encodeFunctionData("transferOwnership", [
|
1146
|
+
newOwner,
|
1147
|
+
]);
|
1148
|
+
return {
|
1149
|
+
context: ethCallContext,
|
1150
|
+
calldata,
|
1151
|
+
};
|
1152
|
+
} catch (e) {
|
1153
|
+
const stack = new Error().stack;
|
1154
|
+
throw transformEtherError(e, undefined, stack);
|
1155
|
+
}
|
1156
|
+
},
|
1157
|
+
};
|
389
1158
|
}
|
390
1159
|
|
391
1160
|
export class ERC20BoundContractView extends BoundContractView<
|
@@ -397,59 +1166,134 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
397
1166
|
spender: string,
|
398
1167
|
overrides?: Overrides
|
399
1168
|
): Promise<bigint> {
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
1169
|
+
const ethCallContext = {
|
1170
|
+
chainId: this.context.chainId,
|
1171
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1172
|
+
address: this.context.address,
|
1173
|
+
};
|
1174
|
+
return await this.view.allowance(
|
1175
|
+
owner,
|
1176
|
+
spender,
|
1177
|
+
{
|
1178
|
+
blockTag: this.context.blockNumber,
|
1179
|
+
...overrides,
|
1180
|
+
},
|
1181
|
+
this.context.preparedData,
|
1182
|
+
ethCallContext
|
1183
|
+
);
|
404
1184
|
}
|
405
1185
|
|
406
1186
|
async balanceOf(account: string, overrides?: Overrides): Promise<bigint> {
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
1187
|
+
const ethCallContext = {
|
1188
|
+
chainId: this.context.chainId,
|
1189
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1190
|
+
address: this.context.address,
|
1191
|
+
};
|
1192
|
+
return await this.view.balanceOf(
|
1193
|
+
account,
|
1194
|
+
{
|
1195
|
+
blockTag: this.context.blockNumber,
|
1196
|
+
...overrides,
|
1197
|
+
},
|
1198
|
+
this.context.preparedData,
|
1199
|
+
ethCallContext
|
1200
|
+
);
|
411
1201
|
}
|
412
1202
|
|
413
1203
|
async decimals(overrides?: Overrides): Promise<bigint> {
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
1204
|
+
const ethCallContext = {
|
1205
|
+
chainId: this.context.chainId,
|
1206
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1207
|
+
address: this.context.address,
|
1208
|
+
};
|
1209
|
+
return await this.view.decimals(
|
1210
|
+
{
|
1211
|
+
blockTag: this.context.blockNumber,
|
1212
|
+
...overrides,
|
1213
|
+
},
|
1214
|
+
this.context.preparedData,
|
1215
|
+
ethCallContext
|
1216
|
+
);
|
418
1217
|
}
|
419
1218
|
|
420
1219
|
async locker(overrides?: Overrides): Promise<string> {
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
1220
|
+
const ethCallContext = {
|
1221
|
+
chainId: this.context.chainId,
|
1222
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1223
|
+
address: this.context.address,
|
1224
|
+
};
|
1225
|
+
return await this.view.locker(
|
1226
|
+
{
|
1227
|
+
blockTag: this.context.blockNumber,
|
1228
|
+
...overrides,
|
1229
|
+
},
|
1230
|
+
this.context.preparedData,
|
1231
|
+
ethCallContext
|
1232
|
+
);
|
425
1233
|
}
|
426
1234
|
|
427
1235
|
async name(overrides?: Overrides): Promise<string> {
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
1236
|
+
const ethCallContext = {
|
1237
|
+
chainId: this.context.chainId,
|
1238
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1239
|
+
address: this.context.address,
|
1240
|
+
};
|
1241
|
+
return await this.view.name(
|
1242
|
+
{
|
1243
|
+
blockTag: this.context.blockNumber,
|
1244
|
+
...overrides,
|
1245
|
+
},
|
1246
|
+
this.context.preparedData,
|
1247
|
+
ethCallContext
|
1248
|
+
);
|
432
1249
|
}
|
433
1250
|
|
434
1251
|
async owner(overrides?: Overrides): Promise<string> {
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
1252
|
+
const ethCallContext = {
|
1253
|
+
chainId: this.context.chainId,
|
1254
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1255
|
+
address: this.context.address,
|
1256
|
+
};
|
1257
|
+
return await this.view.owner(
|
1258
|
+
{
|
1259
|
+
blockTag: this.context.blockNumber,
|
1260
|
+
...overrides,
|
1261
|
+
},
|
1262
|
+
this.context.preparedData,
|
1263
|
+
ethCallContext
|
1264
|
+
);
|
439
1265
|
}
|
440
1266
|
|
441
1267
|
async symbol(overrides?: Overrides): Promise<string> {
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
1268
|
+
const ethCallContext = {
|
1269
|
+
chainId: this.context.chainId,
|
1270
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1271
|
+
address: this.context.address,
|
1272
|
+
};
|
1273
|
+
return await this.view.symbol(
|
1274
|
+
{
|
1275
|
+
blockTag: this.context.blockNumber,
|
1276
|
+
...overrides,
|
1277
|
+
},
|
1278
|
+
this.context.preparedData,
|
1279
|
+
ethCallContext
|
1280
|
+
);
|
446
1281
|
}
|
447
1282
|
|
448
1283
|
async totalSupply(overrides?: Overrides): Promise<bigint> {
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
1284
|
+
const ethCallContext = {
|
1285
|
+
chainId: this.context.chainId,
|
1286
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1287
|
+
address: this.context.address,
|
1288
|
+
};
|
1289
|
+
return await this.view.totalSupply(
|
1290
|
+
{
|
1291
|
+
blockTag: this.context.blockNumber,
|
1292
|
+
...overrides,
|
1293
|
+
},
|
1294
|
+
this.context.preparedData,
|
1295
|
+
ethCallContext
|
1296
|
+
);
|
453
1297
|
}
|
454
1298
|
|
455
1299
|
callStatic = {
|
@@ -461,39 +1305,78 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
461
1305
|
amount: BigNumberish,
|
462
1306
|
overrides?: Overrides
|
463
1307
|
): Promise<boolean> {
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
1308
|
+
const ethCallContext = {
|
1309
|
+
chainId: this.context.chainId,
|
1310
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1311
|
+
address: this.context.address,
|
1312
|
+
};
|
1313
|
+
return await this.view.callStatic.approve(
|
1314
|
+
spender,
|
1315
|
+
amount,
|
1316
|
+
{
|
1317
|
+
blockTag: this.context.blockNumber,
|
1318
|
+
...overrides,
|
1319
|
+
},
|
1320
|
+
this.context.preparedData,
|
1321
|
+
ethCallContext
|
1322
|
+
);
|
468
1323
|
},
|
469
1324
|
async burn(amount: BigNumberish, overrides?: Overrides): Promise<void> {
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
1325
|
+
const ethCallContext = {
|
1326
|
+
chainId: this.context.chainId,
|
1327
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1328
|
+
address: this.context.address,
|
1329
|
+
};
|
1330
|
+
return await this.view.callStatic.burn(
|
1331
|
+
amount,
|
1332
|
+
{
|
1333
|
+
blockTag: this.context.blockNumber,
|
1334
|
+
...overrides,
|
1335
|
+
},
|
1336
|
+
this.context.preparedData,
|
1337
|
+
ethCallContext
|
1338
|
+
);
|
474
1339
|
},
|
475
1340
|
async burnFrom(
|
476
1341
|
account: string,
|
477
1342
|
amount: BigNumberish,
|
478
1343
|
overrides?: Overrides
|
479
1344
|
): Promise<void> {
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
1345
|
+
const ethCallContext = {
|
1346
|
+
chainId: this.context.chainId,
|
1347
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1348
|
+
address: this.context.address,
|
1349
|
+
};
|
1350
|
+
return await this.view.callStatic.burnFrom(
|
1351
|
+
account,
|
1352
|
+
amount,
|
1353
|
+
{
|
1354
|
+
blockTag: this.context.blockNumber,
|
1355
|
+
...overrides,
|
1356
|
+
},
|
1357
|
+
this.context.preparedData,
|
1358
|
+
ethCallContext
|
1359
|
+
);
|
484
1360
|
},
|
485
1361
|
async decreaseAllowance(
|
486
1362
|
spender: string,
|
487
1363
|
subtractedValue: BigNumberish,
|
488
1364
|
overrides?: Overrides
|
489
1365
|
): Promise<boolean> {
|
1366
|
+
const ethCallContext = {
|
1367
|
+
chainId: this.context.chainId,
|
1368
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1369
|
+
address: this.context.address,
|
1370
|
+
};
|
490
1371
|
return await this.view.callStatic.decreaseAllowance(
|
491
1372
|
spender,
|
492
1373
|
subtractedValue,
|
493
1374
|
{
|
494
1375
|
blockTag: this.context.blockNumber,
|
495
1376
|
...overrides,
|
496
|
-
}
|
1377
|
+
},
|
1378
|
+
this.context.preparedData,
|
1379
|
+
ethCallContext
|
497
1380
|
);
|
498
1381
|
},
|
499
1382
|
async increaseAllowance(
|
@@ -501,32 +1384,73 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
501
1384
|
addedValue: BigNumberish,
|
502
1385
|
overrides?: Overrides
|
503
1386
|
): Promise<boolean> {
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
1387
|
+
const ethCallContext = {
|
1388
|
+
chainId: this.context.chainId,
|
1389
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1390
|
+
address: this.context.address,
|
1391
|
+
};
|
1392
|
+
return await this.view.callStatic.increaseAllowance(
|
1393
|
+
spender,
|
1394
|
+
addedValue,
|
1395
|
+
{
|
1396
|
+
blockTag: this.context.blockNumber,
|
1397
|
+
...overrides,
|
1398
|
+
},
|
1399
|
+
this.context.preparedData,
|
1400
|
+
ethCallContext
|
1401
|
+
);
|
508
1402
|
},
|
509
1403
|
async renounceOwnership(overrides?: Overrides): Promise<void> {
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
1404
|
+
const ethCallContext = {
|
1405
|
+
chainId: this.context.chainId,
|
1406
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1407
|
+
address: this.context.address,
|
1408
|
+
};
|
1409
|
+
return await this.view.callStatic.renounceOwnership(
|
1410
|
+
{
|
1411
|
+
blockTag: this.context.blockNumber,
|
1412
|
+
...overrides,
|
1413
|
+
},
|
1414
|
+
this.context.preparedData,
|
1415
|
+
ethCallContext
|
1416
|
+
);
|
514
1417
|
},
|
515
1418
|
async setLocker(_locker: string, overrides?: Overrides): Promise<void> {
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
1419
|
+
const ethCallContext = {
|
1420
|
+
chainId: this.context.chainId,
|
1421
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1422
|
+
address: this.context.address,
|
1423
|
+
};
|
1424
|
+
return await this.view.callStatic.setLocker(
|
1425
|
+
_locker,
|
1426
|
+
{
|
1427
|
+
blockTag: this.context.blockNumber,
|
1428
|
+
...overrides,
|
1429
|
+
},
|
1430
|
+
this.context.preparedData,
|
1431
|
+
ethCallContext
|
1432
|
+
);
|
520
1433
|
},
|
521
1434
|
async transfer(
|
522
1435
|
recipient: string,
|
523
1436
|
amount: BigNumberish,
|
524
1437
|
overrides?: Overrides
|
525
1438
|
): Promise<boolean> {
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
1439
|
+
const ethCallContext = {
|
1440
|
+
chainId: this.context.chainId,
|
1441
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1442
|
+
address: this.context.address,
|
1443
|
+
};
|
1444
|
+
return await this.view.callStatic.transfer(
|
1445
|
+
recipient,
|
1446
|
+
amount,
|
1447
|
+
{
|
1448
|
+
blockTag: this.context.blockNumber,
|
1449
|
+
...overrides,
|
1450
|
+
},
|
1451
|
+
this.context.preparedData,
|
1452
|
+
ethCallContext
|
1453
|
+
);
|
530
1454
|
},
|
531
1455
|
async transferFrom(
|
532
1456
|
sender: string,
|
@@ -534,6 +1458,11 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
534
1458
|
amount: BigNumberish,
|
535
1459
|
overrides?: Overrides
|
536
1460
|
): Promise<boolean> {
|
1461
|
+
const ethCallContext = {
|
1462
|
+
chainId: this.context.chainId,
|
1463
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1464
|
+
address: this.context.address,
|
1465
|
+
};
|
537
1466
|
return await this.view.callStatic.transferFrom(
|
538
1467
|
sender,
|
539
1468
|
recipient,
|
@@ -541,16 +1470,359 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
541
1470
|
{
|
542
1471
|
blockTag: this.context.blockNumber,
|
543
1472
|
...overrides,
|
544
|
-
}
|
1473
|
+
},
|
1474
|
+
this.context.preparedData,
|
1475
|
+
ethCallContext
|
545
1476
|
);
|
546
1477
|
},
|
547
1478
|
async transferOwnership(
|
548
1479
|
newOwner: string,
|
549
1480
|
overrides?: Overrides
|
550
1481
|
): Promise<void> {
|
551
|
-
|
552
|
-
|
553
|
-
|
1482
|
+
const ethCallContext = {
|
1483
|
+
chainId: this.context.chainId,
|
1484
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
1485
|
+
address: this.context.address,
|
1486
|
+
};
|
1487
|
+
return await this.view.callStatic.transferOwnership(
|
1488
|
+
newOwner,
|
1489
|
+
{
|
1490
|
+
blockTag: this.context.blockNumber,
|
1491
|
+
...overrides,
|
1492
|
+
},
|
1493
|
+
this.context.preparedData,
|
1494
|
+
ethCallContext
|
1495
|
+
);
|
1496
|
+
},
|
1497
|
+
};
|
1498
|
+
|
1499
|
+
encodeCall = {
|
1500
|
+
view: this.view,
|
1501
|
+
context: this.context,
|
1502
|
+
|
1503
|
+
allowance(
|
1504
|
+
owner: string,
|
1505
|
+
spender: string,
|
1506
|
+
overrides?: Overrides
|
1507
|
+
): EthCallParam {
|
1508
|
+
const chainId =
|
1509
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1510
|
+
const address = this.context.address;
|
1511
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1512
|
+
if (overrides?.blockTag) {
|
1513
|
+
blockTag =
|
1514
|
+
typeof overrides.blockTag == "string"
|
1515
|
+
? overrides.blockTag
|
1516
|
+
: "0x" + overrides.blockTag.toString(16);
|
1517
|
+
}
|
1518
|
+
|
1519
|
+
return this.view.encodeCall.allowance(owner, spender, {
|
1520
|
+
chainId,
|
1521
|
+
address,
|
1522
|
+
blockTag,
|
1523
|
+
});
|
1524
|
+
},
|
1525
|
+
approve(
|
1526
|
+
spender: string,
|
1527
|
+
amount: BigNumberish,
|
1528
|
+
overrides?: Overrides
|
1529
|
+
): EthCallParam {
|
1530
|
+
const chainId =
|
1531
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1532
|
+
const address = this.context.address;
|
1533
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1534
|
+
if (overrides?.blockTag) {
|
1535
|
+
blockTag =
|
1536
|
+
typeof overrides.blockTag == "string"
|
1537
|
+
? overrides.blockTag
|
1538
|
+
: "0x" + overrides.blockTag.toString(16);
|
1539
|
+
}
|
1540
|
+
|
1541
|
+
return this.view.encodeCall.approve(spender, amount, {
|
1542
|
+
chainId,
|
1543
|
+
address,
|
1544
|
+
blockTag,
|
1545
|
+
});
|
1546
|
+
},
|
1547
|
+
balanceOf(account: string, overrides?: Overrides): EthCallParam {
|
1548
|
+
const chainId =
|
1549
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1550
|
+
const address = this.context.address;
|
1551
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1552
|
+
if (overrides?.blockTag) {
|
1553
|
+
blockTag =
|
1554
|
+
typeof overrides.blockTag == "string"
|
1555
|
+
? overrides.blockTag
|
1556
|
+
: "0x" + overrides.blockTag.toString(16);
|
1557
|
+
}
|
1558
|
+
|
1559
|
+
return this.view.encodeCall.balanceOf(account, {
|
1560
|
+
chainId,
|
1561
|
+
address,
|
1562
|
+
blockTag,
|
1563
|
+
});
|
1564
|
+
},
|
1565
|
+
burn(amount: BigNumberish, overrides?: Overrides): EthCallParam {
|
1566
|
+
const chainId =
|
1567
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1568
|
+
const address = this.context.address;
|
1569
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1570
|
+
if (overrides?.blockTag) {
|
1571
|
+
blockTag =
|
1572
|
+
typeof overrides.blockTag == "string"
|
1573
|
+
? overrides.blockTag
|
1574
|
+
: "0x" + overrides.blockTag.toString(16);
|
1575
|
+
}
|
1576
|
+
|
1577
|
+
return this.view.encodeCall.burn(amount, { chainId, address, blockTag });
|
1578
|
+
},
|
1579
|
+
burnFrom(
|
1580
|
+
account: string,
|
1581
|
+
amount: BigNumberish,
|
1582
|
+
overrides?: Overrides
|
1583
|
+
): EthCallParam {
|
1584
|
+
const chainId =
|
1585
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1586
|
+
const address = this.context.address;
|
1587
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1588
|
+
if (overrides?.blockTag) {
|
1589
|
+
blockTag =
|
1590
|
+
typeof overrides.blockTag == "string"
|
1591
|
+
? overrides.blockTag
|
1592
|
+
: "0x" + overrides.blockTag.toString(16);
|
1593
|
+
}
|
1594
|
+
|
1595
|
+
return this.view.encodeCall.burnFrom(account, amount, {
|
1596
|
+
chainId,
|
1597
|
+
address,
|
1598
|
+
blockTag,
|
1599
|
+
});
|
1600
|
+
},
|
1601
|
+
decimals(overrides?: Overrides): EthCallParam {
|
1602
|
+
const chainId =
|
1603
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1604
|
+
const address = this.context.address;
|
1605
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1606
|
+
if (overrides?.blockTag) {
|
1607
|
+
blockTag =
|
1608
|
+
typeof overrides.blockTag == "string"
|
1609
|
+
? overrides.blockTag
|
1610
|
+
: "0x" + overrides.blockTag.toString(16);
|
1611
|
+
}
|
1612
|
+
|
1613
|
+
return this.view.encodeCall.decimals({ chainId, address, blockTag });
|
1614
|
+
},
|
1615
|
+
decreaseAllowance(
|
1616
|
+
spender: string,
|
1617
|
+
subtractedValue: BigNumberish,
|
1618
|
+
overrides?: Overrides
|
1619
|
+
): EthCallParam {
|
1620
|
+
const chainId =
|
1621
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1622
|
+
const address = this.context.address;
|
1623
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1624
|
+
if (overrides?.blockTag) {
|
1625
|
+
blockTag =
|
1626
|
+
typeof overrides.blockTag == "string"
|
1627
|
+
? overrides.blockTag
|
1628
|
+
: "0x" + overrides.blockTag.toString(16);
|
1629
|
+
}
|
1630
|
+
|
1631
|
+
return this.view.encodeCall.decreaseAllowance(spender, subtractedValue, {
|
1632
|
+
chainId,
|
1633
|
+
address,
|
1634
|
+
blockTag,
|
1635
|
+
});
|
1636
|
+
},
|
1637
|
+
increaseAllowance(
|
1638
|
+
spender: string,
|
1639
|
+
addedValue: BigNumberish,
|
1640
|
+
overrides?: Overrides
|
1641
|
+
): EthCallParam {
|
1642
|
+
const chainId =
|
1643
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1644
|
+
const address = this.context.address;
|
1645
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1646
|
+
if (overrides?.blockTag) {
|
1647
|
+
blockTag =
|
1648
|
+
typeof overrides.blockTag == "string"
|
1649
|
+
? overrides.blockTag
|
1650
|
+
: "0x" + overrides.blockTag.toString(16);
|
1651
|
+
}
|
1652
|
+
|
1653
|
+
return this.view.encodeCall.increaseAllowance(spender, addedValue, {
|
1654
|
+
chainId,
|
1655
|
+
address,
|
1656
|
+
blockTag,
|
1657
|
+
});
|
1658
|
+
},
|
1659
|
+
locker(overrides?: Overrides): EthCallParam {
|
1660
|
+
const chainId =
|
1661
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1662
|
+
const address = this.context.address;
|
1663
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1664
|
+
if (overrides?.blockTag) {
|
1665
|
+
blockTag =
|
1666
|
+
typeof overrides.blockTag == "string"
|
1667
|
+
? overrides.blockTag
|
1668
|
+
: "0x" + overrides.blockTag.toString(16);
|
1669
|
+
}
|
1670
|
+
|
1671
|
+
return this.view.encodeCall.locker({ chainId, address, blockTag });
|
1672
|
+
},
|
1673
|
+
name(overrides?: Overrides): EthCallParam {
|
1674
|
+
const chainId =
|
1675
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1676
|
+
const address = this.context.address;
|
1677
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1678
|
+
if (overrides?.blockTag) {
|
1679
|
+
blockTag =
|
1680
|
+
typeof overrides.blockTag == "string"
|
1681
|
+
? overrides.blockTag
|
1682
|
+
: "0x" + overrides.blockTag.toString(16);
|
1683
|
+
}
|
1684
|
+
|
1685
|
+
return this.view.encodeCall.name({ chainId, address, blockTag });
|
1686
|
+
},
|
1687
|
+
owner(overrides?: Overrides): EthCallParam {
|
1688
|
+
const chainId =
|
1689
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1690
|
+
const address = this.context.address;
|
1691
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1692
|
+
if (overrides?.blockTag) {
|
1693
|
+
blockTag =
|
1694
|
+
typeof overrides.blockTag == "string"
|
1695
|
+
? overrides.blockTag
|
1696
|
+
: "0x" + overrides.blockTag.toString(16);
|
1697
|
+
}
|
1698
|
+
|
1699
|
+
return this.view.encodeCall.owner({ chainId, address, blockTag });
|
1700
|
+
},
|
1701
|
+
renounceOwnership(overrides?: Overrides): EthCallParam {
|
1702
|
+
const chainId =
|
1703
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1704
|
+
const address = this.context.address;
|
1705
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1706
|
+
if (overrides?.blockTag) {
|
1707
|
+
blockTag =
|
1708
|
+
typeof overrides.blockTag == "string"
|
1709
|
+
? overrides.blockTag
|
1710
|
+
: "0x" + overrides.blockTag.toString(16);
|
1711
|
+
}
|
1712
|
+
|
1713
|
+
return this.view.encodeCall.renounceOwnership({
|
1714
|
+
chainId,
|
1715
|
+
address,
|
1716
|
+
blockTag,
|
1717
|
+
});
|
1718
|
+
},
|
1719
|
+
setLocker(_locker: string, overrides?: Overrides): EthCallParam {
|
1720
|
+
const chainId =
|
1721
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1722
|
+
const address = this.context.address;
|
1723
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1724
|
+
if (overrides?.blockTag) {
|
1725
|
+
blockTag =
|
1726
|
+
typeof overrides.blockTag == "string"
|
1727
|
+
? overrides.blockTag
|
1728
|
+
: "0x" + overrides.blockTag.toString(16);
|
1729
|
+
}
|
1730
|
+
|
1731
|
+
return this.view.encodeCall.setLocker(_locker, {
|
1732
|
+
chainId,
|
1733
|
+
address,
|
1734
|
+
blockTag,
|
1735
|
+
});
|
1736
|
+
},
|
1737
|
+
symbol(overrides?: Overrides): EthCallParam {
|
1738
|
+
const chainId =
|
1739
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1740
|
+
const address = this.context.address;
|
1741
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1742
|
+
if (overrides?.blockTag) {
|
1743
|
+
blockTag =
|
1744
|
+
typeof overrides.blockTag == "string"
|
1745
|
+
? overrides.blockTag
|
1746
|
+
: "0x" + overrides.blockTag.toString(16);
|
1747
|
+
}
|
1748
|
+
|
1749
|
+
return this.view.encodeCall.symbol({ chainId, address, blockTag });
|
1750
|
+
},
|
1751
|
+
totalSupply(overrides?: Overrides): EthCallParam {
|
1752
|
+
const chainId =
|
1753
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1754
|
+
const address = this.context.address;
|
1755
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1756
|
+
if (overrides?.blockTag) {
|
1757
|
+
blockTag =
|
1758
|
+
typeof overrides.blockTag == "string"
|
1759
|
+
? overrides.blockTag
|
1760
|
+
: "0x" + overrides.blockTag.toString(16);
|
1761
|
+
}
|
1762
|
+
|
1763
|
+
return this.view.encodeCall.totalSupply({ chainId, address, blockTag });
|
1764
|
+
},
|
1765
|
+
transfer(
|
1766
|
+
recipient: string,
|
1767
|
+
amount: BigNumberish,
|
1768
|
+
overrides?: Overrides
|
1769
|
+
): EthCallParam {
|
1770
|
+
const chainId =
|
1771
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1772
|
+
const address = this.context.address;
|
1773
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1774
|
+
if (overrides?.blockTag) {
|
1775
|
+
blockTag =
|
1776
|
+
typeof overrides.blockTag == "string"
|
1777
|
+
? overrides.blockTag
|
1778
|
+
: "0x" + overrides.blockTag.toString(16);
|
1779
|
+
}
|
1780
|
+
|
1781
|
+
return this.view.encodeCall.transfer(recipient, amount, {
|
1782
|
+
chainId,
|
1783
|
+
address,
|
1784
|
+
blockTag,
|
1785
|
+
});
|
1786
|
+
},
|
1787
|
+
transferFrom(
|
1788
|
+
sender: string,
|
1789
|
+
recipient: string,
|
1790
|
+
amount: BigNumberish,
|
1791
|
+
overrides?: Overrides
|
1792
|
+
): EthCallParam {
|
1793
|
+
const chainId =
|
1794
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1795
|
+
const address = this.context.address;
|
1796
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1797
|
+
if (overrides?.blockTag) {
|
1798
|
+
blockTag =
|
1799
|
+
typeof overrides.blockTag == "string"
|
1800
|
+
? overrides.blockTag
|
1801
|
+
: "0x" + overrides.blockTag.toString(16);
|
1802
|
+
}
|
1803
|
+
|
1804
|
+
return this.view.encodeCall.transferFrom(sender, recipient, amount, {
|
1805
|
+
chainId,
|
1806
|
+
address,
|
1807
|
+
blockTag,
|
1808
|
+
});
|
1809
|
+
},
|
1810
|
+
transferOwnership(newOwner: string, overrides?: Overrides): EthCallParam {
|
1811
|
+
const chainId =
|
1812
|
+
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
1813
|
+
const address = this.context.address;
|
1814
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1815
|
+
if (overrides?.blockTag) {
|
1816
|
+
blockTag =
|
1817
|
+
typeof overrides.blockTag == "string"
|
1818
|
+
? overrides.blockTag
|
1819
|
+
: "0x" + overrides.blockTag.toString(16);
|
1820
|
+
}
|
1821
|
+
|
1822
|
+
return this.view.encodeCall.transferOwnership(newOwner, {
|
1823
|
+
chainId,
|
1824
|
+
address,
|
1825
|
+
blockTag,
|
554
1826
|
});
|
555
1827
|
},
|
556
1828
|
};
|
@@ -568,7 +1840,8 @@ export class ERC20Processor extends BaseProcessor<
|
|
568
1840
|
fetchConfig?: Partial<EthFetchConfig>,
|
569
1841
|
preprocessHandler?: (
|
570
1842
|
event: ApprovalEvent,
|
571
|
-
ctx: ERC20Context
|
1843
|
+
ctx: ERC20Context,
|
1844
|
+
preprocessStore: { [k: string]: any }
|
572
1845
|
) => Promise<PreprocessResult>
|
573
1846
|
): this {
|
574
1847
|
if (!filter) {
|
@@ -589,7 +1862,8 @@ export class ERC20Processor extends BaseProcessor<
|
|
589
1862
|
fetchConfig?: Partial<EthFetchConfig>,
|
590
1863
|
preprocessHandler?: (
|
591
1864
|
event: OwnershipTransferredEvent,
|
592
|
-
ctx: ERC20Context
|
1865
|
+
ctx: ERC20Context,
|
1866
|
+
preprocessStore: { [k: string]: any }
|
593
1867
|
) => Promise<PreprocessResult>
|
594
1868
|
): this {
|
595
1869
|
if (!filter) {
|
@@ -606,7 +1880,8 @@ export class ERC20Processor extends BaseProcessor<
|
|
606
1880
|
fetchConfig?: Partial<EthFetchConfig>,
|
607
1881
|
preprocessHandler?: (
|
608
1882
|
event: TransferEvent,
|
609
|
-
ctx: ERC20Context
|
1883
|
+
ctx: ERC20Context,
|
1884
|
+
preprocessStore: { [k: string]: any }
|
610
1885
|
) => Promise<PreprocessResult>
|
611
1886
|
): this {
|
612
1887
|
if (!filter) {
|
@@ -981,7 +2256,8 @@ export class ERC20ProcessorTemplate extends BaseProcessorTemplate<
|
|
981
2256
|
fetchConfig?: Partial<EthFetchConfig>,
|
982
2257
|
preprocessHandler?: (
|
983
2258
|
event: ApprovalEvent,
|
984
|
-
ctx: ERC20Context
|
2259
|
+
ctx: ERC20Context,
|
2260
|
+
preprocessStore: { [k: string]: any }
|
985
2261
|
) => Promise<PreprocessResult>
|
986
2262
|
): this {
|
987
2263
|
if (!filter) {
|
@@ -1002,7 +2278,8 @@ export class ERC20ProcessorTemplate extends BaseProcessorTemplate<
|
|
1002
2278
|
fetchConfig?: Partial<EthFetchConfig>,
|
1003
2279
|
preprocessHandler?: (
|
1004
2280
|
event: OwnershipTransferredEvent,
|
1005
|
-
ctx: ERC20Context
|
2281
|
+
ctx: ERC20Context,
|
2282
|
+
preprocessStore: { [k: string]: any }
|
1006
2283
|
) => Promise<PreprocessResult>
|
1007
2284
|
): this {
|
1008
2285
|
if (!filter) {
|
@@ -1019,7 +2296,8 @@ export class ERC20ProcessorTemplate extends BaseProcessorTemplate<
|
|
1019
2296
|
fetchConfig?: Partial<EthFetchConfig>,
|
1020
2297
|
preprocessHandler?: (
|
1021
2298
|
event: TransferEvent,
|
1022
|
-
ctx: ERC20Context
|
2299
|
+
ctx: ERC20Context,
|
2300
|
+
preprocessStore: { [k: string]: any }
|
1023
2301
|
) => Promise<PreprocessResult>
|
1024
2302
|
): this {
|
1025
2303
|
if (!filter) {
|