-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaxBeneficiaries.t.sol
More file actions
48 lines (37 loc) · 2.04 KB
/
MaxBeneficiaries.t.sol
File metadata and controls
48 lines (37 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.28;
import {Test} from "forge-std/Test.sol";
import {VestingParams} from "src/tokenDistribution/vesting/VestingParams.sol";
import {Beneficiary, VestingType} from "src/tokenDistribution/utils/Common.sol";
contract MaxBeneficiariesTest is Test {
uint256 public constant MONTH = 30 days;
uint64 public vestingStartTime;
VestingParams vestingParams;
function setUp() external {
// forge-lint: disable-next-line(unsafe-typecast)
vestingStartTime = uint64(block.timestamp + MONTH);
}
/// @dev Deployment cost of 401 beneficiaries is equal 19_448_973 (≈ half a block gas limit)
/// Checked with the command:
/// `forge test -vvv --mt test_deploy_moreBeneficiaries --gas-report`
function test_maxBeneficiaries() external {
// Stage 0. Create liquidity beneficiaries
uint256 liquidityTotalAmount = 287_500_000e18; // equal vestingParams.LIQUIDITY_TOTAL_AMOUNT()
Beneficiary[] memory liquidityBeneficiaries = new Beneficiary[](1); // min number of beneficiary
liquidityBeneficiaries[0] =
Beneficiary({account: makeAddr("liquidityBeneficiary"), amount: liquidityTotalAmount});
// Stage 1. Create team beneficiary. Simulate 400 beneficiaries
uint256 teamBeneficiariesCount = 400;
uint256 teamTotalAmount = 100_000_000e18; // equal vestingParams.TEAM_TOTAL_AMOUNT()
Beneficiary[] memory teamBeneficiaries = new Beneficiary[](teamBeneficiariesCount);
for (uint256 i = 0; i < teamBeneficiariesCount; i++) {
teamBeneficiaries[i] = Beneficiary({
account: vm.addr(uint256(keccak256(abi.encodePacked("OneOfBeneficiary", i)))),
amount: teamTotalAmount / teamBeneficiariesCount
});
}
// Stage 2. Deploy VestingParams
vestingParams = new VestingParams(vestingStartTime, teamBeneficiaries, liquidityBeneficiaries);
assertEq(vestingParams.getBeneficiaries(VestingType.TEAM).length, teamBeneficiariesCount);
}
}