🕹️ ERC-20 Guide

Define and Mint Fungible 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 a model that includes the following attributes:

  • id: A unique identifier for identifying the ERC-20 contract within Co:Create.
  • name: The name of the ERC-20 contract.
  • symbol: The symbol of the ERC-20 contract.
  • contract_address: The contract address of the ERC-20 contract on the Polygon blockchain.

Methods

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

  • Create ERC-20: Create and deploy a new ERC-20 contract
  • List ERC-20: Get a list of all ERC-20 contracts for an organization.
  • Mint ERC-20: Mint ERC-20 tokens to a specified wallet address.
  • Transfer ERC-20: Transfer ERC-20 tokens from one wallet address to another.
  • Update ERC-20: Manage any config on the ERC-20 contract, eg: transfer restrictions.

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"
  }
}

Any question?
Feel free to join us on Discord or by emailing [email protected], to get access.