Skip to content
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@
"author": "felix2feng",
"license": "MIT",
"homepage": "https://github.com/SetProtocol",
"resolutions": {
"@ethersproject/abi": "5.4.1",
"@ethersproject/bignumber": "5.4.1",
"@ethersproject/contracts": "5.4.1",
"@ethersproject/providers": "5.4.5"
},
"devDependencies": {
"@0x/utils": "^6.4.3",
"@nomiclabs/hardhat-ethers": "^2.0.2",
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/aaveV2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getAaveV2Fixture
} from "@utils/test/index";
import { SystemFixture, AaveV2Fixture } from "@utils/fixtures";
import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";
import { ether } from "@utils/common";

const expect = getWaffleExpect();
Expand Down Expand Up @@ -117,4 +117,4 @@ describe("AaveV2Fixture", async () => {
expect(config.stableBorrowRateEnabled).to.eq(true);
});
});
});
});
2 changes: 1 addition & 1 deletion test/fixtures/curve.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import { CurveFixture } from "@utils/fixtures";
import { StandardTokenMock } from "../../typechain/StandardTokenMock";
import { ZERO } from "@utils/constants";
import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
import { BigNumber, BigNumberish } from "ethers";
import { LiquidityGauge } from "@typechain/LiquidityGauge";

const expect = getWaffleExpect();
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/kyberV3DMM.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from "@utils/test/index";
import { SystemFixture, KyberV3DMMFixture } from "@utils/fixtures";
import { ZERO, MAX_UINT_256 } from "@utils/constants";
import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";
import { Address } from "@utils/types";
import { DMMPool } from "../../typechain/DMMPool";

Expand Down Expand Up @@ -174,4 +174,4 @@ describe("KyberV3DMMFixture", () => {
expect(lpTokenBalance).to.be.gt(ZERO);
});
});
});
});
4 changes: 2 additions & 2 deletions test/fixtures/uniswap.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from "@utils/test/index";
import { SystemFixture, UniswapFixture } from "@utils/fixtures";
import { ZERO, MAX_UINT_256 } from "@utils/constants";
import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";

const expect = getWaffleExpect();

Expand Down Expand Up @@ -168,4 +168,4 @@ describe("UniswapFixture", () => {
expect(amountStaked).to.eq(subjectAmount);
});
});
});
});
10 changes: 4 additions & 6 deletions test/integration/aaveGovernanceModule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { keccak256 } from "ethers/lib/utils";
import { defaultAbiCoder } from "ethers/lib/utils";
import { utils, BigNumber } from "ethers";

import { Address, Bytes } from "@utils/types";
import { Account } from "@utils/test/types";
Expand Down Expand Up @@ -104,8 +102,8 @@ describe("AaveGovernanceModule", () => {

beforeEach(async () => {
await aaveSetup.aaveProtoGovernance.newProposal(
keccak256(new Buffer("ProposalOne")),
keccak256(new Buffer("RandomIPFSHash")),
utils.keccak256(new Buffer("ProposalOne")),
utils.keccak256(new Buffer("RandomIPFSHash")),
ether(13000000),
await getRandomAddress(),
1660,
Expand Down Expand Up @@ -145,7 +143,7 @@ describe("AaveGovernanceModule", () => {

describe("when voting with another supported token", () => {
beforeEach(async () => {
subjectData = defaultAbiCoder.encode(
subjectData = utils.defaultAbiCoder.encode(
["address"],
[aaveSetup.lendToken.address]
);
Expand Down
6 changes: 3 additions & 3 deletions test/integration/aaveGovernanceV2Module.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { defaultAbiCoder } from "ethers/lib/utils";
import { BigNumber } from "ethers";
import { utils } from "ethers";

import { Address, Bytes } from "@utils/types";
import { Account } from "@utils/test/types";
Expand Down Expand Up @@ -184,7 +184,7 @@ describe("AaveGovernanceV2Module", () => {
subjectCaller = owner;
subjectSetToken = setToken;
subjectGovernanceIntegrationName = aaveGovernanceV2AdapterIntegrationName;
subjectProposalData = defaultAbiCoder.encode(
subjectProposalData = utils.defaultAbiCoder.encode(
["address", "address[]", "uint256[]", "string[]", "bytes[]", "bool[]", "bytes32"],
[aaveSetup.executor.address, targets, values, signatures, calldatas, withDelegateCall, ipfsHash]
);
Expand Down
2 changes: 1 addition & 1 deletion test/integration/aaveMigrationWrapModule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";

import { Address } from "@utils/types";
import { Account } from "@utils/test/types";
Expand Down
4 changes: 2 additions & 2 deletions test/integration/aaveUniswapLeverageDebtIssuance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
getUniswapFixture
} from "@utils/test/index";
import { AaveV2Fixture, SystemFixture, UniswapFixture } from "@utils/fixtures";
import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";
import { ADDRESS_ZERO, ZERO, EMPTY_BYTES, MAX_UINT_256 } from "@utils/constants";

const expect = getWaffleExpect();
Expand Down Expand Up @@ -1725,4 +1725,4 @@ describe("AaveUniswapLeverageDebtIssuance", () => {
});
});
});
});
});
2 changes: 1 addition & 1 deletion test/integration/aaveWrapModule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";

import { Address } from "@utils/types";
import { Account } from "@utils/test/types";
Expand Down
2 changes: 1 addition & 1 deletion test/integration/agiMigrationWrapModule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";

import { Address } from "@utils/types";
import { Account } from "@utils/test/types";
Expand Down
4 changes: 2 additions & 2 deletions test/integration/ammSplitterGeneralIndexModule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";

import { Address } from "@utils/types";
import { Account } from "@utils/test/types";
Expand Down Expand Up @@ -295,4 +295,4 @@ describe("AMMSplitterGeneralIndexModule", () => {
});
});
});
});
});
5 changes: 2 additions & 3 deletions test/integration/ammSplitterTradeModule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { defaultAbiCoder } from "ethers/lib/utils";
import { BigNumber, utils } from "ethers";
import { ethers } from "hardhat";

import { Address, Bytes } from "@utils/types";
Expand Down Expand Up @@ -286,7 +285,7 @@ describe("AMMSplitterTradeModule", () => {

subjectDestinationToken = setup.dai.address;
const tradePath = [subjectSourceToken, setup.weth.address, subjectDestinationToken];
subjectData = defaultAbiCoder.encode(
subjectData = utils.defaultAbiCoder.encode(
["address[]"],
[tradePath]
);
Expand Down
23 changes: 16 additions & 7 deletions test/integration/claim/compClaimAdapter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "module-alias/register";
import { waffle } from "hardhat";
import { Contract, BigNumber } from "ethers";
import { MockContract } from "@ethereum-waffle/mock-contract";
import { Address } from "@utils/types";
import { Account } from "@utils/test/types";
import { ADDRESS_ZERO } from "@utils/constants";
Expand Down Expand Up @@ -29,6 +30,7 @@ describe("CompClaimAdapter", function() {
let compoundAdmin: Account;
let deployer: DeployHelper;
let comptroller: Contract;
let mockComptroller: MockContract;
let compClaimAdapter: CompClaimAdapter;

before(async function() {
Expand All @@ -43,15 +45,15 @@ describe("CompClaimAdapter", function() {
context("unit tests", async function() {

before(async function() {
comptroller = await deployMockContract(owner.wallet, ComptrollerArtifact.abi);
compClaimAdapter = await deployer.adapters.deployCompClaimAdapter(comptroller.address);
mockComptroller = await deployMockContract(owner.wallet, ComptrollerArtifact.abi);
compClaimAdapter = await deployer.adapters.deployCompClaimAdapter(mockComptroller.address);
});

describe("#getClaimCallData", async function() {
let claimCallData: string;

before(function() {
claimCallData = comptroller.interface.encodeFunctionData("claimComp(address)", [ADDRESS_ZERO]);
claimCallData = mockComptroller.interface.encodeFunctionData("claimComp(address)", [ADDRESS_ZERO]);
});

function subject(): Promise<[Address, BigNumber, string]> {
Expand All @@ -61,7 +63,7 @@ describe("CompClaimAdapter", function() {
it("should return claim callData", async function() {
const callData = await subject();

expect(callData[0]).to.eq(comptroller.address);
expect(callData[0]).to.eq(mockComptroller.address);
expect(callData[1]).to.eq(ether(0));
expect(callData[2]).to.eq(claimCallData);
});
Expand All @@ -71,7 +73,7 @@ describe("CompClaimAdapter", function() {
const rewards: BigNumber = ether(1);

before(async function() {
await comptroller.mock.compAccrued.returns(rewards);
await mockComptroller.mock.compAccrued.returns(rewards);
});

function subject(): Promise<BigNumber> {
Expand All @@ -85,7 +87,7 @@ describe("CompClaimAdapter", function() {

describe("#getTokenAddress", async function() {
before(async function() {
await comptroller.mock.getCompAddress.returns(ADDRESS_ZERO);
await mockComptroller.mock.getCompAddress.returns(ADDRESS_ZERO);
});

function subject(): Promise<Address> {
Expand Down Expand Up @@ -176,7 +178,14 @@ describe("CompClaimAdapter", function() {
});

it("should claim accrued amount", async function() {
await expect(subject).to.changeTokenBalance(comp, setToken, amount);
const initialCompBalance = await comp.balanceOf(setToken.address);

await subject();

const finalCompBalance = await comp.balanceOf(setToken.address);
const expectedBalance = initialCompBalance.add(amount);

expect(finalCompBalance).to.equal(expectedBalance);
});
});
});
Expand Down
7 changes: 3 additions & 4 deletions test/integration/compoundBravoGovernanceModule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { defaultAbiCoder } from "ethers/lib/utils";
import { BigNumber, utils } from "ethers";

import { Address, Bytes } from "@utils/types";
import { Account } from "@utils/test/types";
Expand Down Expand Up @@ -120,7 +119,7 @@ describe("CompoundBravoGovernanceModule", () => {

subjectSetToken = setToken.address;
subjectIntegrationName = compoundBravoGovernanceAdapterIntegrationName;
subjectProposalData = defaultAbiCoder.encode(
subjectProposalData = utils.defaultAbiCoder.encode(
["address[]", "uint256[]", "string[]", "bytes[]", "string"],
[targets, values, signatures, calldatas, description]
);
Expand Down Expand Up @@ -165,7 +164,7 @@ describe("CompoundBravoGovernanceModule", () => {
"0x00000000000000000000000000000000000000000000000002c68af0bb140000",
];
const description = "Create A Proposal";
const proposalData = defaultAbiCoder.encode(
const proposalData = utils.defaultAbiCoder.encode(
["address[]", "uint256[]", "string[]", "bytes[]", "string"],
[targets, values, signatures, calldatas, description]
);
Expand Down
7 changes: 3 additions & 4 deletions test/integration/compoundGovernanceModule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { defaultAbiCoder } from "ethers/lib/utils";
import { BigNumber, utils } from "ethers";

import { Address, Bytes } from "@utils/types";
import { Account } from "@utils/test/types";
Expand Down Expand Up @@ -119,7 +118,7 @@ describe("CompoundGovernanceModule", () => {

subjectSetToken = setToken.address;
subjectIntegrationName = compoundLikeGovernanceAdapterIntegrationName;
subjectProposalData = defaultAbiCoder.encode(
subjectProposalData = utils.defaultAbiCoder.encode(
["address[]", "uint256[]", "string[]", "bytes[]", "string"],
[targets, values, signatures, calldatas, description]
);
Expand Down Expand Up @@ -162,7 +161,7 @@ describe("CompoundGovernanceModule", () => {
"0x00000000000000000000000000000000000000000000000002c68af0bb140000",
];
const description = "Create A Proposal";
const proposalData = defaultAbiCoder.encode(
const proposalData = utils.defaultAbiCoder.encode(
["address[]", "uint256[]", "string[]", "bytes[]", "string"],
[targets, values, signatures, calldatas, description]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
getUniswapFixture,
} from "@utils/test/index";
import { CompoundFixture, SystemFixture, UniswapFixture } from "@utils/fixtures";
import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";
import { ADDRESS_ZERO, ZERO, EMPTY_BYTES, MAX_UINT_256 } from "@utils/constants";

const expect = getWaffleExpect();
Expand Down
2 changes: 1 addition & 1 deletion test/integration/compoundWrapModule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";

import { Address } from "@utils/types";
import { Account } from "@utils/test/types";
Expand Down
2 changes: 1 addition & 1 deletion test/integration/curveStakingModule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";

import { Address } from "@utils/types";
import { Account } from "@utils/test/types";
Expand Down
2 changes: 1 addition & 1 deletion test/integration/oracles/cTokenOracle.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";

import { Address } from "@utils/types";
import { Account } from "@utils/test/types";
Expand Down
2 changes: 1 addition & 1 deletion test/integration/oracles/yearnVaultOracle.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";

import { Address } from "@utils/types";
import { Account } from "@utils/test/types";
Expand Down
2 changes: 1 addition & 1 deletion test/integration/sushiswapExchangeTradeModule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "module-alias/register";

import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";
import { ethers } from "hardhat";

import { Address, Bytes } from "@utils/types";
Expand Down
7 changes: 3 additions & 4 deletions test/integration/uniswapGovernanceModule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { defaultAbiCoder } from "ethers/lib/utils";
import { BigNumber, utils } from "ethers";

import { Address, Bytes } from "@utils/types";
import { Account } from "@utils/test/types";
Expand Down Expand Up @@ -119,7 +118,7 @@ describe("UniswapGovernanceModule", () => {

subjectSetToken = setToken.address;
subjectIntegrationName = compoundLikeGovernanceAdapterIntegrationName;
subjectProposalData = defaultAbiCoder.encode(
subjectProposalData = utils.defaultAbiCoder.encode(
["address[]", "uint256[]", "string[]", "bytes[]", "string"],
[targets, values, signatures, calldatas, description]
);
Expand Down Expand Up @@ -162,7 +161,7 @@ describe("UniswapGovernanceModule", () => {
"0x00000000000000000000000000000000000000000000000002c68af0bb140000",
];
const description = "Create A Proposal";
const proposalData = defaultAbiCoder.encode(
const proposalData = utils.defaultAbiCoder.encode(
["address[]", "uint256[]", "string[]", "bytes[]", "string"],
[targets, values, signatures, calldatas, description]
);
Expand Down
4 changes: 2 additions & 2 deletions test/integration/uniswapV2ExchangeGeneralIndexModule.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "module-alias/register";
import { BigNumber } from "@ethersproject/bignumber";
import { BigNumber } from "ethers";

import { Address } from "@utils/types";
import { Account } from "@utils/test/types";
Expand Down Expand Up @@ -377,4 +377,4 @@ describe("UniswapV2ExchangeGeneralIndexModule", () => {
});
});
});
});
});
Loading