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

Function selectAction

CLI/commands/token_manager.js:134–227  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

132}
133
134async function selectAction() {
135 let options = ['Update token details'/*, 'Change granularity'*/];
136
137 let transferFrozen = await securityToken.methods.transfersFrozen().call();
138 if (transferFrozen) {
139 options.push('Unfreeze transfers');
140 } else {
141 options.push('Freeze transfers');
142 }
143
144 let isMintingFrozen = await securityToken.methods.mintingFrozen().call();
145 if (!isMintingFrozen) {
146 let isFreezeMintingAllowed = await featureRegistry.methods.getFeatureStatus('freezeMintingAllowed').call();
147 if (isFreezeMintingAllowed) {
148 options.push('Freeze minting permanently');
149 }
150 }
151
152 options.push('Create a checkpoint', 'List investors')
153
154 let currentCheckpointId = await securityToken.methods.currentCheckpointId().call();
155 if (currentCheckpointId > 0) {
156 options.push('List investors at checkpoint')
157 }
158
159 if (!isMintingFrozen) {
160 options.push('Mint tokens');
161 }
162
163 options.push('Manage modules', 'Withdraw tokens from contract');
164
165 let index = readlineSync.keyInSelect(options, 'What do you want to do?', { cancel: 'Exit' });
166 let selected = index == -1 ? 'Exit' : options[index];
167 console.log('Selected:', selected);
168 switch (selected) {
169 case 'Update token details':
170 let updatedDetails = readlineSync.question('Enter new off-chain details of the token (i.e. Dropbox folder url): ');
171 await updateTokenDetails(updatedDetails);
172 break;
173 case 'Change granularity':
174 //let granularity = readlineSync.questionInt('Enter ')
175 //await changeGranularity();
176 break;
177 case 'Freeze transfers':
178 await freezeTransfers();
179 break;
180 case 'Unfreeze transfers':
181 await unfreezeTransfers();
182 break;
183 case 'Freeze minting permanently':
184 await freezeMinting();
185 break;
186 case 'Create a checkpoint':
187 await createCheckpoint();
188 break;
189 case 'List investors':
190 await listInvestors();
191 break;

Callers 1

executeAppFunction · 0.85

Calls 10

updateTokenDetailsFunction · 0.85
freezeTransfersFunction · 0.85
unfreezeTransfersFunction · 0.85
freezeMintingFunction · 0.85
createCheckpointFunction · 0.85
listInvestorsFunction · 0.85
mintTokensFunction · 0.85
listModuleOptionsFunction · 0.85
withdrawFromContractFunction · 0.85

Tested by

no test coverage detected