Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Deploying Contracts

Deploy Gatekeeper1155 contracts via the factory using CREATE2 for deterministic addresses.

Deploy with Setup Calls

import {
  Factory,
  MINTER_ROLE,
  gatekeeper1155FactoryAddress,
  gatekeeper1155Address,
  gatekeeperAddress,
} from '@sceneinfrastructure/sdk'
 
const chainId = 8453 // Base
const walletAddress = '0x3456789012345678901234567890123456789012'
 
// Prepare setup calls
const setupCalls = [
  // Grant MINTER role to the Gatekeeper contract
  Factory.encodeGrantRoles({
    user: gatekeeperAddress[chainId],
    roles: MINTER_ROLE,
  }),
 
  // Create a token tier
  Factory.encodeSetupNewTier({
    tokenURI: 'ipfs://QmTokenMetadata...',
    stubURI: 'ipfs://QmStubMetadata...',
    maxSupply: 1000n,
  }),
]
 
const { to, data, predictedAddress } = Factory.prepareDeploy({
  factory: gatekeeper1155FactoryAddress[chainId],
  implementation: gatekeeper1155Address[chainId],
  nonce: BigInt(Date.now()),
  creator: walletAddress,
  owner: walletAddress,
  contractURI: 'ipfs://QmContractMetadata...',
  calls: setupCalls,
})

Setup Call Helpers

Grant Roles

Grant access control roles to addresses:

import {
  Factory,
  ADMIN_ROLE,
  HOST_ROLE,
  DOOR_ROLE,
  MINTER_ROLE,
  gatekeeperAddress,
} from '@sceneinfrastructure/sdk'
 
const chainId = 8453 // Base
 
// Grant single role (e.g., to the Gatekeeper contract)
const grantMinter = Factory.encodeGrantRoles({
  user: gatekeeperAddress[chainId],
  roles: MINTER_ROLE,
})
 
// Grant multiple roles to an admin address
const grantMultiple = Factory.encodeGrantRoles({
  user: '0x2345678901234567890123456789012345678901',
  roles: ADMIN_ROLE | HOST_ROLE,
})

Setup Token Tiers

Create token tiers with metadata and supply limits:

import { Factory } from '@sceneinfrastructure/sdk'
 
// Limited supply tier
const limitedTier = Factory.encodeSetupNewTier({
  tokenURI: 'ipfs://QmTokenMetadata...',
  stubURI: 'ipfs://QmStubMetadata...',
  maxSupply: 500n,
})
 
// Unlimited supply tier (maxSupply = 0)
const unlimitedTier = Factory.encodeSetupNewTier({
  tokenURI: 'ipfs://QmTokenMetadata...',
  stubURI: 'ipfs://QmStubMetadata...',
  maxSupply: 0n,
})

Call Gatekeeper

Execute calls to the Gatekeeper contract during deployment:

import { Factory, Gatekeeper, gatekeeperAddress } from '@sceneinfrastructure/sdk'
 
const chainId = 8453 // Base
 
// Token contract will be the predictedAddress from prepareDeploy
const tokenContractAddress = '0x2345678901234567890123456789012345678901'
 
const saleKey = {
  token: tokenContractAddress,
  vendorFeeBps: 0,
  referralFeeBps: 0,
  salesTaxBps: 0,
  vendor: '0x3456789012345678901234567890123456789012',
  nonce: 1n,
  currency: '0x1111111111111111111111111111111111111111',
  fundsRecipient: '0x5678901234567890123456789012345678901234',
  tokenId: 1n,
} as const
 
// Encode a registerSale call
const registerData = Gatekeeper.encodeRegisterSale({
  saleKey,
  saleState: {
    startTime: 1n,
    endTime: 9999999999n,
    quantity: 100,
    price: 1000000n,
    approvers: [],
  },
})
 
// Wrap in callGatekeeper
const gatekeeperCall = Factory.encodeCallGatekeeper({
  gatekeeper: gatekeeperAddress[chainId],
  data: registerData,
})

Next Steps