Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sdk/packages/indexer/scripts/generate-chain-yamls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ const generateEvmYaml = async (chain: string, config: Configuration) => {
config,
endpoints,
blockNumber,
// Flattened (vault, underlyingToken) pairs so the template can emit one Deposit/Withdraw
// datasource per vault. The handler resolves underlyingToken from YIELD_VAULT_ADDRESSES.
yieldVaults:
config.type === "evm" && config.contracts?.yieldVaults
? Object.entries(config.contracts.yieldVaults).flatMap(([token, entry]) =>
entry.vaults.map((vault) => ({ vault, underlyingToken: token })),
)
: [],
handlerKind: "ethereum/LogHandler",
handlers: [
{ handler: "handleStateMachineUpdatedEvent", topics: ["StateMachineUpdated(string,uint256)"] },
Expand Down
38 changes: 38 additions & 0 deletions sdk/packages/indexer/scripts/templates/evm-chain.yaml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ dataSources:
file: ./abis/EthereumHost.abi.json
chainLinkAggregatorV3:
file: ./abis/ChainLinkAggregatorV3.abi.json
# Listed so the Erc4626Abi interface is always generated for the yield-vault handlers, even on
# chains with no configured vaults (e.g. testnet); the vault datasources reference it for decoding.
erc4626:
file: ./abis/Erc4626.abi.json
mapping:
file: ./dist/index.js
handlers:
Expand Down Expand Up @@ -79,6 +83,40 @@ dataSources:
topics:
- 'DustSwept(address,uint256,address)'
{{/if}}
{{#each yieldVaults}}
- kind: ethereum/Runtime
startBlock: {{../blockNumber}}
options:
abi: erc4626
address: '{{this.vault}}'
assets:
erc4626:
file: ./abis/Erc4626.abi.json
mapping:
file: ./dist/index.js
handlers:
- kind: ethereum/LogHandler
handler: handleVaultDepositEvent
filter:
topics:
- 'Deposit(address,address,uint256,uint256)'
- kind: ethereum/LogHandler
handler: handleVaultWithdrawEvent
filter:
topics:
- 'Withdraw(address,address,address,uint256,uint256)'
{{/each}}
{{#if yieldVaults.length}}
- kind: ethereum/Runtime
startBlock: {{blockNumber}}
mapping:
file: ./dist/index.js
handlers:
- handler: handleVaultSnapshotIndexing
kind: ethereum/BlockHandler
filter:
modulo: 50 # Daily LP yield snapshot; the handler dedupes per UTC day, so re-attempts bail cheaply.
{{/if}}
- kind: ethereum/Runtime
startBlock: {{blockNumber}}
mapping:
Expand Down
160 changes: 160 additions & 0 deletions sdk/packages/indexer/src/configs/abis/Erc4626.abi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
[
{
"type": "event",
"name": "Deposit",
"inputs": [
{
"name": "sender",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "owner",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "assets",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "shares",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "Withdraw",
"inputs": [
{
"name": "sender",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "receiver",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "owner",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "assets",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "shares",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "function",
"name": "asset",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "decimals",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint8",
"internalType": "uint8"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "balanceOf",
"inputs": [
{
"name": "account",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "totalSupply",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "totalAssets",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "convertToAssets",
"inputs": [
{
"name": "shares",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
}
]
Loading
Loading