Skip to content

Commit

Permalink
test(refundratio): add the last ones
Browse files Browse the repository at this point in the history
  • Loading branch information
zgorizzo69 committed Nov 19, 2021
1 parent f8a5744 commit 07516ee
Show file tree
Hide file tree
Showing 4 changed files with 564 additions and 122 deletions.
13 changes: 12 additions & 1 deletion contracts/Hub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ contract Hub is Ownable, Initializable {
bytes memory _encodedCurveDetails
) external {
Details.Hub storage hub_ = _hubs[_id];
if (hub_.updating && block.timestamp > hub_.endTime) {
Details.Hub memory hubUpdated = finishUpdate(_id);
hub_.refundRatio = hubUpdated.refundRatio;
hub_.targetRefundRatio = hubUpdated.targetRefundRatio;
hub_.curve = hubUpdated.curve;
hub_.targetCurve = hubUpdated.targetCurve;
hub_.reconfigure = hubUpdated.reconfigure;
hub_.updating = hubUpdated.updating;
hub_.startTime = hubUpdated.startTime;
hub_.endTime = hubUpdated.endTime;
}
require(!hub_.updating, "already updating");
require(block.timestamp >= hub_.endCooldown, "Still cooling down");
if (_targetRefundRatio != 0) {
Expand Down Expand Up @@ -113,7 +124,7 @@ contract Hub is Ownable, Initializable {
hub_.endCooldown = block.timestamp + _warmup + _duration + _cooldown;
}

function finishUpdate(uint256 id) external returns (Details.Hub memory) {
function finishUpdate(uint256 id) public returns (Details.Hub memory) {
Details.Hub storage hub_ = _hubs[id];
require(block.timestamp > hub_.endTime, "Still updating");

Expand Down
2 changes: 1 addition & 1 deletion test/contracts/migrations/UniswapSingleTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { CurveRegistry } from "../../../artifacts/types/CurveRegistry";
import { MigrationRegistry } from "../../../artifacts/types/MigrationRegistry";
import { SingleAssetVault } from "../../../artifacts/types/SingleAssetVault";
import { MeToken } from "../../../artifacts/types/MeToken";
import { impersonate, mineBlock, passOneHour } from "../../utils/hardhatNode";
import { impersonate, mineBlock, passHours } from "../../utils/hardhatNode";
import { UniswapSingleTransfer } from "../../../artifacts/types/UniswapSingleTransfer";
import { hubSetup } from "../../utils/hubSetup";
import { expect } from "chai";
Expand Down
Loading

0 comments on commit 07516ee

Please sign in to comment.