Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ evm/script/update-consensus-client.sh
# Generated by indexer codegen (generate-chain-yamls.ts) — not committed
sdk/packages/indexer/src/token-slot-overrides.ts
sdk/packages/indexer/src/yield-vault-addresses.ts
sdk/packages/indexer/src/solver-account-addresses.ts
28 changes: 28 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 Expand Up @@ -287,6 +295,25 @@ const generateYieldVaultAddresses = () => {
console.log("Generated yield-vault-addresses.ts")
}

const generateSolverAccountAddresses = () => {
const solverAccounts: Record<string, string> = {}

validChains.forEach((config) => {
if (config.type === "evm" && config.contracts?.solverAccount) {
solverAccounts[config.stateMachineId] = config.contracts.solverAccount
}
})

const value = `// Auto-generated, DO NOT EDIT
// SolverAccount contract address per chain (EIP-7702 delegation target for our solver EOAs).
// To add or update entries, edit the "solverAccount" field in the relevant chain entry
// in src/configs/config-mainnet.json (or config-testnet.json) and re-run codegen.
export const SOLVER_ACCOUNT_ADDRESSES: Record<string, string> = ${JSON.stringify(solverAccounts, null, 2)}`

fs.writeFileSync(root + "/src/solver-account-addresses.ts", value)
console.log("Generated solver-account-addresses.ts")
}

const generateTokenSlotOverrides = () => {
const lines: string[] = []
lines.push("// Auto-generated, DO NOT EDIT")
Expand Down Expand Up @@ -383,6 +410,7 @@ try {
generateChainsByIsmpHost()
generateChainsIntentGatewayV3Addresses()
generateYieldVaultAddresses()
generateSolverAccountAddresses()
generateTokenSlotOverrides()
generateTestnetStateMachineIds()
generateEnvironmentConfig()
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"
}
]
6 changes: 6 additions & 0 deletions sdk/packages/indexer/src/configs/config-mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"erc6160ext20": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"handlerV1": "0x2a18AB35DEa43474882E05A661e2F20fe89c0535",
"intentGatewayV3": "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
"solverAccount": "0x975e80B476cB1d4Cd06c292ce36898f2bE4159ea",
"yieldVaults": {
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": {
"description": "USDC \u2192 stataUSDC (Aave v3 Ethereum)",
Expand Down Expand Up @@ -84,6 +85,7 @@
"erc6160ext20": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
"handlerV1": "0x2a18AB35DEa43474882E05A661e2F20fe89c0535",
"intentGatewayV3": "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
"solverAccount": "0x975e80B476cB1d4Cd06c292ce36898f2bE4159ea",
"yieldVaults": {
"0xaf88d065e77c8cc2239327c5edb3a432268e5831": {
"description": "USDC (native Circle) \u2192 stataUSDCn (Aave v3 Arbitrum)",
Expand Down Expand Up @@ -122,6 +124,7 @@
"erc6160ext20": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
"handlerV1": "0x2a18AB35DEa43474882E05A661e2F20fe89c0535",
"intentGatewayV3": "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
"solverAccount": "0x975e80B476cB1d4Cd06c292ce36898f2bE4159ea",
"yieldVaults": {
"0x0b2c639c533813f4aa9d7837caf62653d097ff85": {
"description": "USDC (native Circle) \u2192 stataUSDCn (Aave v3 Optimism)",
Expand Down Expand Up @@ -155,6 +158,7 @@
"erc6160ext20": "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",
"handlerV1": "0x2a18AB35DEa43474882E05A661e2F20fe89c0535",
"intentGatewayV3": "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
"solverAccount": "0x975e80B476cB1d4Cd06c292ce36898f2bE4159ea",
"yieldVaults": {
"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913": {
"description": "USDC \u2192 stataUSDC (Aave v3 Base; no USDT market on Base)",
Expand Down Expand Up @@ -194,6 +198,7 @@
"erc6160ext20": "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",
"handlerV1": "0x2a18AB35DEa43474882E05A661e2F20fe89c0535",
"intentGatewayV3": "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
"solverAccount": "0x975e80B476cB1d4Cd06c292ce36898f2bE4159ea",
"yieldVaults": {
"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d": {
"description": "USDC (Binance-pegged) \u2192 staticAUSDC (Aave v3 BNB Chain)",
Expand Down Expand Up @@ -264,6 +269,7 @@
"erc6160ext20": "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063",
"handlerV1": "0x2a18AB35DEa43474882E05A661e2F20fe89c0535",
"intentGatewayV3": "0xAe041F7B0CB581876832830baeB6a2Aa2a3C9716",
"solverAccount": "0x975e80B476cB1d4Cd06c292ce36898f2bE4159ea",
"yieldVaults": {
"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359": {
"description": "USDC (native Circle) \u2192 stataUSDCn (Aave v3 Polygon)",
Expand Down
1 change: 1 addition & 0 deletions sdk/packages/indexer/src/configs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const evmContractsSchema = z.object({
handlerV1: z.string().min(3, "Invalid Ethereum address"),
erc6160ext20: z.string().min(3, "Invalid Ethereum address"),
intentGatewayV3: z.string().optional(),
solverAccount: z.string().optional(),
yieldVaults: z
.record(
z.string(),
Expand Down
Loading
Loading