Freee Docs
  • Guide
  • Getting Started
    • How do I connect my wallet to Freee?
    • How do I mint on Freee?
    • Gas Fees
  • Freee Create
    • What can I create on Freee?
    • Single-Edition (ERC-721)
      • How to create a Edition
      • Managing your Edition (ERC-721)
    • Drop (ERC-721)
      • How to create a Drop (ERC-721)
      • How to set up the artwork folder for your Drops collection
      • How to set up the .csv file in your Drops collection
      • Managing your Drop (ERC-721)
    • Collection (ERC-721)
      • How to create a collection (ERC721)
      • How to upload collection artworks?
      • Managing your Collection (ERC721)
        • Manage Sale Stages
        • Manage Pre-reveal & Reveal
        • General Settings
      • Others
        • In depth outline of collection artworks folder
        • In-depth Outline of collection metadata CSV
    • Multi-Edition (ERC-1155)
      • How to Create a Multi-Edition
      • Managing your Collection (Onchain)
    • More Features
      • How can I create an Airdrop?
      • How can I create an Allowlist?
      • Receive blast rewards
    • Create FAQs
      • Can I connect a multi-sig wallet?
      • How do I use a split contract with my collection?
      • How do I withdraw my earnings?
      • Do I have to pay a fee to collect my earnings?
      • Can I add a custom payout address to my collection?
  • Smart Contracts
    • Deployed Contract Addresses
      • Mainnets
      • Testnets
    • Smart Contracts Event-based Overview
    • 1155 Contracts
      • Creating a Contract
      • Creating a Token
      • Selling a Token
      • Minting Tokens
      • Permissions
    • 721 Contracts
      • NFT Creator Factory
      • NFT Implementation
      • Edition Metadata Renderer
      • Drop Metadata Renderer
      • Collection Metadata Renderer
  • Freee Platform Fees
  • Create, share, and collect to earn
    • Understanding Rewards on Freee
    • How to create to earn
    • How to share to earn
    • How to collect to earn
    • Diamond Rewards Chart
  • Freee FAQs
    • Why can't I mint from a collection ?
    • Why can't I see my minted NFT(s) ?
    • Why did my mint transaction fail ?
  • Legal
    • Privacy Policy
    • Terms of Service
Powered by GitBook
On this page
  • Calling the Factory Contract
  • Royalty Configuration
  • Contract URI
  • Setup Actions
  1. Smart Contracts
  2. 1155 Contracts

Creating a Contract

All 1155 contracts created from Freee are deployed by calling a central factory contract.

Previous1155 ContractsNextCreating a Token

Last updated 1 year ago

When calling this factory it will deploy a minimal proxy contract that is upgradeable. All upgrades are opt-in and must be done manually on a per contract basis by the user.

View the list of deployed contract addresses .

Calling the Factory Contract

The createContract function on the factory is responsible for deploying a new 1155 contract.

The setupActions parameter allows for multiple actions to be called when deploying the contract.

Such as creating a token and sale in the same transaction as deploying the contract.

  • contractURI: The URI for the contract metadata

  • name: The name of the contract

  • defaultRoyaltyConfiguration: The default royalty configuration for the contract

  • defaultAdmin: The default admin for the contract

  • setupActions: The actions to perform on the new contract upon initialization (optional)

function createContract(
    string calldata newContractURI,
    string calldata name,
    ICreatorRoyaltiesControl.RoyaltyConfiguration memory defaultRoyaltyConfiguration,
    address payable defaultAdmin,
    bytes[] calldata setupActions
) external returns (address)

The contract supports multicall so multiple functions can be called to set up the contract in a single transaction.

Royalty Configuration

The defaultRoyaltyConfiguration sets contract-wide royalties.

Note, that royalties can also be set at the token level.

The parameter can be passed in with the following details:

  • royaltyMintSchedule: 1/N tokens are minted to the royalty recipient

  • royaltyBPS: The royalty amount in basis points for secondary sales.

  • royaltyRecipient: The address that will receive the royalty payments.

struct RoyaltyConfiguration {
    uint32 royaltyMintSchedule;
    uint32 royaltyBPS;
    address royaltyRecipient;
}

Contract URI

The Contract URI contains contract specific details. This metadata is stored in a JSON file on IPFS.

The uri is retrieved via the contractURI() call on the contract.

type CollectionMetadata = {
  name?: string
  description?: string
  image?: string
  imageURI?: string
  animation_url?: string
  animationURI?: string
  seller_fee_basis_points?: string
  seller_fee_recipient?: string
  storefront?: {
    theme?: StorefrontTheme
  }
}

Setup Actions

An optional param that is encoded function data that can be passed in and can call a separate function within the contract. This allows creating a token and setting permissions in the same transaction of creating the contract. Actions that can be called:

  • Creating a token

  • Setting the salesConfig

  • Granting permissions/minter role

  • Admin minting tokens

here