Skip to content

Commit

Permalink
feat(deployments): typed deployment contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbeckers committed Nov 9, 2023
1 parent 34436b9 commit fc0161d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@hypercerts-org/contracts",
"description": "EVM compatible protocol for managing impact claims",
"version": "0.9.0",
"version": "0.10.0",
"author": {
"name": "Hypercerts Foundation",
"url": "https://github.com/hypercerts-org/hypercerts"
Expand Down
20 changes: 18 additions & 2 deletions contracts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import type { IAllowlist } from "../types/src/protocol/interfaces/IAllowlist";
import type { IHypercertToken } from "../types/src/protocol/interfaces/IHypercertToken";
import type { Errors } from "../types/src/protocol/libs/Errors";

import deployments from "./deployments.json";
import deploymentsJSON from "./deployments.json";

/*
in order to adjust the build folder:
Expand All @@ -31,8 +31,24 @@ import deployments from "./deployments.json";
4) bump package.json version to publish a new package to npm.
*/

export type Deployment = {
HypercertMinterUUPS: `0x${string}`;
HypercertMinterImplementation: `0x${string}`;
TransferManager?: `0x${string}`;
HypercertExchange?: `0x${string}`;
};

export type DeployedChains = keyof typeof deploymentsJSON;

// Deployments
export { deployments };
const deployments = deploymentsJSON as Record<DeployedChains, Deployment>;

const asDeployedChain = (chainId: string | number) => {
if (chainId in deployments) return chainId as DeployedChains;
throw new Error(`Chain ${chainId} not deployed`);
};

export { deployments, asDeployedChain };

// Interfaces
export { IAllowlist, IHypercertToken };
Expand Down

0 comments on commit fc0161d

Please sign in to comment.