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:
Parameter | Description |
---|---|
type | Whether to deploy a PLATFORM contract, a CUSTOM contract, or link an EXTERNAL contract. |
platform | The payload for deploying a PLATFORM contract. |
custom | The payload for deploying a CUSTOM contract. |
external | The payload for linking an EXTERNAL contract. |
token_id_assignment_strategy | Determines 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_id | Any network that is available for your organization. |
The following is an 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.
{
"type": "PLATFORM",
"network_id": 59140,
"token_id_assignment_strategy": "AUTOMATIC",
"platform": {
"symbol": "PLATFC",
"variant": "FlexibleERC721",
"max_supply": "10000",
"owner": "0x878130E8A6e5890374e6eD261fd9A2CaBCB81264",
"soulbound": false
}
}
Parameter | Required? | Description |
---|---|---|
type | Yes | Must be PLATFORM . This configures the collection to use a platform contract. |
network_id | Yes | The network ID to deploy this contract. |
token_id_assignment_strategy | No | Accepted values are AUTOMATIC , EXTERNAL or MANUAL . |
symbol | Yes | Symbol of this contract as part of its metadata. |
variant | Yes | Variant of the platform contracts to use. Accepted values are FrozenERC721 , FlexibleERC721 , SignatureERC721 , FrozenERC1155 , and FlexibleERC1155 . |
max_supply | No | The max number of tokens that are allowed to be created from this contract. |
owner | No | The owner of this contract. Contract owners can perform all functions defined by the contract, and grant or revoke admin roles. |
soulbound | No | Accepted 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.
{
"type": "CUSTOM",
"network_id": 59140,
"token_id_assignment_strategy": "AUTOMATIC",
"custom": {
"constructor_args": ["BYOCSMC"],
"abi": [],
"bytecode": ""
}
}
Parameter | Required? | Description |
---|---|---|
type | Yes | Must be CUSTOM . This configures the collection to use a custom contract. |
network_id | Yes | The network ID to deploy this contract. |
token_id_assignment_strategy | No | Accepted values are AUTOMATIC , MANUAL , or EXTERNAL . |
constructor_args | Yes | The constructor args to deploy this custom contract. |
abi | Yes | The abi specification for this custom contract. |
bytecode | Yes | The compiled contract bytecode that is needed for on-chain deployment. |
The contract must have an ERC721
or ERC1155
[capability] to be compatible with the Phosphor platform.
Link an external contract
The following is an example payload when linking an external contract.
{
"type": "EXTERNAL",
"network_id": 59140,
"external": {
"address": "0xe42cad6fc883877a76a26a16ed92444ab177e306",
"token_type": "ERC721",
"token_filter": { "type": "static", "token_ids": ["1", "2"] }
}
}
Parameter | Required? | Description |
---|---|---|
type | Yes | Must be EXTERNAL . This Links the collection to a deployed contract. |
network_id | Yes | The network ID that the contract has already deployed on. |
address | Yes | The on-chain address of the contract. |
token_type | Yes | Type of NFT this contract supports. Accepted values are ERC721 or ERC1155 . |
token_filter | No | Identifies which tokens the platform must keep track of. |
- static token filter
- range token filter
{
"type": "static",
"token_ids": ["1", "2"]
}
{
"type": "range",
"range": ["1", "10"]
}
The contract must implement one of the following [capability] combinations to be compatible with the Phosphor platform:
ERC721
andERC721_METADATA
.ERC1155
andERC1155_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.