Smoke.t.sol
End-to-end happy path across every module.
46 lines1.7 KBSolidity
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity ^0.8.24; |
| 3 | |
| 4 | import {Base, IMirror} from "./Base.t.sol"; |
| 5 | import {SeatMode} from "../src/interfaces/IK401Interfaces.sol"; |
| 6 | |
| 7 | contract SmokeTest is Base { |
| 8 | function test_fixtureDeploys() public view { |
| 9 | assertEq(k401.name(), "Four Oh One K"); |
| 10 | assertEq(k401.symbol(), "401K"); |
| 11 | assertEq(k401.totalSupply(), INITIAL_SUPPLY); |
| 12 | assertEq(k401.FEE_BPS(), 500); |
| 13 | assertEq(k401.balanceOf(address(pair)), 100_000e18, "pair seeded fee-free"); |
| 14 | assertEq(k401.totalSeats(), 0, "no seats yet: everyone holding skips NFTs"); |
| 15 | } |
| 16 | |
| 17 | function test_seatsMintOnTransfer() public { |
| 18 | _giveSeats(alice, 5); |
| 19 | assertEq(k401.balanceOf(alice), 5e18); |
| 20 | assertEq(k401.seatBalanceOf(alice), 5); |
| 21 | assertEq(k401.totalSeats(), 5); |
| 22 | |
| 23 | uint256[] memory ids = k401.seatsOf(alice); |
| 24 | assertEq(ids.length, 5); |
| 25 | assertEq(registry.tierOf(ids[0]), 1); |
| 26 | assertEq(registry.multiplierOf(ids[0]), 1e18); |
| 27 | assertEq(uint8(registry.modeOf(ids[0])), uint8(SeatMode.VESTED)); |
| 28 | assertEq(mirror.ownerOf(ids[0]), alice); |
| 29 | } |
| 30 | |
| 31 | function test_oraclePrimes() public { |
| 32 | _primeOracle(); |
| 33 | assertTrue(oracle.isValid()); |
| 34 | // Pool seeded at 100k 401K / 200k USDG -> ~2.00 USDG per 401K. |
| 35 | assertApproxEqRel(oracle.consult(), 2e18, 0.01e18); |
| 36 | } |
| 37 | |
| 38 | function test_treasuryBuckets() public view { |
| 39 | // 1,200,000 USDG (6 dec) against 1,000,000 401K supply. |
| 40 | assertEq(treasury.reserveValueWad(), 1_200_000e18); |
| 41 | assertEq(treasury.rfv(), 1.2e18); |
| 42 | assertGe(treasury.rfvPerToken(), 1e18); |
| 43 | assertEq(treasury.equityValueWad(), 0); |
| 44 | } |
| 45 | } |
| 46 |
Click any line number to deep-link to it — the target line highlights on load.