// SPDX-License-Identifier: MIT pragma solidity 0.8.24; import { Test } from "forge-std/Test.sol"; import { FlourishingRewardPolicyV3 } from "../../contracts/bonds/FlourishingRewardPolicyV3.sol"; /// @notice Executed Base-policy numeric vectors, not a copied formula. /// Native tests assert these same independent exact values with real SBF. contract FlourishingLongTermParityV3Test is Test { event LongTermVector(bool partnership, uint64 year, uint256 human, uint256 ai, uint256 fund); function test_bothExecutedPoliciesMatchNineAnnualNativeLifecycleVectors() public { for (uint256 family; family < 2; ++family) { bool partnership = family == 1; FlourishingRewardPolicyV3 policy = new FlourishingRewardPolicyV3( address(this), 1, address(this), partnership, [address(0x101), address(0x102), address(0x103)], 365 days, 10, 60 ); uint64 start = uint64(block.timestamp + 60); FlourishingRewardPolicyV3.Allocation memory allocation = FlourishingRewardPolicyV3.Allocation({ human: address(0x201), ai: address(0x202), partnershipFund: address(0x203), rewardBasis: 1_000_000, cap: 100_000_000, activeStart: start, activeEnd: start + 3650 days }); policy.setAllocation(address(this), 1, allocation); allocation.activeEnd += 1; vm.expectRevert(FlourishingRewardPolicyV3.InvalidAllocation.selector); policy.setAllocation(address(this), 2, allocation); for (uint64 year = 1; year <= 9; ++year) { FlourishingRewardPolicyV3.Observation memory o; o.bond = address(this); o.bondId = 1; o.period = year - 1; for (uint256 i; i < (partnership ? 4 : 6); ++i) o.scores[i] = 10_000; (uint256 human, uint256 ai, uint256 fund) = policy.preview(o); uint256 earned = partnership ? (year == 1 ? 2_000_000 : year <= 4 ? 3_000_000 : 5_000_000) : (year == 1 ? 5_000_000 : year <= 3 ? 7_000_000 : year == 4 ? 9_000_000 : 11_000_000); assertEq(human, earned * (partnership ? 60 : 50) / 100); assertEq(ai, earned * (partnership ? 30 : 50) / 100); assertEq(fund, partnership ? earned / 10 : 0); emit LongTermVector(partnership, year, human, ai, fund); } } } }