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

Function selectDividend

CLI/commands/dividends_manager.js:694–711  ·  view source on GitHub ↗
(dividends)

Source from the content-addressed store, hash-verified

692}
693
694async function selectDividend(dividends) {
695 let result = null;
696 let options = dividends.map(function (d) {
697 return `${d.name}
698 Amount: ${web3.utils.fromWei(d.amount)} ${d.tokenSymbol}
699 Status: ${isExpiredDividend(d) ? 'Expired' : hasRemaining(d) ? 'In progress' : 'Completed'}
700 Token: ${d.tokenSymbol}
701 Created: ${moment.unix(d.created).format('MMMM Do YYYY, HH:mm:ss')}
702 Expiry: ${moment.unix(d.expiry).format('MMMM Do YYYY, HH:mm:ss')} `
703 });
704
705 let index = readlineSync.keyInSelect(options, 'Select a dividend:', { cancel: 'RETURN' });
706 if (index != -1) {
707 result = dividends[index];
708 }
709
710 return result;
711}
712
713async function getDividends() {
714 function DividendData(_index, _created, _maturity, _expiry, _amount, _claimedAmount, _name, _tokenSymbol) {

Callers 1

dividendsManagerFunction · 0.85

Calls 2

isExpiredDividendFunction · 0.85
hasRemainingFunction · 0.85

Tested by

no test coverage detected