(dividends)
| 692 | } |
| 693 | |
| 694 | async 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 | |
| 713 | async function getDividends() { |
| 714 | function DividendData(_index, _created, _maturity, _expiry, _amount, _claimedAmount, _name, _tokenSymbol) { |
no test coverage detected