Skip to content

Commit 114ac3e

Browse files
fix: update across contracts (#68)
1 parent c45eba7 commit 114ac3e

File tree

3 files changed

+404
-147
lines changed

3 files changed

+404
-147
lines changed

Diff for: packages/indexer/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"author": "",
2222
"license": "ISC",
2323
"dependencies": {
24-
"@across-protocol/constants": "^3.1.13",
25-
"@across-protocol/contracts": "^3.0.8",
24+
"@across-protocol/constants": "^3.1.16",
25+
"@across-protocol/contracts": "^3.0.11",
2626
"@across-protocol/sdk": "^3.2.2",
2727
"@types/lodash": "^4.17.7",
2828
"bullmq": "^5.12.12",

Diff for: packages/indexer/src/utils/contractUtils.ts

+13-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ export type GetSpokeClientParams = {
2121
hubPoolClient: across.clients.HubPoolClient;
2222
};
2323

24+
function getAddress(contractName: string, chainId: number): string {
25+
const address = getDeployedAddress(contractName, chainId);
26+
if (!address) {
27+
throw new Error(
28+
`Address for contract ${contractName} on ${chainId} not found `,
29+
);
30+
}
31+
return address;
32+
}
33+
2434
/**
2535
* Resolves a spoke pool client with the given parameters
2636
* @param params Parameters to resolve a spoke client.
@@ -32,7 +42,7 @@ export function getSpokeClient(
3242
params: GetSpokeClientParams,
3343
): across.clients.SpokePoolClient {
3444
const { provider, logger, maxBlockLookBack, chainId, hubPoolClient } = params;
35-
const address = getDeployedAddress("SpokePool", chainId);
45+
const address = getAddress("SpokePool", chainId);
3646
const deployedBlockNumber = getDeployedBlockNumber("SpokePool", chainId);
3747

3848
const toBlock = params.toBlock;
@@ -85,7 +95,7 @@ export function getConfigStoreClient(
8595
params: GetConfigStoreClientParams,
8696
): across.clients.AcrossConfigStoreClient {
8797
const { provider, logger, maxBlockLookBack, chainId } = params;
88-
const address = getDeployedAddress("AcrossConfigStore", chainId);
98+
const address = getAddress("AcrossConfigStore", chainId);
8999
const deployedBlockNumber = getDeployedBlockNumber(
90100
"AcrossConfigStore",
91101
chainId,
@@ -131,7 +141,7 @@ export function getHubPoolClient(
131141
): across.clients.HubPoolClient {
132142
const { provider, logger, maxBlockLookBack, chainId, configStoreClient } =
133143
params;
134-
const address = getDeployedAddress("HubPool", chainId);
144+
const address = getAddress("HubPool", chainId);
135145
const deployedBlockNumber = getDeployedBlockNumber("HubPool", chainId);
136146

137147
const hubPoolContract = new Contract(address, HubPoolFactory.abi, provider);

0 commit comments

Comments
 (0)