File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ contract TreasuryV1 is StorageV1 {
42
42
error SyncIntervalNotMet ();
43
43
error WeightsNotValid ();
44
44
error YieldIntervalNotMet ();
45
+ error YieldTooLow ();
45
46
46
47
/* //////////////////////////////////////////////////////////////
47
48
EVENTS
@@ -74,6 +75,25 @@ contract TreasuryV1 is StorageV1 {
74
75
YIELD LOCKERS LOGIC
75
76
////////////////////////////////////////////////////////////// */
76
77
78
+ /**
79
+ * @notice Claims an amount of yield from the treasury.
80
+ * @param amount The amount of yield to claim.
81
+ * @param receiver The address receiving the yield.
82
+ * @dev If amount provided is equal to type(uint256).max, it will claim the full available yield balance.
83
+ */
84
+ function claimYield (uint256 amount , address receiver ) external onlyOwner {
85
+ if (amount > availableYield) revert YieldTooLow ();
86
+
87
+ if (amount == type (uint256 ).max) {
88
+ uint256 availableYield_ = availableYield;
89
+ availableYield = 0 ;
90
+ IERC20 (EURE).safeTransfer (receiver, availableYield_);
91
+ } else {
92
+ availableYield -= amount;
93
+ IERC20 (EURE).safeTransfer (receiver, amount);
94
+ }
95
+ }
96
+
77
97
/**
78
98
* @notice Synchronizes all yield lockers by adjusting balances based on weights and idle ratio.
79
99
*/
You can’t perform that action at this time.
0 commit comments