Skip to content

lakshyakumar/Tokenization-Platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Token Platform

Token Platform is a collection of Token, Staking and PrivateDistribution Contracts along their tests and deployment files.

Installation

Use the package manager npm to install project.

npm install

Usage

# For accounts
npx hardhat accounts

# For compiling
npx hardhat compile

# For testing
npx hardhat test

Deployment Guide

deployToken.js

Params:

  • intialamount: Initial amount of tokens to be deployed.
  • tokenName: Name of the token.
  • tokenSymbol: Symbol of the token.
  • tokenOwner: (Optional) Address of the token owner. If not provided, the script will use the deploying address.
# To run the script
npx hardhat run ./scripts/deployToken.js

deploySale.js

Params:

  • saleOwner: (Optional) Address of the owner who will deploy the contract. If not provided, the script will use the deploying address.
  • tokenAddress: Address of the token contract.
# To run the script
npx hardhat run ./scripts/deploySale.js

initiateSale.js

Params:

  • saleAddress: Address of the sale contract.
  • initialTGEAmountPercent: Initial TGE (Token Generation Event) amount percentage.
  • vestingPeriodInDays: Vesting period in days.
  • noOfVestingPeriods: Number of vesting periods.
  • cliffDuration: Duration of the cliff in days.
  • investors: List of investors' addresses.
  • amount: Amount of tokens for each investor.
# To run the script
npx hardhat run ./scripts/initiateSale.js

deployStake.js

Params:

  • stakeOwner: (Optional) Address of the owner who will deploy the contract. If not provided, the script will use the deploying address.
  • stakeToken: Address of the token to be staked.
  • rewardToken: Address of the token distributed as rewards.
  • initialReward: Initial reward amount.
  • duration_days: Duration of the staking period in days.
# To run the script
npx hardhat run ./scripts/deployStake.js

Contract Functions

Token Contract (Token.sol)

Functions:

  1. Constructor:

    • Initializes the token with an initial supply and assigns ownership to an address.
  2. Mint:

    • Function to mint new tokens and assign them to a specified address. Only the owner can call this function.

PrivateDistribution Contract (PrivateDistribution.sol)

Functions:

  1. Constructor:

    • Initializes the PrivateDistribution contract with the token address and contract owner address.
  2. Set Vesting Schedule:

    • Sets the vesting schedule for token distribution.
  3. Add Investor:

    • Adds an investor with the specified token allocation.
  4. Add Investors:

    • Adds multiple investors with their token allocations.
  5. Finalize Investors:

    • Finalizes the investor set.
  6. Set Initial Timestamp:

    • Sets the initial timestamp for the vesting schedule.
  7. Withdrawable Tokens:

    • Calculates the amount of withdrawable tokens for an investor.
  8. Withdraw Tokens:

    • Allows an investor to withdraw their tokens.
  9. Claim Tokens:

    • Allows the owner to claim any remaining tokens after vesting ends.

Stake Contract (Stake.sol)

Functions:

  1. Constructor:

    • Initializes the Stake contract with the owner address, stake token address, reward token address, and staking duration.
  2. Notify Reward Amount:

    • Notifies the contract about the reward amount to be distributed.
  3. Claim Rewards:

    • Claims the earned rewards for the caller.
  4. Stake:

    • Stakes the specified amount of tokens.
  5. Unstake:

    • Withdraws the specified amount of tokens from the stake.
  6. Balance Of:

    • Returns the balance of tokens for the specified account.
  7. Exit:

    • Unstakes and claims rewards.
  8. Recover Excess Token:

    • Allows the owner to recover excess tokens mistakenly sent to the contract.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

About

Staking, sale and token contract

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors