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

Function showReport

CLI/commands/dividends_manager.js:473–514  ·  view source on GitHub ↗
(_name, _tokenSymbol, _amount, _witthheld, _claimed, _investorArray, _claimedArray, _excludedArray, _withheldArray, _amountArray)

Source from the content-addressed store, hash-verified

471}
472
473function showReport(_name, _tokenSymbol, _amount, _witthheld, _claimed, _investorArray, _claimedArray, _excludedArray, _withheldArray, _amountArray) {
474 let title = `${_name.toUpperCase()} DIVIDEND REPORT`;
475 let dataTable =
476 [[
477 'Investor',
478 'Amount sent',
479 'Taxes withheld (%)',
480 `Taxes withheld (${_tokenSymbol})`,
481 'Amount received',
482 'Withdrawn'
483 ]];
484 for (let i = 0; i < _investorArray.length; i++) {
485 let investor = _investorArray[i];
486 let excluded = _excludedArray[i];
487 let withdrawn = _claimedArray[i] ? 'YES' : 'NO';
488 let amount = !excluded ? web3.utils.fromWei(web3.utils.toBN(_amountArray[i]).add(web3.utils.toBN(_withheldArray[i]))) : 0;
489 let withheld = !excluded ? web3.utils.fromWei(_withheldArray[i]) : 'NA';
490 let withheldPercentage = (!excluded) ? (withheld !== '0' ? parseFloat(withheld) / parseFloat(amount) * 100 : 0) : 'NA';
491 let received = !excluded ? web3.utils.fromWei(_amountArray[i]) : 0;
492 dataTable.push([
493 investor,
494 amount,
495 withheldPercentage,
496 withheld,
497 received,
498 withdrawn
499 ]);
500 }
501 console.log(chalk.yellow(`-----------------------------------------------------------------------------------------------------------------------------------------------------------`));
502 console.log(title.padStart((50 - title.length) / 2, '*').padEnd((50 - title.length) / 2, '*'));
503 console.log();
504 console.log(`- Total amount of dividends sent: ${web3.utils.fromWei(_amount)} ${_tokenSymbol} `);
505 console.log(`- Total amount of taxes withheld: ${web3.utils.fromWei(_witthheld)} ${_tokenSymbol} `);
506 console.log(`- Total amount of dividends distributed: ${web3.utils.fromWei(_claimed)} ${_tokenSymbol} `);
507 console.log(`- Total amount of investors: ${_investorArray.length} `);
508 console.log();
509 console.log(table(dataTable));
510 console.log();
511 console.log(chalk.yellow(`NOTE: If investor has not claimed the dividend yet, TAX and AMOUNT are calculated with the current values set and they might change.`));
512 console.log(chalk.yellow(`-----------------------------------------------------------------------------------------------------------------------------------------------------------`));
513 console.log();
514}
515
516async function pushDividends(dividendIndex, checkpointId) {
517 let accounts = readlineSync.question('Enter addresses to push dividends to (ex- add1,add2,add3,...) or leave empty to push to all addresses: ', {

Callers 1

manageExistingDividendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected