Skip to main content

Deploying Contracts

Learn how to deploy a contract to multiple chains with Holograph SDK.

Prerequisites

To get the most out of this guide, make sure to:


1. Deploy to Primary Chain

src/holograph/deploy.ts
import { HolographLegacyCollection } from "@holographxyz/sdk";
import { networks } from "@holographxyz/networks";

import { holographConfig, wallet } from "./config";

const myContract = new HolographLegacyCollection(holographConfig, {
collectionInfo: {
name: "NFTs Without Boundaries",
description: "Possibly the most innovative NFT collection yet.",
symbol: "HOLO",
royaltiesBps: 2000, // 20%
salt: "0x0000000000000000000000000000000000000000000000000000018e7cc167e2",
},
primaryChainId: networks.polygon.chain,
});

const signatureData = await myContract.signDeploy(wallet);

const { collectionAddress, txHash } = await myContract.deploy(signatureData);

For more information, check out the HolographLegacyCollection class reference.


2. Deploy to Multiple Chains

Option 1: Using deploy method again:

src/holograph/deploy.ts
const avalancheSignatureData = await myContract.signDeploy(
wallet,
networks.avalanche.chain
);

await myContract.deploy(avalancheSignatureData);

Option 2: Using deployBatch method:

src/holograph/batch-deploy.ts
const signatureData = await myContract.signDeployBatch(wallet, [
networks.polygon.chain,
networks.avalanche.chain,
networks.binance.chain,
networks.arbitrumOne.chain,
]);

await myContract.deployBatch(signatureData);

Congrats! You have deployed an omnichain contract!


3. Deploy Multichain Open Edition (MOE)

Multichain open editions enable users to mint NFTs on multiple chains.

src/holograph/moe-deploy.ts
import { HolographMoeERC721DropV2 } from "@holographxyz/sdk";
import { networks } from "@holographxyz/networks";

import { holographConfig, wallet } from "./config";

const myMOEContract = new HolographMoeERC721DropV2(holographConfig, {
collectionInfo: {
name: "NFTs Without Boundaries",
description: "Possibly the most innovative NFT collection yet.",
symbol: "HOLO",
royaltiesBps: 2000, // 20%
salt: "0x0000000000000000000000000000000000000000000000000000018e7cc167e2",
},
nftInfo: {
ipfsImageCid: "QmQJNvXvNqfDAV4srQ8dRr8s4FYBKB67RnWhvWLvE72osu",
ipfsUrl: "ipfs://fileurl.com/file",
},
salesConfig: {
maxSalePurchasePerAddress: 10,
publicSaleStart: "2025-01-01T00:00:00Z", // It must be in the ISO format
publicSaleEnd: "2025-01-07T00:00:00Z",
publicSalePrice: 25, // USD unit
},
primaryChainId: networks.polygon.chain,
});

const signatureData = await myMOEContract.signDeploy(wallet);

const { collectionAddress, txHash } = await myMOEContract.deploy(
signatureData
);

For more information, check out the HolographMoeERC721DropV2 class reference.