-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIFeeDistributor.sol
More file actions
69 lines (54 loc) · 2.82 KB
/
IFeeDistributor.sol
File metadata and controls
69 lines (54 loc) · 2.82 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
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.8.13 <0.9.0;
/// @title IFeeDistributor
/// @notice Interface for the Fee Distributor contract.
interface IFeeDistributor {
// =========================================================================
// Types
// =========================================================================
/// @notice Return struct for recipient information.
struct RecipientInfo {
address recipient;
uint16 bps;
}
// =========================================================================
// Events
// =========================================================================
/// @notice Emitted when a recipient is added or updated.
/// @param recipient The recipient address.
/// @param bps The new share of fees in basis points.
event RecipientSet(address indexed recipient, uint16 bps);
/// @notice Emitted when a recipient is removed.
/// @param recipient The recipient address.
event RecipientRemoved(address indexed recipient);
// =========================================================================
// Errors
// =========================================================================
/// @notice Error when the caller is not authorized.
error Unauthorized();
/// @notice Error when zero basis points is provided.
error ZeroBps();
/// @notice Error when total basis points exceeds 10,000.
error TotalBpsExceeded(uint16 totalBps);
/// @notice Error when the recipient does not exist.
error RecipientNotFound(address recipient);
// =========================================================================
// Functions
// =========================================================================
/// @notice Sets or updates a recipient's share in basis points.
/// @param recipient The address to receive fees.
/// @param bps The share of fees in basis points.
function setRecipient(address recipient, uint16 bps) external;
/// @notice Removes a recipient from fee distribution.
/// @param recipient The address to remove.
function removeRecipient(address recipient) external;
/// @notice Distributes the contract's native balance to recipients.
/// @dev Called during block finalization outside of the normal transaction
/// lifecycle. Implementations must not revert. Each recipient receives a
/// portion of the balance according to their configured basis points. Any
/// remainder is sent to the current block proposer's fee recipient address.
function distribute() external;
/// @notice Returns all current recipients and their basis points.
/// @return recipients The array of recipient addresses and their shares.
function getRecipients() external view returns (RecipientInfo[] memory recipients);
}