generated from foundry-rs/forge-template
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathIPufferModule.sol
137 lines (119 loc) · 4.49 KB
/
IPufferModule.sol
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
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;
import { ISignatureUtils } from "eigenlayer/interfaces/ISignatureUtils.sol";
import { BeaconChainProofs } from "eigenlayer/libraries/BeaconChainProofs.sol";
import { IDelegationManager } from "eigenlayer/interfaces/IDelegationManager.sol";
import { IERC20 } from "openzeppelin/token/ERC20/IERC20.sol";
/**
* @title IPufferModule
* @author Puffer Finance
* @custom:security-contact security@puffer.fi
*/
interface IPufferModule {
/**
* @notice Thrown if the rewards are already claimed for a `blockNumber`
* @dev Signature "0xa9214540"
*/
error AlreadyClaimed(uint256 blockNumber, address node);
/**
* @notice Thrown if guardians try to post root for an invalid block number
* @dev Signature "0x9f4aafbe"
*/
error InvalidBlockNumber(uint256 blockNumber);
/**
* @notice Thrown if the there is nothing to be claimed for the provided information
* @dev Signature "0x64ab3466"
*/
error NothingToClaim(address node);
/**
* @notice Emitted when the rewards MerkleRoot `root` for a `blockNumber` is posted
*/
event RewardsRootPosted(uint256 indexed blockNumber, bytes32 root);
/**
* @notice Emits when rewards are claimed
* @param node is the node address
* @param amount is the amount claimed in wei
*/
event RewardsClaimed(address indexed node, uint256 amount);
/**
* @notice Returns the Withdrawal credentials for that module
*/
function getWithdrawalCredentials() external view returns (bytes memory);
/**
* @notice Returns the module name
*/
function NAME() external view returns (bytes32);
/**
* @notice Starts the validator
*/
function callStake(bytes calldata pubKey, bytes calldata signature, bytes32 depositDataRoot) external payable;
/**
* @notice Calls the delegateTo function on the EigenLayer delegation manager
* @param operator is the address of the restaking operator
* @param approverSignatureAndExpiry the signature of the delegation approver
* @param approverSalt salt for the signature
* @dev Restricted to the DAO
*/
function callDelegateTo(
address operator,
ISignatureUtils.SignatureWithExpiry calldata approverSignatureAndExpiry,
bytes32 approverSalt
) external;
/**
* @notice Calls the undelegate function on the EigenLayer delegation manager
* @dev Restricted to the DAO
*/
function callUndelegate() external returns (bytes32[] memory withdrawalRoot);
/**
* @notice Returns the EigenPod address owned by the module
*/
function getEigenPod() external view returns (address);
/**
* @notice Queues the withdrawal from EigenLayer for the Beacon Chain strategy
* @dev Restricted to PufferModuleManager
*/
function queueWithdrawals(uint256 shareAmount) external returns (bytes32[] memory);
/**
* @notice Verifies and processes the withdrawals
*/
function verifyAndProcessWithdrawals(
uint64 oracleTimestamp,
BeaconChainProofs.StateRootProof calldata stateRootProof,
BeaconChainProofs.WithdrawalProof[] calldata withdrawalProofs,
bytes[] calldata validatorFieldsProofs,
bytes32[][] calldata validatorFields,
bytes32[][] calldata withdrawalFields
) external;
/**
* @notice Verifies the withdrawal credentials
*/
function verifyWithdrawalCredentials(
uint64 oracleTimestamp,
BeaconChainProofs.StateRootProof calldata stateRootProof,
uint40[] calldata validatorIndices,
bytes[] calldata validatorFieldsProofs,
bytes32[][] calldata validatorFields
) external;
/**
* @notice Completes the queued withdrawals
*/
function completeQueuedWithdrawals(
IDelegationManager.Withdrawal[] calldata withdrawals,
IERC20[][] calldata tokens,
uint256[] calldata middlewareTimesIndexes,
bool[] calldata receiveAsTokens
) external;
/**
* @notice Withdraws the non beacon chain ETH balance
*/
function withdrawNonBeaconChainETHBalanceWei(uint256 amountToWithdraw) external;
/**
* @notice Function callable only by PufferProtocol
* @param to is the destination address
* @param amount is the ETH amount in wei
* @param data is the calldata
*/
function call(address to, uint256 amount, bytes calldata data)
external
returns (bool success, bytes memory response);
}