Vyper 0.4.0
is used in the project.
! Given project was migrated from hardhat to foundry. NomicFoundation/hardhat#5479
This project introduces a fully decentralized presale smart contract built in Vyper, designed to streamline the process of Initial DEX Offerings (IDO) and token vesting—all within a single, robust contract. The goal is to provide an efficient and versatile solution for token distribution while maintaining full decentralization.
Key Features
- Support for open-to-all or invite-only sales through whitelisted addresses.
- Flexible configuration options for inclusivity or exclusivity as needed.
- Token vesting with tailor-made cliff periods for gradual token releases.
- Decentralized control over unlock schedules to ensure trust and transparency.
- Set custom token pricing for the presale to meet project-specific requirements.
- Define exact time windows for presales to align with marketing or strategic goals.
- Combines IDO and vesting functionality, reducing the need for multiple contracts.
- Simplified deployment and management for token projects of any scale.
Poetry is used here for installing vyper compiler with selected version in python virtual environment. Such as it is recommend in official documentation. Also Poetry is used as package manager for managing packages like snekmate.
https://docs.vyperlang.org/en/stable/installing-vyper.html
Use just
in your terminal to see all available commands in your project.
just setup
just build
just compile
Format your Solidity code
forge fmt --check
Using the Branching Tree Technique with Bulloak in Foundry Testing
In my recent Foundry project, I adopted the Branching Tree Testing Technique using Bulloak to ensure comprehensive coverage and robust testing of smart contracts. This approach, inspired by the natural growth patterns of a tree, emphasizes systematically exploring all possible paths of execution within the contract, branching out to test edge cases and unexpected scenarios. What is the Branching Tree Technique?
The Branching Tree Technique organizes tests hierarchically, much like a tree structure:
- Root: Represents the base or initial state of the contract.
- Branches: Correspond to different paths or scenarios derived from contract functions.
- Leaves: Represent specific edge cases or end states.
This technique ensures no part of the logic remains untested, particularly in complex scenarios with multiple dependencies or conditional flows.
- user can purchase both, erc20 and native tokens.
- owner cannot update price after presale start.
- owner can update price before presale start.
- owner can update presale start.
- owner can update presale end.
- owner can update presale cliff.
- owner can update presale unlock.
- owner can update presale whitelist.
- owner can select public or whitelisted presale.
- only owner can deposit tokens into presale.
- owner can withdraw unsold tokens anytime.
- presale is finished when presale end is reached.
- presale is finished when all token liquidity is sold.
- owner can update presale schedule (start/end), only if presale is not started.
- in whitelist presale different addresses may have custom price and unlock schedule.
- owner can update whitelist root anytime.
- it is not possible to make a presale which takes both erc20 and native tokens.