feat(ponder): Add strict ESLint + Prettier with pre-commit hooks (#52)
- Install eslint, @typescript-eslint plugins, prettier, husky, lint-staged
- Configure ESLint flat config with TypeScript parser
- Enforce: no-explicit-any (with exceptions), no-unused-vars, naming-convention, prefer-const, no-console
- Set style: 2-space indent, 140 char max-len, disable complexity rules
- Configure Prettier: single quotes, 140 width, trailing commas
- Setup husky pre-commit hook to auto-fix and format on commit
- Replace console.log/warn with context.logger.info/warn in handlers
- Remove console.log from ponder.config.ts (replaced with comment)
- Add npm scripts: lint, lint:fix, format, format:check
- All lint rules pass without warnings
resolvel #45
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/52
2025-10-04 15:37:26 +02:00
|
|
|
import { createConfig } from 'ponder';
|
|
|
|
|
import type { Abi } from 'viem';
|
2026-02-18 00:19:05 +01:00
|
|
|
import { KraikenAbi, StakeAbi, LiquidityManagerAbi } from 'kraiken-lib/abis';
|
2025-09-23 14:18:04 +02:00
|
|
|
|
2025-09-23 19:24:05 +02:00
|
|
|
// Network configurations keyed by canonical environment name
|
2025-09-30 20:02:43 +02:00
|
|
|
type NetworkConfig = {
|
|
|
|
|
chainId: number;
|
|
|
|
|
rpc: string;
|
|
|
|
|
disableCache?: boolean;
|
|
|
|
|
contracts: {
|
|
|
|
|
kraiken: string;
|
|
|
|
|
stake: string;
|
2026-02-18 00:19:05 +01:00
|
|
|
liquidityManager: string;
|
2025-09-30 20:02:43 +02:00
|
|
|
startBlock: number;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const networks: Record<string, NetworkConfig> = {
|
2025-09-23 19:24:05 +02:00
|
|
|
BASE_SEPOLIA_LOCAL_FORK: {
|
2025-09-23 14:18:04 +02:00
|
|
|
chainId: 31337,
|
feat(ponder): Add strict ESLint + Prettier with pre-commit hooks (#52)
- Install eslint, @typescript-eslint plugins, prettier, husky, lint-staged
- Configure ESLint flat config with TypeScript parser
- Enforce: no-explicit-any (with exceptions), no-unused-vars, naming-convention, prefer-const, no-console
- Set style: 2-space indent, 140 char max-len, disable complexity rules
- Configure Prettier: single quotes, 140 width, trailing commas
- Setup husky pre-commit hook to auto-fix and format on commit
- Replace console.log/warn with context.logger.info/warn in handlers
- Remove console.log from ponder.config.ts (replaced with comment)
- Add npm scripts: lint, lint:fix, format, format:check
- All lint rules pass without warnings
resolvel #45
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/52
2025-10-04 15:37:26 +02:00
|
|
|
rpc: process.env.PONDER_RPC_URL_BASE_SEPOLIA_LOCAL_FORK || 'http://127.0.0.1:8545',
|
2025-09-24 14:02:28 +02:00
|
|
|
disableCache: true,
|
2025-09-23 14:18:04 +02:00
|
|
|
contracts: {
|
feat(ponder): Add strict ESLint + Prettier with pre-commit hooks (#52)
- Install eslint, @typescript-eslint plugins, prettier, husky, lint-staged
- Configure ESLint flat config with TypeScript parser
- Enforce: no-explicit-any (with exceptions), no-unused-vars, naming-convention, prefer-const, no-console
- Set style: 2-space indent, 140 char max-len, disable complexity rules
- Configure Prettier: single quotes, 140 width, trailing commas
- Setup husky pre-commit hook to auto-fix and format on commit
- Replace console.log/warn with context.logger.info/warn in handlers
- Remove console.log from ponder.config.ts (replaced with comment)
- Add npm scripts: lint, lint:fix, format, format:check
- All lint rules pass without warnings
resolvel #45
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/52
2025-10-04 15:37:26 +02:00
|
|
|
kraiken: process.env.KRAIKEN_ADDRESS || '0x56186c1E64cA8043dEF78d06AfF222212eA5df71',
|
|
|
|
|
stake: process.env.STAKE_ADDRESS || '0x056E4a859558A3975761ABd7385506BC4D8A8E60',
|
2026-02-18 00:19:05 +01:00
|
|
|
liquidityManager: process.env.LM_ADDRESS || '0x33d10f2449ffede92b43d4fba562f132ba6a766a',
|
feat(ponder): Add strict ESLint + Prettier with pre-commit hooks (#52)
- Install eslint, @typescript-eslint plugins, prettier, husky, lint-staged
- Configure ESLint flat config with TypeScript parser
- Enforce: no-explicit-any (with exceptions), no-unused-vars, naming-convention, prefer-const, no-console
- Set style: 2-space indent, 140 char max-len, disable complexity rules
- Configure Prettier: single quotes, 140 width, trailing commas
- Setup husky pre-commit hook to auto-fix and format on commit
- Replace console.log/warn with context.logger.info/warn in handlers
- Remove console.log from ponder.config.ts (replaced with comment)
- Add npm scripts: lint, lint:fix, format, format:check
- All lint rules pass without warnings
resolvel #45
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/52
2025-10-04 15:37:26 +02:00
|
|
|
startBlock: parseInt(process.env.START_BLOCK || '31425917'),
|
2025-09-23 14:18:04 +02:00
|
|
|
},
|
|
|
|
|
},
|
2026-03-14 22:36:52 +00:00
|
|
|
BASE_MAINNET_LOCAL_FORK: {
|
|
|
|
|
chainId: 31337,
|
|
|
|
|
rpc: process.env.PONDER_RPC_URL_BASE_MAINNET_LOCAL_FORK || 'http://127.0.0.1:8545',
|
|
|
|
|
disableCache: true,
|
|
|
|
|
contracts: {
|
|
|
|
|
kraiken: process.env.KRAIKEN_ADDRESS || '0x45caa5929f6ee038039984205bdecf968b954820',
|
|
|
|
|
stake: process.env.STAKE_ADDRESS || '0xed70707fab05d973ad41eae8d17e2bcd36192cfc',
|
|
|
|
|
liquidityManager: process.env.LM_ADDRESS || '0x0000000000000000000000000000000000000000',
|
|
|
|
|
startBlock: parseInt(process.env.START_BLOCK || '26038614'),
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-09-23 19:24:05 +02:00
|
|
|
BASE_SEPOLIA: {
|
2025-09-23 14:18:04 +02:00
|
|
|
chainId: 84532,
|
feat(ponder): Add strict ESLint + Prettier with pre-commit hooks (#52)
- Install eslint, @typescript-eslint plugins, prettier, husky, lint-staged
- Configure ESLint flat config with TypeScript parser
- Enforce: no-explicit-any (with exceptions), no-unused-vars, naming-convention, prefer-const, no-console
- Set style: 2-space indent, 140 char max-len, disable complexity rules
- Configure Prettier: single quotes, 140 width, trailing commas
- Setup husky pre-commit hook to auto-fix and format on commit
- Replace console.log/warn with context.logger.info/warn in handlers
- Remove console.log from ponder.config.ts (replaced with comment)
- Add npm scripts: lint, lint:fix, format, format:check
- All lint rules pass without warnings
resolvel #45
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/52
2025-10-04 15:37:26 +02:00
|
|
|
rpc: process.env.PONDER_RPC_URL_BASE_SEPOLIA || 'https://sepolia.base.org',
|
2025-09-23 14:18:04 +02:00
|
|
|
contracts: {
|
feat(ponder): Add strict ESLint + Prettier with pre-commit hooks (#52)
- Install eslint, @typescript-eslint plugins, prettier, husky, lint-staged
- Configure ESLint flat config with TypeScript parser
- Enforce: no-explicit-any (with exceptions), no-unused-vars, naming-convention, prefer-const, no-console
- Set style: 2-space indent, 140 char max-len, disable complexity rules
- Configure Prettier: single quotes, 140 width, trailing commas
- Setup husky pre-commit hook to auto-fix and format on commit
- Replace console.log/warn with context.logger.info/warn in handlers
- Remove console.log from ponder.config.ts (replaced with comment)
- Add npm scripts: lint, lint:fix, format, format:check
- All lint rules pass without warnings
resolvel #45
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/52
2025-10-04 15:37:26 +02:00
|
|
|
kraiken: '0x22c264Ecf8D4E49D1E3CabD8DD39b7C4Ab51C1B8',
|
|
|
|
|
stake: '0xe28020BCdEeAf2779dd47c670A8eFC2973316EE2',
|
2026-02-18 00:19:05 +01:00
|
|
|
liquidityManager: process.env.LM_ADDRESS || '0x0000000000000000000000000000000000000000',
|
2025-09-23 14:18:04 +02:00
|
|
|
startBlock: 20940337,
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-09-23 19:24:05 +02:00
|
|
|
BASE: {
|
2025-09-23 14:18:04 +02:00
|
|
|
chainId: 8453,
|
feat(ponder): Add strict ESLint + Prettier with pre-commit hooks (#52)
- Install eslint, @typescript-eslint plugins, prettier, husky, lint-staged
- Configure ESLint flat config with TypeScript parser
- Enforce: no-explicit-any (with exceptions), no-unused-vars, naming-convention, prefer-const, no-console
- Set style: 2-space indent, 140 char max-len, disable complexity rules
- Configure Prettier: single quotes, 140 width, trailing commas
- Setup husky pre-commit hook to auto-fix and format on commit
- Replace console.log/warn with context.logger.info/warn in handlers
- Remove console.log from ponder.config.ts (replaced with comment)
- Add npm scripts: lint, lint:fix, format, format:check
- All lint rules pass without warnings
resolvel #45
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/52
2025-10-04 15:37:26 +02:00
|
|
|
rpc: process.env.PONDER_RPC_URL_BASE || 'https://base.llamarpc.com',
|
2025-09-23 14:18:04 +02:00
|
|
|
contracts: {
|
feat(ponder): Add strict ESLint + Prettier with pre-commit hooks (#52)
- Install eslint, @typescript-eslint plugins, prettier, husky, lint-staged
- Configure ESLint flat config with TypeScript parser
- Enforce: no-explicit-any (with exceptions), no-unused-vars, naming-convention, prefer-const, no-console
- Set style: 2-space indent, 140 char max-len, disable complexity rules
- Configure Prettier: single quotes, 140 width, trailing commas
- Setup husky pre-commit hook to auto-fix and format on commit
- Replace console.log/warn with context.logger.info/warn in handlers
- Remove console.log from ponder.config.ts (replaced with comment)
- Add npm scripts: lint, lint:fix, format, format:check
- All lint rules pass without warnings
resolvel #45
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/52
2025-10-04 15:37:26 +02:00
|
|
|
kraiken: '0x45caa5929f6ee038039984205bdecf968b954820',
|
|
|
|
|
stake: '0xed70707fab05d973ad41eae8d17e2bcd36192cfc',
|
2026-02-18 00:19:05 +01:00
|
|
|
liquidityManager: process.env.LM_ADDRESS || '0x0000000000000000000000000000000000000000',
|
2025-09-23 14:18:04 +02:00
|
|
|
startBlock: 26038614,
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-09-30 20:02:43 +02:00
|
|
|
};
|
2025-09-23 14:18:04 +02:00
|
|
|
|
|
|
|
|
// Select network based on environment variable
|
feat(ponder): Add strict ESLint + Prettier with pre-commit hooks (#52)
- Install eslint, @typescript-eslint plugins, prettier, husky, lint-staged
- Configure ESLint flat config with TypeScript parser
- Enforce: no-explicit-any (with exceptions), no-unused-vars, naming-convention, prefer-const, no-console
- Set style: 2-space indent, 140 char max-len, disable complexity rules
- Configure Prettier: single quotes, 140 width, trailing commas
- Setup husky pre-commit hook to auto-fix and format on commit
- Replace console.log/warn with context.logger.info/warn in handlers
- Remove console.log from ponder.config.ts (replaced with comment)
- Add npm scripts: lint, lint:fix, format, format:check
- All lint rules pass without warnings
resolvel #45
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/52
2025-10-04 15:37:26 +02:00
|
|
|
const NETWORK = (process.env.PONDER_NETWORK as keyof typeof networks) || 'BASE_SEPOLIA_LOCAL_FORK';
|
2025-09-23 14:18:04 +02:00
|
|
|
const selectedNetwork = networks[NETWORK as keyof typeof networks];
|
|
|
|
|
|
|
|
|
|
if (!selectedNetwork) {
|
feat(ponder): Add strict ESLint + Prettier with pre-commit hooks (#52)
- Install eslint, @typescript-eslint plugins, prettier, husky, lint-staged
- Configure ESLint flat config with TypeScript parser
- Enforce: no-explicit-any (with exceptions), no-unused-vars, naming-convention, prefer-const, no-console
- Set style: 2-space indent, 140 char max-len, disable complexity rules
- Configure Prettier: single quotes, 140 width, trailing commas
- Setup husky pre-commit hook to auto-fix and format on commit
- Replace console.log/warn with context.logger.info/warn in handlers
- Remove console.log from ponder.config.ts (replaced with comment)
- Add npm scripts: lint, lint:fix, format, format:check
- All lint rules pass without warnings
resolvel #45
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/52
2025-10-04 15:37:26 +02:00
|
|
|
throw new Error(`Invalid network: ${NETWORK}. Valid options: ${Object.keys(networks).join(', ')}`);
|
2025-09-23 14:18:04 +02:00
|
|
|
}
|
|
|
|
|
|
feat(ponder): Add strict ESLint + Prettier with pre-commit hooks (#52)
- Install eslint, @typescript-eslint plugins, prettier, husky, lint-staged
- Configure ESLint flat config with TypeScript parser
- Enforce: no-explicit-any (with exceptions), no-unused-vars, naming-convention, prefer-const, no-console
- Set style: 2-space indent, 140 char max-len, disable complexity rules
- Configure Prettier: single quotes, 140 width, trailing commas
- Setup husky pre-commit hook to auto-fix and format on commit
- Replace console.log/warn with context.logger.info/warn in handlers
- Remove console.log from ponder.config.ts (replaced with comment)
- Add npm scripts: lint, lint:fix, format, format:check
- All lint rules pass without warnings
resolvel #45
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/52
2025-10-04 15:37:26 +02:00
|
|
|
// Network configuration logged during Ponder startup
|
|
|
|
|
// Network=${NETWORK}, chainId=${selectedNetwork.chainId}, startBlock=${selectedNetwork.contracts.startBlock}
|
2025-09-23 19:24:05 +02:00
|
|
|
|
2025-09-23 14:18:04 +02:00
|
|
|
export default createConfig({
|
2025-09-23 16:57:49 +02:00
|
|
|
// Use PostgreSQL if DATABASE_URL is set, otherwise use PGlite
|
feat(ponder): Add strict ESLint + Prettier with pre-commit hooks (#52)
- Install eslint, @typescript-eslint plugins, prettier, husky, lint-staged
- Configure ESLint flat config with TypeScript parser
- Enforce: no-explicit-any (with exceptions), no-unused-vars, naming-convention, prefer-const, no-console
- Set style: 2-space indent, 140 char max-len, disable complexity rules
- Configure Prettier: single quotes, 140 width, trailing commas
- Setup husky pre-commit hook to auto-fix and format on commit
- Replace console.log/warn with context.logger.info/warn in handlers
- Remove console.log from ponder.config.ts (replaced with comment)
- Add npm scripts: lint, lint:fix, format, format:check
- All lint rules pass without warnings
resolvel #45
Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/52
2025-10-04 15:37:26 +02:00
|
|
|
database: process.env.DATABASE_URL
|
|
|
|
|
? {
|
|
|
|
|
kind: 'postgres' as const,
|
|
|
|
|
connectionString: process.env.DATABASE_URL,
|
|
|
|
|
schema: process.env.DATABASE_SCHEMA || 'public',
|
|
|
|
|
}
|
|
|
|
|
: undefined,
|
2025-09-23 14:18:04 +02:00
|
|
|
chains: {
|
|
|
|
|
[NETWORK]: {
|
|
|
|
|
id: selectedNetwork.chainId,
|
|
|
|
|
rpc: selectedNetwork.rpc,
|
2025-09-30 20:02:43 +02:00
|
|
|
disableCache: selectedNetwork.disableCache ?? false,
|
2025-09-23 14:18:04 +02:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
contracts: {
|
|
|
|
|
Kraiken: {
|
2025-09-30 20:02:43 +02:00
|
|
|
abi: KraikenAbi satisfies Abi,
|
2025-09-23 14:18:04 +02:00
|
|
|
chain: NETWORK,
|
|
|
|
|
address: selectedNetwork.contracts.kraiken as `0x${string}`,
|
|
|
|
|
startBlock: selectedNetwork.contracts.startBlock,
|
|
|
|
|
},
|
|
|
|
|
Stake: {
|
2025-09-30 20:02:43 +02:00
|
|
|
abi: StakeAbi satisfies Abi,
|
2025-09-23 14:18:04 +02:00
|
|
|
chain: NETWORK,
|
|
|
|
|
address: selectedNetwork.contracts.stake as `0x${string}`,
|
|
|
|
|
startBlock: selectedNetwork.contracts.startBlock,
|
|
|
|
|
},
|
2026-02-18 00:19:05 +01:00
|
|
|
LiquidityManager: {
|
|
|
|
|
abi: LiquidityManagerAbi satisfies Abi,
|
|
|
|
|
chain: NETWORK,
|
|
|
|
|
address: selectedNetwork.contracts.liquidityManager as `0x${string}`,
|
|
|
|
|
startBlock: selectedNetwork.contracts.startBlock,
|
|
|
|
|
},
|
2025-09-23 14:18:04 +02:00
|
|
|
},
|
|
|
|
|
blocks: {
|
|
|
|
|
StatsBlock: {
|
|
|
|
|
chain: NETWORK,
|
|
|
|
|
interval: 1,
|
|
|
|
|
startBlock: selectedNetwork.contracts.startBlock,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|