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

Function pushDividends

CLI/commands/dividends_manager.js:516–537  ·  view source on GitHub ↗
(dividendIndex, checkpointId)

Source from the content-addressed store, hash-verified

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: ', {
518 limit: function (input) {
519 return input === '' || (input.split(',').every(a => web3.utils.isAddress(a)));
520 },
521 limitMessage: `All addresses must be valid`
522 }).split(',');
523 if (accounts[0] !== '') {
524 let action = currentDividendsModule.methods.pushDividendPaymentToAddresses(dividendIndex, accounts);
525 let receipt = await common.sendTransaction(action);
526 logPushResults(receipt);
527 } else {
528 let investorsAtCheckpoint = await securityToken.methods.getInvestorsAt(checkpointId).call();
529 console.log(`There are ${investorsAtCheckpoint.length} investors at checkpoint ${checkpointId} `);
530 let batchSize = readlineSync.questionInt(`How many investors per transaction do you want to push to? `);
531 for (let i = 0; i < investorsAtCheckpoint.length; i += batchSize) {
532 let action = currentDividendsModule.methods.pushDividendPayment(dividendIndex, i, batchSize);
533 let receipt = await common.sendTransaction(action);
534 logPushResults(receipt);
535 }
536 }
537}
538
539async function exploreAccount(dividendIndex, dividendTokenAddress, dividendTokenSymbol) {
540 let account = readlineSync.question('Enter address to explore: ', {

Callers 1

manageExistingDividendFunction · 0.85

Calls 1

logPushResultsFunction · 0.85

Tested by

no test coverage detected