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

Use auto-published set-protocol-v2@hardhat #20

Merged
merged 7 commits into from
Mar 25, 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: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
"tsconfig.json"
],
"scripts": {
"build": "yarn clean && yarn build:setprotocol && yarn compile && yarn build:typechain",
"build": "yarn clean && yarn compile && yarn build:typechain",
"build:npm": "yarn clean && yarn compile:npm && yarn build:typechain",
"build:typechain": "yarn typechain && yarn transpile-dist",
"build:setprotocol": "yarn copy:config && tsc -p tsconfig.setprotocol.json",
"copy:config": "cp hardhat.config.ts node_modules/@setprotocol/set-protocol-v2",
"chain": "npx hardhat node",
"clean": "rm -rf coverage.json .coverage_cache .coverage_contracts cache coverage typechain artifacts dist",
"compile": "npx hardhat compile",
Expand Down Expand Up @@ -92,7 +90,7 @@
"web3": "^1.2.9"
},
"dependencies": {
"@setprotocol/set-protocol-v2": "^0.1.11-hardhat.0",
"@setprotocol/set-protocol-v2": "^0.4.0-hhat.1",
"@uniswap/v3-sdk": "^3.5.1",
"ethers": "5.5.2",
"fs-extra": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion tasks/subtasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
} from "hardhat/builtin-tasks/task-names";

import { subtask } from "hardhat/config";
import { addGasToAbiMethods } from "@setprotocol/set-protocol-v2/utils/tasks";
import { addGasToAbiMethods } from "@setprotocol/set-protocol-v2/dist/utils/tasks";

// Injects network block limit (minus 1 million) in the abi so
// ethers uses it instead of running gas estimation.
Expand Down
4 changes: 2 additions & 2 deletions test/extensions/FeeSplitExtension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import {
getRandomAccount
} from "@utils/index";
import { getStreamingFee, getStreamingFeeInflationAmount } from "@utils/common";
import { SystemFixture } from "@setprotocol/set-protocol-v2/utils/fixtures";
import { getSystemFixture } from "@setprotocol/set-protocol-v2/utils/test";
import { SystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/fixtures";
import { getSystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/test";
import { BigNumber, ContractTransaction } from "ethers";

const expect = getWaffleExpect();
Expand Down
4 changes: 2 additions & 2 deletions test/extensions/issuanceExtension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import {
getWaffleExpect,
preciseMul
} from "@utils/index";
import { SystemFixture } from "@setprotocol/set-protocol-v2/utils/fixtures";
import { getSystemFixture, getRandomAccount } from "@setprotocol/set-protocol-v2/utils/test";
import { SystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/fixtures";
import { getSystemFixture, getRandomAccount } from "@setprotocol/set-protocol-v2/dist/utils/test";

const expect = getWaffleExpect();

Expand Down
36 changes: 26 additions & 10 deletions test/extensions/perpV2LeverageStrategyExtension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import {

import { ADDRESS_ZERO, ZERO, ONE_DAY_IN_SECONDS, TWO } from "../../utils/constants";
import {
PerpV2LeverageModule,
PositionV2,
PerpV2LibraryV2,
PerpV2Positions,
PerpV2LeverageModuleV2,
SetToken,
PerpV2,
SlippageIssuanceModule,
ContractCallerMock
} from "@setprotocol/set-protocol-v2/utils/contracts";
Expand All @@ -38,8 +40,8 @@ import {
} from "../../utils/index";
import { PerpV2PriceFeedMock } from "@utils/contracts";

import { PerpV2Fixture, SystemFixture } from "@setprotocol/set-protocol-v2/utils/fixtures";
import { getPerpV2Fixture, getSystemFixture } from "@setprotocol/set-protocol-v2/utils/test";
import { PerpV2Fixture, SystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/fixtures";
import { getPerpV2Fixture, getSystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/test";

import { BaseManager, PerpV2LeverageStrategyExtension } from "@utils/contracts/index";

Expand Down Expand Up @@ -67,10 +69,13 @@ describe("PerpV2LeverageStrategyExtension", () => {
let basePriceDecimalAdjustment: BigNumber;

let leverageStrategyExtension: PerpV2LeverageStrategyExtension;
let perpV2LeverageModule: PerpV2LeverageModule;
let perpLib: PerpV2;
let positionLib: PositionV2;
let perpLib: PerpV2LibraryV2;
let perpPositionsLib: PerpV2Positions;
let perpV2LeverageModule: PerpV2LeverageModuleV2;
let issuanceModule: SlippageIssuanceModule;
let baseManager: BaseManager;
let maxPerpPositionsPerSet: BigNumber;

let perpV2PriceFeedMock: PerpV2PriceFeedMock;

Expand Down Expand Up @@ -116,14 +121,25 @@ describe("PerpV2LeverageStrategyExtension", () => {
systemSetup.controller.address
);

perpLib = await deployer.setDeployer.libraries.deployPerpV2();
perpV2LeverageModule = await deployer.setDeployer.modules.deployPerpV2LeverageModule(
maxPerpPositionsPerSet = TWO;

// Deploy libraries
positionLib = await deployer.setDeployer.libraries.deployPositionV2();
perpLib = await deployer.setDeployer.libraries.deployPerpV2LibraryV2();
perpPositionsLib = await deployer.setDeployer.libraries.deployPerpV2Positions();

perpV2LeverageModule = await deployer.setDeployer.modules.deployPerpV2LeverageModuleV2(
systemSetup.controller.address,
perpV2Setup.vault.address,
perpV2Setup.quoter.address,
perpV2Setup.marketRegistry.address,
"contracts/protocol/integration/lib/PerpV2.sol:PerpV2",
perpLib.address
maxPerpPositionsPerSet,
"contracts/protocol/lib/PositionV2.sol:PositionV2",
positionLib.address,
"contracts/protocol/integration/lib/PerpV2LibraryV2.sol:PerpV2LibraryV2",
perpLib.address,
"contracts/protocol/integration/lib/PerpV2Positions.sol:PerpV2Positions",
perpPositionsLib.address,
);

await systemSetup.controller.addModule(issuanceModule.address);
Expand Down
6 changes: 3 additions & 3 deletions test/extensions/streamingFeeSplitExtension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import {
getTransactionTimestamp
} from "@utils/index";
import { getStreamingFee, getStreamingFeeInflationAmount } from "@utils/common";
import { SystemFixture } from "@setprotocol/set-protocol-v2/utils/fixtures";
import { getSystemFixture, getRandomAccount } from "@setprotocol/set-protocol-v2/utils/test";
import { ZERO } from "@setprotocol/set-protocol-v2/utils/constants";
import { SystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/fixtures";
import { getSystemFixture, getRandomAccount } from "@setprotocol/set-protocol-v2/dist/utils/test";
import { ZERO } from "@setprotocol/set-protocol-v2/dist/utils/constants";

const expect = getWaffleExpect();

Expand Down
4 changes: 2 additions & 2 deletions test/extensions/tradeExtension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import {
getAccounts,
getWaffleExpect
} from "@utils/index";
import { SystemFixture } from "@setprotocol/set-protocol-v2/utils/fixtures";
import { getSystemFixture, getRandomAccount } from "@setprotocol/set-protocol-v2/utils/test";
import { SystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/fixtures";
import { getSystemFixture, getRandomAccount } from "@setprotocol/set-protocol-v2/dist/utils/test";
import { ContractTransaction } from "ethers";

const expect = getWaffleExpect();
Expand Down
6 changes: 3 additions & 3 deletions test/factories/delegatedManagerFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import {
} from "@utils/index";

import { ProtocolUtils } from "@utils/common";
import { SystemFixture } from "@setprotocol/set-protocol-v2/utils/fixtures";
import { MODULE_STATE } from "@setprotocol/set-protocol-v2/utils/constants";
import { SystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/fixtures";
import { MODULE_STATE } from "@setprotocol/set-protocol-v2/dist/utils/constants";

import {
getSystemFixture,
getProtocolUtils
} from "@setprotocol/set-protocol-v2/utils/test";
} from "@setprotocol/set-protocol-v2/dist/utils/test";
import { SetToken } from "@setprotocol/set-protocol-v2/utils/contracts";

const expect = getWaffleExpect();
Expand Down
4 changes: 2 additions & 2 deletions test/hooks/supplyCapIssuanceHook.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
getWaffleExpect,
getRandomAccount,
} from "@utils/index";
import { SystemFixture } from "@setprotocol/set-protocol-v2/utils/fixtures";
import { getSystemFixture } from "@setprotocol/set-protocol-v2/utils/test";
import { SystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/fixtures";
import { getSystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/test";
import { BigNumber, ContractTransaction } from "ethers";

const expect = getWaffleExpect();
Expand Down
4 changes: 2 additions & 2 deletions test/lib/baseExtension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import {
SetToken
} from "@setprotocol/set-protocol-v2/utils/contracts";

import { getSystemFixture } from "@setprotocol/set-protocol-v2/utils/test";
import { getSystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/test";

import {
SystemFixture
} from "@setprotocol/set-protocol-v2/utils/fixtures";
} from "@setprotocol/set-protocol-v2/dist/utils/fixtures";

import { ContractTransaction } from "ethers";

Expand Down
4 changes: 2 additions & 2 deletions test/lib/baseGlobalExtension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import {
SetToken
} from "@setprotocol/set-protocol-v2/utils/contracts";

import { getSystemFixture } from "@setprotocol/set-protocol-v2/utils/test";
import { getSystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/test";

import {
SystemFixture
} from "@setprotocol/set-protocol-v2/utils/fixtures";
} from "@setprotocol/set-protocol-v2/dist/utils/fixtures";

import { ContractTransaction } from "ethers";

Expand Down
4 changes: 2 additions & 2 deletions test/manager/baseManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
getRandomAccount,
getRandomAddress
} from "@utils/index";
import { SystemFixture } from "@setprotocol/set-protocol-v2/utils/fixtures";
import { getSystemFixture } from "@setprotocol/set-protocol-v2/utils/test";
import { SystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/fixtures";
import { getSystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/test";

const expect = getWaffleExpect();

Expand Down
4 changes: 2 additions & 2 deletions test/manager/delegatedManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
getWaffleExpect,
getRandomAddress
} from "@utils/index";
import { SystemFixture } from "@setprotocol/set-protocol-v2/utils/fixtures";
import { getSystemFixture, getRandomAccount } from "@setprotocol/set-protocol-v2/utils/test";
import { SystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/fixtures";
import { getSystemFixture, getRandomAccount } from "@setprotocol/set-protocol-v2/dist/utils/test";
import { ContractTransaction } from "ethers";
import { getLastBlockTransaction } from "@utils/test/testingUtils";

Expand Down
4 changes: 2 additions & 2 deletions test/managerCore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
getAccounts,
getWaffleExpect,
} from "@utils/index";
import { getSystemFixture, getRandomAccount } from "@setprotocol/set-protocol-v2/utils/test";
import { SystemFixture } from "@setprotocol/set-protocol-v2/utils/fixtures";
import { getSystemFixture, getRandomAccount } from "@setprotocol/set-protocol-v2/dist/utils/test";
import { SystemFixture } from "@setprotocol/set-protocol-v2/dist/utils/fixtures";


const expect = getWaffleExpect();
Expand Down
24 changes: 0 additions & 24 deletions tsconfig.setprotocol.json

This file was deleted.

4 changes: 2 additions & 2 deletions utils/deploys/deployMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { BaseExtensionMock__factory } from "../../typechain/factories/BaseExtens
import { BaseGlobalExtensionMock__factory } from "../../typechain/factories/BaseGlobalExtensionMock__factory";
import { ManagerMock__factory } from "../../typechain/factories/ManagerMock__factory";
import { ModuleMock__factory } from "../../typechain/factories/ModuleMock__factory";
import { ChainlinkAggregatorMock__factory } from "@setprotocol/set-protocol-v2/typechain";
import { ContractCallerMock__factory } from "@setprotocol/set-protocol-v2/typechain";
import { ChainlinkAggregatorMock__factory } from "@setprotocol/set-protocol-v2/dist/typechain";
import { ContractCallerMock__factory } from "@setprotocol/set-protocol-v2/dist/typechain";
import { MutualUpgradeMock__factory } from "../../typechain/factories/MutualUpgradeMock__factory";
import { MutualUpgradeV2Mock__factory } from "../../typechain/factories/MutualUpgradeV2Mock__factory";
import { PerpV2PriceFeedMock__factory } from "../../typechain/factories/PerpV2PriceFeedMock__factory";
Expand Down
6 changes: 3 additions & 3 deletions utils/deploys/deploySetV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import {
} from "../types";

import { SetToken } from "@setprotocol/set-protocol-v2/typechain/SetToken";
import { SetToken__factory } from "@setprotocol/set-protocol-v2/typechain/factories/SetToken__factory";
import { SetToken__factory } from "@setprotocol/set-protocol-v2/dist/typechain/factories/SetToken__factory";
import { DebtIssuanceModule } from "@setprotocol/set-protocol-v2/typechain/DebtIssuanceModule";
import { DebtIssuanceModule__factory } from "@setprotocol/set-protocol-v2/typechain/factories/DebtIssuanceModule__factory";
import { DebtIssuanceModule__factory } from "@setprotocol/set-protocol-v2/dist/typechain/factories/DebtIssuanceModule__factory";
import { DebtIssuanceModuleV2 } from "@setprotocol/set-protocol-v2/typechain/DebtIssuanceModuleV2";
import { DebtIssuanceModuleV2__factory } from "@setprotocol/set-protocol-v2/typechain/factories/DebtIssuanceModuleV2__factory";
import { DebtIssuanceModuleV2__factory } from "@setprotocol/set-protocol-v2/dist/typechain/factories/DebtIssuanceModuleV2__factory";

export default class DeploySetV2 {
private _deployerSigner: Signer;
Expand Down
2 changes: 1 addition & 1 deletion utils/deploys/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Signer } from "ethers";

import SetDeployHelper from "@setprotocol/set-protocol-v2/utils/deploys";
import SetDeployHelper from "@setprotocol/set-protocol-v2/dist/utils/deploys";

import DeployManager from "./deployManager";
import DeployMocks from "./deployMocks";
Expand Down
2 changes: 1 addition & 1 deletion utils/flexibleLeverageUtils/flexibleLeverage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BigNumber } from "@ethersproject/bignumber";
import { PerpV2BaseToken, SetToken } from "@setprotocol/set-protocol-v2/typechain";
import { PerpV2Fixture } from "@setprotocol/set-protocol-v2/utils/fixtures";
import { PerpV2Fixture } from "@setprotocol/set-protocol-v2/dist/utils/fixtures";
import { ether, preciseMul, preciseDiv } from "../common";

export function calculateNewLeverageRatio(
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1503,10 +1503,10 @@
"@sentry/types" "5.29.2"
tslib "^1.9.3"

"@setprotocol/set-protocol-v2@^0.1.11-hardhat.0":
version "0.1.11-hardhat.0"
resolved "https://registry.yarnpkg.com/@setprotocol/set-protocol-v2/-/set-protocol-v2-0.1.11-hardhat.0.tgz#3f940f3c7674e2f0bb350e29a839aa07a834c4d9"
integrity sha512-5IMXhoy2PYvNYMSUmjTAnGLlx6R+Wg4b7LXeSjrw0r4Hb7FFVi0jjNiqcU7QDs0Auc6rnXJUZwtM+6BYqmnnhw==
"@setprotocol/set-protocol-v2@^0.4.0-hhat.1":
version "0.4.0-hhat.1"
resolved "https://registry.yarnpkg.com/@setprotocol/set-protocol-v2/-/set-protocol-v2-0.4.0-hhat.1.tgz#0d8a49551cc69e8addd4af2ee167729e9b2a0319"
integrity sha512-5hmTZO//ch+XbW/MYZf+be0VnZbORbbwwLajAuQYHYKEYbbERAsjGpGg4JAA2m79g/aA0amp84QtH46el7mpOQ==
dependencies:
"@uniswap/v3-sdk" "^3.5.1"
ethers "^5.5.2"
Expand Down