Skip to content

Commit

Permalink
feat: remove across contracts (UMAprotocol#3775)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrice32 authored Feb 7, 2022
1 parent 4b2ff2f commit 84c053b
Show file tree
Hide file tree
Showing 62 changed files with 145 additions and 7,760 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
docker:
- image: circleci/node:lts
working_directory: ~/protocol
resource_class: large
steps:
- restore_cache:
key: protocol-{{ .Environment.CIRCLE_SHA1 }}
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"/dist/**/*"
],
"dependencies": {
"@across-protocol/contracts": "^0.1.2",
"@across-protocol/contracts": "^0.1.4",
"@eth-optimism/hardhat-ovm": "^0.2.2",
"@ethersproject/bignumber": "^5.0.5",
"@google-cloud/kms": "^2.3.1",
Expand Down
8 changes: 7 additions & 1 deletion packages/common/src/hardhat/plugins/ExtendedWeb3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ extendEnvironment((_hre) => {
const hre = _hre as HRE;
hre._artifactCache = {};
hre.getContract = (name, artifactOverrides = {}) => {
if (!hre._artifactCache[name]) hre._artifactCache[name] = hre.artifacts.readArtifactSync(name);
if (!hre._artifactCache[name]) {
// Allows for the caller to bypass the hardhat lookup.
// This is a bit of a hack and will not work for library linking unless linkReferences is provided.
if (artifactOverrides.abi && artifactOverrides.bytecode)
hre._artifactCache[name] = { contractName: name, ...artifactOverrides } as Artifact;
else hre._artifactCache[name] = hre.artifacts.readArtifactSync(name);
}
const artifact = { ...hre._artifactCache[name], ...artifactOverrides };

const deployed = async () => {
Expand Down
38 changes: 0 additions & 38 deletions packages/common/src/hardhat/tasks/acrossPool.ts

This file was deleted.

20 changes: 16 additions & 4 deletions packages/common/src/hardhat/tasks/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ task("generate-contracts-frontend", "Generate typescipt for the contracts-fronte
);

artifacts.forEach(({ contractName, packageName }) => {
if (fs.existsSync(`typechain/${packageName}/ethers/${contractName}.d.ts`))
if (
fs.existsSync(`typechain/${packageName}/ethers/${contractName}.d.ts`) ||
fs.existsSync(`typechain/${packageName}/ethers/${contractName}.ts`)
)
fs.appendFileSync(
out,
`export type { ${contractName} as ${contractName}Ethers } from "../typechain/${packageName}/ethers";\n`
Expand All @@ -146,7 +149,10 @@ task("generate-contracts-frontend", "Generate typescipt for the contracts-fronte

// Write Web3 contract types.
artifacts.forEach(({ contractName, packageName }) => {
if (fs.existsSync(`typechain/${packageName}/web3/${contractName}.d.ts`))
if (
fs.existsSync(`typechain/${packageName}/web3/${contractName}.d.ts`) ||
fs.existsSync(`typechain/${packageName}/web3/${contractName}.ts`)
)
fs.appendFileSync(
out,
`export type { ${normalizeClassName(contractName)} as ${normalizeClassName(
Expand Down Expand Up @@ -216,7 +222,10 @@ task("generate-contracts-node", "Generate typescipt for the contracts-node packa
);

artifacts.forEach(({ contractName, packageName }) => {
if (fs.existsSync(`typechain/${packageName}/ethers/${contractName}.d.ts`))
if (
fs.existsSync(`typechain/${packageName}/ethers/${contractName}.d.ts`) ||
fs.existsSync(`typechain/${packageName}/ethers/${contractName}.ts`)
)
fs.appendFileSync(
out,
`export type { ${contractName} as ${contractName}Ethers } from "../typechain/${packageName}/ethers";\n`
Expand All @@ -233,7 +242,10 @@ task("generate-contracts-node", "Generate typescipt for the contracts-node packa

// Write Web3 contract types.
artifacts.forEach(({ contractName, packageName }) => {
if (fs.existsSync(`typechain/${packageName}/web3/${contractName}.d.ts`))
if (
fs.existsSync(`typechain/${packageName}/web3/${contractName}.d.ts`) ||
fs.existsSync(`typechain/${packageName}/web3/${contractName}.ts`)
)
fs.appendFileSync(
out,
`export type { ${normalizeClassName(contractName)} as ${normalizeClassName(
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.2.1",
"description": "UMA smart contracts and unit tests",
"devDependencies": {
"@across-protocol/contracts": "^0.1.2",
"@across-protocol/contracts": "^0.1.4",
"@ethersproject/abi": "^5.4.0",
"@ethersproject/abstract-provider": "^5.4.0",
"@ethersproject/contracts": "^5.4.0",
Expand Down Expand Up @@ -35,7 +35,7 @@
"clean": "rm -rf dist generated typechain",
"copy-across-types": "mkdir -p typechain/@across-protocol/contracts && rsync -a $(dirname $(node -p 'require.resolve(\"@across-protocol/contracts/package.json\")'))/contract-types/ typechain/@across-protocol/contracts",
"generate-ts": "yarn clean && mkdir -p generated typechain/core && cp -R ../core/contract-types/* typechain/core/ && yarn copy-across-types && yarn hardhat generate-contracts-frontend --out ./generated/index.ts",
"build": "yarn generate-ts && yarn tsc && rsync -R ./typechain/**/**/*.d.ts ./dist",
"build": "yarn generate-ts && yarn tsc && rsync -a --include '*/' --include '*.d.ts' --exclude '*' ./typechain ./dist/",
"prepublish": "yarn build"
},
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-frontend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"include": ["generated/index.ts"],
"include": ["generated/index.ts", "typechain/**/*"],
"compilerOptions": {
"outDir": "./dist",
"declaration": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.2.1",
"description": "UMA smart contracts and unit tests",
"devDependencies": {
"@across-protocol/contracts": "^0.1.2",
"@across-protocol/contracts": "^0.1.4",
"@ethersproject/abi": "^5.4.0",
"@ethersproject/abstract-provider": "^5.4.0",
"@ethersproject/contracts": "^5.4.0",
Expand Down Expand Up @@ -35,7 +35,7 @@
"clean": "rm -rf dist generated typechain",
"copy-across-types": "mkdir -p typechain/@across-protocol/contracts && rsync -a $(dirname $(node -p 'require.resolve(\"@across-protocol/contracts/package.json\")'))/contract-types/ typechain/@across-protocol/contracts",
"generate-ts": "yarn clean && mkdir -p generated typechain/core && cp -R ../core/contract-types/* typechain/core/ && yarn copy-across-types && yarn hardhat generate-contracts-node --out ./generated/index.ts",
"build": "yarn generate-ts && yarn tsc && rsync -R ./typechain/**/**/*.d.ts ./dist/packages/contracts-node",
"build": "yarn generate-ts && yarn tsc && rsync -a --include '*/' --include '*.d.ts' --exclude '*' ./typechain ./dist/packages/contracts-node/",
"prepublish": "yarn build"
},
"bugs": {
Expand Down
2 changes: 2 additions & 0 deletions packages/contracts-node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"esModuleInterop": true,
"include": [
"generated/index.ts",
"typechain/**/*",
"../core/artifacts/**/*.json",
"../../node_modules/@across-protocol/contracts/artifacts/**/*.json",
"../../node_modules/@across-protocol/contracts/artifacts/**/*.json"
],
"exclude": [
Expand Down
Loading

0 comments on commit 84c053b

Please sign in to comment.