@@ -3,20 +3,21 @@ pragma solidity ^0.8.4;
33
44import {Test, console} from "forge-std/Test.sol " ;
55import {DeployDiamond} from "@diamond-script/DeployDiamond.s.sol " ;
6+ import {DeployDiamondHelper} from "@diamond-test/helpers/DeployDiamondHelper.sol " ;
67import {Diamond} from "@diamond/Diamond.sol " ;
78import {IDiamondCut} from "@diamond/interfaces/IDiamondCut.sol " ;
89import {IDiamondLoupe} from "@diamond/interfaces/IDiamondLoupe.sol " ;
910import {HelperContract} from "@diamond-test/helpers/HelperContract.sol " ;
11+ import {MyShinyFacet} from "@diamond/facets/MyShinyFacet.sol " ;
12+ import {AddMyShinyFacet} from "@diamond-script/AddMyShinyFacet.s.sol " ;
13+ import {AddMyShinyFacetHelper} from "@diamond-test/helpers/AddMyShinyFacetHelper.sol " ;
1014
1115/// @notice Provides shared state for tests involving a freshly deployed Diamond contract.
1216/// @dev Sets up references to deployed facets, interfaces, and the diamond itself for testing.
13- abstract contract DeployedDiamondState is HelperContract {
17+ abstract contract DeployedDiamondState is DeployDiamondHelper {
1418 /// @notice Instance of the deployed Diamond contract.
1519 Diamond public diamond;
1620
17- /// @notice Script used to deploy the Diamond contract.
18- DeployDiamond public deployDiamond;
19-
2021 /// @notice Interface for the DiamondCut functionality of the deployed diamond.
2122 IDiamondCut public diamondCut;
2223
@@ -32,12 +33,43 @@ abstract contract DeployedDiamondState is HelperContract {
3233 /// @notice Deploys the Diamond contract and initializes interface references and facet addresses.
3334 /// @dev This function is intended to be called in a test setup phase (e.g., `setUp()` in Foundry).
3435 function setUp () public {
35- deployDiamond = new DeployDiamond ();
36- diamond = deployDiamond.run ();
36+ diamond = _deployDiamond (diamondOwner);
37+
38+ diamondCut = IDiamondCut (address (diamond));
39+ diamondLoupe = IDiamondLoupe (address (diamond));
40+
41+ facetAddresses = diamondLoupe.facetAddresses ();
42+ }
43+ }
44+
45+ abstract contract AddMyShinyFacetState is DeployDiamondHelper , AddMyShinyFacetHelper {
46+ /// @notice Instance of the deployed Diamond contract.
47+ Diamond public diamond;
48+
49+ /// @notice Interface for the DiamondCut functionality of the deployed diamond.
50+ IDiamondCut public diamondCut;
51+
52+ /// @notice Interface for the DiamondLoupe functionality of the deployed diamond.
53+ IDiamondLoupe public diamondLoupe;
54+
55+ /// @notice Stores the facet addresses returned from the diamond loupe.
56+ address [] public facetAddresses;
57+
58+ MyShinyFacet public myShinyFacet;
59+
60+ AddMyShinyFacet public addMyShinyFacet;
61+
62+ string [4 ] public facetNames = ["DiamondCutFacet " , "DiamondLoupeFacet " , "OwnableRolesFacet " , "MyShinyFacet " ];
63+
64+ function setUp () public {
65+ vm.startPrank (diamondOwner);
66+ diamond = _deployDiamond (diamondOwner);
3767
3868 diamondCut = IDiamondCut (address (diamond));
3969 diamondLoupe = IDiamondLoupe (address (diamond));
4070
71+ myShinyFacet = _addMyShinyFacet (diamond);
72+
4173 facetAddresses = diamondLoupe.facetAddresses ();
4274 }
4375}
0 commit comments