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

Function inputRestrictionData

CLI/commands/transfer_manager.js:2179–2202  ·  view source on GitHub ↗
(isDaily)

Source from the content-addressed store, hash-verified

2177}
2178
2179function inputRestrictionData(isDaily) {
2180 let restriction = {};
2181 restriction.restrictionType = readlineSync.keyInSelect(RESTRICTION_TYPES, 'How do you want to set the allowance? ', { cancel: false });
2182 if (restriction.restrictionType == RESTRICTION_TYPES.indexOf('Fixed')) {
2183 restriction.allowedTokens = web3.utils.toWei(readlineSync.question(`Enter the maximum amount of tokens allowed to be traded every ${isDaily ? 'day' : 'rolling period'}: `).toString());
2184 } else {
2185 restriction.allowedTokens = toWeiPercentage(readlineSync.question(`Enter the maximum percentage of total supply allowed to be traded every ${isDaily ? 'day' : 'rolling period'}: `).toString());
2186 }
2187 if (isDaily) {
2188 restriction.rollingPeriodInDays = 1;
2189 } else {
2190 restriction.rollingPeriodInDays = readlineSync.questionInt(`Enter the rolling period in days (10 days): `, { defaultInput: 10 });
2191 }
2192 restriction.startTime = readlineSync.questionInt(`Enter the time (Unix Epoch time) at which restriction get into effect (now = 0): `, { defaultInput: 0 });
2193 let oneMonthFromNow = Math.floor(Date.now() / 1000) + gbl.constants.DURATION.days(30);
2194 restriction.endTime = readlineSync.question(`Enter the time (Unix Epoch time) when the purchase lockup period ends and the investor can freely purchase tokens from others (1 month from now = ${oneMonthFromNow}): `, {
2195 limit: function (input) {
2196 return input > restriction.startTime + gbl.constants.DURATION.days(restriction.rollingPeriodInDays);
2197 },
2198 limitMessage: 'Must be greater than startTime + rolling period',
2199 defaultInput: oneMonthFromNow
2200 });
2201 return restriction;
2202}
2203
2204async function lockUpTransferManager() {
2205 console.log('\n', chalk.blue(`Lockup Transfer Manager at ${currentTransferManager.options.address}`), '\n');

Callers 2

Calls 1

toWeiPercentageFunction · 0.85

Tested by

no test coverage detected