MCPcopy Create free account
hub / github.com/PolymathNetwork/polymath-core / step_token_deploy

Function step_token_deploy

CLI/commands/ST20Generator.js:119–155  ·  view source on GitHub ↗
(_name, _details, _divisible)

Source from the content-addressed store, hash-verified

117}
118
119async function step_token_deploy(_name, _details, _divisible) {
120 console.log(chalk.blue('\nToken Creation - Token Deployment'));
121
122 let launchFee = web3.utils.fromWei(await securityTokenRegistry.methods.getSecurityTokenLaunchFee().call());
123 console.log(chalk.green(`\nToken deployment requires ${launchFee} POLY & deducted from '${Issuer.address}', Current balance is ${(web3.utils.fromWei(await polyToken.methods.balanceOf(Issuer.address).call()))} POLY\n`));
124
125 let tokenName;
126 if (typeof _name !== 'undefined') {
127 tokenName = _name;
128 console.log(`Token Name: ${tokenName}`);
129 } else {
130 tokenName = readlineSync.question('Enter the name for your new token: ', { defaultInput: 'default' });
131 }
132
133 let tokenDetails;
134 if (typeof _details !== 'undefined') {
135 tokenDetails = _details;
136 console.log(`Token details: ${tokenDetails.toString()}`)
137 } else {
138 tokenDetails = readlineSync.question('Enter off-chain details of the token (i.e. Dropbox folder url): ');
139 }
140
141 let divisibility;
142 if (typeof _divisible !== 'undefined') {
143 divisibility = _divisible.toString() == 'true';
144 console.log(`Divisible: ${divisibility.toString()}`)
145 } else {
146 let divisible = readlineSync.question('Press "N" for Non-divisible type token or hit Enter for divisible type token (Default): ');
147 divisibility = (divisible != 'N' && divisible != 'n');
148 }
149
150 await approvePoly(securityTokenRegistryAddress, launchFee);
151 let generateSecurityTokenAction = securityTokenRegistry.methods.generateSecurityToken(tokenName, tokenSymbol, tokenDetails, divisibility);
152 let receipt = await common.sendTransaction(generateSecurityTokenAction);
153 let event = common.getEventFromLogs(securityTokenRegistry._jsonInterface, receipt.logs, 'NewSecurityToken');
154 console.log(chalk.green(`Security Token has been successfully deployed at address ${event._securityTokenAddress}`));
155}
156
157//////////////////////
158// HELPER FUNCTIONS //

Callers 1

executeAppFunction · 0.85

Calls 1

approvePolyFunction · 0.85

Tested by

no test coverage detected