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

Function step_ticker_registration

CLI/commands/ST20Generator.js:62–94  ·  view source on GitHub ↗
(_ticker)

Source from the content-addressed store, hash-verified

60}
61
62async function step_ticker_registration(_ticker) {
63 console.log(chalk.blue('\nToken Symbol Registration'));
64
65 let regFee = web3.utils.fromWei(await securityTokenRegistry.methods.getTickerRegistrationFee().call());
66 let available = false;
67
68 while (!available) {
69 console.log(chalk.yellow(`\nRegistering the new token symbol requires ${regFee} POLY & deducted from '${Issuer.address}', Current balance is ${(web3.utils.fromWei(await polyToken.methods.balanceOf(Issuer.address).call()))} POLY\n`));
70
71 if (typeof _ticker !== 'undefined') {
72 tokenSymbol = _ticker;
73 console.log(`Token Symbol: ${tokenSymbol}`);
74 } else {
75 tokenSymbol = await selectTicker();
76 }
77
78 let details = await securityTokenRegistry.methods.getTickerDetails(tokenSymbol).call();
79 if (new BigNumber(details[1]).toNumber() == 0) {
80 // If it has no registration date, it is available
81 available = true;
82 await approvePoly(securityTokenRegistryAddress, regFee);
83 let registerTickerAction = securityTokenRegistry.methods.registerTicker(Issuer.address, tokenSymbol, "");
84 await common.sendTransaction(registerTickerAction, { factor: 1.5 });
85 } else if (details[0] == Issuer.address) {
86 // If it has registration date and its owner is Issuer
87 available = true;
88 tokenLaunched = details[4];
89 } else {
90 // If it has registration date and its owner is not Issuer
91 console.log(chalk.yellow('\nToken Symbol has already been registered, please choose another symbol'));
92 }
93 }
94}
95
96async function step_transfer_ticker_ownership(_transferOwnership) {
97 let newOwner = null;

Callers 1

executeAppFunction · 0.85

Calls 2

selectTickerFunction · 0.85
approvePolyFunction · 0.85

Tested by

no test coverage detected