()
| 2472 | } |
| 2473 | |
| 2474 | async function modifyLockupsInBatch() { |
| 2475 | let csvFilePath = readlineSync.question(`Enter the path for csv data file (${MODIFY_LOCKUP_DATA_CSV}): `, { |
| 2476 | defaultInput: MODIFY_LOCKUP_DATA_CSV |
| 2477 | }); |
| 2478 | let batchSize = readlineSync.question(`Enter the max number of records per transaction or batch size (${gbl.constants.DEFAULT_BATCH_SIZE}): `, { |
| 2479 | limit: function (input) { |
| 2480 | return parseInt(input) > 0; |
| 2481 | }, |
| 2482 | limitMessage: 'Must be greater than 0', |
| 2483 | defaultInput: gbl.constants.DEFAULT_BATCH_SIZE |
| 2484 | }); |
| 2485 | let parsedData = csvParse(csvFilePath); |
| 2486 | let validData = parsedData.filter( |
| 2487 | row => !isNaN(row[0]) && |
| 2488 | moment.unix(row[1]).isValid() && |
| 2489 | (!isNaN(row[2] && (parseFloat(row[2]) % 1 === 0))) && |
| 2490 | (!isNaN(row[3] && (parseFloat(row[3]) % 1 === 0))) && |
| 2491 | typeof row[4] === 'string'); |
| 2492 | let invalidRows = parsedData.filter(row => !validData.includes(row)); |
| 2493 | if (invalidRows.length > 0) { |
| 2494 | console.log(chalk.red(`The following lines from csv file are not valid: ${invalidRows.map(r => parsedData.indexOf(r) + 1).join(',')} `)); |
| 2495 | } |
| 2496 | let batches = common.splitIntoBatches(validData, batchSize); |
| 2497 | let [amountArray, startTimeArray, lockUpPeriodArray, releaseFrequencyArray, lockupNameArray] = common.transposeBatches(batches); |
| 2498 | for (let batch = 0; batch < batches.length; batch++) { |
| 2499 | console.log(`Batch ${batch + 1} - Attempting to modify the following lockups: \n\n`, lockupNameArray[batch], '\n'); |
| 2500 | lockupNameArray[batch] = lockupNameArray[batch].map(n => web3.utils.toHex(n)); |
| 2501 | let action = currentTransferManager.methods.modifyLockUpTypeMulti(amountArray[batch], startTimeArray[batch], lockUpPeriodArray[batch], releaseFrequencyArray[batch], lockupNameArray[batch]); |
| 2502 | let receipt = await common.sendTransaction(action); |
| 2503 | console.log(chalk.green('Modify multiple lockups transaction was successful.')); |
| 2504 | console.log(`${receipt.gasUsed} gas used.Spent: ${web3.utils.fromWei((new web3.utils.BN(receipt.gasUsed)).mul(new web3.utils.BN(defaultGasPrice)))} ETH`); |
| 2505 | } |
| 2506 | } |
| 2507 | |
| 2508 | async function deleteLockupsInBatch() { |
| 2509 | let csvFilePath = readlineSync.question(`Enter the path for csv data file (${DELETE_LOCKUP_DATA_CSV}): `, { |
no outgoing calls
no test coverage detected