- Setting up a contract address filter
- Writing transformation code to decode key contract events
- Testing and registering the transformation for pipeline use
- Set up a target database or webhook
- Create a data schema using transformation output
- Deploy the full pipeline and verify that the data is flowing
The Example Contract: Aave Pool
For this tutorial, we’ll be indexing events from the Aave Pool contract, which emits all the core supply, borrow, repay, and liquidation events. You can find its documentation and ABI here: You can extract event signatures from either the ABI or directly from Etherscan. We recommend verifying or formatting them with an LLM to ensure they match the expected Solidity format used by The Indexing Company. Follow this Event Extraction Example for tips.Step 1: Set up a contract address filter
Postman Command Name:1. Create Contract Filter
The first step is to define which contracts your pipeline should listen to. If no filter is applied, the transformation code will be applied to all blocks. In our case, we’ll be indexing events from the Aave Pool contract.
To register this contract as a filter, send the following curl
request:
aave_example_filter
that targets the Aave Pool contract. You can confirm it was created by calling:
Postman Command Name: 2. Get Contract Filters
3. Delete Contract Filter
Step 2: Write transformation code
JavaScript Filename:AavePool.js
Now that the contract filter is set up, it’s time to define the logic to extract relevant onchain events. The Indexing Company supports transformation functions written in JavaScript, which operate on each block. We will decode logs and format events for downstream use. For an instruction to find and transform these events visit our (Event Extraction Example)[/examples/evm_event_sigs].
Below is the transformation code we’ll use to extract key Aave Pool events:
Step 3: Test the transformation
Postman Command Name:4a. Test Transformation (JS code upload)
or 4b. Test Transformation (JS code as Text)
Before registering your transformation into a live pipeline, it’s essential to test it against real onchain data. The Indexing API provides a /transformations/test
endpoint that lets you simulate a run using a specific block number and your contract filter. We are using this transaction to test on.
To get the network
you look up the Network Key here. We are testing this on Ethereum at block 22282149 (called beat in the API).
Use the following curl
to test the transformation code:
- Select
POST
- Set the URL with the correct query parameters
- Go to Body > form-data, set key to
code
, typeText
, and paste in your transformation code OR set typeFile
and upload theAavePool.js
file.
Supply
, Borrow
, etc.) show up correctly.
For block 22282149
on Ethereum, you should receive an output similar to the following:
Step 4: Register the transformation
Postman Command Name:5a. Register Transformation (JS code upload)
or 5b. Register Transformation (JS code as Text)
Once you’ve confirmed your transformation code works correctly, you can register it for production use. This saves the code under a unique transformation ID, allowing you to reference it in the pipeline setup.
Use the following curl
to register the transformation:
- Select
POST
- Use the same endpoint URL
- Under Body > form-data, key should be
code
, set type toText
, and paste your transformation function OR set typeFile
and upload theAavePool.js
file.
What’s Next?
In Part 2, we’ll continue by wiring up the destination: setting up a database or webhook, generating a schema from your transformation output, and deploying the full pipeline. Need help getting started or want to integrate indexing into your stack?- Reach out to us at indexing.co/get-in-touch
- Or email us at hello@indexing.co