@blessnetwork/bless-time-contract
v0.0.4
Published
A Solana program that manages the Bless token airdrop process, vault reserves, administrator governance, and Merkle tree–based eligibility verification. Built with Anchor.
Downloads
20
Readme
bls-time-contract
A Solana program that manages the Bless token airdrop process, vault reserves, administrator governance, and Merkle tree–based eligibility verification. Built with Anchor.
Features
Program State Initialization
Create and configure the Bless Time state account.
Create a secure token vault controlled by the program.
Administrator Management
- Secure proposal and acceptance of new admin accounts.
Vault Management
Recharge vault with additional BLESS tokens.
Track recharge records.
Merkle Tree Airdrop
Off-chain generated Merkle root for participant eligibility.
On-chain proof verification to ensure only eligible users can claim.
Prevent duplicate claims with per-user claim records.
Instructions
1. initialize_bless_time_state
Creates the Bless Time State and its vault account.
Context: InitBlessTimeState Parameters:
bump: u8 – PDA bump for bls_time_state.
vault_bump: u8 – PDA bump for vault_account.
Flow:
Creates bls_time_state PDA.
Creates token vault_account PDA with bls_time_state as authority.
Sets the admin to the payer.
2. set_pending_admin_account
Proposes a new admin account.
Context: BlsTimeProposeAdmin
Notes:
Callable only by the current admin_account.
Stores pending_admin in bls_time_state.
Rejects if proposed admin is the same as current or already pending.
3. accept_admin
Finalizes admin transfer.
Context: BlsTimeAcceptAdmin Notes:
Callable only by the pending_admin.
Updates admin_account to pending_admin.
Clears pending_admin after acceptance.
4. set_merkle_tree_root
Sets the Merkle root for airdrop eligibility.
Context: BlessTimeSetMerkleTreeRoot Parameters:
- root: [u8; 32] – The new Merkle root.
Notes:
Only callable by admin_account.
Rejects default [0u8; 32] and unchanged roots.
5. recharge_vault_account
Transfers tokens into the program’s vault.
Context: InitVaultRechargeRecord Parameters:
amount: u64 – Number of tokens to transfer.
Flow:
Uses CPI to SPL Token program.
Transfers from recharge_account to vault_account.
6. bless_token_claim
Claims tokens via Merkle proof.
Context: BlsTokenClaim Parameters:
amount: u64 – Claim amount.
locked_time: i64 – Unix timestamp when claim can be made.
proof: Vec<[u8; 32]> – Merkle proof.
record_bump: u8 – PDA bump for user_claim_record.
Flow:
Checks claim_paused flag.
Verifies Merkle proof with payer address, amount, and locked time.
Ensures vault has sufficient balance.
Checks that the current block time ≥ locked_time.
Creates user_claim_record PDA to prevent reclaims.
Transfers tokens from vault to user via CPI with PDA signing.
Security
All admin-sensitive actions require correct signer checks.
Claim verification is backed by off-chain Merkle tree generation.
Duplicate claims prevented via PDA-bound UserClaimRecord.
Vault account is owned by program state PDA to prevent unauthorized transfers.
