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

Function mintTokens

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

Source from the content-addressed store, hash-verified

282}
283
284async function mintTokens() {
285 let options = ['Modify whitelist', 'Mint tokens to a single address', `Mint tokens to multiple addresses from CSV`];
286 let index = readlineSync.keyInSelect(options, 'What do you want to do?', { cancel: 'Return' });
287 let selected = index == -1 ? 'Return' : options[index];
288 console.log('Selected:', selected);
289 switch (selected) {
290 case 'Modify whitelist':
291 let investor = readlineSync.question('Enter the address to whitelist: ', {
292 limit: function (input) {
293 return web3.utils.isAddress(input);
294 },
295 limitMessage: "Must be a valid address"
296 });
297 let fromTime = readlineSync.questionInt('Enter the time (Unix Epoch time) when the sale lockup period ends and the investor can freely sell his tokens: ');
298 let toTime = readlineSync.questionInt('Enter the time (Unix Epoch time) when the purchase lockup period ends and the investor can freely purchase tokens from others: ');
299 let expiryTime = readlineSync.questionInt('Enter the time till investors KYC will be validated (after that investor need to do re-KYC): ');
300 let canBuyFromSTO = readlineSync.keyInYNStrict('Is the investor a restricted investor?');
301 await modifyWhitelist(investor, fromTime, toTime, expiryTime, canBuyFromSTO);
302 break;
303 case 'Mint tokens to a single address':
304 console.log(chalk.yellow(`Investor should be previously whitelisted.`));
305 let receiver = readlineSync.question(`Enter the address to receive the tokens: `);
306 let amount = readlineSync.question(`Enter the amount of tokens to mint: `);
307 await mintToSingleAddress(receiver, amount);
308 break;
309 case `Mint tokens to multiple addresses from CSV`:
310 console.log(chalk.yellow(`Investors should be previously whitelisted.`));
311 await multiMint();
312 break;
313 }
314}
315
316/// Mint actions
317async function modifyWhitelist(investor, fromTime, toTime, expiryTime, canBuyFromSTO) {

Callers 1

selectActionFunction · 0.85

Calls 3

modifyWhitelistFunction · 0.85
mintToSingleAddressFunction · 0.85
multiMintFunction · 0.85

Tested by

no test coverage detected