File tree Expand file tree Collapse file tree 4 files changed +13
-1
lines changed Expand file tree Collapse file tree 4 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -64,11 +64,12 @@ library LibDeployment {
64
64
return FacetCutInfo ({ name: "IssuerFacet " , selectors: selectors });
65
65
}
66
66
if (facetType == FacetType.Stakeholder) {
67
- bytes4 [] memory selectors = new bytes4 [](4 );
67
+ bytes4 [] memory selectors = new bytes4 [](5 );
68
68
selectors[0 ] = StakeholderFacet.createStakeholder.selector ;
69
69
selectors[1 ] = StakeholderFacet.getStakeholderPositions.selector ;
70
70
selectors[2 ] = StakeholderFacet.linkStakeholderAddress.selector ;
71
71
selectors[3 ] = StakeholderFacet.getStakeholderId.selector ;
72
+ selectors[4 ] = StakeholderFacet.getStakeholderIndex.selector ;
72
73
return FacetCutInfo ({ name: "StakeholderFacet " , selectors: selectors });
73
74
}
74
75
if (facetType == FacetType.StockClass) {
Original file line number Diff line number Diff line change @@ -70,6 +70,11 @@ contract StakeholderFacet {
70
70
return stakeholder_id;
71
71
}
72
72
73
+ /// @notice Get stakeholder idx for a stakeholder id
74
+ function getStakeholderIndex (bytes16 stakeholder_id ) external view returns (uint256 ) {
75
+ return StorageLib.get ().stakeholderIndex[stakeholder_id];
76
+ }
77
+
73
78
/// @notice Get all positions for a stakeholder
74
79
/// @dev INVESTOR_ROLE can only view their own positions, OPERATOR_ROLE and above can view any
75
80
function getStakeholderPositions (bytes16 stakeholder_id ) external view returns (StakeholderPositions memory ) {
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ interface IStakeholderFacet {
41
41
/// @param ensure_exists If true, will revert if the address is not linked to a stakeholder
42
42
function getStakeholderId (address wallet_address , bool ensure_exists ) external view returns (bytes16 );
43
43
44
+ /// @notice Get stakeholder idx for a stakeholder id
45
+ function getStakeholderIndex (bytes16 stakeholder_id ) external view returns (uint256 );
46
+
44
47
/// @notice Get all positions for a stakeholder
45
48
/// @dev INVESTOR_ROLE can only view their own positions, OPERATOR_ROLE and above can view any
46
49
/// @param stakeholder_id The stakeholder to get positions for
Original file line number Diff line number Diff line change @@ -107,6 +107,9 @@ contract DiamondStakeholderPositionsTest is DiamondTestBase {
107
107
// Ensure it exists
108
108
id = sf.getStakeholderId (wallet, true );
109
109
assertNotEq (id, bytes16 (0 ));
110
+
111
+ // Ensure it returns a non-0 idx
112
+ assertGt (sf.getStakeholderIndex (id), 0 );
110
113
}
111
114
112
115
function testGetStakeholderPositions () public {
You can’t perform that action at this time.
0 commit comments