Design (draft)
Vesting DApp for Cardano Blockchain
Overview
This document outlines the design for a Vesting DApp on the Cardano blockchain, allowing organizations to create their own NFT minting policy and manage the vesting process for their members. The design also includes the ability for organization representatives to overrule vesting, such as canceling someone's future tokens, if a majority decides on this action.
Workflow
-
Create an Organization: Define members by their addresses. A unique token with a specific policy ID is sent to each member to allow managing vesting schedules.
-
Mint Organization Tokens: Tokens are minted and distributed among members post organization creation.
-
Create Vesting Schedules: Set up vesting schedules by specifying beneficiaries, token distribution per period, and the total number of periods.
-
Claim Benefits: Beneficiaries can view and claim their amounts through the dashboard.
How it works
Anyone can establish a vesting schedule for any token. To do this, a UTxO (Unspent Transaction Output) is locked into the vesting contract with a specific datum structure attached, containing the following details:
type Datum {
datum_id: ByteArray; // ID to avoid double satisfaction
beneficiary: VerificationKeyHash;// Beneficiary's credentials
date: POSIXTime; // Start date in POSIX time (e.g., 1672843961000)
tokens_required: Int; // Amount of tokens required for cancellation
org_token: value.PolicyId; // Organization's token policy ID
beacon_token: value.PolicyId; // Beacon token policy ID
num_periods: Int; // Number of vesting periods
period_length: Int; // Duration of each vesting period (in days)
amount_per_period: Int; // Amount of tokens distributed per period
token_policy_id: ByteArray; // Policy ID of the vested token
token_name: ByteArray; // Name of the vested token
}
This UTxO will also contain a "beacon token." All beacon tokens share the same policy, and their token name matches the organization policy ID, facilitating effortless tracking of the organization's UTxOs.
Multiple UTxOs
Users can create various UTxOs to account for different tokens, beneficiaries, or varying periods and amounts.
Unlocking UTxO
A UTxO may be unlocked if the claimable amount is sent to the beneficiary, and any remaining balance is returned to the contract with the identical datum.
Canceling Vesting Trenches
Organization members holding the tokens can cancel vesting trenches. To do so, they must create a transaction including a minimum number of tokens specified in the datum of the locked UTxO. This mechanism also enables the retrieval of the minimum ADA that was locked in the UTxO.
Considerations
- This design allows for an easily trackable vesting process on the Cardano blockchain.
- The linear vesting schedule can be extended to more complex vesting curves by creating multiple utxos for each user.
- Organization representatives have the ability to overrule vesting decisions if a majority agrees.
Future Enhancements
- Implementing support for non-linear vesting schedules natively within the vesting contract.
- Allowing organizations to update their NFT minting policy and vesting schedules after creation.
- Enhancing the decision-making process for organization representatives to overrule vesting decisions.