Pirichain Smart Scenarios Documentation
  • ➰Pirichain Smart Scenario (PSce)
  • 🧿Which Industries can use easily PSces?
  • ♥️Full Support Interoperability!
  • ➰General Structure of Smart Scenarios
  • ➰PSce Working Principles And Limitations
  • ➰PSce Constants
  • ➰PSce Accumulator Object
  • ➰Simple Usage PSce
  • ➰Generating a new transaction though PSce
  • ➰What will i have if i execute a PCse
  • 💲Operation Costs
  • 🔐Double Protect! your client assets are in safe with addition authenticator code
  • 🛑Avoid these methods and situations in PSce
  • ➿PSce Functions
    • 🏁sendPIRI
    • 🏁sendToken
    • 🏁pushData
    • 🏁getBalance
    • 🏁getBalanceList
    • 🏁getPureTransaction
    • 🏁getTransaction
    • 🏁listPoolTransactions
    • 🏁findData
    • 🏁findDataWithAddress
    • 🏁findDataWithValue
      • 🏁findDataUpperThanValue
      • 🏁findDataLowerThanValue
    • 🏁getRandom
    • 🌏getData
    • 🌎postData
    • 🔓generateAuthenticator
    • 🔓verifyAuthenticator
    • 🔓getMyAuthenticatorToken
    • ❓Validators
    • 🔔Examples
      • 🍁Get PSce owner wallet balance
      • 🍁sendToken Example
      • 🍁EVM based similar approach- Token Management With PSDATA
      • 🍁Connect to EXTERNAL ENVIRONMENTS!
      • 🍁Time Based Inheritor Example
      • 🍁Token Example with Ticket Operation
      • 🍁A sample about token vesting
      • 🍁Asset Management Of Share Holders using with PSce
      • 🍁Double Protect your assets using with Pirichain Authenticator Factor
      • 🍁What an easy to build up your metaverse planet in Pirichain!
      • 🍁A new approach dependency factor using with PSce
      • 🍁Advanced Operation - Withdraw All Your Asset From PCse
      • 🍁Task Diversification and Transaction Proof (TDTP)
      • 🍁A Sample of using Origin Flag Integration on Binance Smart Chain Network.
      • 🍁Deposit/Withdraw from Foreign Chain (BSC) and Add Order , Buy and Sell Token, Just a 277 Code Lines!
      • 🍁Pirichain Decentralized Exchange (DEX) Sample Full Codes
Powered by GitBook
On this page
  1. PSce Functions
  2. Examples

A sample about token vesting

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.

PreviousToken Example with Ticket OperationNextAsset Management Of Share Holders using with PSce

Last updated 9 months ago

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.

How can manage the my PSce balance?

Though your code explained

const InvestorAddress='PRTMRKWZ56v4D8mV1oj813bqTgdfUm9J4woVTDMpGxF';

    const totalAmount=43_333; // for only testing.
    const cliffDate={};
    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 2026

async function withdraw(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"+new Date().getFullYear().toString()]==undefined)
        PSDATA["withDraw"+new Date().getFullYear().toString()]=0;
            if (PSDATA["withDraw"+new Date().getFullYear().toString()]+amount<=cliffDate["_"+new Date().getFullYear()])
            {
                PSDATA["takenDate_"+new Date().toString()]=amount;
                PSDATA["withDraw"+new Date().getFullYear().toString()]+=amount;
                await Map.saveMap(JSON.stringify(PSDATA));
                return await Transaction.sendPIRI(InvestorAddress,amount);

            }
            else
            {
                return {error:1,data:'You wont take this amount because of exceed to cliff limit!' };
            }
}
➿
🔔
🍁
here.