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

Function selectTicker

CLI/commands/ST20Generator.js:160–186  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

158// HELPER FUNCTIONS //
159//////////////////////
160async function selectTicker() {
161 let result;
162 let userTickers = (await securityTokenRegistry.methods.getTickersByOwner(Issuer.address).call()).map(t => web3.utils.hexToAscii(t));
163 let options = await Promise.all(userTickers.map(async function (t) {
164 let tickerDetails = await securityTokenRegistry.methods.getTickerDetails(t).call();
165 let tickerInfo;
166 if (tickerDetails[4]) {
167 tickerInfo = `Token launched at ${(await securityTokenRegistry.methods.getSecurityTokenAddress(t).call())}`;
168 } else {
169 tickerInfo = `Expires at ${moment.unix(tickerDetails[2]).format('MMMM Do YYYY, HH:mm:ss')}`;
170 }
171 return `${t}
172 ${tickerInfo}`;
173 }));
174 options.push('Register a new ticker');
175
176 let index = readlineSync.keyInSelect(options, 'Select a ticker:');
177 if (index == -1) {
178 process.exit(0);
179 } else if (index == options.length - 1) {
180 result = readlineSync.question('Enter a symbol for your new ticker: ');
181 } else {
182 result = userTickers[index];
183 }
184
185 return result;
186}
187
188async function approvePoly(spender, fee) {
189 polyBalance = await polyToken.methods.balanceOf(Issuer.address).call();

Callers 1

step_ticker_registrationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected