Skip to content

Commit

Permalink
feat(indexer): update indexer to use historical proxy instead of erc2…
Browse files Browse the repository at this point in the history
…0-relay (#237)
  • Loading branch information
playX18 authored Dec 7, 2024
1 parent 2424902 commit 410f728
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion indexer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM node:20-alpine AS node
FROM node AS api
WORKDIR /assets
COPY api/gear/vft_manager.idl .
COPY api/gear/erc20_relay.idl .
COPY api/gear/historical_proxy.idl .
COPY api/ethereum/IERC20Manager.json .
COPY api/ethereum/IMessageQueue.json .
COPY indexer/scripts/abi.js .
Expand Down
2 changes: 1 addition & 1 deletion indexer/src/gear/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export const config = {
archiveUrl: getEnv('GEAR_ARCHIVE_URL', 'https://v2.archive.subsquid.io/network/vara-testnet'),
rpcUrl: getEnv('GEAR_RPC_URL', 'https://testnet.vara.network'),
vftManager: getEnv('GEAR_VFT_MANAGER'),
erc20Relay: getEnv('GEAR_ERC20_RELAY'),
hisotricalProxy: getEnv('GEAR_HISTORICAL_PROXY'),
fromBlock: Number(getEnv('GEAR_FROM_BLOCK', '11000000')),
};
14 changes: 7 additions & 7 deletions indexer/src/gear/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Codec } from './codec';
const tempState = new TempState(Network.Gear);

let vftManagerDecoder: Codec;
let erc20RelayDecoder: Codec;
let hisotricalProxy: Codec;

const handler = async (ctx: ProcessorContext) => {
await tempState.new(ctx);
Expand Down Expand Up @@ -78,13 +78,13 @@ const handler = async (ctx: ProcessorContext) => {
}
}
}
case config.erc20Relay: {
const service = erc20RelayDecoder.service(msg.payload);
if (service !== 'Erc20Relay') continue;
const method = erc20RelayDecoder.method(msg.payload);
case config.hisotricalProxy: {
const service = hisotricalProxy.service(msg.payload);
if (service !== 'HistoricalProxy') continue;
const method = hisotricalProxy.method(msg.payload);
if (method !== 'Relayed') continue;

const { block_number, transaction_index } = erc20RelayDecoder.decodeEvent<Relayed>(
const { block_number, transaction_index } = hisotricalProxy.decodeEvent<Relayed>(
service,
method,
msg.payload,
Expand All @@ -106,7 +106,7 @@ const handler = async (ctx: ProcessorContext) => {

export const runProcessor = async () => {
vftManagerDecoder = await Codec.create('./assets/vft_manager.idl');
erc20RelayDecoder = await Codec.create('./assets/erc20_relay.idl');
hisotricalProxy = await Codec.create('./assets/historical_proxy.idl');

processor.run(
new TypeormDatabase({
Expand Down
2 changes: 1 addition & 1 deletion indexer/src/gear/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const processor = new SubstrateBatchProcessor()
timestamp: true,
},
})
.addGearUserMessageSent({ programId: [config.vftManager, config.erc20Relay], extrinsic: true, call: true })
.addGearUserMessageSent({ programId: [config.vftManager, config.hisotricalProxy], extrinsic: true, call: true })
.setBlockRange({
from: config.fromBlock,
});
Expand Down

0 comments on commit 410f728

Please sign in to comment.