You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Change access control for rebalance method to allow non-operator accounts to call it. (#123)
* Use onlyAllowedCaller instead of onlyOperator to control access to rebalance method
* Undo accidental change in BaseExtension
* Remove onlyEOA from docstring comment
* Extended `minPositions` configuration to potentially allow opening up access to `rebalance` method (#125)
* Extend minPosition configuration to allow opening up rebalance method
* Refactoring to make precommit linter happy
* Refactoring of FixedRebalanceExtension.sol
* Return current positions from rebalance method
* Add tests for returned position values
* Increase tolerance in integration tests
* Fix wrong indentation
Co-authored-by: Richard Guan <[email protected]>
* Remove extra space from test name
Co-authored-by: Richard Guan <[email protected]>
Co-authored-by: Christian Koopmann <[email protected]>
Co-authored-by: Richard Guan <[email protected]>
require(_rebalanceMinPositions[i] >= weightedMinPosition, "Caller provided min position must not be less than operator specified value weighted by share");
// @dev Calculates the minimumPosition for a given maturity by taking the weighted average between the _minPosition configured by the operator and the position before the rebalance call.
243
+
function _getWeightedMinPosition(uint256_minPosition, uint256_positionBefore, uint256_share) internalpurereturns(uint256) {
244
+
if(_minPosition > _positionBefore) {
245
+
// If the position was below the min position before you have to increase it by at least _share % of the difference
// @dev Get positions that are currently above their targeted weight
215
255
function _getOverweightPositions()
216
256
internal
@@ -380,21 +420,21 @@ contract FixedRebalanceExtension is BaseExtension {
380
420
381
421
382
422
// @dev Sets configured allocations for the setToken
383
-
function _setAllocations(uint256[] memory_maturities, uint256[] memory_allocations) internal {
384
-
require(_maturities.length== _allocations.length, "Maturities and allocations must be same length");
423
+
function _setAllocations(uint256[] memory_maturities, uint256[] memory_allocations, uint256[] memory_minPositions) internal {
424
+
require((_maturities.length== _allocations.length) && (_maturities.length== _minPositions.length), "Maturities, minPositions and allocations must be same length");
0 commit comments