Deploy ERC-20 (Bootstrap)
Use the erc20BaseAbi and erc20BaseBytecode from @cfxdevkit/contracts to deploy a production-ready ERC-20 with one function call.
How it works
erc20BaseAbi+erc20BaseBytecodeare exported from@cfxdevkit/contracts— a capped, burnable, pausable ERC-20 with ERC-2612 permit.wallet.deployContract(abi, bytecode, args)handles signing, broadcasting, and polling for the receipt — returns the deployed address directly.- Constructor arguments:
(name, symbol, initialSupply, owner)— the owner receives the full initial supply.
import { erc20BaseAbi, erc20BaseBytecode } from '@cfxdevkit/contracts'
import { EspaceWalletClient, EVM_TESTNET, parseUnits } from '@cfxdevkit/core'
const wallet = new EspaceWalletClient({
chainId: EVM_TESTNET.id,
rpcUrl: EVM_TESTNET.rpcUrls.default.http[0],
privateKey: '0x...',
})
const contractAddress = await wallet.deployContract(
erc20BaseAbi,
erc20BaseBytecode,
['My Token', 'MTK', parseUnits('1000000', 18), wallet.getAddress()],
)
console.log('Deployed at:', contractAddress)Last updated on