Skip to main content

Overview

A comprehensive token project template with four production-grade contracts covering the full token lifecycle: creation, distribution via vesting, yield via staking, and secure management via multisig.

Quick Start

Generated Files

my-token
dokrypt.yaml
foundry.toml
README.md
contracts
token
ManagedToken.sol
vesting
VestingSchedule.sol
staking
StakeRewards.sol
multisig
MultiSig.sol
test
token
ManagedToken.t.sol
vesting
VestingSchedule.t.sol
staking
StakeRewards.t.sol
multisig
MultiSig.t.sol
scripts
deploy-token.js
setup-vesting.js

Contracts

ManagedToken.sol

Full-featured ERC-20 with owner-controlled minting, burning, and emergency pause. Constructor:
Functions: Events: Transfer, Approval, Paused, Unpaused, OwnershipTransferred

VestingSchedule.sol

Linear token vesting with configurable cliff and duration. Constructor:
Schedule struct:
Functions: Vesting Logic:
  • Before cliff: 0 tokens are vested
  • After cliff: tokens vest linearly over the remaining duration
  • Formula: vestedAmount = totalAmount * (currentTime - start) / duration
Events: ScheduleCreated, TokensReleased, ScheduleRevoked
Use dokrypt chain time-travel to test vesting schedules without waiting. For example, dokrypt chain time-travel 180d jumps past a 6-month cliff.

StakeRewards.sol

Synthetix-style proportional staking rewards. Users stake tokens and earn rewards proportional to their share of the total stake. Constructor:
Functions: Reward Calculation:
  • rewardRate = rewardAmount / duration
  • rewardPerToken += rewardRate * timeDelta / totalStaked
  • earned = stakedBalance * (rewardPerToken - userPaidPerToken) + storedRewards
Events: Staked, Withdrawn, RewardPaid, RewardsDurationUpdated

MultiSig.sol

M-of-N multisignature wallet for secure fund management. Constructor:
  • _owners: Array of owner addresses
  • _required: Minimum confirmations needed to execute
Transaction struct:
Functions: Events: Deposit, Submission, Confirmation, Revocation, Execution, ExecutionFailure The wallet accepts ETH via the receive() function, emitting a Deposit event.

Deployment

Deploy Token

Environment variables:

Setup Vesting