In this Smart Scenario; It is divided into equal periods of 10 months (Per month 2.1 Million PIRI). The asset is coded so that it can only be claimed once a month.
Who will send those PIRIs?
Relavent PSce will send PIRI though its own balance. This PSce must be have 21 Millions of PIRI for complete properly end of 10 months.
constInvestorAddress='PRTMRKWZ56v4D8mV1oj813bqTgdfUm9J4woVTDMpGxF';consttotalAmount=43_333; // for only testing.constcliffDate={}; cliffDate["_2024"]=totalAmount*0.05; // Pay %5 on 2024 cliffDate["_2025"]=totalAmount*0.2; // Pay %25 on 2025 cliffDate["_2026"]=totalAmount*0.75; // Pay %75 in 2026asyncfunctionwithdraw(amount){if (EXECUTER_ADDRESS!==InvestorAddress) {return {error:1,data:'This PSce doesnt belong to you!'}; }if (isNaN(amount))return {error:1,data:'Amount is not true format!'};if (parseFloat(amount)<=0)return {error:1,data:'Amount must be positive number!'};if (parseFloat(amount)>totalAmount)return {error:1,data:'Amount must be lower than total amount'};if (PSDATA==undefined) PSDATA={};if (PSDATA["withDraw"+newDate().getFullYear().toString()]==undefined)PSDATA["withDraw"+newDate().getFullYear().toString()]=0;if (PSDATA["withDraw"+newDate().getFullYear().toString()]+amount<=cliffDate["_"+newDate().getFullYear()]) {PSDATA["takenDate_"+newDate().toString()]=amount;PSDATA["withDraw"+newDate().getFullYear().toString()]+=amount;awaitMap.saveMap(JSON.stringify(PSDATA));returnawaitTransaction.sendPIRI(InvestorAddress,amount); }else {return {error:1,data:'You wont take this amount because of exceed to cliff limit!' }; }}