mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-01-24 12:09:06 +00:00
e30af92901
* Add a CLI to fill state for a given range * Refactor code * Add a CLI to reset IPLD state * Replace ORDER BY clause in the query to get latest IPLD block * Optimize delete query in CLI to reset IPLD state * Add an option to decouple subgraph state creation from mapping code * Use a raw SQL query to delete IPLD blocks in a block range * Accomodate changes in codegen
52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
//
|
|
// Copyright 2022 Vulcanize, Inc.
|
|
//
|
|
|
|
import yargs from 'yargs';
|
|
import { providers } from 'ethers';
|
|
import debug from 'debug';
|
|
|
|
const log = debug('vulcanize:test');
|
|
|
|
const main = async (): Promise<void> => {
|
|
const argv = await yargs.parserConfiguration({
|
|
'parse-numbers': false
|
|
}).options({
|
|
endpoint: {
|
|
alias: 'e',
|
|
demandOption: true,
|
|
describe: 'Endpoint to perform getStorageAt against',
|
|
type: 'string'
|
|
},
|
|
contract: {
|
|
alias: 'c',
|
|
demandOption: true,
|
|
describe: 'Contract address',
|
|
type: 'string'
|
|
},
|
|
slot: {
|
|
alias: 's',
|
|
demandOption: true,
|
|
describe: 'Storge slot',
|
|
type: 'string'
|
|
},
|
|
blockTag: {
|
|
alias: 'b',
|
|
describe: 'Block tag to make eth-call with (block number (hex) / block hash)',
|
|
type: 'string'
|
|
},
|
|
}).argv;
|
|
|
|
const provider = new providers.JsonRpcProvider(argv.endpoint);
|
|
|
|
log(`Making a getStorageAt call for slot ${argv.slot} to endpoint ${argv.endpoint}`);
|
|
const result = await provider.getStorageAt(argv.contract, argv.slot, argv.blockTag);
|
|
|
|
log("Result:");
|
|
log(result);
|
|
}
|
|
|
|
main().catch(err => {
|
|
log(err);
|
|
});
|