-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathISPRegistry.sol
More file actions
178 lines (155 loc) · 7.13 KB
/
ISPRegistry.sol
File metadata and controls
178 lines (155 loc) · 7.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
// SPDX-License-Identifier: MIT
pragma solidity =0.8.30;
import {CommonTypes} from "filecoin-solidity/v0.8/types/CommonTypes.sol";
import {SLITypes} from "../types/SLITypes.sol";
/**
* @title ISPRegistry
* @notice Interface for storage provider registration, matching, and capacity management
*/
interface ISPRegistry {
struct ProviderInfo {
address organization;
address payee;
bool paused;
bool blocked;
SLITypes.SLIThresholds capabilities;
uint256 availableBytes;
uint256 committedBytes;
uint256 pendingBytes;
/// @notice Monthly ERC20 token price per 32 GiB sector in smallest units (0 = manual approval)
uint256 pricePerSectorPerMonth;
}
/**
* @notice Get all registered providers
* @return Array of all registered provider actor IDs
*/
function getProviders() external view returns (CommonTypes.FilActorId[] memory);
/**
* @notice Get providers that have committed capacity (committedBytes > 0)
* @return Array of provider actor IDs with permanently allocated storage
*/
function getCommittedProviders() external view returns (CommonTypes.FilActorId[] memory);
/**
* @notice Get all providers registered under an organization
* @param organization The organization address
* @return Array of provider actor IDs belonging to the organization
*/
function getProvidersByOrganization(address organization) external view returns (CommonTypes.FilActorId[] memory);
/**
* @notice Get full information about a provider
* @param provider The provider actor ID
* @return info The provider's registration info
*/
function getProviderInfo(CommonTypes.FilActorId provider) external view returns (ProviderInfo memory info);
/**
* @notice Check if a provider is registered
* @param provider The provider actor ID
* @return True if the provider is registered
*/
function isProviderRegistered(CommonTypes.FilActorId provider) external view returns (bool);
/**
* @notice Find a provider matching requirements and reserve pending capacity
* @dev Selects the least-committed eligible provider. Reserves `pendingBytes` atomically
* so capacity is held between matching and commitment.
* Returns FilActorId(0) if no provider matches.
* @param requirements SLI thresholds the client needs
* @param terms Commercial terms (size, price, duration)
* @return provider The matched provider, or FilActorId(0) if none found
* @return autoApprove True if the provider's price per sector is met by the deal terms
*/
function getProviderForDeal(SLITypes.SLIThresholds calldata requirements, SLITypes.DealTerms calldata terms)
external
returns (CommonTypes.FilActorId provider, bool autoApprove);
/**
* @notice Release committed capacity (called on deal rejection)
* @dev Decrements committedBytes for the provider. Reverts on underflow.
* @param provider The provider whose capacity to release
* @param sizeBytes Amount of capacity to release
*/
function releaseCapacity(CommonTypes.FilActorId provider, uint256 sizeBytes) external;
/**
* @notice Release pending capacity (called on deal rejection before commitment)
* @dev Decrements pendingBytes for the provider. Reverts if sizeBytes > pendingBytes.
* @param provider The provider whose pending capacity to release
* @param sizeBytes Amount of pending capacity to release
*/
function releasePendingCapacity(CommonTypes.FilActorId provider, uint256 sizeBytes) external;
/**
* @notice Check if address is authorized to act on behalf of a provider
* @dev Admin always returns true. Otherwise checks MinerUtils.isControllingAddress.
* @param caller Address to check
* @param provider Provider to check against
* @return True if caller is authorized for provider
*/
function isAuthorizedForProvider(address caller, CommonTypes.FilActorId provider) external view returns (bool);
/**
* @notice Block a provider (admin only, excluded from matching)
* @param provider The provider to block
*/
function blockProvider(CommonTypes.FilActorId provider) external;
/**
* @notice Unblock a provider (admin only)
* @param provider The provider to unblock
*/
function unblockProvider(CommonTypes.FilActorId provider) external;
/**
* @notice Commit actual capacity after DDO allocation
* @dev Releases estimated pending bytes, then commits actual bytes.
* Enforces sector padding tolerance if configured.
* @param provider The provider whose capacity to commit
* @param estimatedSizeBytes Estimated size from the original deal proposal
* @param actualSizeBytes Actual deal size from DDO allocation
*/
function commitCapacity(CommonTypes.FilActorId provider, uint256 estimatedSizeBytes, uint256 actualSizeBytes)
external;
/**
* @notice Pause a provider (excluded from matching)
* @param provider The provider to pause
*/
function pauseProvider(CommonTypes.FilActorId provider) external;
/**
* @notice Unpause a provider (available for matching)
* @param provider The provider to unpause
*/
function unpauseProvider(CommonTypes.FilActorId provider) external;
/**
* @notice Update provider's available storage capacity
* @param provider The provider to update
* @param availableBytes New available capacity in bytes
*/
function updateAvailableSpace(CommonTypes.FilActorId provider, uint256 availableBytes) external;
/**
* @notice Set SLI capabilities for a provider
* @param provider The provider to update
* @param capabilities The SLI capabilities this provider guarantees
*/
function setCapabilities(CommonTypes.FilActorId provider, SLITypes.SLIThresholds calldata capabilities) external;
/**
* @notice Set the monthly price per sector for a provider
* @param provider The provider to update
* @param pricePerSectorPerMonth The monthly ERC20 token price per 32 GiB sector in smallest units (0 to disable auto-approve)
*/
function setPrice(CommonTypes.FilActorId provider, uint256 pricePerSectorPerMonth) external;
/**
* @notice Set the payment recipient address for a provider
* @param provider The provider to update
* @param payee The address that will receive payments for this provider
*/
function setPayee(CommonTypes.FilActorId provider, address payee) external;
/**
* @notice Get the payment recipient address for a provider
* @param provider The provider actor ID
* @return The payee address
*/
function getPayee(CommonTypes.FilActorId provider) external view returns (address);
/**
* @notice Set the sector padding tolerance in basis points (admin only)
* @param bps Tolerance in basis points (e.g., 1000 = 10%)
*/
function setToleranceBps(uint256 bps) external;
/**
* @notice Get the current sector padding tolerance
* @return Tolerance in basis points
*/
function getToleranceBps() external view returns (uint256);
}