Skip to content

Commit 4e6340c

Browse files
committed
ExampleDiamond improvements
1 parent 33a8e75 commit 4e6340c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/diamond/DiamondCutFacet.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ contract DiamondCutFacet {
6464
revert NoBytecodeAtAddress(_facet, "DiamondCutFacet: Add facet has no code");
6565
}
6666
// The position to store the next selector in the selectors array
67-
uint16 selectorPosition = uint16(s.selectors.length);
67+
uint32 selectorPosition = uint32(s.selectors.length);
6868
for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; selectorIndex++) {
6969
bytes4 selector = _functionSelectors[selectorIndex];
7070
address oldFacet = s.facetAndPosition[selector].facet;

src/diamond/deployment/ExampleDiamond.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import {IERC721Metadata} from "../../interfaces/IERC721Metadata.sol";
1010

1111
contract ExampleDiamond is ComposeDiamond {
1212
/// @notice Struct to hold facet address and its function selectors.
13-
// struct Facet {
14-
// address facet;
15-
// bytes4[] functionSelectors;
16-
// }
17-
13+
/// struct FacetCut {
14+
/// address facetAddress;
15+
/// FacetCutAction action; // Add=0, Replace=1, Remove=2
16+
/// bytes4[] functionSelectors;
17+
/// }
1818
/// @notice Initializes the diamond contract with facets, owner and other data.
1919
/// @dev Adds all provided facets to the diamond's function selector mapping and sets the contract owner.
2020
/// Each facet in the array will have its function selectors registered to enable delegatecall routing.
@@ -29,7 +29,7 @@ contract ExampleDiamond is ComposeDiamond {
2929
// Setting the contract owner
3030
LibOwner.setContractOwner(_diamondOwner);
3131
// Setting ERC721 token details
32-
LibERC721.setMetadata("ExampleDiamondNFT", "EDN", "https://example.com/metadata/");
32+
LibERC721.setMetadata({_name: "ExampleDiamondNFT", _symbol: "EDN", _baseURI: "https://example.com/metadata/"});
3333
// Registering ERC165 interfaces
3434
LibERC165.registerInterface(type(IERC721).interfaceId);
3535
LibERC165.registerInterface(type(IERC721Metadata).interfaceId);

0 commit comments

Comments
 (0)