-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathponder.config.ts
More file actions
126 lines (123 loc) · 4.13 KB
/
ponder.config.ts
File metadata and controls
126 lines (123 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import { createConfig, factory } from "ponder";
import type { Abi, AbiEvent } from "viem";
import MonsterRegistryAbi from "./src/contracts/abis/MonsterRegistry.json";
import ActAbi from "./src/contracts/abis/Act.json";
import SeasonAbi from "./src/contracts/abis/Season.json";
import BattleAbi from "./src/contracts/abis/Battle.json";
import BattleFactoryAbi from "./src/contracts/abis/BattleFactory.json";
import CharacterAbi from "./src/contracts/abis/Character.json";
import StandardDeckAbi from "./src/contracts/abis/StandardDeck.json";
import PlayerStatsStorageAbi from "./src/contracts/abis/PlayerStatsStorage.json";
import deployments from "./src/contracts/deployments.json";
import CharacterFactoryAbi from "./src/contracts/abis/CharacterFactory.json";
import StandardDeckLogicAbi from "./src/contracts/abis/StandardDeckLogic.json";
import DeckConfigurationAbi from "./src/contracts/abis/DeckConfiguration.json";
import RoomRewardsAbi from "./src/contracts/abis/RoomRewards.json";
import BattleRoomAbi from "./src/contracts/abis/BattleRoom.json";
import PlayerDeckManagerAbi from "./src/contracts/abis/PlayerDeckManager.json";
// Helper function to get deployment info by contract name
function getDeployment(contractName: string) {
const deployment = deployments.find(d => d.contractName === contractName);
if (!deployment) {
throw new Error(`Deployment not found for contract: ${contractName}`);
}
return {
address: deployment.contractAddress as `0x${string}`,
startBlock: parseInt(deployment.blockNumber, 16),
};
}
export default createConfig({
chains: {
custom: {
id: 0x82384e,
rpc: process.env.PONDER_RPC_URL_1!,
},
},
contracts: {
Act: {
chain: "custom",
abi: ActAbi as Abi,
address: factory({
address: getDeployment("Season").address,
event: SeasonAbi.find((val) => val.type === "event" && val.name === "ActAdded") as AbiEvent,
parameter: "act"
}),
startBlock: getDeployment("Act").startBlock,
},
MonsterRegistry: {
chain: "custom",
abi: MonsterRegistryAbi as Abi,
...getDeployment("MonsterRegistry"),
},
Season: {
chain: "custom",
abi: SeasonAbi as Abi,
...getDeployment("Season"),
},
BattleFactory: {
chain: "custom",
abi: BattleFactoryAbi as Abi,
...getDeployment("BattleFactory"),
},
Battle: {
chain: "custom",
abi: BattleAbi as Abi,
address: factory({
address: getDeployment("BattleFactory").address,
event: BattleFactoryAbi.find((val) => val.type === "event" && val.name === "CreatedGame") as AbiEvent,
parameter: "gameAddress"
}),
startBlock: getDeployment("BattleFactory").startBlock
},
PlayerStatsStorage: {
chain: "custom",
abi: PlayerStatsStorageAbi as Abi,
...getDeployment("PlayerStatsStorage"),
},
CharacterFactory: {
chain: "custom",
abi: CharacterFactoryAbi as Abi,
...getDeployment("CharacterFactory"),
},
Character: {
chain: "custom",
abi: CharacterAbi as Abi,
address: factory({
address: getDeployment("CharacterFactory").address,
event: CharacterFactoryAbi.find((val) => val.type === "event" && val.name === "CharacterCreated") as AbiEvent,
parameter: "character"
}),
startBlock: getDeployment("CharacterFactory").startBlock
},
StandardDeck: {
chain: "custom",
abi: StandardDeckAbi as Abi,
...getDeployment("StandardDeck"),
},
StandardDeckLogic: {
chain: "custom",
abi: StandardDeckLogicAbi as Abi,
...getDeployment("StandardDeckLogic"),
},
RoomRewards: {
chain: "custom",
abi: RoomRewardsAbi as Abi,
...getDeployment("RoomRewards"),
},
BattleRoom: {
chain: "custom",
abi: BattleRoomAbi as Abi,
...getDeployment("BattleRoom"),
},
DeckConfiguration: {
chain: "custom",
abi: DeckConfigurationAbi as Abi,
...getDeployment("DeckConfiguration"),
},
PlayerDeckManager: {
chain: "custom",
abi: PlayerDeckManagerAbi as Abi,
...getDeployment("PlayerDeckManager"),
},
},
});