πŸ•ΉοΈ 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 users

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

The body parameters for wallet_addresses and num_tokens are specified as arrays. To mint tokens to a single user, specify the arrays as an array of 1.

curl --request POST \
     --url https://api.testcocrt.xyz/alpha/erc20/mint \
     --header 'Authorization: Bearer <YOUR_API_KEY_HERE>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "wallet_addresses": [
    "0xaaa5623dc643ae463e4bf65dd267bf668750152b",
    "0xbb6fdb5252825ef15207e7973b94598e7c221e35",
    "0xd6e3b62b8b78f7bab557017de19b3eb1a5e55aab"
  ],
  "erc20_id": "1e294661-c059-488f-9b03-90b37405c19d",
  "num_tokens": [
    100,
    200,
    200
  ]
}
'

Example response:

{
  "data": {
    "erc20_id": "1e294661-c059-488f-9b03-90b37405c19d",
    "contract_address": "0xdd6a0601245071ec7f5c8a93b6a545a848360665",
    "num_tokens": [
      100,
      200,
      200
    ],
    "wallet_addresses": [
      "0xaaa5623dc643ae463e4bf65dd267bf668750152b",
      "0xbb6fdb5252825ef15207e7973b94598e7c221e35",
      "0xd6e3b62b8b78f7bab557017de19b3eb1a5e55aab"
    ]
  }
}

πŸ‘

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