VestingWalletConfidentialExample

VestingWalletConfidentialExample

Category: Identity | Difficulty: Advanced | Chapters: Erc7984, Vesting | Concept: Confidential vesting (ERC7984) + public KYC gating + factory/clones

Confidential vesting wallet with public KYC gating on releases

Why this example

This example focuses on Confidential vesting (ERC7984) + public KYC gating + factory/clones. It is designed to be self-contained and easy to run locally.

Quick start

npm install
npm run test:mocked -- test/identity/VestingWalletConfidentialExample.test.ts

Dependencies

  • SimpleKycRegistry

  • MintableConfidentialToken

Deployment plan

Step
Contract
Args
Saves As

1

SimpleKycRegistry

$deployer

kyc

2

MintableConfidentialToken

$deployer, "Vesting Confidential Token", "vCONF", "ipfs://vesting-token"

token

3

VestingWalletConfidentialExampleFactory

@kyc

vestingFactory

Contract and test

Pitfalls to avoid

No pitfalls are highlighted in the tests for this example.

API Reference

Overview

Confidential vesting wallet with KYC-gated releases

Developer Notes

Clone-compatible implementation using initializer pattern

kyc

The KYC registry for compliance checks

NotKycApproved

Error thrown when a non-KYC-approved beneficiary attempts to release

Parameters

Name
Type
Description

beneficiary

address

The address that was not KYC-approved

constructor

Initializes the implementation contract and disables further initialization

initialize

Initialize clone state (clones-safe initializer)

Clones do not run constructors; this configures coprocessor and VestingWallet state.

Parameters

Name
Type
Description

kyc_

contract SimpleKycRegistry

Public KYC registry

beneficiary

address

Address that can release vested tokens

startTimestamp

uint48

Vesting start time (unix seconds)

durationSeconds

uint48

Vesting duration in seconds

release

Release vested tokens to the beneficiary (KYC-gated)

Reverts if beneficiary is not KYC-approved in the public registry.

Parameters

Name
Type
Description

token

address

ERC7984 token address

VestingWalletConfidentialExampleFactory

Overview

Factory for deploying KYC-gated confidential vesting wallets as clones

Developer Notes

Uses clone pattern for gas-efficient deployment

InvalidBeneficiary

Error thrown when beneficiary is the zero address

kyc

The KYC registry used for all deployed vesting wallets

constructor

Initializes the factory with a KYC registry

Parameters

Name
Type
Description

kyc_

contract SimpleKycRegistry

The KYC registry contract for compliance checks

_deployVestingWalletImplementation

Deploys the vesting wallet implementation contract

Return Values

Name
Type
Description

[0]

address

The address of the deployed implementation

_validateVestingWalletInitArgs

Validates the initialization arguments for a new vesting wallet

Parameters

Name
Type
Description

initArgs

bytes

ABI-encoded (beneficiary, startTimestamp, durationSeconds)

_initializeVestingWallet

Initializes a newly cloned vesting wallet

Parameters

Name
Type
Description

vestingWalletAddress

address

The address of the cloned vesting wallet

initArgs

bytes

ABI-encoded (beneficiary, startTimestamp, durationSeconds)

Last updated