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

Function selectToken

CLI/commands/transfer_manager.js:2696–2724  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2694}
2695
2696async function selectToken() {
2697 let result = null;
2698
2699 let userTokens = await securityTokenRegistry.methods.getTokensByOwner(Issuer.address).call();
2700 let tokenDataArray = await Promise.all(userTokens.map(async function (t) {
2701 let tokenData = await securityTokenRegistry.methods.getSecurityTokenData(t).call();
2702 return { symbol: tokenData[0], address: t };
2703 }));
2704 let options = tokenDataArray.map(function (t) {
2705 return `${t.symbol} - Deployed at ${t.address} `;
2706 });
2707 options.push('Enter token symbol manually');
2708
2709 let index = readlineSync.keyInSelect(options, 'Select a token:', { cancel: 'EXIT' });
2710 let selected = index != -1 ? options[index] : 'EXIT';
2711 switch (selected) {
2712 case 'Enter token symbol manually':
2713 result = readlineSync.question('Enter the token symbol: ');
2714 break;
2715 case 'EXIT':
2716 process.exit();
2717 break;
2718 default:
2719 result = tokenDataArray[index].symbol;
2720 break;
2721 }
2722
2723 return result;
2724}
2725
2726async function logTotalInvestors() {
2727 let investorsCount = await securityToken.methods.getInvestorCount().call();

Callers 1

initializeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected