πŸ•ΉοΈ ERC-20

Deploy and mint ERC-20 tokens

Overview

The CoCreate API provides functionality for ERC-20 contract deployment & management, including creating new ERC-20 contracts, minting, transferring, and managing token transfer restrictions.

ERC-20 Model

The CoCreate API uses an ERC-20 model that includes the following attributes:

FieldDescriptionTypeOptional
idA unique identifier for identifying the ERC-20 contract within Co:Create. Generated by Co:Create platform and returned upon successful contract deployment.stringNo
contract addressA unique identifier for identifying the ERC-20 contract within the Polygon blockchain ecosystem. Generated by Co:Create platform and returned upon successful contract deployment.stringNo
nameThe token name of the contract.stringNo
symbolThe token symbol of the contract.stringNo
transfer_restrictedIf true, the tokens are transfer restricted. If false, the tokens are transferable. Default is false.booleanYes
transfer_allowlistThe list of wallet addresses that are allowed to transfer the tokens. This is only used if transfer_restricted is true. Default is an empty list.[string]Yes

Methods

The CoCreate API provides the following methods for creating & managing ERC-20 tokens:

NameMethodDescription
Deploy New ERC20 ContractPOSTDeploy New ERC-20 Contract with the given name, symbol and parameters.
List ERC20 ContractsGETGet a list of all ERC-20 contracts for an organization.
Patch ERC20 ContractPATCHManage any config on the ERC-20 contract, eg: transfer restrictions.
Mint ERC20POSTMint ERC-20 tokens to a specified wallet address.
Transfer ERC20POSTTransfer ERC-20 tokens from one wallet address to another.

Guide

Create a new ERC-20 contract

To create a new ERC-20 contract, make a POST request to the ERC20 API.

Example request:

curl --request POST \
  --url https://api.testcocrt.xyz/alpha/erc20 \
  --header 'Authorization: Bearer <YOUR_KEY_HERE>' \
  --data '{ "name": "Karma Points", "symbol": "KRMA"}'

Example response:

{
  "data": {
    "contract_address": "0x30391925aB782008FEBE2fbf05Ea043ec966831c",
    "created_at": "2023-02-23T06:57:11.352161+00:00",
    "id": "b49da6ec-d7bb-43f3-919c-3fce33b5de22",
    "name": "Karma Points",
    "symbol": "KRMA"
  }
}

Mint ERC-20 to a user

To mint ERC-20, make a POST request to the Mint method of the ERC20 API.

curl --request POST \
  --url https://api.testcocrt.xyz/alpha/erc20/mint \
  --header 'Authorization: Bearer <YOUR_KEY_HERE>' \
  --data '{
  	 "erc20_id":"f19e6691-3013-4bd1-8803-1a596f3a2af1",
     "mint_quantity":3,
     "wallet_address":"0x30391925aB782008FEBE2fbf05Ea043ec966831c"
}'

Example response:

{
  "data": {
    "num_tokens": 3,
    "wallet_address": "0x189407D5c7E31E26fd31a4EB1ed500626f670675",
    "erc20_id": "f19e6691-3013-4bd1-8803-1a596f3a2af1"
  }
}

πŸ‘

Get Help

If you get stuck at any time, reach out to us on Discord or contact us via email at [email protected].


What’s Next