Skip to content

Commit f4cb717

Browse files
committed
docs: main readme
1 parent 4a5972e commit f4cb717

2 files changed

Lines changed: 46 additions & 52 deletions

File tree

README.md

Lines changed: 46 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,77 @@
1-
// TODO: Уточнить, что не подходит для реализации вестинга ребейз токенов
1+
# True Vesting
22

3-
## Foundry
3+
**True Vesting** is a pet project for creating decentralized vesting of an ERC-20 token. The decentralization lies in the fact that, after the token is created, its entire supply is transferred to a dedicated contract responsible for distribution. The token cannot be withdrawn by the owner or any other party. The token can only be sent to specific contracts that handle its distribution according to predefined rules.
44

5-
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
5+
Currently, only one type of distribution has been implemented—vesting. Other types can be successfully added later.
66

7-
Foundry consists of:
7+
The project does not implement full-fledged tokenomics and serves only as an example for two allocation groups: team and liquidity. Any coincidences are purely accidental.
88

9-
- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
10-
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
11-
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
12-
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.
9+
_Important!_ The project i**s not designed to support vesting for rebase tokens** or tokens with dynamically changing quantities.
1310

14-
## Documentation
11+
## Smart Contract Overview
1512

16-
https://book.getfoundry.sh/
13+
The following smart contracts have been implemented:
14+
- [MetaToken.sol](./src/MetaToken.sol). The ERC-20 token contract, which we will distribute through the contract `MetaTokenDistributor.sol`.
15+
- [MetaTokenDistributor.sol](./src/tokenDistribution/MetaTokenDistributor.sol). A contract that will initiate various types of vesting. It can be upgraded to handle token locking, adding liquidity, sending tokens to mentors, and so on.
16+
- [VestingParams.sol](./src/tokenDistribution/vesting/VestingParams.sol). A contract that stores parameters for all types of vesting (in our case, two types: team and liquidity). It includes the description of allocations, a list of beneficiary addresses, and the token unlock schedule.
17+
- [Vesting.sol](./src/tokenDistribution/vesting/Vesting.sol). Implementation of the vesting contract. A new instance is created for each type of vesting. It organizes the token unlock process according to the established schedule.
1718

18-
## Usage
19+
## Architecture
1920

20-
### Build
21+
![](./images/architecture.png)
2122

22-
```shell
23-
$ forge build
24-
```
23+
The smart contract architecture outlines the process of creating new vesting instances.To create a new vesting, the following deployment and smart contract call process must be executed:
2524

26-
### Test
25+
1. Deploy the `VestingParams.sol` smart contract, which defines all vesting rules for all vesting types.
26+
2. Deploy the `MetaTokenDistributor.sol` smart contract. The distribution contract accepts and stores the address of `VestingParams.sol`.
27+
3. Under the hood, a `MetaToken.sol` contract for distribution will be deployed.
28+
4. At the time of `MetaToken.sol` deployment, its entire supply will be sent to the `MetaTokenDistributor.sol` contract.
29+
5. To initiate vesting, the `startVesting()` function must be called on the `MetaTokenDistributor.sol` contract.
30+
6. The `MetaTokenDistributor.sol` contract will request vesting parameters from the `VestingParams.sol` contract.
31+
7. Deploy a `Vesting.sol` contract using the minimal clone pattern.
2732

28-
```shell
29-
$ forge test
30-
```
33+
_Important!_ Each type of vesting can only be initiated once and by anyone after the vesting start time has been reached.
3134

32-
### Format
35+
### Maximum number of beneficiaries
3336

34-
```shell
35-
$ forge fmt
36-
```
37+
The list of beneficiaries is determined at the moment of deploying the smart contract [VestingParams.sol](./src/tokenDistribution/vesting/VestingParams.sol) in the constructor. Therefore, it is important to understand the maximum number of beneficiaries that can be set in this way without exceeding the block gas limit.
3738

38-
### Gas Snapshots
39+
As of 2025, the block gas limit in the Ethereum network is 36 million. In the Arbitrum network, it is significantly higher, but according to the documentation, the practical working limit is 32 million.
3940

40-
```shell
41-
$ forge snapshot
42-
```
41+
To determine the actual gas consumption, you can refer to the load test [MaxBeneficiaries.t.sol](./test/tokenDistribution/vesting/loadTests/MaxBeneficiaries.t.sol). Run the test with gas profiling using `forge test -vvv --mt test_deploy_moreBeneficiaries --gas-report`.
4342

44-
### Anvil
43+
The resulting table shows that for 401 beneficiaries, `19_448_973` gas will be consumed, which is optimal and will occupy approximately half of the block gas limit in Ethereum.
4544

46-
```shell
47-
$ anvil
48-
```
45+
![](./images/maxBeneficiariesLimit.png)
4946

50-
### Deploy
47+
Important! For deployment on other networks, it is necessary to check the documentation and review the block and transaction gas limits.
5148

52-
```shell
53-
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
54-
```
49+
## Getting started
5550

56-
### Cast
51+
The project is written using a [Foundry framework](https://book.getfoundry.sh/).
5752

58-
```shell
59-
$ cast <subcommand>
60-
```
53+
### Usage
6154

62-
### Help
55+
**Build**
6356

6457
```shell
65-
$ forge --help
66-
$ anvil --help
67-
$ cast --help
58+
$ forge build
6859
```
6960

70-
### Maximum number of beneficiaries
61+
**Test**
7162

72-
The list of beneficiaries is determined at the moment of deploying the smart contract [VestingParams.sol](./src/tokenDistribution/vesting/VestingParams.sol) in the constructor. Therefore, it is important to understand the maximum number of beneficiaries that can be set in this way without exceeding the block gas limit.
73-
74-
As of 2025, the block gas limit in the Ethereum network is 36 million. In the Arbitrum network, it is significantly higher, but according to the documentation, the practical working limit is 32 million.
75-
76-
To determine the actual gas consumption, you can refer to the load test [MaxBeneficiaries.t.sol](./test/tokenDistribution/vesting/loadTests/MaxBeneficiaries.t.sol). Run the test with gas profiling using `forge test -vvv --mt test_deploy_moreBeneficiaries --gas-report`.
63+
```shell
64+
$ forge test
65+
```
7766

78-
The resulting table shows that for 401 beneficiaries, `19_448_973` gas will be consumed, which is optimal and will occupy approximately half of the block gas limit in Ethereum.
67+
**Test coverage**
7968

80-
![](./images/maxBeneficiariesLimit.png)
69+
```shell
70+
$ forge coverage
71+
```
8172

82-
Important! For deployment on other networks, it is necessary to check the documentation and review the block and transaction gas limits.
73+
**Format**
8374

75+
```shell
76+
$ forge fmt
77+
```

images/architecture.png

182 KB
Loading

0 commit comments

Comments
 (0)