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

Function exploreAccount

CLI/commands/dividends_manager.js:539–566  ·  view source on GitHub ↗
(dividendIndex, dividendTokenAddress, dividendTokenSymbol)

Source from the content-addressed store, hash-verified

537}
538
539async function exploreAccount(dividendIndex, dividendTokenAddress, dividendTokenSymbol) {
540 let account = readlineSync.question('Enter address to explore: ', {
541 limit: function (input) {
542 return web3.utils.isAddress(input);
543 },
544 limitMessage: "Must be a valid address",
545 });
546 let isExcluded = await currentDividendsModule.methods.isExcluded(account, dividendIndex).call();
547 let hasClaimed = await currentDividendsModule.methods.isClaimed(account, dividendIndex).call();
548 let dividendAmounts = await currentDividendsModule.methods.calculateDividend(dividendIndex, account).call();
549 let dividendBalance = dividendAmounts[0];
550 let dividendTax = dividendAmounts[1];
551 let dividendTokenBalance = await getBalance(account, dividendTokenAddress);
552 let securityTokenBalance = await getBalance(account, securityToken.options.address);
553
554 console.log();
555 console.log(`Security token balance: ${web3.utils.fromWei(securityTokenBalance)} ${tokenSymbol} `);
556 console.log(`Dividend token balance: ${web3.utils.fromWei(dividendTokenBalance)} ${dividendTokenSymbol} `);
557 console.log(`Is excluded: ${isExcluded ? 'YES' : 'NO'} `);
558 if (!isExcluded) {
559 console.log(`Has claimed: ${hasClaimed ? 'YES' : 'NO'} `);
560 if (!hasClaimed) {
561 console.log(`Dividends available: ${web3.utils.fromWei(dividendBalance)} ${dividendTokenSymbol} `);
562 console.log(`Tax withheld: ${web3.utils.fromWei(dividendTax)} ${dividendTokenSymbol} `);
563 }
564 }
565 console.log();
566}
567
568async function withdrawWithholding(dividendIndex, dividendTokenSymbol) {
569 let action = currentDividendsModule.methods.withdrawWithholding(dividendIndex);

Callers 1

manageExistingDividendFunction · 0.70

Calls 1

getBalanceFunction · 0.70

Tested by

no test coverage detected