> For the complete documentation index, see [llms.txt](https://smartscenarios.pirichain.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smartscenarios.pirichain.com/psce-functions/examples/a-sample-about-token-vesting.md).

# A sample about token vesting

***Who will send those PIRIs?***&#x20;

*<mark style="color:purple;">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.</mark>*

***How can manage the my PSce balance?***&#x20;

*<mark style="color:purple;">Though your code explained</mark>* [*<mark style="color:purple;">here.</mark>*](/psce-functions/examples/advanced-operation-withdraw-all-your-asset-from-pcse.md)

```javascript
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!' };
            }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://smartscenarios.pirichain.com/psce-functions/examples/a-sample-about-token-vesting.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
