The CDP SDK supports deploying custom contracts alongside ERC-20s (fungible tokens), ERC-721s (NFTs), and ERC-1155s (MultiTokens). If you’d like to see support for additional contracts, contact us in the CDP Discord.
See supported methods at the bottom of this page for a list of all the methods supported by each contract type.
To deploy an arbitrary contract, first write a Solidity smart contract, then get the contract in the input JSON format. There are three ways to do this:
Next, execute the following command to compile and deploy the contract:
The contract code will be automatically verified and available for viewing on Etherscan’s family of blockchain explorers.
ERC-20 tokens are the most common type of fungible token on Ethereum. Interacting with the contract is done through the Transfer API for simple transfers, or with the invokeContract
function for other calls. All standard ERC-20 functions are supported. Below is an example of how to call a deployed ERC20 contract.
Tokens can be created and interacted with by doing the following:
ERC-721 is the standard for non-fungible tokens on Ethereum. The URI is the location of the metadata for the NFT. To properly interact with marketplaces, the URI must be a valid JSON file.
The creation and interaction process is similar to fungible tokens:
ERC-1155 is the standard for multi-token fungible tokens on Ethereum. Instead of minting one token at a time, you can mint multiple tokens in a single transaction with the same metadata. This guide explains how to define the metadata properly.
Two mint methods are supported: mint
and mintBatch
. mint
requires a single to
address and mintBatch
requires an array of to
addresses and an array of values
of the same length.
Inherits: ERC20
Constructor to initialize the ERC20 token with a name, symbol, and initial supply. The entire initial supply is assigned to the deployer of the contract.
Inherits: ERC721AQueryable, Ownable2Step
Constructor to initialize the token with name, symbol, base URI, and deployer address
Parameters
Name | Type | Description |
---|---|---|
name | string | The name of the token |
symbol | string | The symbol of the token |
baseURI | string | The base URI for the token metadata |
Mint a single token to a specified address
Only the contract owner can call this function
Parameters
Name | Type | Description |
---|---|---|
to | address | The address to mint the token to |
Mint a single token to a specified address with data
Only the contract owner can call this function
Parameters
Name | Type | Description |
---|---|---|
to | address | The address to mint the token to |
data | bytes | The data to pass to the minted token |
Mint a specified quantity of tokens to a specified address
Only the contract owner can call this function
Parameters
Name | Type | Description |
---|---|---|
to | address | The address to mint tokens to |
quantity | uint8 | The number of tokens to mint |
Mint a specified quantity of tokens to a specified address with data
Only the contract owner can call this function
Parameters
Name | Type | Description |
---|---|---|
to | address | The address to mint tokens to |
quantity | uint8 | The number of tokens to mint |
data | bytes | The data to pass to the minted tokens |
Inherits: ERC1155Supply, Ownable2Step
Constructs an ERC1155 token with a URI, owned by the deployer of the contract
Parameters
Name | Type | Description |
---|---|---|
uri | string | The URI for all the token metadata, should be of the format “https://token-cdn-domain/{id}.json” |
Mint a new token which can be fungible or non-fungible. Non-fungible tokens have a unique ID with a total supply of 1
Parameters
Name | Type | Description |
---|---|---|
to | address | The address to receive the minted tokens |
id | uint256 | The ID of the token to mint |
value | uint256 | The amount of tokens to mint |
Mint a new token which can be fungible or non-fungible. Non-fungible tokens have a unique ID with a total supply of 1
Parameters
Name | Type | Description |
---|---|---|
to | address | The address to receive the minted tokens |
id | uint256 | The ID of the token to mint |
value | uint256 | The amount of tokens to mint |
data | bytes | Additional data with no specified format, to be passed to the receiver contract |
Mint a batch of new tokens which can be fungible or non-fungible. Non-fungible tokens have a unique ID with a total supply of 1
Parameters
Name | Type | Description |
---|---|---|
to | address | The address to receive the minted tokens |
ids | uint256[] | The IDs of the tokens to mint |
values | uint256[] | The amounts of tokens to mint, must be the same length as ids |
Mint a batch of new tokens which can be fungible or non-fungible. Non-fungible tokens have a unique ID with a total supply of 1
Parameters
Name | Type | Description |
---|---|---|
to | address | The address to receive the minted tokens |
ids | uint256[] | The IDs of the tokens to mint |
values | uint256[] | The amounts of tokens to mint, must be the same length as ids |
data | bytes | Additional data with no specified format, to be passed to the receiver contract |