Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

working all curves tests #105

Merged
merged 7 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions contracts/DiamondInit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {IDiamondCut} from "./interfaces/IDiamondCut.sol";
import {IDiamondLoupe} from "./interfaces/IDiamondLoupe.sol";
import {LibDiamond} from "./libs/LibDiamond.sol";
import "./libs/Details.sol";
import "hardhat/console.sol";

contract DiamondInit {
struct Args {
Expand All @@ -32,11 +31,6 @@ contract DiamondInit {
s.foundry = _args.foundry;
s.vaultRegistry = _args.vaultRegistry;
s.curveRegistry = _args.curveRegistry;
console.log(
"## DiamondInit s.curveRegistry:%s vaultRegistry:%s",
address(s.curveRegistry),
address(s.vaultRegistry)
);
s.migrationRegistry = _args.migrationRegistry;
// s.mintFee = _args.mintFee;
// s.burnBuyerFee = _args.burnBuyerFee;
Expand Down
4 changes: 1 addition & 3 deletions contracts/curves/BancorPower.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ contract BancorPower is Power, ICurve {
bytes16 private immutable _maxWeight = uint256(MAX_WEIGHT).fromUInt(); // gas savings
bytes16 private immutable _one = (uint256(1)).fromUInt();
address public hub;
address public foundry;

// NOTE: keys are the respective hubId
mapping(uint256 => Bancor) private _bancors;

constructor(address _hub, address _foundry) {
constructor(address _hub) {
hub = _hub;
foundry = _foundry;
}

function register(uint256 _hubId, bytes calldata _encodedDetails)
Expand Down
5 changes: 1 addition & 4 deletions contracts/curves/StepwiseCurve.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@ contract StepwiseCurve is ICurve {

uint256 public constant PRECISION = 10**18;
address public hub;
address public foundry;

// NOTE: keys are their respective hubId
mapping(uint256 => Stepwise) private _stepwises;

constructor(address _hub, address _foundry) {
constructor(address _hub) {
hub = _hub;
foundry = _foundry;
}

function register(uint256 _hubId, bytes calldata _encodedDetails)
Expand Down
3 changes: 1 addition & 2 deletions contracts/curves/StepwiseCurveABDK.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ contract StepwiseCurve is ICurve {
// NOTE: keys are their respective hubId
mapping(uint256 => Stepwise) private _stepwises;

constructor(address _hub, address _foundry) {
constructor(address _hub) {
hub = _hub;
foundry = _foundry;
}

function register(uint256 _hubId, bytes calldata _encodedDetails)
Expand Down
8 changes: 2 additions & 6 deletions contracts/facets/HubFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import "../interfaces/IVault.sol";
import "../interfaces/IRegistry.sol";
import "../interfaces/ICurve.sol";
import "../interfaces/IFoundry.sol";
import "hardhat/console.sol";

contract HubFacet {
event Register(
Expand Down Expand Up @@ -52,11 +51,6 @@ contract HubFacet {
bytes memory _encodedVaultArgs
) external {
// TODO: access control
console.log(
"## s.curveRegistry:%s vaultRegistry:%s",
address(s.curveRegistry),
address(s.vaultRegistry)
);
require(
s.curveRegistry.isApproved(address(_curve)),
"_curve !approved"
Expand Down Expand Up @@ -114,6 +108,7 @@ contract HubFacet {
this.finishUpdate(_id);
}
require(!hub_.updating, "already updating");

require(block.timestamp >= hub_.endCooldown, "Still cooling down");
// Make sure at least one of the values is different
require(
Expand All @@ -132,6 +127,7 @@ contract HubFacet {
);
hub_.targetRefundRatio = _targetRefundRatio;
}

bool reconfigure;
if (_encodedCurveDetails.length > 0) {
if (_targetCurve == address(0)) {
Expand Down
10 changes: 3 additions & 7 deletions test/contracts/curves/BancorBancorCurve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,14 @@ const setup = async () => {
bancorPower = await deploy<BancorPower>(
"BancorPower",
undefined,
hub.address,
foundry.address
hub.address
);

({ token } = await hubSetup(
encodedCurveDetails,
encodedVaultArgs,
5000,
hub,
foundry,
bancorPower
"BancorPower"
));
dai = token;
});
Expand Down Expand Up @@ -383,8 +380,7 @@ const setup = async () => {
newbancorPower = await deploy<BancorPower>(
"BancorPower",
undefined,
hub.address,
foundry.address
hub.address
);

({ token } = await hubSetup(
Expand Down
Loading