CapsuleFactory.sol

The CapsuleFactory Contract

The CapsuleFactory contract allows users to deploy their own Capsule Collections. While the CapsuleMinter contract can be thought of as a database for Capsule NFTs, the CapsuleFactory contract can be thought of as a database for Capsule Collections.

View CapsuleFactory.sol verified contract code on Etherscan

View CapsuleFactory.sol verified proxy contract code on Etherscan

User Interactable Methods

createCapsuleCollection

function createCapsuleCollection(string _name, string _symbol, address _tokenURIOwner, bool _isCollectionPrivate) external payable returns (address)

Usage: The main method which creates a Capsule NFT Collection for a user. Creation of a Capsule Collection MUST go through the CapsuleFactory in order to ensure ecosystem safety - this ensures that no Capsule contract is able to exploit the CapsuleMinter's token storing/redeeming methods.

Parameters:

  • _name: (string) - the name of the Capsule Collection

  • _symbol: (string) - the symbol of the Capsule Collection

  • _tokenURIOwner: (address) - the address of the Capsule Collection tokenURIOwner (also known as the Metamaster)

  • _isCollectionPrivate: (boolean) - whether the Capsule Collection is designated as private

Returns: (address) - The address of the newly deployed Capsule Collection.

getAllCapsuleCollections

Usage: Get a list of all Capsule Collections created.

Parameters: (none)

Returns: (address[]) - An array of addresses of all Capsule Collections created.

getCapsuleCollectionsOf

Usage: Get list of all Capsule Collections created by an input owner address _owner.

Parameters:

  • _owner: (address) - the address of the owner

Returns: (address[]) - An array of addresses of all Capsule Collections created by _owner.

User Non-Interactable Methods

updateCapsuleCollectionOwner

Usage: A helper method which updates owner of a Capsule Collection. This is called when the transferOwnership method is called by the Capsule NFT in order to update the Capsule's owner information in the CapsuleFactory. Only a Capsule NFT may call this method.

Parameters:

  • _previousOwner: (address) - the address of the old owner (the caller)

  • _newOwner: (address) - the address of the new owner

Lesser Interesting Methods

initialize

addToWhitelist

removeFromWhitelist

addToBlacklist

removeFromBlacklist

flushTaxAmount

The owner or tax collector can call this function to withdraw all ETH stored in this contract

getWhitelist

Get a list of all whitelisted addresses

getBlacklist

Get a list of all blacklisted addresses

isBlacklisted

Return whether a given address is blacklisted or not

isWhitelisted

Return whether a given address is whitelisted or not

setCapsuleMinter

Set CapsuleMinter address

updateCapsuleCollectionTax

Update Capsule Collection creation tax

updateTaxCollector

Update tax collector

Key Constants

VERSION

Key Events

CapsuleCollectionTaxUpdated

CapsuleCollectionCreated

CapsuleOwnerUpdated

TaxCollectorUpdated

CapsuleFactoryStorage

capsuleCollectionTax

taxCollector

capsuleMinter

capsules

capsulesOf

isCapsule

whitelist

blacklist

Last updated