Skip to content

faizalshaik/TokenLock

Repository files navigation

Token Lockup and SPL Smart Contracts

WARNING: DO NOT DEPLOY THE main BRANCH TO A PRODUCTION ENVIRONMENT SUCH AS ETHEREUM MAINNET

The code in the main branch is under active development and there may be significant bugs or security issues introduced that have not been caught by code review or independent security auditors.

It is recommended you use versioned releases where there is an attached audit report. The independent audits are typically conducted for specific git commit identifiers specified in the security audit reports. It is highly advisable to perform your own audit of the smart contracts to both understand what you are deploying and to independently assess the security of the code.

This Open Source software is provided "as is" with no warranty as specified in the LICENSE file.

Overview

This is an Solana SPL standard compatible token and TokenLockup scheduled release "vesting" smart contract that:

  • Does not have centralized controllers or admin roles to demonstrate strong decentralization and increased trust
  • Can enforce a scheduled release of tokens (e.g. investment lockups)
  • The maximum number of tokens is minted on deployment and it is not possible exceed this number
  • Smart contract enforced lockup schedules are used to control the circulating supply instead of inflationary minting.
  • Allows for burning tokens to reduce supply (e.g. for permanent cross chain transfers to a new blockchain and burning excess reserve tokens to support token price)
  • Optimized to decrease the use of gas for the costly transfer schedules

At A Glance

Feature Value
Network Solana
Protocol SPL
mint() no tokens minted ever after deployment
freeze() never
burn() Only from transaction senders own wallet address. No one can burn from someone else's address.
Admin Roles None
Upgradeable No
Transfer Restrictions None
Additional Functions Unlock Schedule related functions
Griefer Protection Minimum locked scheduled token amount slashing

Dev Environment

Clone this repo and cd into root. Then: The following dependencies are required to build and run this example, depending on your OS, they may already be installed:

If this is your first time using Rust, these Installation Notes might be helpful.

Configure CLI

If you're on Windows, it is recommended to use WSL to run these commands

  1. Set CLI config url to localhost cluster
solana config set --url localhost
  1. Create CLI Keypair

If this is your first time using the Solana CLI, you will need to generate a new keypair:

solana-keygen new

Start local Solana cluster

This example connects to a local Solana cluster by default.

Start a local Solana cluster:

solana-test-validator

Note: You may need to do some system tuning (and restart your computer) to get the validator to run

Listen to transaction logs:

solana logs

Install npm dependencies

npm install

Build the on-chain program

There is both a Rust and C version of the on-chain program, whichever is built last will be the one used when running the example.

npm run build:program-rust
npm run build:program-c

Deploy the on-chain program

solana program deploy dist/program/helloworld.so

Run the JavaScript client

npm run start

About

Solana-smart contract

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages