Skip to content

Latest commit

 

History

History
66 lines (41 loc) · 2.69 KB

README.md

File metadata and controls

66 lines (41 loc) · 2.69 KB

Azuro Envio indexer boilerplate

This repo is to help the grantee build the opensource azuro indexer, it includes the configuration and events indexed from the gnosis azuro v3 subgraph. Now deployed

Additional resources

Changes to generated code

This indexer requires some small changes to the generated code, the code that gets created when you run pnpm envio codegen:

Note that after performing the following changes to the generated code, avoid using pnpm envio dev (unless you make changes to the config.yaml), instead use pnpm envio start or pnpm envio start -r.

  1. pnpm envio codegen will build the generated code files
  2. change the match event for NewGame from saying LPv2 to _.And same for LPv3 new game

/generated/srcTypes.res:

image

  1. The next step is dealing with the decoding, previously it was trying to decode using the lpv2 abi but we need to explicitely tell it, if its after this block & its this address then we're going to explicitely tell it to use the LPv3 abi

generated/src/ContractInterfaceManager.res:

image

let getAbiMapping = (self: t, ~fromBlock) => {
  self.contractAddressMapping.nameByAddress
  ->Js.Dict.entries
  ->Belt.Array.keepMap(((addr, name)) => {
    self.contractNameInterfaceMapping
    ->Js.Dict.get(name)
    ->Belt.Option.map(v => {
      let abi =
        addr == "0x204e7371Ade792c5C006fb52711c50a7efC843ed" && fromBlock > 29688365
          ? Abis.lPv3Abi->Ethers.makeAbi
          : v.abi
      (addr, abi)
    })
  })
  ->Js.Dict.fromArray
}
  1. Then lastly from hypersyncWorker.res we need to add the fromBlock ->ContractInterfaceManager.getAbiMapping(~fromBlock)

generated/src/eventFetching/chainWorkers/HyperSyncWorker.res:

image

Cached .db files

  • *.db files on the repo are stored as LFS pointers (Github large file system), so you may need to run git lfs pull to restore the *.db files locally

Multichain

To make this indexer multichain, simply add the additional blockchain information under the networks section in config.yaml. Also see dev note at the bottom here for possible optimization.