Skip to content

Commit

Permalink
Remove shouldLockSetToken argument entirely from propose method
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoopmann committed Dec 20, 2023
1 parent 77b876c commit ba40dae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
12 changes: 4 additions & 8 deletions contracts/adapters/OptimisticAuctionRebalanceExtensionV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {OptimisticOracleV3Interface} from "../interfaces/OptimisticOracleV3Inter
*
* @dev The contract extends `BaseAuctionRebalanceExtension` by adding an optimistic oracle mechanism for validating rules on the proposing and executing of rebalances.
* It allows setting product-specific parameters for optimistic rebalancing and includes callback functions for resolved or disputed assertions.
* @dev Version 1 is characterised by: Optional Asset Whitelist, Disabled Set Token locking, control over rebalance timing via "isOpen" flag
* @dev Version 1 is characterised by: Optional Asset Whitelist, No Set Token locking, control over rebalance timing via "isOpen" flag
*/
contract OptimisticAuctionRebalanceExtensionV1 is AuctionRebalanceExtension, AssetAllowList {
using AddressArrayUtils for address[];
Expand All @@ -59,7 +59,6 @@ contract OptimisticAuctionRebalanceExtensionV1 is AuctionRebalanceExtension, As
address[] newComponents,
AuctionExecutionParams[] newComponentsAuctionParams,
AuctionExecutionParams[] oldComponentsAuctionParams,
bool shouldLockSetToken,
uint256 rebalanceDuration,
uint256 positionMultiplier
);
Expand Down Expand Up @@ -201,7 +200,6 @@ contract OptimisticAuctionRebalanceExtensionV1 is AuctionRebalanceExtension, As
* @param _newComponentsAuctionParams AuctionExecutionParams for new components, indexed corresponding to _newComponents.
* @param _oldComponentsAuctionParams AuctionExecutionParams for existing components, indexed corresponding to
* the current component positions. Set to 0 for components being removed.
* @param _shouldLockSetToken Indicates if the rebalance should lock the SetToken. Must be false in this version.
* @param _rebalanceDuration Duration of the rebalance in seconds.
* @param _positionMultiplier Position multiplier at the time target units were calculated.
*/
Expand All @@ -211,23 +209,21 @@ contract OptimisticAuctionRebalanceExtensionV1 is AuctionRebalanceExtension, As
address[] memory _newComponents,
AuctionExecutionParams[] memory _newComponentsAuctionParams,
AuctionExecutionParams[] memory _oldComponentsAuctionParams,
bool _shouldLockSetToken,
uint256 _rebalanceDuration,
uint256 _positionMultiplier
)
external
onlyAllowedAssets(_newComponents)
onlyIfOpen()
{
require(_shouldLockSetToken == false, "_shouldLockSetToken must be false");
bytes32 proposalHash = keccak256(abi.encode(
setToken,
_quoteAsset,
_oldComponents,
_newComponents,
_newComponentsAuctionParams,
_oldComponentsAuctionParams,
_shouldLockSetToken,
false, // We don't allow locking the set token in this version
_rebalanceDuration,
_positionMultiplier
));
Expand Down Expand Up @@ -257,7 +253,7 @@ contract OptimisticAuctionRebalanceExtensionV1 is AuctionRebalanceExtension, As
product: setToken
});

emit RebalanceProposed( setToken, _quoteAsset, _oldComponents, _newComponents, _newComponentsAuctionParams, _oldComponentsAuctionParams, _shouldLockSetToken, _rebalanceDuration, _positionMultiplier);
emit RebalanceProposed( setToken, _quoteAsset, _oldComponents, _newComponents, _newComponentsAuctionParams, _oldComponentsAuctionParams, _rebalanceDuration, _positionMultiplier);
emit AssertedClaim(setToken, msg.sender, productSettings.rulesHash, assertionId, claim);

}
Expand All @@ -274,7 +270,7 @@ contract OptimisticAuctionRebalanceExtensionV1 is AuctionRebalanceExtension, As
* @param _newComponentsAuctionParams AuctionExecutionParams for new components, indexed corresponding to _newComponents.
* @param _oldComponentsAuctionParams AuctionExecutionParams for existing components, indexed corresponding to
* the current component positions. Set to 0 for components being removed.
* @param _shouldLockSetToken Indicates if the rebalance should lock the SetToken.
* @param _shouldLockSetToken Indicates if the rebalance should lock the SetToken. Has to be false in this version
* @param _rebalanceDuration Duration of the rebalance in seconds.
* @param _positionMultiplier Position multiplier at the time target units were calculated.
*/
Expand Down
11 changes: 0 additions & 11 deletions test/adapters/optimisticAuctionRebalanceExtensionV1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ describe("OptimisticAuctionRebalanceExtensionV1", () => {
subjectNewComponents,
subjectNewComponentsAuctionParams,
subjectOldComponentsAuctionParams,
subjectShouldLockSetToken,
subjectRebalanceDuration,
subjectPositionMultiplier,
);
Expand All @@ -287,7 +286,6 @@ describe("OptimisticAuctionRebalanceExtensionV1", () => {
subjectNewComponents,
subjectNewComponentsAuctionParams,
subjectOldComponentsAuctionParams,
subjectShouldLockSetToken,
subjectRebalanceDuration,
subjectPositionMultiplier,
);
Expand All @@ -307,15 +305,6 @@ describe("OptimisticAuctionRebalanceExtensionV1", () => {
.proposedProduct(utils.formatBytes32String("win"));
expect(proposal.product).to.eq(setToken.address);
});

context("when trying to lock set token", () => {
beforeEach(() => {
subjectShouldLockSetToken = true;
});
it("should revert", async () => {
await expect(subject()).to.be.revertedWith("_shouldLockSetToken must be false");
});
});
});
context("when the extension is not open for rebalance", () => {
beforeEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ if (process.env.INTEGRATIONTEST) {
() => sellAllAuctionParam,
);

subjectShouldLockSetToken = true;
subjectShouldLockSetToken = false;
subjectRebalanceDuration = BigNumber.from(86400);
subjectPositionMultiplier = ether(0.999);
subjectCaller = operator;
Expand Down Expand Up @@ -272,7 +272,6 @@ if (process.env.INTEGRATIONTEST) {
subjectNewComponents,
subjectNewComponentsAuctionParams,
subjectOldComponentsAuctionParams,
subjectShouldLockSetToken,
subjectRebalanceDuration,
subjectPositionMultiplier,
);
Expand Down Expand Up @@ -321,7 +320,6 @@ if (process.env.INTEGRATIONTEST) {
subjectNewComponents,
subjectNewComponentsAuctionParams,
subjectOldComponentsAuctionParams,
subjectShouldLockSetToken,
subjectRebalanceDuration,
subjectPositionMultiplier,
);
Expand Down Expand Up @@ -458,7 +456,6 @@ if (process.env.INTEGRATIONTEST) {
subjectNewComponents,
subjectNewComponentsAuctionParams,
subjectOldComponentsAuctionParams,
subjectShouldLockSetToken,
subjectRebalanceDuration,
subjectPositionMultiplier,
);
Expand Down

0 comments on commit ba40dae

Please sign in to comment.