@@ -13,7 +13,7 @@ import "../interfaces/IHarvester.sol";
13
13
14
14
struct YieldBearingParams {
15
15
// Address of the asset used to mint the yield bearing asset
16
- address depositAsset ;
16
+ address asset ;
17
17
// Target exposure to the collateral yield bearing asset used
18
18
uint64 targetExposure;
19
19
// Maximum exposure within the Transmuter to the deposit asset
@@ -92,23 +92,23 @@ abstract contract BaseHarvester is IHarvester, AccessControl {
92
92
/**
93
93
* @notice Set the yieldBearingAsset data
94
94
* @param yieldBearingAsset address of the yieldBearingAsset
95
- * @param depositAsset address of the depositAsset
95
+ * @param asset address of the asset
96
96
* @param targetExposure target exposure to the yieldBearingAsset asset used
97
- * @param minExposure minimum exposure within the Transmuter to the depositAsset
98
- * @param maxExposure maximum exposure within the Transmuter to the depositAsset
97
+ * @param minExposure minimum exposure within the Transmuter to the asset
98
+ * @param maxExposure maximum exposure within the Transmuter to the asset
99
99
* @param overrideExposures whether limit exposures should be overriden or read onchain through the Transmuter
100
100
*/
101
101
function setYieldBearingAssetData (
102
102
address yieldBearingAsset ,
103
- address depositAsset ,
103
+ address asset ,
104
104
uint64 targetExposure ,
105
105
uint64 minExposure ,
106
106
uint64 maxExposure ,
107
107
uint64 overrideExposures
108
108
) external onlyGuardian {
109
109
_setYieldBearingAssetData (
110
110
yieldBearingAsset,
111
- depositAsset ,
111
+ asset ,
112
112
targetExposure,
113
113
minExposure,
114
114
maxExposure,
@@ -117,13 +117,13 @@ abstract contract BaseHarvester is IHarvester, AccessControl {
117
117
}
118
118
119
119
/**
120
- * @notice Set the limit exposures to the depositAsset linked to the yield bearing asset
120
+ * @notice Set the limit exposures to the asset linked to the yield bearing asset
121
121
* @param yieldBearingAsset address of the yield bearing asset
122
122
*/
123
123
function updateLimitExposuresYieldAsset (address yieldBearingAsset ) public virtual {
124
124
YieldBearingParams storage yieldBearingInfo = yieldBearingData[yieldBearingAsset];
125
125
if (yieldBearingInfo.overrideExposures == 2 )
126
- _updateLimitExposuresYieldAsset (yieldBearingInfo.depositAsset , yieldBearingInfo);
126
+ _updateLimitExposuresYieldAsset (yieldBearingInfo.asset , yieldBearingInfo);
127
127
}
128
128
129
129
/**
@@ -180,39 +180,39 @@ abstract contract BaseHarvester is IHarvester, AccessControl {
180
180
(uint256 stablecoinsFromYieldBearingAsset , uint256 stablecoinsIssued ) = transmuter.getIssuedByCollateral (
181
181
yieldBearingAsset
182
182
);
183
- (uint256 stablecoinsFromDepositAsset , ) = transmuter.getIssuedByCollateral (yieldBearingInfo.depositAsset );
183
+ (uint256 stablecoinsFromAsset , ) = transmuter.getIssuedByCollateral (yieldBearingInfo.asset );
184
184
uint256 targetExposureScaled = yieldBearingInfo.targetExposure * stablecoinsIssued;
185
185
if (stablecoinsFromYieldBearingAsset * 1e9 > targetExposureScaled) {
186
186
// Need to decrease exposure to yield bearing asset
187
187
amount = stablecoinsFromYieldBearingAsset - targetExposureScaled / 1e9 ;
188
188
uint256 maxValueScaled = yieldBearingInfo.maxExposure * stablecoinsIssued;
189
189
// These checks assume that there are no transaction fees on the stablecoin->collateral conversion and so
190
190
// it's still possible that exposure goes above the max exposure in some rare cases
191
- if (stablecoinsFromDepositAsset * 1e9 > maxValueScaled) amount = 0 ;
192
- else if ((stablecoinsFromDepositAsset + amount) * 1e9 > maxValueScaled)
193
- amount = maxValueScaled / 1e9 - stablecoinsFromDepositAsset ;
191
+ if (stablecoinsFromAsset * 1e9 > maxValueScaled) amount = 0 ;
192
+ else if ((stablecoinsFromAsset + amount) * 1e9 > maxValueScaled)
193
+ amount = maxValueScaled / 1e9 - stablecoinsFromAsset ;
194
194
} else {
195
195
// In this case, exposure after the operation might remain slightly below the targetExposure as less
196
196
// collateral may be obtained by burning stablecoins for the yield asset and unwrapping it
197
197
increase = 1 ;
198
198
amount = targetExposureScaled / 1e9 - stablecoinsFromYieldBearingAsset;
199
199
uint256 minValueScaled = yieldBearingInfo.minExposure * stablecoinsIssued;
200
- if (stablecoinsFromDepositAsset * 1e9 < minValueScaled) amount = 0 ;
201
- else if (stablecoinsFromDepositAsset * 1e9 < minValueScaled + amount * 1e9 )
202
- amount = stablecoinsFromDepositAsset - minValueScaled / 1e9 ;
200
+ if (stablecoinsFromAsset * 1e9 < minValueScaled) amount = 0 ;
201
+ else if (stablecoinsFromAsset * 1e9 < minValueScaled + amount * 1e9 )
202
+ amount = stablecoinsFromAsset - minValueScaled / 1e9 ;
203
203
}
204
204
}
205
205
206
206
function _setYieldBearingAssetData (
207
207
address yieldBearingAsset ,
208
- address depositAsset ,
208
+ address asset ,
209
209
uint64 targetExposure ,
210
210
uint64 minExposure ,
211
211
uint64 maxExposure ,
212
212
uint64 overrideExposures
213
213
) internal virtual {
214
214
YieldBearingParams storage yieldBearingInfo = yieldBearingData[yieldBearingAsset];
215
- yieldBearingInfo.depositAsset = depositAsset ;
215
+ yieldBearingInfo.asset = asset ;
216
216
if (targetExposure >= 1e9 ) revert InvalidParam ();
217
217
yieldBearingInfo.targetExposure = targetExposure;
218
218
yieldBearingInfo.overrideExposures = overrideExposures;
@@ -222,22 +222,22 @@ abstract contract BaseHarvester is IHarvester, AccessControl {
222
222
yieldBearingInfo.minExposure = minExposure;
223
223
} else {
224
224
yieldBearingInfo.overrideExposures = 2 ;
225
- _updateLimitExposuresYieldAsset (depositAsset , yieldBearingInfo);
225
+ _updateLimitExposuresYieldAsset (asset , yieldBearingInfo);
226
226
}
227
227
}
228
228
229
229
function _updateLimitExposuresYieldAsset (
230
- address depositAsset ,
230
+ address asset ,
231
231
YieldBearingParams storage yieldBearingInfo
232
232
) internal virtual {
233
233
uint64 [] memory xFeeMint;
234
- (xFeeMint, ) = transmuter.getCollateralMintFees (depositAsset );
234
+ (xFeeMint, ) = transmuter.getCollateralMintFees (asset );
235
235
uint256 length = xFeeMint.length ;
236
236
if (length <= 1 ) yieldBearingInfo.maxExposure = 1e9 ;
237
237
else yieldBearingInfo.maxExposure = xFeeMint[length - 2 ];
238
238
239
239
uint64 [] memory xFeeBurn;
240
- (xFeeBurn, ) = transmuter.getCollateralBurnFees (depositAsset );
240
+ (xFeeBurn, ) = transmuter.getCollateralBurnFees (asset );
241
241
length = xFeeBurn.length ;
242
242
if (length <= 1 ) yieldBearingInfo.minExposure = 0 ;
243
243
else yieldBearingInfo.minExposure = xFeeBurn[length - 2 ];
0 commit comments