Creating Vesting Contract


I’m trying to create vesting contract and have some questions.
I just tried testing the vesting contract in mainnet with 5 minutes of time intervals of vesting period(I have 3 vesting schedules).
However, I see that the only first one comes in.
Is there any minimum time interval for vesting contract?
Also, are there any other requirements regarding the creation of a vesting schedule?

1 Like
  • What does “only first one comes in.” mean?
  • Please share your code and some tx id otherwise can’t help you
  • No minimum, but the more schedules the more expensive the account allocation will be

So I tried this in devnet using the cli – where I did the following:

echo "RUST_BACKTRACE=1 ./target/debug/vesting-contract-cli      \
--url                             \
--program_id 59UJTfBWoqSKreiNgr3psmw8EJuhzHEo2XyH6t6jgtzr                                        \
create                                                          \
--mint_address HzwzjMmUXwCv6Z82L2wUGdwhUy8RsasYtZc8BJ8Xck9u                                            \
--source_owner ~/.config/solana/bon1.json                   \
--source_token_address 7TgcWRXxcnfDG1VmNX5q16Wm3MGgHpKUurpU9MFejj1v                    \
--destination_token_address HRPkXP4CMPH11a1pS8ZBhZnowk5i6DVKz1yUXModbXJY                 \
--amounts 10000000000,200000000000,3000000000000,!                                               \
--release-times 1645001467,1645001767,1645002067,!                   \
--payer ~/.config/solana/bon1.json"                         \
--verbose | bash 
  1. So in the command I have three different vesting schedules, each separated by 5 min intervals
  2. When I run the unlock command,
echo "RUST_BACKTRACE=1 ./target/debug/vesting-contract-cli      \
--url                             \
--program_id 59UJTfBWoqSKreiNgr3psmw8EJuhzHEo2XyH6t6jgtzr                                        \
unlock                                                          \
--seed CiDwVBFgWV9E5MvXWoLgnEgn2hK7rJikbvfWavzAR4S                                                    \
--payer ~/.config/solana/bon1.json" | bash
  1. I receive only the first vesting schedule and even after the time has passed, I don’t receive the other two tokens even though the time has passed.
    Here is my tx where I received the first amount: Explorer | Solana
    Vesting account pubkey: BXvE1G5EgeB5i5EZ7qG6qvgNKBPP2htMdid2sTpa7Bwb
    I have also tried in mainnet with the same command above but just deploying the program in mainnet, and changed the urls to mainnet-beta

Everything seems right to me:

  • 1645001467 = Wednesday, 16 February 2022 08:51:07 GMT
  • 1645001767 = Wednesday, 16 February 2022 08:56:07 GMT
  • 1645002067 = Wednesday, 16 February 2022 09:01:07 GMT

You sent your unlock tx Explorer | Solana at 08:54:52 GMT so only the first schedule was eligible for unlock at that time.

I tried to unlock using the same CLI command you pasted and I have been able to unlock them Explorer | Solana

So do I have to unlock them every time when the period comes?
So for 1645001767 unix time, do I have to run the unlock code again after 1645001767?

Yes, that’s correct. You need to run the unlock instruction to trigger the token transfer.

I see. Thank you for your support!

1 Like