Skip to main content
Version: 0.1.0

ERC-20 tokens minting

ERC-20 tokens minted by the interface of Dev Protocol have an extended interface that supports staking, revenue sharing, etc., and are referred to in the whitepaper as Property Tokens.

Mint ERC-20 tokens

Immediately mint your ERC-20 tokens by executing create function of PropertyFactory contract.

create function takes 3 arguments:

  1. Token name
  2. Token symbol
  3. Author address

Token name/symbol are mapped to the token name/symbol of the newly minted ERC-20 tokens. The author address must be the same address as the transaction sender for later ownership authentication and ERC-721 token customization.

import { clientsPropertyFactory } from '@devprotocol/dev-kit'
import { whenDefined } from '@devprotocol/util-ts'
import type { BaseProvider } from '@ethersproject/providers'

// This function mints an ERC-20 tokens with hard-coded options, and returns the new token address.
export default (provider: BaseProvider) => {
const clients = await clientsPropertyFactory(provider)
const propertyFactory = whenDefined(clients, ([l1, l2]) => l1 ?? l2)
const tokenAddress = await whenDefined(propertyFactory, (contract) =>
contract.create(
// Token name
'My Token',
// Token symbol
'MYT',
// Author address
'0xDbc05b1eCB4fdaEf943819C0B04e9ef6df4bAbd6'
)
)
return tokenAddress
}

clientsPropertyFactory detects chains from a given provider and returns an array of contract instances. The first element of the array is the mainnet (v1 interface) contract and the second element of the array is the L2 (v2 interface) contract.

Mint and authentication

To mint a tokens and authenticate at the same time, use the createAndAuthenticate function.

note

TODO: To be described