Skip to main content

Configure a collection contract

Configure a smart contract for a collection by using a default platform contract, a custom contract, meaning bringing your own contract (BYOC), or linking an external contract.

POST https://admin-api.phosphor.xyz/v1/collections/{collection_id}/deployment-request

Each method requires the above POST; however, the payload varies depending on the contract type. The following are the input parameters:

ParameterDescription
typeWhether to deploy a PLATFORM contract, a CUSTOM contract, or link an EXTERNAL contract.
platformThe payload for deploying a PLATFORM contract.
customThe payload for deploying a CUSTOM contract.
externalThe payload for linking an EXTERNAL contract.
token_id_assignment_strategyDetermines how the token IDs for your items are set. AUTOMATIC automatically assigns a token ID when locking, MANUAL requires manually passing a token ID when locking, and EXTERNAL requires that the smart contract assigns the token ID. See token ID assignment strategy.
network_idAny network that is available for your organization.

The following is an example response:

Example response
{
"status": "SUCCESS",
"transaction_id": "aba038d6-ea0f-43b5-884c-3f3ac975dcfb"
}

Use a platform contract

The following is an example payload when using one of our platform contracts.

Example payload
{
"type": "PLATFORM",
"network_id": 59140,
"token_id_assignment_strategy": "AUTOMATIC",
"platform": {
"symbol": "PLATFC",
"variant": "FlexibleERC721",
"max_supply": "10000",
"owner": "0x878130E8A6e5890374e6eD261fd9A2CaBCB81264",
"soulbound": false
}
}
ParameterRequired?Description
typeYesMust be PLATFORM. This configures the collection to use a platform contract.
network_idYesThe network ID to deploy this contract.
token_id_assignment_strategyNoAccepted values are AUTOMATIC, EXTERNAL or MANUAL.
symbolYesSymbol of this contract as part of its metadata.
variantYesVariant of the platform contracts to use. Accepted values are FrozenERC721, FlexibleERC721, SignatureERC721, FrozenERC1155, and FlexibleERC1155.
max_supplyNoThe max number of tokens that are allowed to be created from this contract.
ownerNoThe owner of this contract. Contract owners can perform all functions defined by the contract, and grant or revoke admin roles.
soulboundNoAccepted values are true or false. A "soulbound" contract is one that does not allow token owners to transfer their tokens. It disables all resale activities and marks the tokens permanent ownership.

Bring your own contract

The following is an example payload when bringing your own contract.

Example payload
{
"type": "CUSTOM",
"network_id": 59140,
"token_id_assignment_strategy": "AUTOMATIC",
"custom": {
"constructor_args": ["BYOCSMC"],
"abi": [],
"bytecode": ""
}
}
ParameterRequired?Description
typeYesMust be CUSTOM. This configures the collection to use a custom contract.
network_idYesThe network ID to deploy this contract.
token_id_assignment_strategyNoAccepted values are AUTOMATIC, MANUAL, or EXTERNAL.
constructor_argsYesThe constructor args to deploy this custom contract.
abiYesThe abi specification for this custom contract.
bytecodeYesThe compiled contract bytecode that is needed for on-chain deployment.
caution

The contract must have an ERC721 or ERC1155 [capability] to be compatible with the Phosphor platform.

The following is an example payload when linking an external contract.

Example payload
{
"type": "EXTERNAL",
"network_id": 59140,
"external": {
"address": "0xe42cad6fc883877a76a26a16ed92444ab177e306",
"token_type": "ERC721",
"token_filter": { "type": "static", "token_ids": ["1", "2"] }
}
}
ParameterRequired?Description
typeYesMust be EXTERNAL. This Links the collection to a deployed contract.
network_idYesThe network ID that the contract has already deployed on.
addressYesThe on-chain address of the contract.
token_typeYesType of NFT this contract supports. Accepted values are ERC721 or ERC1155.
token_filterNoIdentifies which tokens the platform must keep track of.
{
"type": "static",
"token_ids": ["1", "2"]
}
Warning

The contract must implement one of the following [capability] combinations to be compatible with the Phosphor platform:

  • ERC721 and ERC721_METADATA.
  • ERC1155 and ERC1155_METADATA.

If the platform can mint NFTs using this contract:

  • The contract must implement one or more [minting capabilities].
  • You must transfer the ownership of the contract to the default organization wallet, or approve the default organization wallet for the necessary tokens.