This folder contains a Soroban smart contract example for a vesting schedule, a digital agreement that governs the gradual transfer of ownership rights, typically for assets like company stock or crypto tokens. It demonstrates defining, adding, and withdrawing vesting schedules, showcasing how to implement and interact with smart contracts on the Stellar network using Soroban.
Function Name | Parameters | Return Type | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
new_vesting |
|
Result<u64, VestError> |
Initializes a new vesting schedule with specific parameters. start_time is a UNIX timestamp, while duration is in seconds. admin is the user who will be allowed to call add_vest(). | ||||||
add_vest |
|
Result<i128, VestError> |
Adds funds to a specified vesting account. Pass as id the value returned by new_vesting(). | ||||||
retrievable_balance |
|
Result<i128, VestError> |
Retrieves the balance that is currently withdrawable by the beneficiary from the vesting account. Pass as id the value returned by new_vesting(). | ||||||
pay_out |
|
Result<i128, VestError> |
Transfers any currently available funds to the beneficiary's account. Note that anyone can call this function on behalf of the beneficiary. Pass as id the value returned by new_vesting(). |
-
Create a Vesting Schedule. To create and define the vesting schedule with its corresponding parameters use the function
new_vesting()
. -
Add Funds. To add the necessary funds to the vesting use
add_vest()
. -
Check Balance. In order to check the balance at the moment for a particular user, call
retrievable_balance()
. -
Withdraw Balance: For the user to withdraw balance use
pay_out()
.
๐ Navigate to this link to view the security review.