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

Function selectCheckpoint

CLI/commands/dividends_manager.js:645–660  ·  view source on GitHub ↗
(includeCreate)

Source from the content-addressed store, hash-verified

643}
644
645async function selectCheckpoint(includeCreate) {
646 if (await securityToken.methods.currentCheckpointId().call() > 0) {
647 let options = [];
648 let fix = 1; //Checkpoint 0 is not included, so I need to add 1 to fit indexes for checkpoints and options
649 let checkpoints = (await getCheckpoints()).map(function (c) { return c.timestamp });
650 if (includeCreate) {
651 options.push('Create new checkpoint');
652 fix = 0; //If this option is added, fix isn't needed.
653 }
654 options = options.concat(checkpoints);
655
656 return readlineSync.keyInSelect(options, 'Select a checkpoint:', { cancel: false }) + fix;
657 } else {
658 return 0;
659 }
660}
661
662async function getCheckpoints() {
663 let result = [];

Callers 3

exploreAddressFunction · 0.85
exploreCheckpointFunction · 0.85
createDividendsFunction · 0.85

Calls 1

getCheckpointsFunction · 0.85

Tested by

no test coverage detected