Skip to content

Commit 0425679

Browse files
f: use erc7201
1 parent 5c5fbc8 commit 0425679

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

packages/subgraph-service/contracts/libraries/IndexingAgreement.sol

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ library IndexingAgreement {
2121
V1
2222
}
2323

24-
struct Manager {
25-
mapping(bytes16 => State) agreements;
26-
mapping(bytes16 agreementId => IndexingAgreementTermsV1 data) termsV1;
27-
mapping(address allocationId => bytes16 agreementId) allocationToActiveAgreementId;
28-
}
29-
3024
/**
3125
* @notice Indexer Agreement Data
3226
* @param allocationId The allocation ID
@@ -80,7 +74,16 @@ library IndexingAgreement {
8074
bytes data;
8175
}
8276

83-
bytes32 private constant INDEXING_AGREEMENT_MANAGER_STORAGE_V1_SLOT = keccak256("v1.manager.indexing-agreement");
77+
/// @custom:storage-location erc7201:graphprotocol.subgraph-service.storage.Manager.IndexingAgreement
78+
struct Manager {
79+
mapping(bytes16 => State) agreements;
80+
mapping(bytes16 agreementId => IndexingAgreementTermsV1 data) termsV1;
81+
mapping(address allocationId => bytes16 agreementId) allocationToActiveAgreementId;
82+
}
83+
84+
// keccak256(abi.encode(uint256(keccak256("graphprotocol.subgraph-service.storage.Manager.IndexingAgreement")) - 1)) & ~bytes32(uint256(0xff))
85+
bytes32 private constant INDEXING_AGREEMENT_MANAGER_STORAGE_LOCATION =
86+
0xfdb6fb5d1a390e01387ce73642e517880d8e0fedd0e7e26ac9194788a7a85200;
8487

8588
/**
8689
* @notice Emitted when an indexer collects indexing fees from a V1 agreement
@@ -384,12 +387,10 @@ library IndexingAgreement {
384387
return wrapper;
385388
}
386389

387-
function _getManager() internal pure returns (Manager storage manager) {
388-
bytes32 slot = INDEXING_AGREEMENT_MANAGER_STORAGE_V1_SLOT;
389-
390+
function _getManager() internal pure returns (Manager storage $) {
390391
// solhint-disable-next-line no-inline-assembly
391392
assembly {
392-
manager.slot := slot
393+
$.slot := INDEXING_AGREEMENT_MANAGER_STORAGE_LOCATION
393394
}
394395
}
395396

0 commit comments

Comments
 (0)