NFT drop utilizing the gas-optimized ERC1155, a minimalist and gas efficient standard ERC1155 implementation. This contract allows you to release 1 or many semi-fungible tokens. Nearly all of the features of Edition are present, and are configurable as a default for all tokens, or customizable for either individual tokens or a series of tokens. This enables unique features like rolling release schedules, configurably rarity per token, different tiers of access with allowlists and token gating, and much more.

Getting Started
Module Methods
Smart Contract Methods

Getting Started

To begin we'll import the DecentSDK, chain configurations, and the Series module.

Then we'll setup our signer (via wagmi/ethers) and create a new instance of the DecentSDK.

// Import SDK, chain configurations, and the Edition module
import { DecentSDK, chain, series } from "@decent.xyz/sdk";

// Get the signer via wagmi or configure using ethers
// Setup the SDK with the desired chain and signer
const sdk = new DecentSDK(chain.goerli, signer);

Module Methods

deploy
Deploy a minimal proxy clone of the Series implementation contract.

getContract
Get an ethers contract instance of a previously deployed Series contract.

deploy

Deploy a minimal proxy clone of the Series implementation contract.

const myNFT = await series.deploy(
  sdk,
  name,
  symbol,
  hasAdjustableCaps,
  isSoulbound,
  startTokenId,
  endTokenId,
  royaltyBPS,
  feeManager,
  payoutAddress,
  currencyOracle,
  contractURI,
  metadataURI,
  defaultDrop,
  dropOverrides,
  onTxPending,
  onTxReceipt
);

console.log("Series deployed to: ", myNFT.address);

sdk (SDK)
An instance of the DecentSDK, configured with a chain and signer.

name (string)
The name of the NFT collection.

symbol (string)
The symbol of the NFT collection.

hasAdjustableCaps (boolean)
Include the ability to change maxTokens at a date after deployment.

isSoulBound (boolean)
Implementation of Soulbound NFTs so that tokens in this collection are non-transferrable. We recommend setting to false for most use cases. Set to true if NFTs are intended to be used as a credential or another purely non-financial use case.

startTokenId (number)
The start range of token Ids for your deployment. Can use to add a new collection on a new token Id and attach distinct metadata and drop parameters to unique token Ids.

endTokenId (number)
The end range of token Ids for your deployment (inclusive).

royaltyBPS (number)
Percentage of secondary sales for the contract creator.

feeManager (string)
The address of a deployed FeeManager (IFeeManager). Use zero address if your implementation does not require a fee structure.

payoutAddress (string)
An alternate address for withdrawals and royalty payments may be used. Use zero address as the default setting for owner payouts.

currencyOracle (string)
The address of a ChainLink pricefeed used to lock pricing to an alternate currency, e.g. the address of the ETH / USD pair on Mainnet, or MATIC / USD on Polygon. Leave empty to price asset in the chain's native currency (e.g., ETH on Ethereum, Optimism, and Arbitrum or MATIC on Polygon).

contractURI (string)
The URI for contract level metadata.

metadataURI (string)
The base URI for the collection metadata.

defaultDrop (DropConfig)
The default drop configuration for all tokens within the series.

type DropConfig = {
  maxTokens: number | BigNumber,
  tokenPrice: BigNumber,
  maxTokensPerOwner: number,
  presaleMerkleRoot: string | null,
  presaleStart: number,
  presaleEnd: number | BigNumber,
  saleStart: number,
  saleEnd: number | BigNumber,
  tokenGate: TokenGateConfig | null,
}

dropOverrides (DropMap)
An optional mapping of tokens to drop configurations. By mapping token ids to drop ids, and drop ids to configurations, we can create arbitrary groupings of 1 or many tokens per drop.

export type DropMap = {
  tokenIds: number[];
  tokenIdDropIds: number[];
  dropIds: number[];
  drops: DropConfig[];
}

onTxPending (Function) - optional
A callback function executed upon submission of the deploy transaction.

onTxReceipt (Function) - optional
A callback function executed upon receipt of the deploy transaction.

getContract

Get an ethers contract instance of a previously deployed Series contract.

const myNFT = await edition.getContract(sdk, address);

sdk (SDK)
An instance of the DecentSDK, configured with a chain and signer.

address (string)
The contract address of a previously deployed Series contract.

Smart Contract Methods

name
Returns the name of the contract.

symbol
Returns the symbol of the contract.

uri
Returns the URI for a given token ID.

setURI
Set the URI for all token IDs.

contractURI
Returns the URI of the contract metadata.

setContractURI
Sets the URI of the contract metadata.

tokenRange
Returns the range of token IDs that are valid for this contract.

tokenDrop
Returns the drop configuration for the specified token ID.

setTokenDrops
Creates new tokens and updates drop configurations for specified token IDs.

tokenPrice
Gets the current price for the specified token.

mintFee
Gets the current minting fee for the specified token.

mint
Mints a specified number of tokens to a specified address.

mintBatch
Mints a batch of tokens to a specified address.

burn
Burns a specified quantity of tokens from the caller's account.

mintAirdrop
Mints a specified token to multiple recipients as part of an airdrop.

mintPresale
Mints a specified number of tokens to the presale buyer address.

pause
Pauses public minting.

unpause
Unpauses public minting.

setPayoutAddress
Sets the payout address to the specified address.

withdraw
Withdraws the balance of the contract to the payout address or the contract owner.

setRoyaltyBPS
Sets the royalty fee.

royaltyInfo
Returns the royalty recipient and amount for a given sale price.

updateOperatorFilter
Updates the operator filter registry with the specified subscription.

name

Returns the name of the contract.

function name() external view returns (string)

symbol

Returns the symbol of the contract.

function symbol() external view returns (string)

uri

Returns the URI for a given token ID.
A single URI is returned for all token types as defined in EIP-1155's token type ID substitution mechanism.
Clients should replace {id} with the actual token type ID when calling the function.
unused @param tokenId ID of the token to retrieve the URI for.

function uri(uint256) public view returns (string)

setURI

Set the URI for all token IDs.

function setURI(string uri_) external

Parameters

NameTypeDescription
uri_stringThe URI for token all token IDs.

contractURI

Returns the URI of the contract metadata.

function contractURI() external view returns (string)

setContractURI

Sets the URI of the contract metadata.

function setContractURI(string contractURI_) external

Parameters

NameTypeDescription
contractURI_stringThe URI of the contract metadata.

tokenRange

Returns the range of token IDs that are valid for this contract.

function tokenRange() external view returns (uint128 startTokenId, uint128 endTokenId)

Return Values

NameTypeDescription
startTokenIduint128The starting token ID for this contract.
endTokenIduint128The ending token ID for this contract.

tokenDrop

Returns the drop configuration for the specified token ID.

function tokenDrop(uint128 tokenId) external view returns (struct IDCNTSeries.Drop)

Parameters

NameTypeDescription
tokenIduint128The ID of the token to retrieve the drop configuration for.

Return Values

NameTypeDescription
[0]struct IDCNTSeries.Dropdrop The drop configuration mapped to the specified token ID.

setTokenDrops

Creates new tokens and updates drop configurations for specified token IDs.

function setTokenDrops(uint128 newTokens, struct IDCNTSeries.DropMap dropMap) external

Parameters

NameTypeDescription
newTokensuint128Optional number of new token IDs to add to the existing token range.
dropMapstruct IDCNTSeries.DropMapOptional parameter object mapping token IDs, drop IDs, and drops.

tokenPrice

Gets the current price for the specified token. If a currency oracle is set,
the price is calculated in native currency using the oracle exchange rate.

function tokenPrice(uint256 tokenId) public view returns (uint256)

Parameters

NameTypeDescription
tokenIduint256The ID of the token to get the price for.

Return Values

NameTypeDescription
[0]uint256The current price of the specified token.

mintFee

Gets the current minting fee for the specified token.

function mintFee(uint256 tokenId, uint256 quantity) external view returns (uint256 fee)

Parameters

NameTypeDescription
tokenIduint256The ID of the token to get the minting fee for.
quantityuint256The quantity of tokens used to calculate the minting fee.

Return Values

NameTypeDescription
feeuint256The current fee for minting the specified token.

mint

Mints a specified number of tokens to a specified address.

function mint(uint256 tokenId, address to, uint256 quantity) external payable

Parameters

NameTypeDescription
tokenIduint256The ID of the token to mint.
toaddressThe address to which the minted tokens will be sent.
quantityuint256The quantity of tokens to mint.

mintBatch

Mints a batch of tokens to a specified address.

function mintBatch(address to, uint256[] tokenIds, uint256[] quantities) external payable

Parameters

NameTypeDescription
toaddressThe address to which the minted tokens will be sent.
tokenIdsuint256[]The IDs of the tokens to mint.
quantitiesuint256[]The quantities to mint of each token.

burn

Burns a specified quantity of tokens from the caller's account.

function burn(uint256 tokenId, uint256 quantity) external

Parameters

NameTypeDescription
tokenIduint256The ID of the token to burn.
quantityuint256The quantity of tokens to burn.

mintAirdrop

Mints a specified token to multiple recipients as part of an airdrop.

function mintAirdrop(uint256 tokenId, address[] recipients) external

Parameters

NameTypeDescription
tokenIduint256The ID of the token to mint.
recipientsaddress[]The list of addresses to receive the minted tokens.

mintPresale

Mints a specified number of tokens to the presale buyer address.

function mintPresale(uint256 tokenId, uint256 quantity, uint256 maxQuantity, uint256 pricePerToken, bytes32[] merkleProof) external payable

Parameters

NameTypeDescription
tokenIduint256The ID of the token to mint.
quantityuint256The quantity of tokens to mint.
maxQuantityuint256The maximum quantity of tokens that can be minted.
pricePerTokenuint256The price per token in wei.
merkleProofbytes32[]The Merkle proof verifying that the presale buyer is eligible to mint tokens.

pause

Pauses public minting.

function pause() external

unpause

Unpauses public minting.

function unpause() external

setPayoutAddress

Sets the payout address to the specified address.
Use 0x0 to default to the contract owner.

function setPayoutAddress(address _payoutAddress) external

Parameters

NameTypeDescription
_payoutAddressaddressThe address to set as the payout address.

withdraw

Withdraws the balance of the contract to the payout address or the contract owner.

function withdraw() external

setRoyaltyBPS

Sets the royalty fee (ERC-2981: NFT Royalty Standard).

function setRoyaltyBPS(uint16 _royaltyBPS) public

Parameters

NameTypeDescription
_royaltyBPSuint16The royalty fee in basis points. (1/100th of a percent)

royaltyInfo

Returns the royalty recipient and amount for a given sale price.

function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount)

Parameters

NameTypeDescription
tokenIduint256The ID of the token being sold.
salePriceuint256The sale price of the token.

Return Values

NameTypeDescription
receiveraddressThe address of the royalty recipient.
royaltyAmountuint256The amount to be paid to the royalty recipient.

updateOperatorFilter

Updates the operator filter registry with the specified subscription.

function updateOperatorFilter(bool enable, address operatorFilter) external

Parameters

NameTypeDescription
enableboolIf true, enables the operator filter, if false, disables it.
operatorFilteraddressThe address of the operator filter subscription.