@@ -3,20 +3,21 @@ pragma solidity ^0.8.4;
3
3
4
4
import {Test, console} from "forge-std/Test.sol " ;
5
5
import {DeployDiamond} from "@diamond-script/DeployDiamond.s.sol " ;
6
+ import {DeployDiamondHelper} from "@diamond-test/helpers/DeployDiamondHelper.sol " ;
6
7
import {Diamond} from "@diamond/Diamond.sol " ;
7
8
import {IDiamondCut} from "@diamond/interfaces/IDiamondCut.sol " ;
8
9
import {IDiamondLoupe} from "@diamond/interfaces/IDiamondLoupe.sol " ;
9
10
import {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 " ;
10
14
11
15
/// @notice Provides shared state for tests involving a freshly deployed Diamond contract.
12
16
/// @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 {
14
18
/// @notice Instance of the deployed Diamond contract.
15
19
Diamond public diamond;
16
20
17
- /// @notice Script used to deploy the Diamond contract.
18
- DeployDiamond public deployDiamond;
19
-
20
21
/// @notice Interface for the DiamondCut functionality of the deployed diamond.
21
22
IDiamondCut public diamondCut;
22
23
@@ -32,12 +33,43 @@ abstract contract DeployedDiamondState is HelperContract {
32
33
/// @notice Deploys the Diamond contract and initializes interface references and facet addresses.
33
34
/// @dev This function is intended to be called in a test setup phase (e.g., `setUp()` in Foundry).
34
35
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);
37
67
38
68
diamondCut = IDiamondCut (address (diamond));
39
69
diamondLoupe = IDiamondLoupe (address (diamond));
40
70
71
+ myShinyFacet = _addMyShinyFacet (diamond);
72
+
41
73
facetAddresses = diamondLoupe.facetAddresses ();
42
74
}
43
75
}
0 commit comments