Skip to content

Commit

Permalink
Merge branch 'dev' into gda
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdavinchee committed Sep 21, 2023
2 parents 7635eb3 + 048af58 commit 940f093
Show file tree
Hide file tree
Showing 21 changed files with 313 additions and 234 deletions.
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,25 @@
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@nomiclabs/hardhat-web3": "^2.0.0",
"@openzeppelin/test-helpers": "^0.5.16",
"@truffle/hdwallet-provider": "^2.1.14",
"@truffle/hdwallet-provider": "^2.1.15",
"@typechain/ethers-v5": "^11.1.1",
"@typechain/hardhat": "^8.0.3",
"@types/lodash": "^4.14.197",
"@types/lodash": "^4.14.198",
"@types/mocha": "^10.0.1",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.6.0",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"cloc": "^2.11.0",
"copyfiles": "^2.4.1",
"dotenv": "^16.3.1",
"eslint": "^8.48.0",
"eslint": "^8.49.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.0.0",
"hardhat": "^2.17.2",
"hardhat": "^2.17.3",
"hardhat-deploy": "^0.11.37",
"husky": "^8.0.3",
"lerna": "^7.2.0",
"lerna": "^7.3.0",
"node-jq": "^4.0.1",
"nodemon": "^3.0.1",
"npm-run-all": "^4.1.5",
Expand All @@ -68,7 +68,7 @@
"prettier-eslint": "^15.0.1",
"solhint": "3.6.2",
"syncpack": "^10.9.3",
"truffle": "^5.11.3",
"truffle": "^5.11.5",
"ts-node": "^10.9.1",
"typechain": "^8.3.1",
"typedoc": "^0.25.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/ethereum-contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Breaking
- `TokenInfo` and `ERC20WithTokenInfo` interface/abstract contract are removed from the codebase, including the bundled ABI contracts
- Migration: Use `IERC20Metadata` instead, as this replaces the previous contracts
- `build/typechain-ethers-v5` is removed from the npm package
- Migration: Consume the ABIs and utilize whatever tool you'd like to generate types from them

### Added

Expand Down
2 changes: 0 additions & 2 deletions packages/ethereum-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"!/build/truffle/*Tester*.json",
"!/build/truffle/*Anvil.json",
"!/build/truffle/*Properties.json",
"/build/typechain-ethers-v5/**/*",
"/build/contracts-sizes.txt",
"/build/bundled-abi.js",
"/build/bundled-abi.json",
Expand All @@ -43,7 +42,6 @@
"build:contracts:foundry": "yarn run-foundry build",
"build:post-contracts": "run-p -l build:post-contracts:*",
"build:post-contracts:abi-bundle": "tasks/build-bundled-abi.sh",
"build:post-contracts:typechain-ethers-v5": "tsc -p tsconfig.typechain.json",
"build:post-contracts:dev-scripts-typings": "rm -rf dev-scripts/*.d.ts dev-scripts/*.d.ts.map; tsc -p tsconfig.scripts.json",
"build:post-contracts:contracts-size": "forge build --sizes > build/contracts-sizes.txt > /dev/null&",
"verify-framework": "tasks/etherscan-verify-framework.sh",
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk-core/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ dist
build
coverage
cache
src/typechain
src/typechain-types
src/abi
**/*.generated.*
**/*.generated.*
3 changes: 2 additions & 1 deletion packages/sdk-core/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ coverage
/src/typechain
*.generated.ts
/typechain-types
/artifacts
/artifacts
src/typechain-types
1 change: 1 addition & 0 deletions packages/sdk-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
],
"scripts": {
"build": "yarn generate && rm -rf dist && run-s build:*",
"build:typechain-types": "./tasks/build-types.sh",
"build:main": "tsc -p tsconfig.json",
"build:module": "tsc -p tsconfig.module.json",
"build:umd": "mkdir -p dist && browserify src/index.ts -s sdkCore -p [ tsify --noImplicitAny --skipLibCheck ] > dist/index.umd.js",
Expand Down
12 changes: 6 additions & 6 deletions packages/sdk-core/src/ConstantFlowAgreementV1.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import {
CFAv1Forwarder,
CFAv1Forwarder__factory,
IConstantFlowAgreementV1,
IConstantFlowAgreementV1__factory,
} from "@superfluid-finance/ethereum-contracts/build/typechain-ethers-v5";
import { ethers } from "ethers";

import Host from "./Host";
Expand All @@ -29,6 +23,12 @@ import {
IWeb3FlowOperatorData,
IWeb3FlowOperatorDataParams,
} from "./interfaces";
import {
CFAv1Forwarder,
CFAv1Forwarder__factory,
IConstantFlowAgreementV1,
IConstantFlowAgreementV1__factory,
} from "./typechain-types";
import {
getSanitizedTimestamp,
isPermissionsClean,
Expand Down
5 changes: 1 addition & 4 deletions packages/sdk-core/src/ERC20Token.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import {
IERC20Metadata,
IERC20Metadata__factory,
} from "@superfluid-finance/ethereum-contracts/build/typechain-ethers-v5";
import { ethers } from "ethers";

import Operation from "./Operation";
import { SFError } from "./SFError";
import { IBaseSuperTokenParams, ITransferFromParams } from "./interfaces";
import { IERC20Metadata, IERC20Metadata__factory } from "./typechain-types";
import { normalizeAddress } from "./utils";

export default class ERC20Token {
Expand Down
12 changes: 6 additions & 6 deletions packages/sdk-core/src/Framework.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import { HardhatEthersHelpers } from "@nomiclabs/hardhat-ethers/types";
import {
Resolver,
Resolver__factory,
Superfluid__factory,
SuperfluidLoader__factory,
} from "@superfluid-finance/ethereum-contracts/build/typechain-ethers-v5";
import { ethers } from "ethers";
import Web3 from "web3";

Expand All @@ -29,6 +23,12 @@ import {
validateFrameworkConstructorOptions,
} from "./frameworkHelpers";
import { IConfig, IContracts, ISignerConstructorOptions } from "./interfaces";
import {
Resolver,
Resolver__factory,
Superfluid__factory,
SuperfluidLoader__factory,
} from "./typechain-types";
import { isEthersProvider, isInjectedWeb3 } from "./utils";

const V1 = "v1";
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk-core/src/Governance.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
SuperfluidGovernanceII,
SuperfluidGovernanceII__factory,
} from "@superfluid-finance/ethereum-contracts/build/typechain-ethers-v5";
import { ethers } from "ethers";

import {
IGetGovernanceParametersParams,
IWeb3GovernanceParams,
} from "./interfaces";
import {
SuperfluidGovernanceII,
SuperfluidGovernanceII__factory,
} from "./typechain-types";

export default class Governance {
contract: SuperfluidGovernanceII;
Expand Down
5 changes: 1 addition & 4 deletions packages/sdk-core/src/Host.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import {
Superfluid,
Superfluid__factory,
} from "@superfluid-finance/ethereum-contracts/build/typechain-ethers-v5";
import { ethers, Overrides } from "ethers";

import Operation from "./Operation";
import { Superfluid, Superfluid__factory } from "./typechain-types";

/**
* Host Helper Class
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk-core/src/InstantDistributionAgreementV1.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import {
IInstantDistributionAgreementV1,
IInstantDistributionAgreementV1__factory,
} from "@superfluid-finance/ethereum-contracts/build/typechain-ethers-v5";
import { ethers } from "ethers";

import Host from "./Host";
Expand All @@ -22,6 +18,10 @@ import {
IWeb3Index,
IWeb3Subscription,
} from "./interfaces";
import {
IInstantDistributionAgreementV1,
IInstantDistributionAgreementV1__factory,
} from "./typechain-types";
import { normalizeAddress } from "./utils";

const idaInterface = IInstantDistributionAgreementV1__factory.createInterface();
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-core/src/Operation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Superfluid__factory } from "@superfluid-finance/ethereum-contracts/build/typechain-ethers-v5";
import { ethers } from "ethers";

import {
Expand All @@ -8,6 +7,7 @@ import {
} from "./BatchCall";
import { SFError } from "./SFError";
import multiplyGasLimit from "./multiplyGasLimit";
import { Superfluid__factory } from "./typechain-types";
import { removeSigHashFromCallData } from "./utils";

export type BatchOperationType =
Expand Down
12 changes: 6 additions & 6 deletions packages/sdk-core/src/SuperToken.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import {
ISETH,
ISETH__factory,
ISuperToken,
ISuperToken__factory,
} from "@superfluid-finance/ethereum-contracts/build/typechain-ethers-v5";
import { BytesLike, ethers, Overrides } from "ethers";

import ConstantFlowAgreementV1 from "./ConstantFlowAgreementV1";
Expand Down Expand Up @@ -63,6 +57,12 @@ import {
SuperTokenGetPoolAdjustmentFlowRateParams,
SuperTokenIsPoolParams,
} from "./interfaces";
import {
ISETH,
ISETH__factory,
ISuperToken,
ISuperToken__factory,
} from "./typechain-types";
import {
getSanitizedTimestamp,
getStringCurrentTimeInSeconds,
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export * from "./pagination";
export * from "./ordering";
export * from "./events";
export * from "./types";
export * from "@superfluid-finance/ethereum-contracts/build/typechain-ethers-v5";
export * from "./typechain-types";

export { Operation, BatchOperationType as OperationType };
export { BatchCall };
Expand Down
5 changes: 3 additions & 2 deletions packages/sdk-core/src/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { ethers, Overrides } from "ethers";

import {
IConstantFlowAgreementV1,
IGeneralDistributionAgreementV1,
IInstantDistributionAgreementV1,
IResolver,
Superfluid,
SuperfluidGovernanceII,
} from "@superfluid-finance/ethereum-contracts/build/typechain-ethers-v5";
import { ethers, Overrides } from "ethers";
} from "./typechain-types";

// TODO (0xdavinchee): reorganize this
// Maybe moving these into categorical files
Expand Down
19 changes: 19 additions & 0 deletions packages/sdk-core/tasks/build-types.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

# make sure that if any step fails, the script fails
set -xe

rm -rf ./src/typechain-types

# if the typechain files do not exist, we build
# hardhat so that it does exist
if [ ! -d "../ethereum-contracts/typechain-types" ]; then
echo "typechain-types does not exist: You must build ethereum-contracts first to generate it."
exit 1
fi

# copy the typechain files over from ethereum-contracts
cp -r ../ethereum-contracts/typechain-types ./src/typechain-types

# compile the typechain files in sdk-core
tsc -p tsconfig.typechain.json
2 changes: 1 addition & 1 deletion packages/sdk-core/test/2_operation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from "chai";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { Framework } from "../src/index";
import { getPerSecondFlowRateByMonth } from "../src";
import { IConstantFlowAgreementV1__factory } from "@superfluid-finance/ethereum-contracts/build/typechain-ethers-v5";
import { IConstantFlowAgreementV1__factory } from "../src/typechain-types";
import Operation from "../src/Operation";
import hre from "hardhat";
import { SuperAppTester } from "../typechain-types";
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-core/test/TestEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SuperfluidFrameworkDeploymentSteps,
TestToken,
TestToken__factory,
} from "@superfluid-finance/ethereum-contracts/build/typechain-ethers-v5";
} from "../src/typechain-types";
import {
Framework,
NativeAssetSuperToken,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"extends": "./tsconfig",
"compilerOptions": {
"target": "ES2019",
"outDir": "build/typechain-ethers-v5",
"outDir": "src/typechain-types",
"moduleResolution": "node",
"module": "CommonJS",
"declaration": true,
"declarationMap": true,
"sourceMap": true
},
"files": [],
"include": ["typechain-types"],
"include": ["src/typechain-types"],
"exclude": ["node_modules/**"]
}
}
Loading

0 comments on commit 940f093

Please sign in to comment.