Vesting

Vesting contract is a smart contract that locks up funds for a period of time and allows the owner to withdraw the funds after the lockup period.

When a new employee joins an organization, they typically receive a promise of compensation to be disbursed after a specified duration of employment. This arrangement often involves the organization depositing the funds into a vesting contract, with the employee gaining access to the funds upon the completion of a predetermined lockup period. Through the utilization of vesting contracts, organizations establish a mechanism to encourage employee retention by linking financial rewards to tenure.

There are 2 actions (or endpoints) available to interact with this smart contract:

  • deposit asset
  • withdraw asset

Install package

First you can to install the @meshsdk/contracts package:

Initialize the contract

To initialize the contract, we need to initialize a provider, MeshTxBuilder and MeshVestingContract.

Both on-chain and off-chain codes are open-source and available on Mesh Github Repository.

Deposit Fund

After the lockup period has expired, the beneficiary can withdraw the funds from the vesting contract.

withdrawFund() withdraw funds from a vesting contract. The function accepts the following parameters:

  • vestingUtxo (UTxO) - unspent transaction output in the script
Deposit Fund

Deposit funds into a vesting contract with a locking period for a beneficiary

Connect wallet to run this demo

No wallets installed

Withdraw Fund

After the lockup period has expired, the beneficiary can withdraw the funds from the vesting contract.

withdrawFund() withdraw funds from a vesting contract. The function accepts the following parameters:

  • vestingUtxo (UTxO) - unspent transaction output in the script
Withdraw Fund

Withdraw funds from a vesting contract

Connect wallet to run this demo

No wallets installed