📌deployContract

Description

The deployContract function deploys an ERC20 token contract on a specified blockchain network with the given name and symbol and returns the contract.

Parameters

Parameter
Type
Description

blockchain

string

Takes a parameter specifying the name of the blockchain network(For eg. bsc, polygon, eth, ava, gnosis, moonbeam)

privateKey

string

The private key of the account to sign the transaction

name

string

The name of the ERC20 token to be deployed

symbol

string

The symbol of the ERC20 token to be deployed

Response

Promise<Object>

object

Returns the transaction receipt object.

Example Request and Response

Prerequisites

Before making requests with NEST® SDK, you must have it installed.

You can install NEST® SDK using either npm or yarn. Use the following commands to install NEST® SDK:

npm install @nest25/evm-chains-lib
OR
yarn add @nest25/evm-chains-lib

Request

Here is an example of how to make a deployContract request using the NEST® SDK:

// import the Nest SDK
const { ERC20 } = require('@nest25/evm-chains-lib');

// create a new instance of the ERC20 class
const erc20 = new ERC20();

// define the main function
const main = async () => {
    // call the deployContract method
    const contract = await erc20.deployContract('klay','your-private-key',"testErc20","TEST");

    // print the receipt
    console.log(`Contract deployed at ${contract.address}. Transaction hash: ${contract.deployTransaction.hash}`);
};
// call the main function
main();

Response

Contract deployed at 0xCE9d9f032587f6680A061896e28d51641a155E9B. Transaction hash: 0x0a1619c524cd447b19957c31862b6e4a397ccce03588712e28bb37619d26c86e

Use Cases

  • Creating a new ERC20 token: The primary use case for the deployContract function is to create a new ERC20 token contract on a specified blockchain network, with the specified name and symbol.

  • Custom token configuration: The deployContract function allows for custom configuration of the ERC20 token contract, such as the total supply and decimal places.

Last updated