From d7185bb6dd392f2255fd8b102458e7dcabcbd192 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sun, 28 Nov 2021 23:23:16 +0530 Subject: [PATCH 01/39] fix: initial commit for shift --- hardhat.config.js | 100 --- hardhat.config.ts | 140 ++++ package-lock.json | 621 +++++++++++++++--- package.json | 7 + scripts/buildDSAv2.js | 15 - scripts/buildDSAv2.ts | 15 + scripts/constant/{abis.js => abis.ts} | 2 +- .../constant/{addresses.js => addresses.ts} | 3 +- scripts/constant/{constant.js => constant.ts} | 2 +- scripts/constant/tokens.js | 23 - scripts/constant/tokens.ts | 23 + test/{ => mainnet}/aave/v1.test.js | 18 +- .../v2.test.js => mainnet/aave/v2.test.ts} | 0 .../b.protocol/b.compound.test.js | 0 .../b.protocol/b.liquity.test.js | 0 test/{ => mainnet}/b.protocol/b.maker.test.js | 16 +- .../basic-ERC1155/ERC1155-transfer.js | 18 +- .../basic-ERC721/ERC721-transfer.js | 18 +- test/{ => mainnet}/compound/compound.test.js | 16 +- .../{ => mainnet}/instapool/instapool.test.js | 18 +- .../liquity/liquity.contracts.js | 0 test/{ => mainnet}/liquity/liquity.helpers.js | 16 +- test/{ => mainnet}/liquity/liquity.test.js | 0 test/{ => mainnet}/mappings/mappings.test.js | 0 .../pooltogether-polygon/pooltogether.test.js | 16 +- .../pooltogether/pooltogether.test.js | 16 +- .../uniswap-sell-beta/uniswap-sell-beta.js | 0 test/{ => mainnet}/uniswap/uniswap.test.js | 22 +- .../uniswapStake/uniswapStake.test.js | 14 +- test/{ => mainnet}/yearn/yearn.test.js | 14 +- yarn.lock | 495 +++++++++++++- 31 files changed, 1302 insertions(+), 346 deletions(-) delete mode 100644 hardhat.config.js create mode 100644 hardhat.config.ts delete mode 100644 scripts/buildDSAv2.js create mode 100644 scripts/buildDSAv2.ts rename scripts/constant/{abis.js => abis.ts} (95%) rename scripts/constant/{addresses.js => addresses.ts} (92%) rename scripts/constant/{constant.js => constant.ts} (88%) delete mode 100644 scripts/constant/tokens.js create mode 100644 scripts/constant/tokens.ts rename test/{ => mainnet}/aave/v1.test.js (88%) rename test/{aave/v2.test.js => mainnet/aave/v2.test.ts} (100%) rename test/{ => mainnet}/b.protocol/b.compound.test.js (100%) rename test/{ => mainnet}/b.protocol/b.liquity.test.js (100%) rename test/{ => mainnet}/b.protocol/b.maker.test.js (95%) rename test/{ => mainnet}/basic-ERC1155/ERC1155-transfer.js (88%) rename test/{ => mainnet}/basic-ERC721/ERC721-transfer.js (88%) rename test/{ => mainnet}/compound/compound.test.js (90%) rename test/{ => mainnet}/instapool/instapool.test.js (84%) rename test/{ => mainnet}/liquity/liquity.contracts.js (100%) rename test/{ => mainnet}/liquity/liquity.helpers.js (93%) rename test/{ => mainnet}/liquity/liquity.test.js (100%) rename test/{ => mainnet}/mappings/mappings.test.js (100%) rename test/{ => mainnet}/pooltogether-polygon/pooltogether.test.js (97%) rename test/{ => mainnet}/pooltogether/pooltogether.test.js (98%) rename test/{ => mainnet}/uniswap-sell-beta/uniswap-sell-beta.js (100%) rename test/{ => mainnet}/uniswap/uniswap.test.js (93%) rename test/{ => mainnet}/uniswapStake/uniswapStake.test.js (96%) rename test/{ => mainnet}/yearn/yearn.test.js (92%) diff --git a/hardhat.config.js b/hardhat.config.js deleted file mode 100644 index 7c82bc76..00000000 --- a/hardhat.config.js +++ /dev/null @@ -1,100 +0,0 @@ -require("@nomiclabs/hardhat-waffle"); -require("@nomiclabs/hardhat-ethers"); -require("@tenderly/hardhat-tenderly"); -require("@nomiclabs/hardhat-etherscan"); -require("@nomiclabs/hardhat-web3"); -require("hardhat-deploy"); -require("hardhat-deploy-ethers"); -require("dotenv").config(); - -const { utils } = require("ethers"); - -const PRIVATE_KEY = process.env.PRIVATE_KEY; -const ALCHEMY_ID = process.env.ALCHEMY_ID; -const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY; - -if (!process.env.ALCHEMY_ID) { - throw new Error("ENV Variable ALCHEMY_ID not set!"); -} - -/** - * @type import('hardhat/config').HardhatUserConfig - */ -module.exports = { - solidity: { - compilers: [ - { - version: "0.7.6", - settings: { - optimizer: { - enabled: true, - runs: 200, - }, - }, - }, - { - version: "0.6.0", - }, - { - version: "0.6.2", - }, - { - version: "0.6.5", - }, - ], - }, - networks: { - kovan: { - url: `https://eth-kovan.alchemyapi.io/v2/${ALCHEMY_ID}`, - accounts: [`0x${PRIVATE_KEY}`], - }, - mainnet: { - url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`, - accounts: [`0x${PRIVATE_KEY}`], - timeout: 150000, - gasPrice: parseInt(utils.parseUnits("30", "gwei")), - }, - rinkeby: { - url: `https://eth-rinkeby.alchemyapi.io/v2/${ALCHEMY_ID}`, - accounts: [`0x${PRIVATE_KEY}`], - timeout: 150000, - }, - hardhat: { - forking: { - url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`, - blockNumber: 12696000, - }, - blockGasLimit: 12000000, - }, - matic: { - url: "https://polygon-rpc.com/", - accounts: [`0x${PRIVATE_KEY}`], - timeout: 150000, - gasPrice: parseInt(utils.parseUnits("50", "gwei")), - }, - arbitrum: { - chainId: 42161, - url: `https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_ID}`, - accounts: [`0x${PRIVATE_KEY}`], - timeout: 150000, - gasPrice: parseInt(utils.parseUnits("2", "gwei")), - }, - avax: { - url: "https://api.avax.network/ext/bc/C/rpc", - chainId: 43114, - accounts: [`0x${PRIVATE_KEY}`], - timeout: 150000, - gasPrice: parseInt(utils.parseUnits("225", "gwei")), - }, - }, - etherscan: { - apiKey: ETHERSCAN_API_KEY, - }, - tenderly: { - project: process.env.TENDERLY_PROJECT, - username: process.env.TENDERLY_USERNAME, - }, - mocha: { - timeout: 100 * 1000, - }, -}; diff --git a/hardhat.config.ts b/hardhat.config.ts new file mode 100644 index 00000000..4150cc68 --- /dev/null +++ b/hardhat.config.ts @@ -0,0 +1,140 @@ +import "@nomiclabs/hardhat-waffle"; +import "@nomiclabs/hardhat-ethers"; +import "@tenderly/hardhat-tenderly"; +import "@nomiclabs/hardhat-etherscan"; +import "@nomiclabs/hardhat-web3"; +import "hardhat-deploy"; +import "hardhat-deploy-ethers"; +import "@typechain/hardhat"; + +import { resolve } from "path"; +import { config as dotenvConfig } from "dotenv"; +import { HardhatUserConfig } from "hardhat/config"; +import { NetworkUserConfig } from "hardhat/types"; +import { utils } from "ethers"; +import Web3 from "web3"; + +dotenvConfig({ path: resolve(__dirname, "./.env") }); + +const chainIds = { + ganache: 1337, + goerli: 5, + hardhat: 31337, + kovan: 42, + mainnet: 1, + rinkeby: 4, + ropsten: 3, + avalanche: 43114, + polygon: 137, +}; + +// Ensure that we have all the environment variables we need. +const mnemonic = process.env.MNEMONIC; +if (!mnemonic) { + throw new Error("Please set your MNEMONIC in a .env file"); +} + +const alchemyApiKey = process.env.ALCHEMY_API_KEY; +if (!alchemyApiKey) { + throw new Error("Please set your ALCHEMY_ETH_API_KEY in a .env file"); +} + +const PRIVATE_KEY = process.env.PRIVATE_KEY; +const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY; + +function createTestnetConfig(network: keyof typeof chainIds): NetworkUserConfig { + const url: string = "https://eth-" + network + ".alchemyapi.io/v2/" + alchemyApiKey; + return { + accounts: { + count: 10, + initialIndex: 0, + mnemonic, + path: "m/44'/60'/0'/0", + }, + chainId: chainIds[network], + url, + }; +} + +function getNetworkUrl(networkType: string) { + //console.log(process.env); + if (networkType === "avalanche") return "https://api.avax.network/ext/bc/C/rpc"; + else if (networkType === "polygon") return `https://polygon-mainnet.g.alchemy.com/v2/${alchemyApiKey}`; + else if (networkType === "arbitrum") return `https://arb-mainnet.g.alchemy.com/v2/${alchemyApiKey}`; + else return `https://eth-mainnet.alchemyapi.io/v2/${alchemyApiKey}`; +} + +function getBlockNumber(networkType: string) { + let web3 = new Web3(new Web3.providers.HttpProvider(getNetworkUrl(networkType))); + let blockNumber; + web3.eth.getBlockNumber().then((x: any) => { + blockNumber = x; + }); + + return blockNumber; +} +/** + * @type import('hardhat/config').HardhatUserConfig + */ + const config: HardhatUserConfig = { + solidity: { + compilers: [ + { + version: "0.7.6", + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + }, + }, + { + version: "0.6.0", + }, + { + version: "0.6.2", + }, + { + version: "0.6.5", + }, + ], + }, + networks: { + hardhat: { + accounts: { + mnemonic, + }, + chainId: chainIds.hardhat, + forking: { + url: String(getNetworkUrl(String(process.env.networkType))), + blockNumber: getBlockNumber(String(process.env.networkType)), + }, + }, + goerli: createTestnetConfig("goerli"), + kovan: createTestnetConfig("kovan"), + rinkeby: createTestnetConfig("rinkeby"), + ropsten: createTestnetConfig("ropsten"), + }, + paths: { + artifacts: "./artifacts", + cache: "./cache", + sources: "./contracts", + tests: "./test", + }, + etherscan: { + apiKey: ETHERSCAN_API_KEY, + }, + tenderly: { + project: process.env.TENDERLY_PROJECT, + username: process.env.TENDERLY_USERNAME, + }, + typechain: { + outDir: "typechain", + target: "ethers-v5", + }, + mocha: { + timeout: 10000 * 1000, + }, +}; + +export default config; diff --git a/package-lock.json b/package-lock.json index 4c82163e..ac293b3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "ISC", "dependencies": { "@openzeppelin/contracts": "^3.4.0-solc-0.7", + "@typechain/hardhat": "^3.0.0", "@uniswap/v3-core": "^1.0.0", "@uniswap/v3-periphery": "^1.2.1", "chalk": "^4.1.2", @@ -26,6 +27,10 @@ "@openzeppelin/test-helpers": "^0.5.15", "@studydefi/money-legos": "^2.4.2", "@tenderly/hardhat-tenderly": "^1.0.12", + "@types/chai": "^4.2.22", + "@types/mocha": "^9.0.0", + "@types/node": "^16.11.10", + "chai": "^4.3.4", "chai-as-promised": "^7.1.1", "ethereum-waffle": "^3.4.0", "ethers": "^5.5.1", @@ -34,6 +39,8 @@ "hardhat-deploy-ethers": "^0.3.0-beta.11", "husky": "^7.0.4", "solidity-coverage": "0.5.11", + "ts-node": "^10.4.0", + "typescript": "^4.5.2", "web3": "^1.5.2" } }, @@ -49,6 +56,27 @@ "node": ">=6.9.0" } }, + "node_modules/@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-consumer": "0.8.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@ensdomains/address-encoder": { "version": "0.1.9", "resolved": "https://registry.npmjs.org/@ensdomains/address-encoder/-/address-encoder-0.1.9.tgz", @@ -541,6 +569,19 @@ "node": ">=10.0" } }, + "node_modules/@ethereum-waffle/compiler/node_modules/@typechain/ethers-v5": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@typechain/ethers-v5/-/ethers-v5-2.0.0.tgz", + "integrity": "sha512-0xdCkyGOzdqh4h5JSf+zoWx85IusEjDcPIwNEHP8mrWSnCae4rvrqB+/gtpdNfX7zjlFlZiMeePn2r63EI3Lrw==", + "dev": true, + "dependencies": { + "ethers": "^5.0.2" + }, + "peerDependencies": { + "ethers": "^5.0.0", + "typechain": "^3.0.0" + } + }, "node_modules/@ethereum-waffle/compiler/node_modules/commander": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", @@ -606,6 +647,56 @@ "node": ">=8.0.0" } }, + "node_modules/@ethereum-waffle/compiler/node_modules/ts-essentials": { + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-6.0.7.tgz", + "integrity": "sha512-2E4HIIj4tQJlIHuATRHayv0EfMGK3ris/GRk1E3CFnsZzeNV+hUmelbaTZHLtXaZppM5oLhHRtO04gINC4Jusw==", + "dev": true, + "peerDependencies": { + "typescript": ">=3.7.0" + } + }, + "node_modules/@ethereum-waffle/compiler/node_modules/typechain": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/typechain/-/typechain-3.0.0.tgz", + "integrity": "sha512-ft4KVmiN3zH4JUFu2WJBrwfHeDf772Tt2d8bssDTo/YcckKW2D+OwFrHXRC6hJvO3mHjFQTihoMV6fJOi0Hngg==", + "dev": true, + "dependencies": { + "command-line-args": "^4.0.7", + "debug": "^4.1.1", + "fs-extra": "^7.0.0", + "js-sha3": "^0.8.0", + "lodash": "^4.17.15", + "ts-essentials": "^6.0.3", + "ts-generator": "^0.1.1" + }, + "bin": { + "typechain": "dist/cli/cli.js" + } + }, + "node_modules/@ethereum-waffle/compiler/node_modules/typechain/node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/@ethereum-waffle/compiler/node_modules/typechain/node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/@ethereum-waffle/ens": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/@ethereum-waffle/ens/-/ens-3.3.0.tgz", @@ -3592,17 +3683,74 @@ "node": ">=4" } }, - "node_modules/@typechain/ethers-v5": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@typechain/ethers-v5/-/ethers-v5-2.0.0.tgz", - "integrity": "sha512-0xdCkyGOzdqh4h5JSf+zoWx85IusEjDcPIwNEHP8mrWSnCae4rvrqB+/gtpdNfX7zjlFlZiMeePn2r63EI3Lrw==", - "dev": true, + "node_modules/@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, + "node_modules/@typechain/hardhat": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@typechain/hardhat/-/hardhat-3.0.0.tgz", + "integrity": "sha512-FpnIIXkDXm54XCHI/Z2iOet7h1MrFSvZfuljX9Uzc6FEjEfb01Tuzu8ywe2iquD3g5JXqovgdv+M54L/2Z6jkg==", "dependencies": { - "ethers": "^5.0.2" + "fs-extra": "^9.1.0" }, "peerDependencies": { - "ethers": "^5.0.0", - "typechain": "^3.0.0" + "hardhat": "^2.0.10", + "lodash": "^4.17.15", + "typechain": "^6.0.0" + } + }, + "node_modules/@typechain/hardhat/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typechain/hardhat/node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/@typechain/hardhat/node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "engines": { + "node": ">= 10.0.0" } }, "node_modules/@types/abstract-leveldown": { @@ -3629,9 +3777,9 @@ } }, "node_modules/@types/chai": { - "version": "4.2.18", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.18.tgz", - "integrity": "sha512-rS27+EkB/RE1Iz3u0XtVL5q36MGDWbgYe7zWiodyKNUnthxY0rukK5V36eiUCtCisB7NN8zKYH6DO2M37qxFEQ==", + "version": "4.2.22", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.22.tgz", + "integrity": "sha512-tFfcE+DSTzWAgifkjik9AySNqIyNoYwmR+uecPwwD/XRNfvOjmC/FjCxpiUGDkDVDphPfCUecSQVFw+lN3M3kQ==", "dev": true }, "node_modules/@types/level-errors": { @@ -3663,10 +3811,16 @@ "@types/node": "*" } }, + "node_modules/@types/mocha": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.0.0.tgz", + "integrity": "sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA==", + "dev": true + }, "node_modules/@types/node": { - "version": "14.14.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.37.tgz", - "integrity": "sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw==" + "version": "16.11.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.10.tgz", + "integrity": "sha512-3aRnHa1KlOEEhJ6+CvyHKK5vE9BcLGjtUpwvqYLRvYNQKMfabu3BwfJaA/SLW8dxe28LsNDjtHwePTuzn3gmOA==" }, "node_modules/@types/node-fetch": { "version": "2.5.12", @@ -3703,8 +3857,7 @@ "node_modules/@types/prettier": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.3.2.tgz", - "integrity": "sha512-eI5Yrz3Qv4KPUa/nSIAi0h+qX0XyewOliug5F2QAtuRg6Kjg6jfmxe1GIwoIRhZspD1A0RP8ANrPwvEXXtRFog==", - "dev": true + "integrity": "sha512-eI5Yrz3Qv4KPUa/nSIAi0h+qX0XyewOliug5F2QAtuRg6Kjg6jfmxe1GIwoIRhZspD1A0RP8ANrPwvEXXtRFog==" }, "node_modules/@types/qs": { "version": "6.9.7", @@ -4090,6 +4243,15 @@ "node": ">=0.4.0" } }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/adm-zip": { "version": "0.4.16", "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz", @@ -4342,6 +4504,12 @@ "readable-stream": "^2.0.6" } }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -4378,7 +4546,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", - "dev": true, "dependencies": { "typical": "^2.6.1" }, @@ -4515,7 +4682,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true, "engines": { "node": ">= 4.0.0" } @@ -5617,7 +5783,6 @@ "version": "4.0.7", "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-4.0.7.tgz", "integrity": "sha512-aUdPvQRAyBvQd2n7jXcsMDz68ckBJELXNzBybCHOibUWEg0mWTnaYCSRU8h9R+aNRSvDihJtssSRCiDRpLaezA==", - "dev": true, "dependencies": { "array-back": "^2.0.0", "find-replace": "^1.0.3", @@ -5851,6 +6016,12 @@ "sha.js": "^2.4.8" } }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "node_modules/cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -8105,7 +8276,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-1.0.3.tgz", "integrity": "sha1-uI5zZNLZyVlVnziMZmcNYTBEH6A=", - "dev": true, "dependencies": { "array-back": "^1.0.4", "test-value": "^2.1.0" @@ -8118,7 +8288,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/array-back/-/array-back-1.0.4.tgz", "integrity": "sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=", - "dev": true, "dependencies": { "typical": "^2.6.0" }, @@ -22229,6 +22398,12 @@ "resolved": "https://registry.npmjs.org/ltgt/-/ltgt-2.2.1.tgz", "integrity": "sha1-81ypHEk/e3PaDgdJUwTxezH4fuU=" }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "node_modules/map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", @@ -26596,7 +26771,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/test-value/-/test-value-2.1.0.tgz", "integrity": "sha1-Edpv9nDzRxpztiXKTz/c97t0gpE=", - "dev": true, "dependencies": { "array-back": "^1.0.3", "typical": "^2.6.0" @@ -26609,7 +26783,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/array-back/-/array-back-1.0.4.tgz", "integrity": "sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=", - "dev": true, "dependencies": { "typical": "^2.6.0" }, @@ -26889,6 +27062,68 @@ "node": ">=4" } }, + "node_modules/ts-node": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz", + "integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/acorn": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz", + "integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", @@ -26978,34 +27213,64 @@ } }, "node_modules/typechain": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/typechain/-/typechain-3.0.0.tgz", - "integrity": "sha512-ft4KVmiN3zH4JUFu2WJBrwfHeDf772Tt2d8bssDTo/YcckKW2D+OwFrHXRC6hJvO3mHjFQTihoMV6fJOi0Hngg==", - "dev": true, + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/typechain/-/typechain-6.0.5.tgz", + "integrity": "sha512-Kr2rATu2Y7Y0wOC/I0zKuyLU8EEUpnuPGkiloZ65ACm4sSLFVF8Tnxn8LEUJSN93dX3RMu2DLF5fwRBOjNB+Gw==", + "peer": true, "dependencies": { + "@types/prettier": "^2.1.1", "command-line-args": "^4.0.7", "debug": "^4.1.1", "fs-extra": "^7.0.0", + "glob": "^7.1.6", "js-sha3": "^0.8.0", "lodash": "^4.17.15", - "ts-essentials": "^6.0.3", - "ts-generator": "^0.1.1" + "mkdirp": "^1.0.4", + "prettier": "^2.1.2", + "ts-essentials": "^7.0.1" }, "bin": { "typechain": "dist/cli/cli.js" + }, + "peerDependencies": { + "typescript": ">=4.1.0" } }, "node_modules/typechain/node_modules/js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", - "dev": true + "peer": true + }, + "node_modules/typechain/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "peer": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/typechain/node_modules/prettier": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.0.tgz", + "integrity": "sha512-FM/zAKgWTxj40rH03VxzIPdXmj39SwSjwG0heUcNFwI+EMZJnY93yAiKXM3dObIKAM5TA88werc8T/EwhB45eg==", + "peer": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } }, "node_modules/typechain/node_modules/ts-essentials": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-6.0.7.tgz", - "integrity": "sha512-2E4HIIj4tQJlIHuATRHayv0EfMGK3ris/GRk1E3CFnsZzeNV+hUmelbaTZHLtXaZppM5oLhHRtO04gINC4Jusw==", - "dev": true, + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-7.0.3.tgz", + "integrity": "sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ==", + "peer": true, "peerDependencies": { "typescript": ">=3.7.0" } @@ -27025,9 +27290,9 @@ } }, "node_modules/typescript": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", - "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==", + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz", + "integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -27039,8 +27304,7 @@ "node_modules/typical": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=", - "dev": true + "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" }, "node_modules/u2f-api": { "version": "0.2.7", @@ -29207,6 +29471,15 @@ "engines": { "node": ">=6" } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } } }, "dependencies": { @@ -29219,6 +29492,21 @@ "regenerator-runtime": "^0.13.4" } }, + "@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true + }, + "@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "requires": { + "@cspotcode/source-map-consumer": "0.8.0" + } + }, "@ensdomains/address-encoder": { "version": "0.1.9", "resolved": "https://registry.npmjs.org/@ensdomains/address-encoder/-/address-encoder-0.1.9.tgz", @@ -29653,6 +29941,15 @@ "typechain": "^3.0.0" }, "dependencies": { + "@typechain/ethers-v5": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@typechain/ethers-v5/-/ethers-v5-2.0.0.tgz", + "integrity": "sha512-0xdCkyGOzdqh4h5JSf+zoWx85IusEjDcPIwNEHP8mrWSnCae4rvrqB+/gtpdNfX7zjlFlZiMeePn2r63EI3Lrw==", + "dev": true, + "requires": { + "ethers": "^5.0.2" + } + }, "commander": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", @@ -29708,6 +30005,50 @@ "semver": "^5.5.0", "tmp": "0.0.33" } + }, + "ts-essentials": { + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-6.0.7.tgz", + "integrity": "sha512-2E4HIIj4tQJlIHuATRHayv0EfMGK3ris/GRk1E3CFnsZzeNV+hUmelbaTZHLtXaZppM5oLhHRtO04gINC4Jusw==", + "dev": true, + "requires": {} + }, + "typechain": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/typechain/-/typechain-3.0.0.tgz", + "integrity": "sha512-ft4KVmiN3zH4JUFu2WJBrwfHeDf772Tt2d8bssDTo/YcckKW2D+OwFrHXRC6hJvO3mHjFQTihoMV6fJOi0Hngg==", + "dev": true, + "requires": { + "command-line-args": "^4.0.7", + "debug": "^4.1.1", + "fs-extra": "^7.0.0", + "js-sha3": "^0.8.0", + "lodash": "^4.17.15", + "ts-essentials": "^6.0.3", + "ts-generator": "^0.1.1" + }, + "dependencies": { + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + } + } } } }, @@ -32129,13 +32470,63 @@ } } }, - "@typechain/ethers-v5": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@typechain/ethers-v5/-/ethers-v5-2.0.0.tgz", - "integrity": "sha512-0xdCkyGOzdqh4h5JSf+zoWx85IusEjDcPIwNEHP8mrWSnCae4rvrqB+/gtpdNfX7zjlFlZiMeePn2r63EI3Lrw==", - "dev": true, + "@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, + "@typechain/hardhat": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@typechain/hardhat/-/hardhat-3.0.0.tgz", + "integrity": "sha512-FpnIIXkDXm54XCHI/Z2iOet7h1MrFSvZfuljX9Uzc6FEjEfb01Tuzu8ywe2iquD3g5JXqovgdv+M54L/2Z6jkg==", "requires": { - "ethers": "^5.0.2" + "fs-extra": "^9.1.0" + }, + "dependencies": { + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + } } }, "@types/abstract-leveldown": { @@ -32161,9 +32552,9 @@ } }, "@types/chai": { - "version": "4.2.18", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.18.tgz", - "integrity": "sha512-rS27+EkB/RE1Iz3u0XtVL5q36MGDWbgYe7zWiodyKNUnthxY0rukK5V36eiUCtCisB7NN8zKYH6DO2M37qxFEQ==", + "version": "4.2.22", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.22.tgz", + "integrity": "sha512-tFfcE+DSTzWAgifkjik9AySNqIyNoYwmR+uecPwwD/XRNfvOjmC/FjCxpiUGDkDVDphPfCUecSQVFw+lN3M3kQ==", "dev": true }, "@types/level-errors": { @@ -32195,10 +32586,16 @@ "@types/node": "*" } }, + "@types/mocha": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.0.0.tgz", + "integrity": "sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA==", + "dev": true + }, "@types/node": { - "version": "14.14.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.37.tgz", - "integrity": "sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw==" + "version": "16.11.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.10.tgz", + "integrity": "sha512-3aRnHa1KlOEEhJ6+CvyHKK5vE9BcLGjtUpwvqYLRvYNQKMfabu3BwfJaA/SLW8dxe28LsNDjtHwePTuzn3gmOA==" }, "@types/node-fetch": { "version": "2.5.12", @@ -32234,8 +32631,7 @@ "@types/prettier": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.3.2.tgz", - "integrity": "sha512-eI5Yrz3Qv4KPUa/nSIAi0h+qX0XyewOliug5F2QAtuRg6Kjg6jfmxe1GIwoIRhZspD1A0RP8ANrPwvEXXtRFog==", - "dev": true + "integrity": "sha512-eI5Yrz3Qv4KPUa/nSIAi0h+qX0XyewOliug5F2QAtuRg6Kjg6jfmxe1GIwoIRhZspD1A0RP8ANrPwvEXXtRFog==" }, "@types/qs": { "version": "6.9.7", @@ -32592,6 +32988,12 @@ } } }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, "adm-zip": { "version": "0.4.16", "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz", @@ -32792,6 +33194,12 @@ "readable-stream": "^2.0.6" } }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -32819,7 +33227,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", - "dev": true, "requires": { "typical": "^2.6.1" } @@ -32939,8 +33346,7 @@ "at-least-node": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" }, "atob": { "version": "2.1.2", @@ -33859,7 +34265,6 @@ "version": "4.0.7", "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-4.0.7.tgz", "integrity": "sha512-aUdPvQRAyBvQd2n7jXcsMDz68ckBJELXNzBybCHOibUWEg0mWTnaYCSRU8h9R+aNRSvDihJtssSRCiDRpLaezA==", - "dev": true, "requires": { "array-back": "^2.0.0", "find-replace": "^1.0.3", @@ -34060,6 +34465,12 @@ "sha.js": "^2.4.8" } }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -35910,7 +36321,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-1.0.3.tgz", "integrity": "sha1-uI5zZNLZyVlVnziMZmcNYTBEH6A=", - "dev": true, "requires": { "array-back": "^1.0.4", "test-value": "^2.1.0" @@ -35920,7 +36330,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/array-back/-/array-back-1.0.4.tgz", "integrity": "sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=", - "dev": true, "requires": { "typical": "^2.6.0" } @@ -46956,6 +47365,12 @@ "resolved": "https://registry.npmjs.org/ltgt/-/ltgt-2.2.1.tgz", "integrity": "sha1-81ypHEk/e3PaDgdJUwTxezH4fuU=" }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", @@ -50535,7 +50950,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/test-value/-/test-value-2.1.0.tgz", "integrity": "sha1-Edpv9nDzRxpztiXKTz/c97t0gpE=", - "dev": true, "requires": { "array-back": "^1.0.3", "typical": "^2.6.0" @@ -50545,7 +50959,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/array-back/-/array-back-1.0.4.tgz", "integrity": "sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=", - "dev": true, "requires": { "typical": "^2.6.0" } @@ -50772,6 +51185,40 @@ } } }, + "ts-node": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz", + "integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==", + "dev": true, + "requires": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "yn": "3.1.1" + }, + "dependencies": { + "acorn": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz", + "integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==", + "dev": true + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + } + } + }, "tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", @@ -50843,31 +51290,46 @@ } }, "typechain": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/typechain/-/typechain-3.0.0.tgz", - "integrity": "sha512-ft4KVmiN3zH4JUFu2WJBrwfHeDf772Tt2d8bssDTo/YcckKW2D+OwFrHXRC6hJvO3mHjFQTihoMV6fJOi0Hngg==", - "dev": true, + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/typechain/-/typechain-6.0.5.tgz", + "integrity": "sha512-Kr2rATu2Y7Y0wOC/I0zKuyLU8EEUpnuPGkiloZ65ACm4sSLFVF8Tnxn8LEUJSN93dX3RMu2DLF5fwRBOjNB+Gw==", + "peer": true, "requires": { + "@types/prettier": "^2.1.1", "command-line-args": "^4.0.7", "debug": "^4.1.1", "fs-extra": "^7.0.0", + "glob": "^7.1.6", "js-sha3": "^0.8.0", "lodash": "^4.17.15", - "ts-essentials": "^6.0.3", - "ts-generator": "^0.1.1" + "mkdirp": "^1.0.4", + "prettier": "^2.1.2", + "ts-essentials": "^7.0.1" }, "dependencies": { "js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", - "dev": true + "peer": true + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "peer": true + }, + "prettier": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.0.tgz", + "integrity": "sha512-FM/zAKgWTxj40rH03VxzIPdXmj39SwSjwG0heUcNFwI+EMZJnY93yAiKXM3dObIKAM5TA88werc8T/EwhB45eg==", + "peer": true }, "ts-essentials": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-6.0.7.tgz", - "integrity": "sha512-2E4HIIj4tQJlIHuATRHayv0EfMGK3ris/GRk1E3CFnsZzeNV+hUmelbaTZHLtXaZppM5oLhHRtO04gINC4Jusw==", - "dev": true, + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-7.0.3.tgz", + "integrity": "sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ==", + "peer": true, "requires": {} } } @@ -50887,15 +51349,14 @@ } }, "typescript": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", - "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==" + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz", + "integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==" }, "typical": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=", - "dev": true + "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" }, "u2f-api": { "version": "0.2.7", @@ -52711,6 +53172,12 @@ "lodash": "^4.17.15", "yargs": "^13.3.0" } + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true } } } diff --git a/package.json b/package.json index 62f04e3f..a4cc56d4 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "homepage": "https://github.com/InstaDApp/dsa-connectors-new#readme", "dependencies": { "@openzeppelin/contracts": "^3.4.0-solc-0.7", + "@typechain/hardhat": "^3.0.0", "@uniswap/v3-core": "^1.0.0", "@uniswap/v3-periphery": "^1.2.1", "chalk": "^4.1.2", @@ -38,6 +39,10 @@ "@openzeppelin/test-helpers": "^0.5.15", "@studydefi/money-legos": "^2.4.2", "@tenderly/hardhat-tenderly": "^1.0.12", + "@types/chai": "^4.2.22", + "@types/mocha": "^9.0.0", + "@types/node": "^16.11.10", + "chai": "^4.3.4", "chai-as-promised": "^7.1.1", "ethereum-waffle": "^3.4.0", "ethers": "^5.5.1", @@ -46,6 +51,8 @@ "hardhat-deploy-ethers": "^0.3.0-beta.11", "husky": "^7.0.4", "solidity-coverage": "0.5.11", + "ts-node": "^10.4.0", + "typescript": "^4.5.2", "web3": "^1.5.2" } } diff --git a/scripts/buildDSAv2.js b/scripts/buildDSAv2.js deleted file mode 100644 index 0f56a8c3..00000000 --- a/scripts/buildDSAv2.js +++ /dev/null @@ -1,15 +0,0 @@ -const hre = require("hardhat"); -const { ethers } = hre; -const addresses = require("./constant/addresses"); -const abis = require("./constant/abis"); - -const instaImplementations_m1 = require("../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json") - -module.exports = async function (owner) { - const instaIndex = await ethers.getContractAt(abis.core.instaIndex, addresses.core.instaIndex) - - const tx = await instaIndex.build(owner, 2, owner); - const receipt = await tx.wait() - const event = receipt.events.find(a => a.event === "LogAccountCreated") - return await ethers.getContractAt(instaImplementations_m1.abi, event.args.account) -}; diff --git a/scripts/buildDSAv2.ts b/scripts/buildDSAv2.ts new file mode 100644 index 00000000..2f359097 --- /dev/null +++ b/scripts/buildDSAv2.ts @@ -0,0 +1,15 @@ +import { ethers } from "hardhat"; + +import { addresses } from "./constant/addresses"; +import { abis } from "./constant/abis"; +import {abi} from "../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json"; + +export default async function (owner: any) { + const instaIndex = await ethers.getContractAt(abis.core.instaIndex, addresses.core.instaIndex) + + const tx = await instaIndex.build(owner, 2, owner); + const receipt = await tx.wait() + const event = receipt.events.find((a: { event: string; }) => a.event === "LogAccountCreated") + return await ethers.getContractAt(abi, event.args.account) +}; + diff --git a/scripts/constant/abis.js b/scripts/constant/abis.ts similarity index 95% rename from scripts/constant/abis.js rename to scripts/constant/abis.ts index cb62ccfb..ed8c8faf 100644 --- a/scripts/constant/abis.js +++ b/scripts/constant/abis.ts @@ -1,4 +1,4 @@ -module.exports = { +export const abis = { core: { connectorsV2: require("./abi/core/connectorsV2.json"), instaIndex: require("./abi/core/instaIndex.json"), diff --git a/scripts/constant/addresses.js b/scripts/constant/addresses.ts similarity index 92% rename from scripts/constant/addresses.js rename to scripts/constant/addresses.ts index 77ee389e..86af9b6a 100644 --- a/scripts/constant/addresses.js +++ b/scripts/constant/addresses.ts @@ -1,4 +1,4 @@ -module.exports = { +export const addresses = { connectors: { basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6", auth: "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9", @@ -9,3 +9,4 @@ module.exports = { instaIndex: "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723", }, }; +  \ No newline at end of file diff --git a/scripts/constant/constant.js b/scripts/constant/constant.ts similarity index 88% rename from scripts/constant/constant.js rename to scripts/constant/constant.ts index 100da5a5..0139c186 100644 --- a/scripts/constant/constant.js +++ b/scripts/constant/constant.ts @@ -1,4 +1,4 @@ -module.exports = { +export const constants = { address_zero: "0x0000000000000000000000000000000000000000", eth_addr: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", max_value: "115792089237316195423570985008687907853269984665640564039457584007913129639935" diff --git a/scripts/constant/tokens.js b/scripts/constant/tokens.js deleted file mode 100644 index c4183095..00000000 --- a/scripts/constant/tokens.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - "eth": { - "type": "token", - "symbol": "ETH", - "name": "Ethereum", - "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - "decimals": 18 - }, - "dai": { - "type": "token", - "symbol": "DAI", - "name": "DAI Stable", - "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - "decimals": 18 - }, - "usdc": { - "type": "token", - "symbol": "USDC", - "name": "USD Coin", - "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "decimals": 6 - } -} \ No newline at end of file diff --git a/scripts/constant/tokens.ts b/scripts/constant/tokens.ts new file mode 100644 index 00000000..d3c95180 --- /dev/null +++ b/scripts/constant/tokens.ts @@ -0,0 +1,23 @@ +export const tokens = { + eth: { + type: "token", + symbol: "ETH", + name: "Ethereum", + address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + decimals: 18, + }, + dai: { + type: "token", + symbol: "DAI", + name: "DAI Stable", + address: "0x6B175474E89094C44Da98b954EedeAC495271d0F", + decimals: 18, + }, + usdc: { + type: "token", + symbol: "USDC", + name: "USD Coin", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + decimals: 6, + }, +}; diff --git a/test/aave/v1.test.js b/test/mainnet/aave/v1.test.js similarity index 88% rename from test/aave/v1.test.js rename to test/mainnet/aave/v1.test.js index 970ef3e8..e93dddb6 100644 --- a/test/aave/v1.test.js +++ b/test/mainnet/aave/v1.test.js @@ -1,16 +1,16 @@ const { expect } = require("chai"); const hre = require("hardhat"); -const abis = require("../../scripts/constant/abis"); -const addresses = require("../../scripts/constant/addresses"); -const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector"); -const getMasterSigner = require("../../scripts/getMasterSigner"); -const buildDSAv2 = require("../../scripts/buildDSAv2"); +const abis = require("../../../scripts/constant/abis"); +const addresses = require("../../../scripts/constant/addresses"); +const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector"); +const getMasterSigner = require("../../../scripts/getMasterSigner"); +const buildDSAv2 = require("../../../scripts/buildDSAv2"); const ConnectV2AaveV1 = require("../../artifacts/contracts/mainnet/connectors/aave/v1/main.sol/ConnectV2AaveV1.json"); const { parseEther } = require("@ethersproject/units"); -const encodeSpells = require("../../scripts/encodeSpells"); -const tokens = require("../../scripts/constant/tokens"); -const constants = require("../../scripts/constant/constant"); -const addLiquidity = require("../../scripts/addLiquidity"); +const encodeSpells = require("../../../scripts/encodeSpells"); +const tokens = require("../../../scripts/constant/tokens"); +const constants = require("../../../scripts/constant/constant"); +const addLiquidity = require("../../../scripts/addLiquidity"); const { ethers } = hre; const ALCHEMY_ID = process.env.ALCHEMY_ID; diff --git a/test/aave/v2.test.js b/test/mainnet/aave/v2.test.ts similarity index 100% rename from test/aave/v2.test.js rename to test/mainnet/aave/v2.test.ts diff --git a/test/b.protocol/b.compound.test.js b/test/mainnet/b.protocol/b.compound.test.js similarity index 100% rename from test/b.protocol/b.compound.test.js rename to test/mainnet/b.protocol/b.compound.test.js diff --git a/test/b.protocol/b.liquity.test.js b/test/mainnet/b.protocol/b.liquity.test.js similarity index 100% rename from test/b.protocol/b.liquity.test.js rename to test/mainnet/b.protocol/b.liquity.test.js diff --git a/test/b.protocol/b.maker.test.js b/test/mainnet/b.protocol/b.maker.test.js similarity index 95% rename from test/b.protocol/b.maker.test.js rename to test/mainnet/b.protocol/b.maker.test.js index 5cc97daa..f6908f04 100644 --- a/test/b.protocol/b.maker.test.js +++ b/test/mainnet/b.protocol/b.maker.test.js @@ -3,15 +3,15 @@ const hre = require("hardhat"); const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../scripts/buildDSAv2") -const encodeSpells = require("../../scripts/encodeSpells.js") -const getMasterSigner = require("../../scripts/getMasterSigner") +const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") +const buildDSAv2 = require("../../../scripts/buildDSAv2") +const encodeSpells = require("../../../scripts/encodeSpells.js") +const getMasterSigner = require("../../../scripts/getMasterSigner") -const addresses = require("../../scripts/constant/addresses"); -const abis = require("../../scripts/constant/abis"); -const constants = require("../../scripts/constant/constant"); -const tokens = require("../../scripts/constant/tokens"); +const addresses = require("../../../scripts/constant/addresses"); +const abis = require("../../../scripts/constant/abis"); +const constants = require("../../../scripts/constant/constant"); +const tokens = require("../../../scripts/constant/tokens"); const connectorMakerArtifacts = require("../../artifacts/contracts/mainnet/connectors/b.protocol/makerdao/main.sol/ConnectV2BMakerDAO.json") diff --git a/test/basic-ERC1155/ERC1155-transfer.js b/test/mainnet/basic-ERC1155/ERC1155-transfer.js similarity index 88% rename from test/basic-ERC1155/ERC1155-transfer.js rename to test/mainnet/basic-ERC1155/ERC1155-transfer.js index a0835384..ff8d8e4a 100644 --- a/test/basic-ERC1155/ERC1155-transfer.js +++ b/test/mainnet/basic-ERC1155/ERC1155-transfer.js @@ -2,17 +2,17 @@ const { expect } = require("chai"); const hre = require("hardhat"); const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -const { abi: implementationsABI } = require("../../scripts/constant/abi/core/InstaImplementations.json") +const { abi: implementationsABI } = require("../../../scripts/constant/abi/core/InstaImplementations.json") -const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../scripts/buildDSAv2") -const encodeSpells = require("../../scripts/encodeSpells.js") -const getMasterSigner = require("../../scripts/getMasterSigner") +const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") +const buildDSAv2 = require("../../../scripts/buildDSAv2") +const encodeSpells = require("../../../scripts/encodeSpells.js") +const getMasterSigner = require("../../../scripts/getMasterSigner") -const addresses = require("../../scripts/constant/addresses"); -const abis = require("../../scripts/constant/abis"); -const constants = require("../../scripts/constant/constant"); -const tokens = require("../../scripts/constant/tokens"); +const addresses = require("../../../scripts/constant/addresses"); +const abis = require("../../../scripts/constant/abis"); +const constants = require("../../../scripts/constant/constant"); +const tokens = require("../../../scripts/constant/tokens"); const connectV2BasicERC1155Artifacts = require("../../artifacts/contracts/mainnet/connectors/basic-ERC1155/main.sol/ConnectV2BasicERC1155.json") const erc1155Artifacts = require("../../artifacts/@openzeppelin/contracts/token/ERC1155/IERC1155.sol/IERC1155.json") diff --git a/test/basic-ERC721/ERC721-transfer.js b/test/mainnet/basic-ERC721/ERC721-transfer.js similarity index 88% rename from test/basic-ERC721/ERC721-transfer.js rename to test/mainnet/basic-ERC721/ERC721-transfer.js index 73dce8ca..c11f02b4 100644 --- a/test/basic-ERC721/ERC721-transfer.js +++ b/test/mainnet/basic-ERC721/ERC721-transfer.js @@ -2,17 +2,17 @@ const { expect } = require("chai"); const hre = require("hardhat"); const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -const { abi: implementationsABI } = require("../../scripts/constant/abi/core/InstaImplementations.json") +const { abi: implementationsABI } = require("../../../scripts/constant/abi/core/InstaImplementations.json") -const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../scripts/buildDSAv2") -const encodeSpells = require("../../scripts/encodeSpells.js") -const getMasterSigner = require("../../scripts/getMasterSigner") +const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") +const buildDSAv2 = require("../../../scripts/buildDSAv2") +const encodeSpells = require("../../../scripts/encodeSpells.js") +const getMasterSigner = require("../../../scripts/getMasterSigner") -const addresses = require("../../scripts/constant/addresses"); -const abis = require("../../scripts/constant/abis"); -const constants = require("../../scripts/constant/constant"); -const tokens = require("../../scripts/constant/tokens"); +const addresses = require("../../../scripts/constant/addresses"); +const abis = require("../../../scripts/constant/abis"); +const constants = require("../../../scripts/constant/constant"); +const tokens = require("../../../scripts/constant/tokens"); const connectV2BasicERC721Artifacts = require("../../artifacts/contracts/mainnet/connectors/basic-ERC721/main.sol/ConnectV2BasicERC721.json") const erc721Artifacts = require("../../artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.json") diff --git a/test/compound/compound.test.js b/test/mainnet/compound/compound.test.js similarity index 90% rename from test/compound/compound.test.js rename to test/mainnet/compound/compound.test.js index 0719eb94..c977ca71 100644 --- a/test/compound/compound.test.js +++ b/test/mainnet/compound/compound.test.js @@ -3,15 +3,15 @@ const hre = require("hardhat"); const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../scripts/buildDSAv2") -const encodeSpells = require("../../scripts/encodeSpells.js") -const getMasterSigner = require("../../scripts/getMasterSigner") +const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") +const buildDSAv2 = require("../../../scripts/buildDSAv2") +const encodeSpells = require("../../../scripts/encodeSpells.js") +const getMasterSigner = require("../../../scripts/getMasterSigner") -const addresses = require("../../scripts/constant/addresses"); -const abis = require("../../scripts/constant/abis"); -const constants = require("../../scripts/constant/constant"); -const tokens = require("../../scripts/constant/tokens"); +const addresses = require("../../../scripts/constant/addresses"); +const abis = require("../../../scripts/constant/abis"); +const constants = require("../../../scripts/constant/constant"); +const tokens = require("../../../scripts/constant/tokens"); const connectV2CompoundArtifacts = require("../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json") diff --git a/test/instapool/instapool.test.js b/test/mainnet/instapool/instapool.test.js similarity index 84% rename from test/instapool/instapool.test.js rename to test/mainnet/instapool/instapool.test.js index cbae67c2..32fefb6f 100644 --- a/test/instapool/instapool.test.js +++ b/test/mainnet/instapool/instapool.test.js @@ -3,16 +3,16 @@ const hre = require("hardhat"); const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../scripts/buildDSAv2") -const encodeSpells = require("../../scripts/encodeSpells.js") -const encodeFlashcastData = require("../../scripts/encodeFlashcastData.js") -const getMasterSigner = require("../../scripts/getMasterSigner") +const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") +const buildDSAv2 = require("../../../scripts/buildDSAv2") +const encodeSpells = require("../../../scripts/encodeSpells.js") +const encodeFlashcastData = require("../../../scripts/encodeFlashcastData.js") +const getMasterSigner = require("../../../scripts/getMasterSigner") -const addresses = require("../../scripts/constant/addresses"); -const abis = require("../../scripts/constant/abis"); -const constants = require("../../scripts/constant/constant"); -const tokens = require("../../scripts/constant/tokens"); +const addresses = require("../../../scripts/constant/addresses"); +const abis = require("../../../scripts/constant/abis"); +const constants = require("../../../scripts/constant/constant"); +const tokens = require("../../../scripts/constant/tokens"); const connectV2CompoundArtifacts = require("../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json") diff --git a/test/liquity/liquity.contracts.js b/test/mainnet/liquity/liquity.contracts.js similarity index 100% rename from test/liquity/liquity.contracts.js rename to test/mainnet/liquity/liquity.contracts.js diff --git a/test/liquity/liquity.helpers.js b/test/mainnet/liquity/liquity.helpers.js similarity index 93% rename from test/liquity/liquity.helpers.js rename to test/mainnet/liquity/liquity.helpers.js index f6aa3e34..ad5a5bc4 100644 --- a/test/liquity/liquity.helpers.js +++ b/test/mainnet/liquity/liquity.helpers.js @@ -1,15 +1,15 @@ const hre = require("hardhat"); -const hardhatConfig = require("../../hardhat.config"); +const hardhatConfig = require("../../../hardhat.config"); // Instadapp deployment and testing helpers -const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector.js"); -const encodeSpells = require("../../scripts/encodeSpells.js"); -const getMasterSigner = require("../../scripts/getMasterSigner"); -const buildDSAv2 = require("../../scripts/buildDSAv2"); +const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js"); +const encodeSpells = require("../../../scripts/encodeSpells.js"); +const getMasterSigner = require("../../../scripts/getMasterSigner"); +const buildDSAv2 = require("../../../scripts/buildDSAv2"); // Instadapp instadappAddresses/ABIs -const instadappAddresses = require("../../scripts/constant/addresses"); -const instadappAbi = require("../../scripts/constant/abis"); +const instadappAddresses = require("../../../scripts/constant/addresses"); +const instadappAbi = require("../../../scripts/constant/abis"); // Instadapp Liquity Connector artifacts const connectV2LiquityArtifacts = require("../../artifacts/contracts/mainnet/connectors/liquity/main.sol/ConnectV2Liquity.json"); @@ -17,7 +17,7 @@ const connectV2BasicV1Artifacts = require("../../artifacts/contracts/mainnet/con const { ethers } = require("hardhat"); // Instadapp uses a fake address to represent native ETH -const { eth_addr: ETH_ADDRESS } = require("../../scripts/constant/constant"); +const { eth_addr: ETH_ADDRESS } = require("../../../scripts/constant/constant"); const LIQUITY_CONNECTOR = "LIQUITY-v1-TEST"; const LUSD_GAS_COMPENSATION = hre.ethers.utils.parseUnits("200", 18); // 200 LUSD gas compensation repaid after loan repayment diff --git a/test/liquity/liquity.test.js b/test/mainnet/liquity/liquity.test.js similarity index 100% rename from test/liquity/liquity.test.js rename to test/mainnet/liquity/liquity.test.js diff --git a/test/mappings/mappings.test.js b/test/mainnet/mappings/mappings.test.js similarity index 100% rename from test/mappings/mappings.test.js rename to test/mainnet/mappings/mappings.test.js diff --git a/test/pooltogether-polygon/pooltogether.test.js b/test/mainnet/pooltogether-polygon/pooltogether.test.js similarity index 97% rename from test/pooltogether-polygon/pooltogether.test.js rename to test/mainnet/pooltogether-polygon/pooltogether.test.js index fc6cc971..54f3f408 100644 --- a/test/pooltogether-polygon/pooltogether.test.js +++ b/test/mainnet/pooltogether-polygon/pooltogether.test.js @@ -5,15 +5,15 @@ const { provider, deployContract } = waffle const ALCHEMY_ID = process.env.ALCHEMY_ID; -const deployAndEnableConnector = require("../../scripts/polygon/deployAndEnableConnector.js") -const buildDSAv2 = require("../../scripts/polygon/buildDSAv2") -const encodeSpells = require("../../scripts/polygon/encodeSpells.js") -const getMasterSigner = require("../../scripts/polygon/getMasterSigner") +const deployAndEnableConnector = require("../../../scripts/polygon/deployAndEnableConnector.js") +const buildDSAv2 = require("../../../scripts/polygon/buildDSAv2") +const encodeSpells = require("../../../scripts/polygon/encodeSpells.js") +const getMasterSigner = require("../../../scripts/polygon/getMasterSigner") -const addresses = require("../../scripts/polygon/constant/addresses"); -const abis = require("../../scripts/constant/abis"); -const constants = require("../../scripts/polygon/constant/constant"); -const tokens = require("../../scripts/polygon/constant/tokens"); +const addresses = require("../../../scripts/polygon/constant/addresses"); +const abis = require("../../../scripts/constant/abis"); +const constants = require("../../../scripts/polygon/constant/constant"); +const tokens = require("../../../scripts/polygon/constant/tokens"); const connectV2AaveV2Artifacts = require("../../artifacts/contracts/polygon/connectors/aave/v2/main.sol/ConnectV2AaveV2Polygon.json") const connectV2PoolTogetherArtifacts = require("../../artifacts/contracts/polygon/connectors/pooltogether/main.sol/ConnectV2PoolTogetherPolygon.json") diff --git a/test/pooltogether/pooltogether.test.js b/test/mainnet/pooltogether/pooltogether.test.js similarity index 98% rename from test/pooltogether/pooltogether.test.js rename to test/mainnet/pooltogether/pooltogether.test.js index 6dc2697b..f3822fa6 100644 --- a/test/pooltogether/pooltogether.test.js +++ b/test/mainnet/pooltogether/pooltogether.test.js @@ -3,15 +3,15 @@ const hre = require("hardhat"); const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../scripts/buildDSAv2") -const encodeSpells = require("../../scripts/encodeSpells.js") -const getMasterSigner = require("../../scripts/getMasterSigner") +const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") +const buildDSAv2 = require("../../../scripts/buildDSAv2") +const encodeSpells = require("../../../scripts/encodeSpells.js") +const getMasterSigner = require("../../../scripts/getMasterSigner") -const addresses = require("../../scripts/constant/addresses"); -const abis = require("../../scripts/constant/abis"); -const constants = require("../../scripts/constant/constant"); -const tokens = require("../../scripts/constant/tokens"); +const addresses = require("../../../scripts/constant/addresses"); +const abis = require("../../../scripts/constant/abis"); +const constants = require("../../../scripts/constant/constant"); +const tokens = require("../../../scripts/constant/tokens"); const connectV2CompoundArtifacts = require("../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json") const connectV2PoolTogetherArtifacts = require("../../artifacts/contracts/mainnet/connectors/pooltogether/main.sol/ConnectV2PoolTogether.json") diff --git a/test/uniswap-sell-beta/uniswap-sell-beta.js b/test/mainnet/uniswap-sell-beta/uniswap-sell-beta.js similarity index 100% rename from test/uniswap-sell-beta/uniswap-sell-beta.js rename to test/mainnet/uniswap-sell-beta/uniswap-sell-beta.js diff --git a/test/uniswap/uniswap.test.js b/test/mainnet/uniswap/uniswap.test.js similarity index 93% rename from test/uniswap/uniswap.test.js rename to test/mainnet/uniswap/uniswap.test.js index 185a9d3b..1ed88892 100644 --- a/test/uniswap/uniswap.test.js +++ b/test/mainnet/uniswap/uniswap.test.js @@ -3,23 +3,23 @@ const hre = require("hardhat"); const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle; -const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector.js"); -const buildDSAv2 = require("../../scripts/buildDSAv2"); -const encodeSpells = require("../../scripts/encodeSpells.js"); -const encodeFlashcastData = require("../../scripts/encodeFlashcastData.js"); -const getMasterSigner = require("../../scripts/getMasterSigner"); -const addLiquidity = require("../../scripts/addLiquidity"); +const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js"); +const buildDSAv2 = require("../../../scripts/buildDSAv2"); +const encodeSpells = require("../../../scripts/encodeSpells.js"); +const encodeFlashcastData = require("../../../scripts/encodeFlashcastData.js"); +const getMasterSigner = require("../../../scripts/getMasterSigner"); +const addLiquidity = require("../../../scripts/addLiquidity"); -const addresses = require("../../scripts/constant/addresses"); -const abis = require("../../scripts/constant/abis"); -const constants = require("../../scripts/constant/constant"); -const tokens = require("../../scripts/constant/tokens"); +const addresses = require("../../../scripts/constant/addresses"); +const abis = require("../../../scripts/constant/abis"); +const constants = require("../../../scripts/constant/constant"); +const tokens = require("../../../scripts/constant/tokens"); const { abi: nftManagerAbi, } = require("@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json"); const connectV2UniswapV3Artifacts = require("../../artifacts/contracts/mainnet/connectors/uniswap/v3/main.sol/ConnectV2UniswapV3.json"); -const { eth } = require("../../scripts/constant/tokens"); +const { eth } = require("../../../scripts/constant/tokens"); const { BigNumber } = require("ethers"); const FeeAmount = { diff --git a/test/uniswapStake/uniswapStake.test.js b/test/mainnet/uniswapStake/uniswapStake.test.js similarity index 96% rename from test/uniswapStake/uniswapStake.test.js rename to test/mainnet/uniswapStake/uniswapStake.test.js index dee656ee..abf1929f 100644 --- a/test/uniswapStake/uniswapStake.test.js +++ b/test/mainnet/uniswapStake/uniswapStake.test.js @@ -3,14 +3,14 @@ const hre = require("hardhat"); const { waffle, ethers } = hre; const { provider, deployContract } = waffle -const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../scripts/buildDSAv2") -const encodeSpells = require("../../scripts/encodeSpells.js") -const getMasterSigner = require("../../scripts/getMasterSigner") -const addLiquidity = require("../../scripts/addLiquidity"); +const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") +const buildDSAv2 = require("../../../scripts/buildDSAv2") +const encodeSpells = require("../../../scripts/encodeSpells.js") +const getMasterSigner = require("../../../scripts/getMasterSigner") +const addLiquidity = require("../../../scripts/addLiquidity"); -const addresses = require("../../scripts/constant/addresses"); -const abis = require("../../scripts/constant/abis"); +const addresses = require("../../../scripts/constant/addresses"); +const abis = require("../../../scripts/constant/abis"); const { abi: nftManagerAbi } = require("@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json") const connectV2UniswapStakerArtifacts = require("../../artifacts/contracts/mainnet/connectors/uniswap/v3_staker/main.sol/ConnectV2UniswapV3Staker.json"); diff --git a/test/yearn/yearn.test.js b/test/mainnet/yearn/yearn.test.js similarity index 92% rename from test/yearn/yearn.test.js rename to test/mainnet/yearn/yearn.test.js index 596029d3..8a9cd382 100644 --- a/test/yearn/yearn.test.js +++ b/test/mainnet/yearn/yearn.test.js @@ -3,14 +3,14 @@ const hre = require("hardhat"); const { waffle, ethers } = hre; const { provider } = waffle -const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../scripts/buildDSAv2") -const encodeSpells = require("../../scripts/encodeSpells.js") -const getMasterSigner = require("../../scripts/getMasterSigner") +const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") +const buildDSAv2 = require("../../../scripts/buildDSAv2") +const encodeSpells = require("../../../scripts/encodeSpells.js") +const getMasterSigner = require("../../../scripts/getMasterSigner") -const tokens = require("../../scripts/constant/tokens"); -const addresses = require("../../scripts/constant/addresses"); -const abis = require("../../scripts/constant/abis"); +const tokens = require("../../../scripts/constant/tokens"); +const addresses = require("../../../scripts/constant/addresses"); +const abis = require("../../../scripts/constant/abis"); const connectV2YearnArtifacts = require("../../artifacts/contracts/mainnet/connectors/yearn_v2/main.sol/ConnectV2YearnV2.json") const toBytes32 = (bn) => { diff --git a/yarn.lock b/yarn.lock index bc93a47e..01f4fd13 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,6 +9,18 @@ dependencies: "regenerator-runtime" "^0.13.4" +"@cspotcode/source-map-consumer@0.8.0": + "integrity" "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==" + "resolved" "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz" + "version" "0.8.0" + +"@cspotcode/source-map-support@0.7.0": + "integrity" "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==" + "resolved" "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz" + "version" "0.7.0" + dependencies: + "@cspotcode/source-map-consumer" "0.8.0" + "@ensdomains/address-encoder@^0.1.7": "integrity" "sha512-E2d2gP4uxJQnDu2Kfg1tHNspefzbLT8Tyjrm5sEuim32UkU2sm5xL4VXtgc2X33fmPEw9+jUMpGs4veMbf+PYg==" "resolved" "https://registry.npmjs.org/@ensdomains/address-encoder/-/address-encoder-0.1.9.tgz" @@ -730,7 +742,7 @@ dependencies: "invariant" "2" -"@ledgerhq/devices@^5.26.0": +"@ledgerhq/devices@^5.26.0", "@ledgerhq/devices@^5.51.1": "integrity" "sha512-4w+P0VkbjzEXC7kv8T1GJ/9AVaP9I6uasMZ/JcdwZBS3qwvKo5A5z9uGhP5c7TvItzcmPb44b5Mw2kT+WjUuAA==" "resolved" "https://registry.npmjs.org/@ledgerhq/devices/-/devices-5.51.1.tgz" "version" "5.51.1" @@ -756,6 +768,31 @@ "bignumber.js" "^9.0.1" "rlp" "^2.2.6" +"@ledgerhq/hw-transport-node-hid-noevents@^5.26.0": + "integrity" "sha512-9wFf1L8ZQplF7XOY2sQGEeOhpmBRzrn+4X43kghZ7FBDoltrcK+s/D7S+7ffg3j2OySyP6vIIIgloXylao5Scg==" + "resolved" "https://registry.npmjs.org/@ledgerhq/hw-transport-node-hid-noevents/-/hw-transport-node-hid-noevents-5.51.1.tgz" + "version" "5.51.1" + dependencies: + "@ledgerhq/devices" "^5.51.1" + "@ledgerhq/errors" "^5.50.0" + "@ledgerhq/hw-transport" "^5.51.1" + "@ledgerhq/logs" "^5.50.0" + "node-hid" "2.1.1" + +"@ledgerhq/hw-transport-node-hid@5.26.0": + "integrity" "sha512-qhaefZVZatJ6UuK8Wb6WSFNOLWc2mxcv/xgsfKi5HJCIr4bPF/ecIeN+7fRcEaycxj4XykY6Z4A7zDVulfFH4w==" + "resolved" "https://registry.npmjs.org/@ledgerhq/hw-transport-node-hid/-/hw-transport-node-hid-5.26.0.tgz" + "version" "5.26.0" + dependencies: + "@ledgerhq/devices" "^5.26.0" + "@ledgerhq/errors" "^5.26.0" + "@ledgerhq/hw-transport" "^5.26.0" + "@ledgerhq/hw-transport-node-hid-noevents" "^5.26.0" + "@ledgerhq/logs" "^5.26.0" + "lodash" "^4.17.20" + "node-hid" "1.3.0" + "usb" "^1.6.3" + "@ledgerhq/hw-transport-u2f@5.26.0": "integrity" "sha512-QTxP1Rsh+WZ184LUOelYVLeaQl3++V3I2jFik+l9JZtakwEHjD0XqOT750xpYNL/vfHsy31Wlz+oicdxGzFk+w==" "resolved" "https://registry.npmjs.org/@ledgerhq/hw-transport-u2f/-/hw-transport-u2f-5.26.0.tgz" @@ -775,6 +812,15 @@ "@ledgerhq/errors" "^5.26.0" "events" "^3.2.0" +"@ledgerhq/hw-transport@^5.51.1": + "integrity" "sha512-6wDYdbWrw9VwHIcoDnqWBaDFyviyjZWv6H9vz9Vyhe4Qd7TIFmbTl/eWs6hZvtZBza9K8y7zD8ChHwRI4s9tSw==" + "resolved" "https://registry.npmjs.org/@ledgerhq/hw-transport/-/hw-transport-5.51.1.tgz" + "version" "5.51.1" + dependencies: + "@ledgerhq/devices" "^5.51.1" + "@ledgerhq/errors" "^5.50.0" + "events" "^3.3.0" + "@ledgerhq/logs@^5.26.0", "@ledgerhq/logs@^5.50.0": "integrity" "sha512-swKHYCOZUGyVt4ge0u8a7AwNcA//h4nx5wIi0sruGye1IJ5Cva0GyK9L2/WdX+kWVTKp92ZiEo1df31lrWGPgA==" "resolved" "https://registry.npmjs.org/@ledgerhq/logs/-/logs-5.50.0.tgz" @@ -1120,6 +1166,26 @@ "strip-indent" "^2.0.0" "super-split" "^1.1.0" +"@tsconfig/node10@^1.0.7": + "integrity" "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==" + "resolved" "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz" + "version" "1.0.8" + +"@tsconfig/node12@^1.0.7": + "integrity" "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==" + "resolved" "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz" + "version" "1.0.9" + +"@tsconfig/node14@^1.0.0": + "integrity" "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==" + "resolved" "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz" + "version" "1.0.1" + +"@tsconfig/node16@^1.0.2": + "integrity" "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==" + "resolved" "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz" + "version" "1.0.2" + "@typechain/ethers-v5@^2.0.0": "integrity" "sha512-0xdCkyGOzdqh4h5JSf+zoWx85IusEjDcPIwNEHP8mrWSnCae4rvrqB+/gtpdNfX7zjlFlZiMeePn2r63EI3Lrw==" "resolved" "https://registry.npmjs.org/@typechain/ethers-v5/-/ethers-v5-2.0.0.tgz" @@ -1127,6 +1193,13 @@ dependencies: "ethers" "^5.0.2" +"@typechain/hardhat@^3.0.0": + "integrity" "sha512-FpnIIXkDXm54XCHI/Z2iOet7h1MrFSvZfuljX9Uzc6FEjEfb01Tuzu8ywe2iquD3g5JXqovgdv+M54L/2Z6jkg==" + "resolved" "https://registry.npmjs.org/@typechain/hardhat/-/hardhat-3.0.0.tgz" + "version" "3.0.0" + dependencies: + "fs-extra" "^9.1.0" + "@types/abstract-leveldown@*": "integrity" "sha512-+jA1XXF3jsz+Z7FcuiNqgK53hTa/luglT2TyTpKPqoYbxVY+mCPF22Rm+q3KPBrMHJwNXFrTViHszBOfU4vftQ==" "resolved" "https://registry.npmjs.org/@types/abstract-leveldown/-/abstract-leveldown-5.0.2.tgz" @@ -1153,10 +1226,10 @@ dependencies: "@types/node" "*" -"@types/chai@*": - "integrity" "sha512-rS27+EkB/RE1Iz3u0XtVL5q36MGDWbgYe7zWiodyKNUnthxY0rukK5V36eiUCtCisB7NN8zKYH6DO2M37qxFEQ==" - "resolved" "https://registry.npmjs.org/@types/chai/-/chai-4.2.18.tgz" - "version" "4.2.18" +"@types/chai@*", "@types/chai@^4.2.22": + "integrity" "sha512-tFfcE+DSTzWAgifkjik9AySNqIyNoYwmR+uecPwwD/XRNfvOjmC/FjCxpiUGDkDVDphPfCUecSQVFw+lN3M3kQ==" + "resolved" "https://registry.npmjs.org/@types/chai/-/chai-4.2.22.tgz" + "version" "4.2.22" "@types/level-errors@*": "integrity" "sha512-/lMtoq/Cf/2DVOm6zE6ORyOM+3ZVm/BvzEZVxUhf6bgh8ZHglXlBqxbxSlJeVp8FCbD3IVvk/VbsaNmDjrQvqQ==" @@ -1184,6 +1257,11 @@ dependencies: "@types/node" "*" +"@types/mocha@^9.0.0": + "integrity" "sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA==" + "resolved" "https://registry.npmjs.org/@types/mocha/-/mocha-9.0.0.tgz" + "version" "9.0.0" + "@types/node-fetch@^2.5.5": "integrity" "sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==" "resolved" "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.12.tgz" @@ -1192,10 +1270,10 @@ "@types/node" "*" "form-data" "^3.0.0" -"@types/node@*": - "integrity" "sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw==" - "resolved" "https://registry.npmjs.org/@types/node/-/node-14.14.37.tgz" - "version" "14.14.37" +"@types/node@*", "@types/node@^16.11.10": + "integrity" "sha512-3aRnHa1KlOEEhJ6+CvyHKK5vE9BcLGjtUpwvqYLRvYNQKMfabu3BwfJaA/SLW8dxe28LsNDjtHwePTuzn3gmOA==" + "resolved" "https://registry.npmjs.org/@types/node/-/node-16.11.10.tgz" + "version" "16.11.10" "@types/node@^12.12.6": "integrity" "sha512-+5haRZ9uzI7rYqzDznXgkuacqb6LJhAti8mzZKWxIXn/WEtvB+GHVJ7AuMwcN1HMvXOSJcrvA6PPoYHYOYYebA==" @@ -1542,6 +1620,11 @@ dependencies: "acorn" "^4.0.3" +"acorn-walk@^8.1.1": + "integrity" "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" + "resolved" "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz" + "version" "8.2.0" + "acorn@^4.0.3": "integrity" "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=" "resolved" "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz" @@ -1557,6 +1640,11 @@ "resolved" "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz" "version" "6.4.2" +"acorn@^8.4.1": + "integrity" "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==" + "resolved" "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz" + "version" "8.6.0" + "adm-zip@^0.4.16": "integrity" "sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg==" "resolved" "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz" @@ -1704,11 +1792,24 @@ "normalize-path" "^3.0.0" "picomatch" "^2.0.4" -"aproba@^1.1.1": +"aproba@^1.0.3", "aproba@^1.1.1": "integrity" "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" "resolved" "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz" "version" "1.2.0" +"are-we-there-yet@~1.1.2": + "integrity" "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==" + "resolved" "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz" + "version" "1.1.5" + dependencies: + "delegates" "^1.0.0" + "readable-stream" "^2.0.6" + +"arg@^4.1.0": + "integrity" "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "resolved" "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz" + "version" "4.1.3" + "argparse@^1.0.7": "integrity" "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==" "resolved" "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz" @@ -2394,6 +2495,13 @@ "resolved" "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz" "version" "2.2.0" +"bindings@^1.4.0", "bindings@^1.5.0": + "integrity" "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==" + "resolved" "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz" + "version" "1.5.0" + dependencies: + "file-uri-to-path" "1.0.0" + "bip39@2.5.0": "version" "2.5.0" dependencies: @@ -2403,6 +2511,15 @@ "safe-buffer" "^5.0.1" "unorm" "^1.3.3" +"bl@^4.0.3": + "integrity" "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==" + "resolved" "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz" + "version" "4.1.0" + dependencies: + "buffer" "^5.5.0" + "inherits" "^2.0.4" + "readable-stream" "^3.4.0" + "blakejs@^1.1.0": "integrity" "sha1-ad+S75U6qIylGjLfarHFShVfx6U=" "resolved" "https://registry.npmjs.org/blakejs/-/blakejs-1.1.0.tgz" @@ -2822,7 +2939,7 @@ "resolved" "https://registry.npmjs.org/chai-bn/-/chai-bn-0.2.1.tgz" "version" "0.2.1" -"chai@^4.0.0", "chai@^4.2.0", "chai@>= 2.1.2 < 5": +"chai@^4.0.0", "chai@^4.2.0", "chai@^4.3.4", "chai@>= 2.1.2 < 5": "integrity" "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==" "resolved" "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz" "version" "4.3.4" @@ -3204,6 +3321,11 @@ "resolved" "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz" "version" "1.2.0" +"console-control-strings@^1.0.0", "console-control-strings@~1.1.0": + "integrity" "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" + "resolved" "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz" + "version" "1.1.0" + "consolidate@^0.15.1": "integrity" "sha512-DW46nrsMJgy9kqAbPt5rKaCr7uFtpo4mSUvLHIUbJEjm0vo+aY5QLwBUq3FK4tRnJr/X0Psc0C4jf/h+HtXSMw==" "resolved" "https://registry.npmjs.org/consolidate/-/consolidate-0.15.1.tgz" @@ -3347,6 +3469,11 @@ "safe-buffer" "^5.0.1" "sha.js" "^2.4.8" +"create-require@^1.1.0": + "integrity" "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + "resolved" "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz" + "version" "1.1.1" + "cross-fetch@^2.1.0", "cross-fetch@^2.1.1": "version" "2.2.3" dependencies: @@ -3570,6 +3697,13 @@ dependencies: "mimic-response" "^1.0.0" +"decompress-response@^4.2.0": + "integrity" "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==" + "resolved" "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz" + "version" "4.2.1" + dependencies: + "mimic-response" "^2.0.0" + "deep-eql@^3.0.1": "integrity" "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==" "resolved" "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz" @@ -3587,6 +3721,11 @@ "object-keys" "^1.1.1" "regexp.prototype.flags" "^1.2.0" +"deep-extend@^0.6.0": + "integrity" "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" + "resolved" "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz" + "version" "0.6.0" + "deep-is@~0.1.3": "integrity" "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" "resolved" "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz" @@ -3653,6 +3792,11 @@ "resolved" "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" "version" "1.0.0" +"delegates@^1.0.0": + "integrity" "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + "resolved" "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz" + "version" "1.0.0" + "depd@~1.1.2": "integrity" "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" "resolved" "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz" @@ -3681,6 +3825,16 @@ "resolved" "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz" "version" "5.0.0" +"detect-libc@^1.0.3": + "integrity" "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" + "resolved" "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz" + "version" "1.0.3" + +"diff@^4.0.1": + "integrity" "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + "resolved" "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz" + "version" "4.0.2" + "diff@3.3.1": "integrity" "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==" "resolved" "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz" @@ -3868,7 +4022,7 @@ dependencies: "iconv-lite" "^0.6.2" -"end-of-stream@^1.0.0", "end-of-stream@^1.1.0": +"end-of-stream@^1.0.0", "end-of-stream@^1.1.0", "end-of-stream@^1.4.1": "integrity" "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==" "resolved" "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz" "version" "1.4.4" @@ -4683,7 +4837,7 @@ "resolved" "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.4.tgz" "version" "4.0.4" -"events@^3.0.0", "events@^3.2.0": +"events@^3.0.0", "events@^3.2.0", "events@^3.3.0": "integrity" "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==" "resolved" "https://registry.npmjs.org/events/-/events-3.3.0.tgz" "version" "3.3.0" @@ -4740,6 +4894,11 @@ "snapdragon" "^0.8.1" "to-regex" "^3.0.1" +"expand-template@^2.0.3": + "integrity" "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==" + "resolved" "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz" + "version" "2.0.3" + "express@^4.14.0": "integrity" "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==" "resolved" "https://registry.npmjs.org/express/-/express-4.17.1.tgz" @@ -5078,6 +5237,11 @@ "inherits" "^2.0.1" "readable-stream" "^2.0.0" +"fs-constants@^1.0.0": + "integrity" "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + "resolved" "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz" + "version" "1.0.0" + "fs-extra@^0.30.0": "integrity" "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=" "resolved" "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz" @@ -5142,6 +5306,16 @@ "jsonfile" "^6.0.1" "universalify" "^2.0.0" +"fs-extra@^9.1.0": + "integrity" "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==" + "resolved" "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz" + "version" "9.1.0" + dependencies: + "at-least-node" "^1.0.0" + "graceful-fs" "^4.2.0" + "jsonfile" "^6.0.1" + "universalify" "^2.0.0" + "fs-minipass@^1.2.5": "version" "1.2.7" dependencies: @@ -5169,6 +5343,19 @@ "resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" "version" "1.0.0" +"fsevents@^1.2.7", "fsevents@~2.1.1": + "integrity" "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==" + "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz" + "version" "1.2.13" + dependencies: + "bindings" "^1.5.0" + "nan" "^2.12.1" + +"fsevents@~2.3.2": + "integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==" + "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" + "version" "2.3.2" + "function-bind@^1.1.1", "function-bind@~1.1.1": "integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" "resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" @@ -5225,6 +5412,20 @@ "ethereumjs-wallet" "0.6.5" "web3" "1.2.11" +"gauge@~2.7.3": + "integrity" "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=" + "resolved" "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz" + "version" "2.7.4" + dependencies: + "aproba" "^1.0.3" + "console-control-strings" "^1.0.0" + "has-unicode" "^2.0.0" + "object-assign" "^4.1.0" + "signal-exit" "^3.0.0" + "string-width" "^1.0.1" + "strip-ansi" "^3.0.1" + "wide-align" "^1.1.0" + "get-caller-file@^1.0.1": "integrity" "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" "resolved" "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz" @@ -5295,6 +5496,11 @@ dependencies: "assert-plus" "^1.0.0" +"github-from-package@0.0.0": + "integrity" "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=" + "resolved" "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz" + "version" "0.0.0" + "glob-parent@^3.1.0": "integrity" "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=" "resolved" "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz" @@ -5321,7 +5527,7 @@ "once" "^1.3.0" "path-is-absolute" "^1.0.0" -"glob@^7.0.0", "glob@^7.1.2", "glob@^7.1.3", "glob@^7.1.4": +"glob@^7.0.0", "glob@^7.1.2", "glob@^7.1.3", "glob@^7.1.4", "glob@^7.1.6": "integrity" "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==" "resolved" "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz" "version" "7.1.6" @@ -5508,7 +5714,7 @@ dependencies: "chokidar" "^3.4.3" -"hardhat@^2.0.0", "hardhat@^2.0.3", "hardhat@^2.0.4", "hardhat@^2.6.7": +"hardhat@^2.0.0", "hardhat@^2.0.10", "hardhat@^2.0.3", "hardhat@^2.0.4", "hardhat@^2.6.7": "integrity" "sha512-Mua01f6ZN1feQLktHSH2p5A5LCdA+Wf7+O2lJDH6wClvWPtI2eqKNNY2gxBwYXoQ28GZrT3K6mqQOZeRWAca6Q==" "resolved" "https://registry.npmjs.org/hardhat/-/hardhat-2.6.7.tgz" "version" "2.6.7" @@ -5615,6 +5821,11 @@ dependencies: "has-symbols" "^1.0.2" +"has-unicode@^2.0.0": + "integrity" "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" + "resolved" "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz" + "version" "2.0.1" + "has-value@^0.3.1": "integrity" "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=" "resolved" "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz" @@ -5932,6 +6143,11 @@ "resolved" "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" "version" "2.0.3" +"ini@~1.3.0": + "integrity" "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + "resolved" "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz" + "version" "1.3.8" + "internal-slot@^1.0.3": "integrity" "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==" "resolved" "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz" @@ -6390,7 +6606,7 @@ "resolved" "https://registry.npmjs.org/js-sha3/-/js-sha3-0.6.1.tgz" "version" "0.6.1" -"js-sha3@^0.8.0": +"js-sha3@^0.8.0", "js-sha3@0.8.0": "integrity" "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" "resolved" "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz" "version" "0.8.0" @@ -7019,6 +7235,11 @@ "pify" "^4.0.1" "semver" "^5.6.0" +"make-error@^1.1.1": + "integrity" "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + "resolved" "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz" + "version" "1.3.6" + "map-age-cleaner@^0.1.1": "integrity" "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==" "resolved" "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz" @@ -7256,6 +7477,11 @@ "resolved" "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz" "version" "1.0.1" +"mimic-response@^2.0.0": + "integrity" "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==" + "resolved" "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz" + "version" "2.1.0" + "min-document@^2.19.0": "integrity" "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=" "resolved" "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz" @@ -7285,7 +7511,7 @@ dependencies: "brace-expansion" "^1.1.7" -"minimist@^1.2.0", "minimist@^1.2.5", "minimist@~1.2.5": +"minimist@^1.2.0", "minimist@^1.2.3", "minimist@^1.2.5", "minimist@~1.2.5": "integrity" "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" "resolved" "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz" "version" "1.2.5" @@ -7339,6 +7565,11 @@ "for-in" "^1.0.2" "is-extendable" "^1.0.1" +"mkdirp-classic@^0.5.2", "mkdirp-classic@^0.5.3": + "integrity" "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" + "resolved" "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz" + "version" "0.5.3" + "mkdirp-promise@^5.0.1": "integrity" "sha1-6bj2jlUsaKnBcTuEiD96HdA5uKE=" "resolved" "https://registry.npmjs.org/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz" @@ -7353,6 +7584,11 @@ dependencies: "minimist" "^1.2.5" +"mkdirp@^1.0.4": + "integrity" "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + "resolved" "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz" + "version" "1.0.4" + "mkdirp@0.5.1": "integrity" "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=" "resolved" "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz" @@ -7494,11 +7730,16 @@ "fmix" "^0.1.0" "imul" "^1.0.0" -"nan@2.13.2": +"nan@^2.12.1", "nan@2.13.2": "integrity" "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" "resolved" "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz" "version" "2.13.2" +"nan@^2.14.0": + "integrity" "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==" + "resolved" "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz" + "version" "2.14.2" + "nano-base32@^1.0.1": "integrity" "sha1-ulSMh578+5DaHE2eCX20pGySVe8=" "resolved" "https://registry.npmjs.org/nano-base32/-/nano-base32-1.0.1.tgz" @@ -7526,6 +7767,11 @@ "snapdragon" "^0.8.1" "to-regex" "^3.0.1" +"napi-build-utils@^1.0.1": + "integrity" "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==" + "resolved" "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz" + "version" "1.0.2" + "negotiator@0.6.2": "integrity" "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" "resolved" "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz" @@ -7553,11 +7799,28 @@ dependencies: "lower-case" "^1.1.1" +"node-abi@^2.18.0", "node-abi@^2.21.0", "node-abi@^2.7.0": + "integrity" "sha512-ag/Vos/mXXpWLLAYWsAoQdgS+gW7IwvgMLOgqopm/DbzAjazLltzgzpVMsFlgmo9TzG5hGXeaBZx2AI731RIsQ==" + "resolved" "https://registry.npmjs.org/node-abi/-/node-abi-2.26.0.tgz" + "version" "2.26.0" + dependencies: + "semver" "^5.4.1" + "node-addon-api@^2.0.0": "integrity" "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" "resolved" "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz" "version" "2.0.2" +"node-addon-api@^3.0.2": + "integrity" "sha512-flmrDNB06LIl5lywUz7YlNGZH/5p0M7W28k8hzd9Lshtdh1wshD2Y+U4h9LD6KObOy1f+fEVdgprPrEymjM5uw==" + "resolved" "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.1.0.tgz" + "version" "3.1.0" + +"node-addon-api@3.0.2": + "integrity" "sha512-+D4s2HCnxPd5PjjI0STKwncjXTUKKqm74MDMz9OPXavjsGmjkvwgLtA5yoxJUdmpj52+2u+RrXgPipahKczMKg==" + "resolved" "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.0.2.tgz" + "version" "3.0.2" + "node-environment-flags@1.0.6": "integrity" "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==" "resolved" "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz" @@ -7585,6 +7848,25 @@ "resolved" "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz" "version" "4.2.3" +"node-hid@1.3.0": + "integrity" "sha512-BA6G4V84kiNd1uAChub/Z/5s/xS3EHBCxotQ0nyYrUG65mXewUDHE1tWOSqA2dp3N+mV0Ffq9wo2AW9t4p/G7g==" + "resolved" "https://registry.npmjs.org/node-hid/-/node-hid-1.3.0.tgz" + "version" "1.3.0" + dependencies: + "bindings" "^1.5.0" + "nan" "^2.14.0" + "node-abi" "^2.18.0" + "prebuild-install" "^5.3.4" + +"node-hid@2.1.1": + "integrity" "sha512-Skzhqow7hyLZU93eIPthM9yjot9lszg9xrKxESleEs05V2NcbUptZc5HFqzjOkSmL0sFlZFr3kmvaYebx06wrw==" + "resolved" "https://registry.npmjs.org/node-hid/-/node-hid-2.1.1.tgz" + "version" "2.1.1" + dependencies: + "bindings" "^1.5.0" + "node-addon-api" "^3.0.2" + "prebuild-install" "^6.0.0" + "node-libs-browser@^2.0.0", "node-libs-browser@^2.2.1": "integrity" "sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q==" "resolved" "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.1.tgz" @@ -7619,6 +7901,11 @@ "resolved" "https://registry.npmjs.org/nofilter/-/nofilter-1.0.4.tgz" "version" "1.0.4" +"noop-logger@^0.1.1": + "integrity" "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=" + "resolved" "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz" + "version" "0.1.1" + "nopt@3.x": "integrity" "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=" "resolved" "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz" @@ -7660,6 +7947,16 @@ dependencies: "path-key" "^2.0.0" +"npmlog@^4.0.1": + "integrity" "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==" + "resolved" "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz" + "version" "4.1.2" + dependencies: + "are-we-there-yet" "~1.1.2" + "console-control-strings" "~1.1.0" + "gauge" "~2.7.3" + "set-blocking" "~2.0.0" + "nth-check@^2.0.0": "integrity" "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==" "resolved" "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz" @@ -8259,6 +8556,47 @@ "resolved" "https://registry.npmjs.org/postinstall-postinstall/-/postinstall-postinstall-2.1.0.tgz" "version" "2.1.0" +"prebuild-install@^5.3.3", "prebuild-install@^5.3.4": + "integrity" "sha512-s8Aai8++QQGi4sSbs/M1Qku62PFK49Jm1CbgXklGz4nmHveDq0wzJkg7Na5QbnO1uNH8K7iqx2EQ/mV0MZEmOg==" + "resolved" "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.6.tgz" + "version" "5.3.6" + dependencies: + "detect-libc" "^1.0.3" + "expand-template" "^2.0.3" + "github-from-package" "0.0.0" + "minimist" "^1.2.3" + "mkdirp-classic" "^0.5.3" + "napi-build-utils" "^1.0.1" + "node-abi" "^2.7.0" + "noop-logger" "^0.1.1" + "npmlog" "^4.0.1" + "pump" "^3.0.0" + "rc" "^1.2.7" + "simple-get" "^3.0.3" + "tar-fs" "^2.0.0" + "tunnel-agent" "^0.6.0" + "which-pm-runs" "^1.0.0" + +"prebuild-install@^6.0.0": + "integrity" "sha512-PzYWIKZeP+967WuKYXlTOhYBgGOvTRSfaKI89XnfJ0ansRAH7hDU45X+K+FZeI1Wb/7p/NnuctPH3g0IqKUuSQ==" + "resolved" "https://registry.npmjs.org/prebuild-install/-/prebuild-install-6.1.2.tgz" + "version" "6.1.2" + dependencies: + "detect-libc" "^1.0.3" + "expand-template" "^2.0.3" + "github-from-package" "0.0.0" + "minimist" "^1.2.3" + "mkdirp-classic" "^0.5.3" + "napi-build-utils" "^1.0.1" + "node-abi" "^2.21.0" + "noop-logger" "^0.1.1" + "npmlog" "^4.0.1" + "pump" "^3.0.0" + "rc" "^1.2.7" + "simple-get" "^3.0.3" + "tar-fs" "^2.0.0" + "tunnel-agent" "^0.6.0" + "precond@0.2": "version" "0.2.3" @@ -8522,6 +8860,16 @@ "iconv-lite" "0.4.24" "unpipe" "1.0.0" +"rc@^1.2.7": + "integrity" "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==" + "resolved" "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz" + "version" "1.2.8" + dependencies: + "deep-extend" "^0.6.0" + "ini" "~1.3.0" + "minimist" "^1.2.0" + "strip-json-comments" "~2.0.1" + "read-pkg-up@^1.0.1": "integrity" "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=" "resolved" "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz" @@ -8564,7 +8912,7 @@ "isarray" "0.0.1" "string_decoder" "~0.10.x" -"readable-stream@^2.0.0", "readable-stream@^2.0.1", "readable-stream@^2.0.2", "readable-stream@^2.0.5", "readable-stream@^2.1.5", "readable-stream@^2.2.2", "readable-stream@^2.2.8", "readable-stream@^2.2.9", "readable-stream@^2.3.3", "readable-stream@^2.3.6", "readable-stream@~2.3.6", "readable-stream@1 || 2": +"readable-stream@^2.0.0", "readable-stream@^2.0.1", "readable-stream@^2.0.2", "readable-stream@^2.0.5", "readable-stream@^2.0.6", "readable-stream@^2.1.5", "readable-stream@^2.2.2", "readable-stream@^2.2.8", "readable-stream@^2.2.9", "readable-stream@^2.3.3", "readable-stream@^2.3.6", "readable-stream@~2.3.6", "readable-stream@1 || 2": "integrity" "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==" "resolved" "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz" "version" "2.3.7" @@ -8593,7 +8941,7 @@ "string_decoder" "^1.1.1" "util-deprecate" "^1.0.1" -"readable-stream@^3.4.0": +"readable-stream@^3.1.1", "readable-stream@^3.4.0": "integrity" "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==" "resolved" "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz" "version" "3.6.0" @@ -8980,6 +9328,11 @@ "resolved" "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz" "version" "5.7.1" +"semver@^5.4.1": + "integrity" "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + "resolved" "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz" + "version" "5.7.1" + "semver@^5.5.0", "semver@^5.6.0": "integrity" "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" "resolved" "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz" @@ -9072,7 +9425,7 @@ "request" "^2.79.0" "xhr" "^2.3.3" -"set-blocking@^2.0.0": +"set-blocking@^2.0.0", "set-blocking@~2.0.0": "integrity" "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" "resolved" "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz" "version" "2.0.0" @@ -9176,6 +9529,15 @@ "once" "^1.3.1" "simple-concat" "^1.0.0" +"simple-get@^3.0.3": + "integrity" "sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==" + "resolved" "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz" + "version" "3.1.0" + dependencies: + "decompress-response" "^4.2.0" + "once" "^1.3.1" + "simple-concat" "^1.0.0" + "slash@^1.0.0": "version" "1.0.0" @@ -9612,7 +9974,7 @@ "resolved" "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz" "version" "2.0.0" -"strip-json-comments@2.0.1": +"strip-json-comments@~2.0.1", "strip-json-comments@2.0.1": "integrity" "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" "resolved" "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz" "version" "2.0.1" @@ -9728,6 +10090,27 @@ "string.prototype.trim" "~1.2.1" "through" "~2.3.8" +"tar-fs@^2.0.0": + "integrity" "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==" + "resolved" "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz" + "version" "2.1.1" + dependencies: + "chownr" "^1.1.1" + "mkdirp-classic" "^0.5.2" + "pump" "^3.0.0" + "tar-stream" "^2.1.4" + +"tar-stream@^2.1.4": + "integrity" "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==" + "resolved" "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz" + "version" "2.2.0" + dependencies: + "bl" "^4.0.3" + "end-of-stream" "^1.4.1" + "fs-constants" "^1.0.0" + "inherits" "^2.0.3" + "readable-stream" "^3.1.1" + "tar@^4.0.2": "integrity" "sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA==" "resolved" "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz" @@ -9913,6 +10296,11 @@ "resolved" "https://registry.npmjs.org/ts-essentials/-/ts-essentials-6.0.7.tgz" "version" "6.0.7" +"ts-essentials@^7.0.1": + "integrity" "sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ==" + "resolved" "https://registry.npmjs.org/ts-essentials/-/ts-essentials-7.0.3.tgz" + "version" "7.0.3" + "ts-generator@^0.1.1": "integrity" "sha512-N+ahhZxTLYu1HNTQetwWcx3so8hcYbkKBHTr4b4/YgObFTIKkOSSsaa+nal12w8mfrJAyzJfETXawbNjSfP2gQ==" "resolved" "https://registry.npmjs.org/ts-generator/-/ts-generator-0.1.1.tgz" @@ -9928,6 +10316,24 @@ "resolve" "^1.8.1" "ts-essentials" "^1.0.0" +"ts-node@^10.4.0": + "integrity" "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==" + "resolved" "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz" + "version" "10.4.0" + dependencies: + "@cspotcode/source-map-support" "0.7.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + "acorn" "^8.4.1" + "acorn-walk" "^8.1.1" + "arg" "^4.1.0" + "create-require" "^1.1.0" + "diff" "^4.0.1" + "make-error" "^1.1.1" + "yn" "3.1.1" + "tslib@^1.9.0", "tslib@^1.9.3": "integrity" "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" "resolved" "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz" @@ -10031,6 +10437,22 @@ "ts-essentials" "^6.0.3" "ts-generator" "^0.1.1" +"typechain@^6.0.0": + "integrity" "sha512-Kr2rATu2Y7Y0wOC/I0zKuyLU8EEUpnuPGkiloZ65ACm4sSLFVF8Tnxn8LEUJSN93dX3RMu2DLF5fwRBOjNB+Gw==" + "resolved" "https://registry.npmjs.org/typechain/-/typechain-6.0.5.tgz" + "version" "6.0.5" + dependencies: + "@types/prettier" "^2.1.1" + "command-line-args" "^4.0.7" + "debug" "^4.1.1" + "fs-extra" "^7.0.0" + "glob" "^7.1.6" + "js-sha3" "^0.8.0" + "lodash" "^4.17.15" + "mkdirp" "^1.0.4" + "prettier" "^2.1.2" + "ts-essentials" "^7.0.1" + "typedarray-to-buffer@^3.1.5": "integrity" "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==" "resolved" "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz" @@ -10043,10 +10465,10 @@ "resolved" "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz" "version" "0.0.6" -"typescript@^4.3.4", "typescript@>=3.7.0": - "integrity" "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==" - "resolved" "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz" - "version" "4.3.5" +"typescript@^4.3.4", "typescript@^4.5.2", "typescript@>=2.7", "typescript@>=3.7.0", "typescript@>=4.1.0": + "integrity" "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==" + "resolved" "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz" + "version" "4.5.2" "typewise-core@^1.2", "typewise-core@^1.2.0": "version" "1.2.0" @@ -10230,6 +10652,15 @@ "punycode" "1.3.2" "querystring" "0.2.0" +"usb@^1.6.3": + "integrity" "sha512-HTCfx6NnNRhv5y98t04Y8j2+A8dmQnEGxCMY2/zN/0gkiioLYfTZ5w/PEKlWRVUY+3qLe9xwRv9pHLkjQYNw/g==" + "resolved" "https://registry.npmjs.org/usb/-/usb-1.7.1.tgz" + "version" "1.7.1" + dependencies: + "bindings" "^1.4.0" + "node-addon-api" "3.0.2" + "prebuild-install" "^5.3.3" + "use@^3.1.0": "integrity" "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" "resolved" "https://registry.npmjs.org/use/-/use-3.1.1.tgz" @@ -11234,6 +11665,11 @@ "resolved" "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz" "version" "2.0.0" +"which-pm-runs@^1.0.0": + "integrity" "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=" + "resolved" "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz" + "version" "1.0.0" + "which-typed-array@^1.1.2": "integrity" "sha512-vjxaB4nfDqwKI0ws7wZpxIlde1XrLX5uB0ZjpfshgmapJMD7jJWhZI+yToJTqaFByF0eNBcYxbjmCzoRP7CfEw==" "resolved" "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.7.tgz" @@ -11253,7 +11689,7 @@ dependencies: "isexe" "^2.0.0" -"wide-align@1.1.3": +"wide-align@^1.1.0", "wide-align@1.1.3": "integrity" "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==" "resolved" "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz" "version" "1.1.3" @@ -11561,3 +11997,8 @@ "which-module" "^2.0.0" "y18n" "^4.0.0" "yargs-parser" "^13.1.0" + +"yn@3.1.1": + "integrity" "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" + "resolved" "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz" + "version" "3.1.1" From 51328e77224ac8bea83a1343977da63f4dc6b079 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Mon, 29 Nov 2021 00:34:32 +0530 Subject: [PATCH 02/39] updated scripts --- scripts/{addLiquidity.js => addLiquidity.ts} | 25 ++++++++++---------- scripts/buildDSAv2.ts | 22 ++++++++++------- scripts/{impersonate.js => impersonate.ts} | 4 ++-- 3 files changed, 28 insertions(+), 23 deletions(-) rename scripts/{addLiquidity.js => addLiquidity.ts} (75%) rename scripts/{impersonate.js => impersonate.ts} (70%) diff --git a/scripts/addLiquidity.js b/scripts/addLiquidity.ts similarity index 75% rename from scripts/addLiquidity.js rename to scripts/addLiquidity.ts index c461a775..8cf3c76c 100644 --- a/scripts/addLiquidity.js +++ b/scripts/addLiquidity.ts @@ -1,7 +1,9 @@ -const { ethers } = require("hardhat"); -const impersonateAccounts = require("./impersonate"); +import { Provider } from "@ethersproject/abstract-provider"; +import { Signer } from "@ethersproject/abstract-signer"; +import { ethers } from "hardhat"; +import { impersonateAccounts } from "./impersonate"; -const mineTx = async (tx) => { +const mineTx = async (tx: any) => { await (await tx).wait(); }; @@ -12,7 +14,7 @@ const tokenMapping = { abi: [ "function mint(address _to, uint256 _amount) external returns (bool);", ], - process: async function(owner, to, amt) { + process: async function(owner: Signer | Provider, to: any, amt: any) { const contract = new ethers.Contract(this.address, this.abi, owner); await mineTx(contract.mint(to, amt)); @@ -22,7 +24,7 @@ const tokenMapping = { impersonateSigner: "0x47ac0fb4f2d84898e4d9e7b4dab3c24507a6d503", abi: ["function transfer(address to, uint value)"], address: "0x6b175474e89094c44da98b954eedeac495271d0f", - process: async function(owner, to, amt) { + process: async function(owner: Signer | Provider, to: any, amt: any) { const contract = new ethers.Contract(this.address, this.abi, owner); await mineTx(contract.transfer(to, amt)); }, @@ -34,7 +36,7 @@ const tokenMapping = { "function issue(uint amount)", "function transfer(address to, uint value)", ], - process: async function(owner, address, amt) { + process: async function(owner: Signer | Provider, address: any, amt: any) { const contract = new ethers.Contract(this.address, this.abi, owner); await mineTx(contract.issue(amt)); @@ -45,7 +47,7 @@ const tokenMapping = { impersonateSigner: "0xCA06411bd7a7296d7dbdd0050DFc846E95fEBEB7", address: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", abi: ["function mint(address _to, uint256 _amount) public returns (bool)"], - process: async function(owner, address, amt) { + process: async function(owner: Signer | Provider, address: any, amt: any) { const contract = new ethers.Contract(this.address, this.abi, owner); await mineTx(contract.mint(address, amt)); }, @@ -54,20 +56,19 @@ const tokenMapping = { impersonateSigner: "0x75e89d5979E4f6Fba9F97c104c2F0AFB3F1dcB88", address: "0x6f40d4a6237c257fff2db00fa0510deeecd303eb", abi: ["function transfer(address to, uint value)"], - process: async function(owner, address, amt) { + process: async function(owner: Signer | Provider, address: any, amt: any) { const contract = new ethers.Contract(this.address, this.abi, owner); await mineTx(contract.transfer(address, amt)); }, - } + }, }; -module.exports = async (tokenName, address, amt) => { +module.exports = async (tokenName: string, address: any, amt: any) => { const [signer] = await ethers.getSigners(); tokenName = tokenName.toLowerCase(); if (!tokenMapping[tokenName]) { throw new Error( - "Add liquidity doesn't support the following token: ", - tokenName + `Add liquidity doesn't support the following token: ${tokenName}` ); } diff --git a/scripts/buildDSAv2.ts b/scripts/buildDSAv2.ts index 2f359097..9ebd63f6 100644 --- a/scripts/buildDSAv2.ts +++ b/scripts/buildDSAv2.ts @@ -2,14 +2,18 @@ import { ethers } from "hardhat"; import { addresses } from "./constant/addresses"; import { abis } from "./constant/abis"; -import {abi} from "../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json"; +import { abi } from "../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json"; -export default async function (owner: any) { - const instaIndex = await ethers.getContractAt(abis.core.instaIndex, addresses.core.instaIndex) - - const tx = await instaIndex.build(owner, 2, owner); - const receipt = await tx.wait() - const event = receipt.events.find((a: { event: string; }) => a.event === "LogAccountCreated") - return await ethers.getContractAt(abi, event.args.account) -}; +export default async function(owner: any) { + const instaIndex = await ethers.getContractAt( + abis.core.instaIndex, + addresses.core.instaIndex + ); + const tx = await instaIndex.build(owner, 2, owner); + const receipt = await tx.wait(); + const event = receipt.events.find( + (a: { event: string }) => a.event === "LogAccountCreated" + ); + return await ethers.getContractAt(abi, event.args.account); +} diff --git a/scripts/impersonate.js b/scripts/impersonate.ts similarity index 70% rename from scripts/impersonate.js rename to scripts/impersonate.ts index fb485cee..9e3c73ac 100644 --- a/scripts/impersonate.js +++ b/scripts/impersonate.ts @@ -1,6 +1,6 @@ -const { ethers, network } = require("hardhat"); +import { ethers, network } from "hardhat"; -module.exports = async (accounts) => { +export const impersonateAccounts = async (accounts: any) => { const signers = []; for (const account of accounts) { await network.provider.request({ From 457ae913c47e914a78ec2cb59ae78acf613a6029 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Mon, 29 Nov 2021 22:51:11 +0530 Subject: [PATCH 03/39] updated scripts --- scripts/addLiquidity.ts | 4 +- scripts/buildDSAv2.ts | 2 +- scripts/deploy.js | 38 ------------------- scripts/deploy.ts | 36 ++++++++++++++++++ scripts/deployAndEnableConnector.js | 19 ---------- scripts/deployAndEnableConnector.ts | 25 ++++++++++++ scripts/deployConnector.js | 24 ------------ scripts/deployConnector.ts | 10 +++++ scripts/encodeSpells.js | 18 --------- scripts/encodeSpells.ts | 18 +++++++++ ...{getMasterSigner.js => getMasterSigner.ts} | 13 +++---- scripts/impersonate.ts | 1 - 12 files changed, 98 insertions(+), 110 deletions(-) delete mode 100644 scripts/deploy.js create mode 100644 scripts/deploy.ts delete mode 100644 scripts/deployAndEnableConnector.js create mode 100644 scripts/deployAndEnableConnector.ts delete mode 100644 scripts/deployConnector.js create mode 100644 scripts/deployConnector.ts delete mode 100644 scripts/encodeSpells.js create mode 100644 scripts/encodeSpells.ts rename scripts/{getMasterSigner.js => getMasterSigner.ts} (68%) diff --git a/scripts/addLiquidity.ts b/scripts/addLiquidity.ts index 8cf3c76c..a2290a65 100644 --- a/scripts/addLiquidity.ts +++ b/scripts/addLiquidity.ts @@ -63,7 +63,7 @@ const tokenMapping = { }, }; -module.exports = async (tokenName: string, address: any, amt: any) => { +export async function addLiquidity(tokenName: string, address: any, amt: any) { const [signer] = await ethers.getSigners(); tokenName = tokenName.toLowerCase(); if (!tokenMapping[tokenName]) { @@ -85,4 +85,4 @@ module.exports = async (tokenName: string, address: any, amt: any) => { }); await token.process(impersonatedSigner, address, amt); -}; +} diff --git a/scripts/buildDSAv2.ts b/scripts/buildDSAv2.ts index 9ebd63f6..5b582e18 100644 --- a/scripts/buildDSAv2.ts +++ b/scripts/buildDSAv2.ts @@ -4,7 +4,7 @@ import { addresses } from "./constant/addresses"; import { abis } from "./constant/abis"; import { abi } from "../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json"; -export default async function(owner: any) { +export async function buildDSAv2(owner: any) { const instaIndex = await ethers.getContractAt( abis.core.instaIndex, addresses.core.instaIndex diff --git a/scripts/deploy.js b/scripts/deploy.js deleted file mode 100644 index 26f65d8e..00000000 --- a/scripts/deploy.js +++ /dev/null @@ -1,38 +0,0 @@ -const hre = require("hardhat"); -const { ethers } = hre; - -const deployConnector = require("./deployConnector"); - -async function main() { - const accounts = await hre.ethers.getSigners() - const wallet = accounts[0] - - const connectMapping = { - '1INCH-A': 'ConnectV2OneInch', - '1INCH-B': 'ConnectV2OneProto', - 'AAVE-V1-A': 'ConnectV2AaveV1', - 'AAVE-V2-A': 'ConnectV2AaveV2', - 'AUTHORITY-A': 'ConnectV2Auth', - 'BASIC-A': 'ConnectV2Basic', - 'COMP-A': 'ConnectV2COMP', - 'COMPOUND-A': 'ConnectV2Compound', - 'DYDX-A': 'ConnectV2Dydx', - 'FEE-A': 'ConnectV2Fee', - 'GELATO-A': 'ConnectV2Gelato', - 'MAKERDAO-A': 'ConnectV2Maker', - 'UNISWAP-A': 'ConnectV2UniswapV2' - } - - const addressMapping = {} - - for (const key in connectMapping) { - addressMapping[key] = await deployConnector(connectMapping[key]) - } -} - -main() - .then(() => process.exit(0)) - .catch(error => { - console.error(error); - process.exit(1); - }); diff --git a/scripts/deploy.ts b/scripts/deploy.ts new file mode 100644 index 00000000..209f908a --- /dev/null +++ b/scripts/deploy.ts @@ -0,0 +1,36 @@ +import { ethers } from "hardhat"; +import { deployConnector } from "./deployConnector"; + +async function main() { + const accounts = await ethers.getSigners(); + const wallet = accounts[0]; + + const connectMapping = { + "1INCH-A": "ConnectV2OneInch", + "1INCH-B": "ConnectV2OneProto", + "AAVE-V1-A": "ConnectV2AaveV1", + "AAVE-V2-A": "ConnectV2AaveV2", + "AUTHORITY-A": "ConnectV2Auth", + "BASIC-A": "ConnectV2Basic", + "COMP-A": "ConnectV2COMP", + "COMPOUND-A": "ConnectV2Compound", + "DYDX-A": "ConnectV2Dydx", + "FEE-A": "ConnectV2Fee", + "GELATO-A": "ConnectV2Gelato", + "MAKERDAO-A": "ConnectV2Maker", + "UNISWAP-A": "ConnectV2UniswapV2", + }; + + const addressMapping = {}; + + for (const key in connectMapping) { + addressMapping[key] = await deployConnector(connectMapping[key]); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployAndEnableConnector.js b/scripts/deployAndEnableConnector.js deleted file mode 100644 index 42d331d1..00000000 --- a/scripts/deployAndEnableConnector.js +++ /dev/null @@ -1,19 +0,0 @@ -const abis = require("./constant/abis"); -const addresses = require("./constant/addresses"); - -const hre = require("hardhat"); -const { ethers, waffle } = hre; -const { deployContract } = waffle; -const fs = require("fs") - - -module.exports = async function ({connectorName, contractArtifact, signer, connectors}) { - const connectorInstanace = await deployContract(signer, contractArtifact, []); - - await connectors.connect(signer).addConnectors([connectorName], [connectorInstanace.address]) - - addresses.connectors[connectorName] = connectorInstanace.address - abis.connectors[connectorName] = contractArtifact.abi; - - return connectorInstanace; -}; diff --git a/scripts/deployAndEnableConnector.ts b/scripts/deployAndEnableConnector.ts new file mode 100644 index 00000000..456f5076 --- /dev/null +++ b/scripts/deployAndEnableConnector.ts @@ -0,0 +1,25 @@ +import { addresses } from "./constant/addresses"; +import { abis } from "./constant/abis"; + +// const { deployContract } = waffle; +import { ethers } from "hardhat"; +import { promises as fs } from "fs"; +import { deployContract } from "ethereum-waffle"; + +export async function deployAndEnableConnector({ + connectorName, + contractArtifact, + signer, + connectors, +}) { + const connectorInstanace = await deployContract(signer, contractArtifact, []); + + await connectors + .connect(signer) + .addConnectors([connectorName], [connectorInstanace.address]); + + addresses.connectors[connectorName] = connectorInstanace.address; + abis.connectors[connectorName] = contractArtifact.abi; + + return connectorInstanace; +} diff --git a/scripts/deployConnector.js b/scripts/deployConnector.js deleted file mode 100644 index f0ae463d..00000000 --- a/scripts/deployConnector.js +++ /dev/null @@ -1,24 +0,0 @@ -const hre = require("hardhat"); -const { ethers } = hre; - -module.exports = async (connectorName) => { - const Connector = await ethers.getContractFactory(connectorName); - const connector = await Connector.deploy(); - await connector.deployed(); - - console.log(`${connectorName} Deployed: ${connector.address}`); - - try { - await hre.run("verify:verify", { - address: connector.address, - constructorArguments: [] - } - ) - } catch (error) { - console.log(`Failed to verify: ${connectorName}@${connector.address}`) - console.log(error) - console.log() - } - - return connector.address -} \ No newline at end of file diff --git a/scripts/deployConnector.ts b/scripts/deployConnector.ts new file mode 100644 index 00000000..44e4667d --- /dev/null +++ b/scripts/deployConnector.ts @@ -0,0 +1,10 @@ +import { ethers } from "hardhat"; + +export const deployConnector = async (connectorName: string) => { + const Connector = await ethers.getContractFactory(connectorName); + const connector = await Connector.deploy(); + await connector.deployed(); + + console.log(`${connectorName} Deployed: ${connector.address}`); + return connector.address; +}; diff --git a/scripts/encodeSpells.js b/scripts/encodeSpells.js deleted file mode 100644 index 719ca8be..00000000 --- a/scripts/encodeSpells.js +++ /dev/null @@ -1,18 +0,0 @@ -const abis = require("./constant/abis"); -const addresses = require("./constant/addresses"); -const { web3 } = hre; - -module.exports = function (spells) { - const targets = spells.map(a => a.connector) - const calldatas = spells.map(a => { - const functionName = a.method; - // console.log(functionName) - const abi = abis.connectors[a.connector].find(b => { - return b.name === functionName - }); - // console.log(functionName) - if (!abi) throw new Error("Couldn't find function") - return web3.eth.abi.encodeFunctionCall(abi, a.args) - }) - return [targets, calldatas] -}; diff --git a/scripts/encodeSpells.ts b/scripts/encodeSpells.ts new file mode 100644 index 00000000..9f4ac21b --- /dev/null +++ b/scripts/encodeSpells.ts @@ -0,0 +1,18 @@ +import { web3 } from "hardhat"; +import { addresses } from "./constant/addresses"; +import { abis } from "./constant/abis"; + +export function encodeSpells(spells: any[]) { + const targets = spells.map((a) => a.connector); + const calldatas = spells.map((a) => { + const functionName = a.method; + // console.log(functionName) + const abi = abis.connectors[a.connector].find((b) => { + return b.name === functionName; + }); + // console.log(functionName) + if (!abi) throw new Error("Couldn't find function"); + return web3.eth.abi.encodeFunctionCall(abi, a.args); + }); + return [targets, calldatas]; +} diff --git a/scripts/getMasterSigner.js b/scripts/getMasterSigner.ts similarity index 68% rename from scripts/getMasterSigner.js rename to scripts/getMasterSigner.ts index d0c19d6a..0c0778d5 100644 --- a/scripts/getMasterSigner.js +++ b/scripts/getMasterSigner.ts @@ -1,9 +1,8 @@ -const hre = require("hardhat"); -const { ethers } = hre; -const addresses = require("./constant/addresses"); -const abis = require("./constant/abis"); +import { ethers, network } from "hardhat"; +import { addresses } from "./constant/addresses"; +import { abis } from "./constant/abis"; -module.exports = async function() { +export async function getMasterSigner() { const [_, __, ___, wallet3] = await ethers.getSigners(); const instaIndex = new ethers.Contract( addresses.core.instaIndex, @@ -12,7 +11,7 @@ module.exports = async function() { ); const masterAddress = await instaIndex.master(); // TODO: make it constant? - await hre.network.provider.request({ + await network.provider.request({ method: "hardhat_impersonateAccount", params: [masterAddress], }); @@ -22,4 +21,4 @@ module.exports = async function() { }); return await ethers.getSigner(masterAddress); -}; +} diff --git a/scripts/impersonate.ts b/scripts/impersonate.ts index 9e3c73ac..29f010d8 100644 --- a/scripts/impersonate.ts +++ b/scripts/impersonate.ts @@ -10,6 +10,5 @@ export const impersonateAccounts = async (accounts: any) => { signers.push(await ethers.getSigner(account)); } - return signers; }; From 9ccfd634d9b666b184b8469bfc13e77f3c762ec2 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sat, 4 Dec 2021 18:38:16 +0530 Subject: [PATCH 04/39] update --- scripts/deployAvaxConnector.ts | 24 +++++ scripts/deployCompoundMapping.ts | 79 +++++++++++++++++ scripts/deployConnectorsFromCmd.ts | 111 ++++++++++++++++++++++++ scripts/deployInstaMappingController.ts | 37 ++++++++ scripts/deployMappingContract.ts | 34 ++++++++ scripts/deploySingle.ts | 27 ++++++ scripts/encodeFlashcastData.ts | 16 ++++ 7 files changed, 328 insertions(+) create mode 100644 scripts/deployAvaxConnector.ts create mode 100644 scripts/deployCompoundMapping.ts create mode 100644 scripts/deployConnectorsFromCmd.ts create mode 100644 scripts/deployInstaMappingController.ts create mode 100644 scripts/deployMappingContract.ts create mode 100644 scripts/deploySingle.ts create mode 100644 scripts/encodeFlashcastData.ts diff --git a/scripts/deployAvaxConnector.ts b/scripts/deployAvaxConnector.ts new file mode 100644 index 00000000..645a3b98 --- /dev/null +++ b/scripts/deployAvaxConnector.ts @@ -0,0 +1,24 @@ +import * as hre from "hardhat"; +const { ethers, deployments, getUnnamedAccounts } = hre; +const { deploy } = deployments; + +async function main() { + const deployer = (await getUnnamedAccounts())[0]; + const connector = "ConnectV2InstaPoolV3Avalanche"; + + const connectorInstance = await deploy(connector, { + from: deployer, + }); + console.log(`${connector} deployed: `, connectorInstance.address); + + await hre.run("sourcify", { + address: connectorInstance.address, + }); +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployCompoundMapping.ts b/scripts/deployCompoundMapping.ts new file mode 100644 index 00000000..3534208d --- /dev/null +++ b/scripts/deployCompoundMapping.ts @@ -0,0 +1,79 @@ +import * as hre from "hardhat"; +const { ethers } = hre; +async function main() { + const CONNECTORS_V2 = "0x97b0B3A8bDeFE8cB9563a3c610019Ad10DB8aD11"; + + const ctokenMapping = { + "ETH-A": "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5", + "BAT-A": "0x6c8c6b02e7b2be14d4fa6022dfd6d75921d90e4e", + "COMP-A": "0x70e36f6bf80a52b3b46b3af8e106cc0ed743e8e4", + "DAI-A": "0x5d3a536e4d6dbd6114cc1ead35777bab948e3643", + "REP-A": "0x158079ee67fce2f58472a96584a73c7ab9ac95c1", + "UNI-A": "0x35a18000230da775cac24873d00ff85bccded550", + "USDC-A": "0x39aa39c021dfbae8fac545936693ac917d5e7563", + "USDT-A": "0xf650c3d88d12db855b8bf7d11be6c55a4e07dcc9", + "WBTC-A": "0xc11b1268c1a384e55c48c2391d8d480264a3a7f4", + "WBTC-B": "0xccF4429DB6322D5C611ee964527D42E5d685DD6a", + "ZRX-A": "0xb3319f5d18bc0d84dd1b4825dcde5d5f7266d407", + "YFI-A": "0x80a2ae356fc9ef4305676f7a3e2ed04e12c33946", + "SUSHI-A": "0x4b0181102a0112a2ef11abee5563bb4a3176c9d7", + "MKR-A": "0x95b4ef2869ebd94beb4eee400a99824bf5dc325b", + "AAVE-A": "0xe65cdb6479bac1e22340e4e755fae7e509ecd06c", + "TUSD-A": "0x12392f67bdf24fae0af363c24ac620a2f67dad86", + "LINK-A": "0xface851a4921ce59e912d19329929ce6da6eb0c7", + }; + + const tokenMapping = { + "ETH-A": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", + "BAT-A": "0x0D8775F648430679A709E98d2b0Cb6250d2887EF", + "COMP-A": "0xc00e94cb662c3520282e6f5717214004a7f26888", + "DAI-A": "0x6b175474e89094c44da98b954eedeac495271d0f", + "REP-A": "0x1985365e9f78359a9B6AD760e32412f4a445E862", + "UNI-A": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", + "USDC-A": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "USDT-A": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "WBTC-A": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", + "WBTC-B": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", + "ZRX-A": "0xe41d2489571d322189246dafa5ebde1f4699f498", + "YFI-A": "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e", + "SUSHI-A": "0x6B3595068778DD592e39A122f4f5a5cF09C90fE2", + "MKR-A": "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2", + "AAVE-A": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9", + "TUSD-A": "0x0000000000085d4780B73119b644AE5ecd22b376", + "LINK-A": "0x514910771af9ca656af840dff83e8264ecf986ca", + }; + + const Mapping = await ethers.getContractFactory("InstaCompoundMapping"); + const mapping = await Mapping.deploy( + CONNECTORS_V2, + Object.keys(ctokenMapping), + Object.values(tokenMapping), + Object.values(ctokenMapping) + ); + await mapping.deployed(); + + console.log(`InstaCompoundMapping Deployed: ${mapping.address}`); + + try { + await hre.run("verify:verify", { + address: mapping.address, + constructorArguments: [ + CONNECTORS_V2, + Object.keys(ctokenMapping), + Object.values(tokenMapping), + Object.values(ctokenMapping), + ], + }); + } catch (error) { + console.log(`Failed to verify: InstaCompoundMapping@${mapping.address}`); + console.log(error); + console.log(); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployConnectorsFromCmd.ts b/scripts/deployConnectorsFromCmd.ts new file mode 100644 index 00000000..3fa462e6 --- /dev/null +++ b/scripts/deployConnectorsFromCmd.ts @@ -0,0 +1,111 @@ +import * as fs from "fs"; +import { ethers, network, config } from "hardhat"; + +let args = process.argv; +args = args.splice(2, args.length); +let params = {}; + +for (let i = 0; i < args.length; i += 2) { + if (args[i][0] !== "-" || args[i][1] !== "-") { + console.log("Please add '--' for the key"); + process.exit(-1); + } + let key = args[i].slice(2, args[i].length); + params[key] = args[i + 1]; +} + +if (!params.hasOwnProperty("connector")) { + console.error("Should include connector params"); + process.exit(-1); +} + +if (!params.hasOwnProperty("network")) { + console.error("Should include network params"); + process.exit(-1); +} + +if (!params.hasOwnProperty("gasPrice")) { + console.error("Should include gas params"); + process.exit(-1); +} + +let privateKey = process.env.PRIVATE_KEY; +let provider = new ethers.providers.JsonRpcProvider( + config.networks[params["network"]].url +); +let wallet = new ethers.Wallet(privateKey, provider); + +network.name = params["networkName"]; +network.config = config.networks[params["networkName"]]; +network.provider = provider; +let contracts = []; + +const parseFile = async (filePath: fs.PathOrFileDescriptor) => { + const data = fs.readFileSync(filePath, "utf-8"); + let parsedData = data.split("contract "); + parsedData = parsedData[parsedData.length - 1].split(" "); + parsedData = parsedData[0]; + return parsedData; +}; + +const parseDir = async (root, basePath, addPath) => { + for (let i = 0; i < root.length; i++) { + addPath = "/" + root[i]; + const dir = fs.readdirSync(basePath + addPath); + if (dir.indexOf("main.sol") !== -1) { + const fileData = await parseFile(basePath + addPath + "/main.sol"); + contracts.push(fileData); + } else { + await parseDir(dir, basePath + addPath, ""); + } + } +}; + +const main = async () => { + const mainnet = fs.readdirSync("./contracts/mainnet/connectors/"); + const polygon = fs.readdirSync("./contracts/polygon/connectors/"); + let basePathMainnet = "./contracts/mainnet/connectors/"; + let basePathPolygon = "./contracts/polygon/connectors/"; + + const connectorName = params["connector"]; + + await parseDir(mainnet, basePathMainnet, ""); + await parseDir(polygon, basePathPolygon, ""); + + if (contracts.indexOf(connectorName) === -1) { + throw new Error( + "can not find the connector!\n" + + "supported connector names are:\n" + + contracts.join("\n") + ); + } + + const Connector = await ethers.getContractFactory(connectorName); + const connector = await Connector.connect(wallet).deploy({ + gasPrice: ethers.utils.parseUnits(params["gasPrice"], "gwei"), + }); + await connector.deployed(); + + console.log(`${connectorName} Deployed: ${connector.address}`); + try { + await hre.run("verify:verify", { + address: connector.address, + constructorArguments: [], + }); + } catch (error) { + console.log(`Failed to verify: ${connectorName}@${connector.address}`); + console.log(error); + } + + return connector.address; +}; + +main() + .then(() => { + console.log("Done successfully"); + process.exit(0); + }) + .catch((err) => { + console.log("error:", err); + process.exit(1); + }); diff --git a/scripts/deployInstaMappingController.ts b/scripts/deployInstaMappingController.ts new file mode 100644 index 00000000..abdacfb8 --- /dev/null +++ b/scripts/deployInstaMappingController.ts @@ -0,0 +1,37 @@ +import * as hre from "hardhat"; +const { ethers } = hre; + +async function main() { + if (hre.network.name === "mainnet") { + console.log("\n\n Deploying Contracts to mainnet. Hit ctrl + c to abort"); + } else if (hre.network.name === "hardhat") { + console.log("\n\n Deploying Contracts to hardhat."); + } + + const InstaMappingController = await ethers.getContractFactory( + "InstaMappingController" + ); + const instaMappingController = await InstaMappingController.deploy(); + await instaMappingController.deployed(); + + console.log( + "InstaMappingController deployed: ", + instaMappingController.address + ); + + if (hre.network.name === "mainnet") { + await hre.run("verify:verify", { + address: instaMappingController.address, + constructorArguments: [], + }); + } else if (hre.network.name === "hardhat") { + console.log("Contracts deployed."); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployMappingContract.ts b/scripts/deployMappingContract.ts new file mode 100644 index 00000000..c55d9991 --- /dev/null +++ b/scripts/deployMappingContract.ts @@ -0,0 +1,34 @@ +import * as hre from "hardhat"; +const { ethers } = hre; + +async function main() { + if (hre.network.name === "mainnet") { + console.log("\n\n Deploying Contracts to mainnet. Hit ctrl + c to abort"); + } else if (hre.network.name === "hardhat") { + console.log("\n\n Deploying Contracts to hardhat."); + } + + const mappingContract = "CONTRACT_NAME"; + + const InstaProtocolMapping = await ethers.getContractFactory(mappingContract); + const instaProtocolMapping = await InstaProtocolMapping.deploy(); + await instaProtocolMapping.deployed(); + + console.log(`${mappingContract} deployed: `, instaProtocolMapping.address); + + if (hre.network.name === "mainnet") { + await hre.run("verify:verify", { + address: instaProtocolMapping.address, + constructorArguments: [], + }); + } else if (hre.network.name === "hardhat") { + console.log("Contracts deployed."); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deploySingle.ts b/scripts/deploySingle.ts new file mode 100644 index 00000000..a8bb344a --- /dev/null +++ b/scripts/deploySingle.ts @@ -0,0 +1,27 @@ +import * as hre from "hardhat"; +const { ethers } = hre; + +const deployConnector = require("./deployConnector"); + +async function main() { + const address = await deployConnector("ConnectOne"); // Example + + const connectorsAbi = [ + "function addConnectors(string[] _connectorNames, address[] _connectors)", + ]; + + const connectorsContract = new ethers.Contract( + "0x84b457c6D31025d56449D5A01F0c34bF78636f67", + connectorsAbi, + ethers.provider + ); + + await connectorsContract.addConnectors(["1inch"], [address]); +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/encodeFlashcastData.ts b/scripts/encodeFlashcastData.ts new file mode 100644 index 00000000..3bfdd432 --- /dev/null +++ b/scripts/encodeFlashcastData.ts @@ -0,0 +1,16 @@ +import { addresses } from "./constant/addresses"; +import { abis } from "./constant/abis"; +import * as hre from "hardhat"; +const { web3 } = hre; + +import { encodeSpells } from "./encodeSpells.js"; + +module.exports = function(spells: any) { + const encodeSpellsData = encodeSpells(spells); + const targetType = "string[]"; + let argTypes = [targetType, "bytes[]"]; + return web3.eth.abi.encodeParameters(argTypes, [ + encodeSpellsData[0], + encodeSpellsData[1], + ]); +}; From 34b1c12159049c3727ba849f9113456c9e82d14f Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sat, 4 Dec 2021 18:40:15 +0530 Subject: [PATCH 05/39] update --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 26988819..74758d38 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,4 @@ build/contracts # buidler artifacts cache +typechain \ No newline at end of file From 280c03dae1b620e77feb1907cf18e872b16ac7e6 Mon Sep 17 00:00:00 2001 From: 0xBhavik <62445791+bhavik-m@users.noreply.github.com> Date: Thu, 2 Dec 2021 23:01:51 +0530 Subject: [PATCH 06/39] Testcases typescript (#124) * initial commit * converted testcases to ts * Update test/mainnet/aave/v1.test.ts Co-authored-by: 0xPradyuman <63545809+pradyuman-verma@users.noreply.github.com> * Update test/mainnet/aave/v1.test.ts Co-authored-by: 0xPradyuman <63545809+pradyuman-verma@users.noreply.github.com> * Update test/mainnet/aave/v1.test.ts Co-authored-by: 0xPradyuman <63545809+pradyuman-verma@users.noreply.github.com> * updated test * updated-test * removed typechain Co-authored-by: 0xPradyuman <63545809+pradyuman-verma@users.noreply.github.com> --- test/mainnet/aave/{v1.test.js => v1.test.ts} | 57 +- test/mainnet/aave/v2.test.ts | 58 +- test/mainnet/b.protocol/b.compound.test.js | 139 --- test/mainnet/b.protocol/b.compound.test.ts | 139 +++ .../{b.liquity.test.js => b.liquity.test.ts} | 45 +- .../{b.maker.test.js => b.maker.test.ts} | 38 +- ...RC1155-transfer.js => ERC1155-transfer.ts} | 42 +- ...{ERC721-transfer.js => ERC721-transfer.ts} | 45 +- .../{compound.test.js => compound.test.ts} | 34 +- .../{instapool.test.js => instapool.test.ts} | 33 +- ...uity.contracts.js => liquity.contracts.ts} | 0 ...{liquity.helpers.js => liquity.helpers.ts} | 36 +- .../{liquity.test.js => liquity.test.ts} | 12 +- .../{mappings.test.js => mappings.test.ts} | 14 +- .../pooltogether-polygon/pooltogether.test.js | 420 --------- .../pooltogether-polygon/pooltogether.test.ts | 422 +++++++++ .../mainnet/pooltogether/pooltogether.test.js | 811 ------------------ .../mainnet/pooltogether/pooltogether.test.ts | 811 ++++++++++++++++++ ...swap-sell-beta.js => uniswap-sell-beta.ts} | 10 +- .../{uniswap.test.js => uniswap.test.ts} | 61 +- ...swapStake.test.js => uniswapStake.test.ts} | 46 +- test/mainnet/yearn/yearn.test.js | 153 ---- test/mainnet/yearn/yearn.test.ts | 154 ++++ yarn.lock | 23 +- 24 files changed, 1801 insertions(+), 1802 deletions(-) rename test/mainnet/aave/{v1.test.js => v1.test.ts} (73%) delete mode 100644 test/mainnet/b.protocol/b.compound.test.js create mode 100644 test/mainnet/b.protocol/b.compound.test.ts rename test/mainnet/b.protocol/{b.liquity.test.js => b.liquity.test.ts} (85%) rename test/mainnet/b.protocol/{b.maker.test.js => b.maker.test.ts} (92%) rename test/mainnet/basic-ERC1155/{ERC1155-transfer.js => ERC1155-transfer.ts} (78%) rename test/mainnet/basic-ERC721/{ERC721-transfer.js => ERC721-transfer.ts} (78%) rename test/mainnet/compound/{compound.test.js => compound.test.ts} (83%) rename test/mainnet/instapool/{instapool.test.js => instapool.test.ts} (77%) rename test/mainnet/liquity/{liquity.contracts.js => liquity.contracts.ts} (100%) rename test/mainnet/liquity/{liquity.helpers.js => liquity.helpers.ts} (89%) rename test/mainnet/liquity/{liquity.test.js => liquity.test.ts} (99%) rename test/mainnet/mappings/{mappings.test.js => mappings.test.ts} (95%) delete mode 100644 test/mainnet/pooltogether-polygon/pooltogether.test.js create mode 100644 test/mainnet/pooltogether-polygon/pooltogether.test.ts delete mode 100644 test/mainnet/pooltogether/pooltogether.test.js create mode 100644 test/mainnet/pooltogether/pooltogether.test.ts rename test/mainnet/uniswap-sell-beta/{uniswap-sell-beta.js => uniswap-sell-beta.ts} (93%) rename test/mainnet/uniswap/{uniswap.test.js => uniswap.test.ts} (83%) rename test/mainnet/uniswapStake/{uniswapStake.test.js => uniswapStake.test.ts} (87%) delete mode 100644 test/mainnet/yearn/yearn.test.js create mode 100644 test/mainnet/yearn/yearn.test.ts diff --git a/test/mainnet/aave/v1.test.js b/test/mainnet/aave/v1.test.ts similarity index 73% rename from test/mainnet/aave/v1.test.js rename to test/mainnet/aave/v1.test.ts index e93dddb6..f1a9d7e6 100644 --- a/test/mainnet/aave/v1.test.js +++ b/test/mainnet/aave/v1.test.ts @@ -1,28 +1,29 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); -const abis = require("../../../scripts/constant/abis"); -const addresses = require("../../../scripts/constant/addresses"); -const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector"); -const getMasterSigner = require("../../../scripts/getMasterSigner"); -const buildDSAv2 = require("../../../scripts/buildDSAv2"); -const ConnectV2AaveV1 = require("../../artifacts/contracts/mainnet/connectors/aave/v1/main.sol/ConnectV2AaveV1.json"); -const { parseEther } = require("@ethersproject/units"); -const encodeSpells = require("../../../scripts/encodeSpells"); -const tokens = require("../../../scripts/constant/tokens"); -const constants = require("../../../scripts/constant/constant"); -const addLiquidity = require("../../../scripts/addLiquidity"); -const { ethers } = hre; +import { expect } from "chai"; +import "hardhat"; +import { abis } from "../../../scripts/constant/abis"; +import { addresses } from "../../../scripts/constant/addresses"; +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector"; +import { getMasterSigner } from "../../../scripts/getMasterSigner"; +import { buildDSAv2 } from "../../../scripts/buildDSAv2"; + +import ConnectV2AaveV1 from "../../artifacts/contracts/mainnet/connectors/aave/v1/main.sol/ConnectV2AaveV1.json"; +import { parseEther } from "@ethersproject/units"; +import { encodeSpells } from "../../../scripts/encodeSpells"; +import { tokens } from "../../../scripts/constant/tokens"; +import { constants } from "../../../scripts/constant/constant"; +import { addLiquidity } from "../../../scripts/addLiquidity"; +// const { ethers } = hre; const ALCHEMY_ID = process.env.ALCHEMY_ID; -describe("Aave V1", function() { +describe("Aave V1", function () { const connectorName = "AAVEV1-TEST-A"; - let wallet0, wallet1; - let dsaWallet0; - let instaConnectorsV2; - let connector; - let masterSigner; + let wallet0: any, wallet1: any; + let dsaWallet0: any; + let instaConnectorsV2: any; + let connector: any; + let masterSigner: any; before(async () => { try { @@ -61,13 +62,13 @@ describe("Aave V1", function() { expect(!!masterSigner.address).to.be.true; }); - describe("DSA wallet setup", function() { - it("Should build DSA v2", async function() { + describe("DSA wallet setup", function () { + it("Should build DSA v2", async function () { dsaWallet0 = await buildDSAv2(wallet0.address); expect(!!dsaWallet0.address).to.be.true; }); - it("Deposit ETH into DSA wallet", async function() { + it("Deposit ETH into DSA wallet", async function () { await wallet0.sendTransaction({ to: dsaWallet0.address, value: parseEther("10"), @@ -78,8 +79,8 @@ describe("Aave V1", function() { }); }); - describe("Main", function() { - it("should deposit ETH in Aave V1", async function() { + describe("Main", function () { + it("should deposit ETH in Aave V1", async function () { const amt = parseEther("1"); const spells = [ { @@ -100,7 +101,7 @@ describe("Aave V1", function() { ); }); - it("Should borrow and payback DAI from Aave V1", async function() { + it("Should borrow and payback DAI from Aave V1", async function () { const amt = parseEther("100"); // 100 DAI // add a little amount of dai to cover any shortfalls @@ -129,7 +130,7 @@ describe("Aave V1", function() { ); }); - it("Should deposit all ETH in Aave V1", async function() { + it("Should deposit all ETH in Aave V1", async function () { const spells = [ { connector: connectorName, @@ -147,7 +148,7 @@ describe("Aave V1", function() { ); }); - it("Should withdraw all ETH from Aave V1", async function() { + it("Should withdraw all ETH from Aave V1", async function () { const spells = [ { connector: connectorName, diff --git a/test/mainnet/aave/v2.test.ts b/test/mainnet/aave/v2.test.ts index 67aac908..b836b088 100644 --- a/test/mainnet/aave/v2.test.ts +++ b/test/mainnet/aave/v2.test.ts @@ -1,26 +1,26 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); -const abis = require("../../scripts/constant/abis"); -const addresses = require("../../scripts/constant/addresses"); -const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector"); -const getMasterSigner = require("../../scripts/getMasterSigner"); -const buildDSAv2 = require("../../scripts/buildDSAv2"); -const ConnectV2AaveV2 = require("../../artifacts/contracts/mainnet/connectors/aave/v2/main.sol/ConnectV2AaveV2.json"); -const { parseEther } = require("@ethersproject/units"); -const encodeSpells = require("../../scripts/encodeSpells"); -const tokens = require("../../scripts/constant/tokens"); -const constants = require("../../scripts/constant/constant"); -const addLiquidity = require("../../scripts/addLiquidity"); -const { ethers } = hre; +import { expect } from "chai"; +import hre from "hardhat"; +import { abis } from "../../../scripts/constant/abis"; +import { addresses } from "../../../scripts/constant/addresses"; +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector"; +import { getMasterSigner } from "../../../scripts/getMasterSigner"; +import { buildDSAv2 } from "../../../scripts/buildDSAv2"; +import { ConnectV2AaveV2 } from "../../artifacts/contracts/mainnet/connectors/aave/v2/main.sol/ConnectV2AaveV2.json"; +import { parseEther } from "@ethersproject/units"; +import { encodeSpells } from "../../../scripts/encodeSpells"; +import { tokens } from "../../../scripts/constant/tokens"; +import { constants } from "../../../scripts/constant/constant"; +import { addLiquidity } from "../../../scripts/addLiquidity"; +// const { ethers } = hre; -describe("Aave V2", function() { +describe("Aave V2", function () { const connectorName = "AAVEV2-TEST-A"; - let wallet0, wallet1; - let dsaWallet0; - let instaConnectorsV2; - let connector; - let masterSigner; + let wallet0: any, wallet1: any; + let dsaWallet0: any; + let instaConnectorsV2: any; + let connector: any; + let masterSigner: any; before(async () => { await hre.network.provider.request({ @@ -55,13 +55,13 @@ describe("Aave V2", function() { expect(!!masterSigner.address).to.be.true; }); - describe("DSA wallet setup", function() { - it("Should build DSA v2", async function() { + describe("DSA wallet setup", function () { + it("Should build DSA v2", async function () { dsaWallet0 = await buildDSAv2(wallet0.address); expect(!!dsaWallet0.address).to.be.true; }); - it("Deposit ETH into DSA wallet", async function() { + it("Deposit ETH into DSA wallet", async function () { await wallet0.sendTransaction({ to: dsaWallet0.address, value: parseEther("10"), @@ -72,8 +72,8 @@ describe("Aave V2", function() { }); }); - describe("Main", function() { - it("should deposit ETH in Aave V2", async function() { + describe("Main", function () { + it("should deposit ETH in Aave V2", async function () { const amt = parseEther("1"); const spells = [ { @@ -94,7 +94,7 @@ describe("Aave V2", function() { ); }); - it("Should borrow and payback DAI from Aave V2", async function() { + it("Should borrow and payback DAI from Aave V2", async function () { const amt = parseEther("100"); // 100 DAI const setId = "83478237"; const spells = [ @@ -119,7 +119,7 @@ describe("Aave V2", function() { ); }); - it("Should borrow and payback half DAI from Aave V2", async function() { + it("Should borrow and payback half DAI from Aave V2", async function () { const amt = parseEther("100"); // 100 DAI // const setId = "83478237"; await addLiquidity("dai", dsaWallet0.address, parseEther("1")); @@ -161,7 +161,7 @@ describe("Aave V2", function() { ); }); - it("Should deposit all ETH in Aave V2", async function() { + it("Should deposit all ETH in Aave V2", async function () { const spells = [ { connector: connectorName, @@ -179,7 +179,7 @@ describe("Aave V2", function() { ); }); - it("Should withdraw all ETH from Aave V2", async function() { + it("Should withdraw all ETH from Aave V2", async function () { const spells = [ { connector: connectorName, diff --git a/test/mainnet/b.protocol/b.compound.test.js b/test/mainnet/b.protocol/b.compound.test.js deleted file mode 100644 index 582a01ca..00000000 --- a/test/mainnet/b.protocol/b.compound.test.js +++ /dev/null @@ -1,139 +0,0 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); -const { web3, deployments, waffle, ethers } = hre; -const { provider, deployContract } = waffle - -const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../scripts/buildDSAv2") -const encodeSpells = require("../../scripts/encodeSpells.js") -const getMasterSigner = require("../../scripts/getMasterSigner") - -const addresses = require("../../scripts/constant/addresses"); -const abis = require("../../scripts/constant/abis"); -const constants = require("../../scripts/constant/constant"); -const tokens = require("../../scripts/constant/tokens"); - -const connectV2CompoundArtifacts = require("../../artifacts/contracts/mainnet/connectors/b.protocol/compound/main.sol/ConnectV2BCompound.json") - -describe("B.Compound", function () { - const connectorName = "B.COMPOUND-TEST-A" - - let dsaWallet0 - let masterSigner; - let instaConnectorsV2; - let connector; - - const wallets = provider.getWallets() - const [wallet0, wallet1, wallet2, wallet3] = wallets - before(async () => { - await hre.network.provider.request({ - method: "hardhat_reset", - params: [ - { - forking: { - jsonRpcUrl: hre.config.networks.hardhat.forking.url, - blockNumber: 13300000, - }, - }, - ], - }); - masterSigner = await getMasterSigner(wallet3) - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); - connector = await deployAndEnableConnector({ - connectorName, - contractArtifact: connectV2CompoundArtifacts, - signer: masterSigner, - connectors: instaConnectorsV2 - }) - console.log("Connector address", connector.address) - }) - - it("Should have contracts deployed.", async function () { - expect(!!instaConnectorsV2.address).to.be.true; - expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; - expect(await connector.name()).to.be.equal("B.Compound-v1.0"); - }); - - describe("DSA wallet setup", function () { - it("Should build DSA v2", async function () { - dsaWallet0 = await buildDSAv2(wallet0.address) - expect(!!dsaWallet0.address).to.be.true; - }); - - it("Deposit ETH into DSA wallet", async function () { - await wallet0.sendTransaction({ - to: dsaWallet0.address, - value: ethers.utils.parseEther("10") - }); - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("10")); - }); - }); - - describe("Main", function () { - - it("Should deposit ETH in Compound", async function () { - const amount = ethers.utils.parseEther("1") // 1 ETH - const spells = [ - { - connector: connectorName, - method: "deposit", - args: ["ETH-A", amount, 0, 0] - } - ] - - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("9")); - }); - - it("Should borrow and payback DAI from Compound", async function () { - const amount = ethers.utils.parseEther("100") // 100 DAI - const setId = "83478237" - const spells = [ - { - connector: connectorName, - method: "borrow", - args: ["DAI-A", amount, 0, setId] - }, - { - connector: connectorName, - method: "payback", - args: ["DAI-A", 0, setId, 0] - } - ] - - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("9")); - }); - - it("Should deposit all ETH in Compound", async function () { - const spells = [ - { - connector: connectorName, - method: "deposit", - args: ["ETH-A", constants.max_value, 0, 0] - } - ] - - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("0")); - }); - - it("Should withdraw all ETH from Compound", async function () { - const spells = [ - { - connector: connectorName, - method: "withdraw", - args: ["ETH-A", constants.max_value, 0, 0] - } - ] - - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("10")); - }); - }) -}) diff --git a/test/mainnet/b.protocol/b.compound.test.ts b/test/mainnet/b.protocol/b.compound.test.ts new file mode 100644 index 00000000..a8bfffe7 --- /dev/null +++ b/test/mainnet/b.protocol/b.compound.test.ts @@ -0,0 +1,139 @@ +import { expect } from "chai"; +import hre from "hardhat"; +const { web3, deployments, waffle, ethers } = hre; //check +const { provider, deployContract } = waffle + +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/buildDSAv2" +import { encodeSpells } from "../../../scripts/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/getMasterSigner" + +import { addresses } from "../../../scripts/constant/addresses"; +import { abis } from "../../../scripts/constant/abis"; +import { constants } from "../../../scripts/constant/constant"; +import { tokens } from "../../../scripts/constant/tokens"; + +import connectV2CompoundArtifacts from "../../artifacts/contracts/mainnet/connectors/b.protocol/compound/main.sol/ConnectV2BCompound.json" + +describe("B.Compound", function () { + const connectorName = "B.COMPOUND-TEST-A" + + let dsaWallet0: any; + let masterSigner: any; + let instaConnectorsV2: any; + let connector: any; + + const wallets = provider.getWallets() + const [wallet0, wallet1, wallet2, wallet3] = wallets + before(async () => { + await hre.network.provider.request({ + method: "hardhat_reset", + params: [ + { + forking: { + jsonRpcUrl: hre.config.networks.hardhat.forking.url, + blockNumber: 13300000, + }, + }, + ], + }); + masterSigner = await getMasterSigner(wallet3) + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); + connector = await deployAndEnableConnector({ + connectorName, + contractArtifact: connectV2CompoundArtifacts, + signer: masterSigner, + connectors: instaConnectorsV2 + }) + console.log("Connector address", connector.address) + }) + + it("Should have contracts deployed.", async function () { + expect(!!instaConnectorsV2.address).to.be.true; + expect(!!connector.address).to.be.true; + expect(!!masterSigner.address).to.be.true; + expect(await connector.name()).to.be.equal("B.Compound-v1.0"); + }); + + describe("DSA wallet setup", function () { + it("Should build DSA v2", async function () { + dsaWallet0 = await buildDSAv2(wallet0.address) + expect(!!dsaWallet0.address).to.be.true; + }); + + it("Deposit ETH into DSA wallet", async function () { + await wallet0.sendTransaction({ + to: dsaWallet0.address, + value: ethers.utils.parseEther("10") + }); + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("10")); + }); + }); + + describe("Main", function () { + + it("Should deposit ETH in Compound", async function () { + const amount = ethers.utils.parseEther("1") // 1 ETH + const spells = [ + { + connector: connectorName, + method: "deposit", + args: ["ETH-A", amount, 0, 0] + } + ] + + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("9")); + }); + + it("Should borrow and payback DAI from Compound", async function () { + const amount = ethers.utils.parseEther("100") // 100 DAI + const setId = "83478237" + const spells = [ + { + connector: connectorName, + method: "borrow", + args: ["DAI-A", amount, 0, setId] + }, + { + connector: connectorName, + method: "payback", + args: ["DAI-A", 0, setId, 0] + } + ] + + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("9")); + }); + + it("Should deposit all ETH in Compound", async function () { + const spells = [ + { + connector: connectorName, + method: "deposit", + args: ["ETH-A", constants.max_value, 0, 0] + } + ] + + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("0")); + }); + + it("Should withdraw all ETH from Compound", async function () { + const spells = [ + { + connector: connectorName, + method: "withdraw", + args: ["ETH-A", constants.max_value, 0, 0] + } + ] + + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("10")); + }); + }) +}) diff --git a/test/mainnet/b.protocol/b.liquity.test.js b/test/mainnet/b.protocol/b.liquity.test.ts similarity index 85% rename from test/mainnet/b.protocol/b.liquity.test.js rename to test/mainnet/b.protocol/b.liquity.test.ts index c50f111c..a59299a0 100644 --- a/test/mainnet/b.protocol/b.liquity.test.js +++ b/test/mainnet/b.protocol/b.liquity.test.ts @@ -1,19 +1,18 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); -const { web3, deployments, waffle, ethers } = hre; +import { expect } from "chai"; +import hre from "hardhat"; +const { web3, deployments, waffle, ethers } = hre; //check const { provider, deployContract } = waffle -const deployAndEnableConnector = require("../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../scripts/buildDSAv2") -const encodeSpells = require("../../scripts/encodeSpells.js") -const getMasterSigner = require("../../scripts/getMasterSigner") +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/buildDSAv2" +import { encodeSpells } from "../../../scripts/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/getMasterSigner" +import { addresses } from "../../../scripts/constant/addresses"; +import { abis } from "../../../scripts/constant/abis"; +import { constants } from "../../../scripts/constant/constant"; +import { tokens } from "../../../scripts/constant/tokens"; -const addresses = require("../../scripts/constant/addresses"); -const abis = require("../../scripts/constant/abis"); -const constants = require("../../scripts/constant/constant"); -const tokens = require("../../scripts/constant/tokens"); - -const connectorLiquityArtifacts = require("../../artifacts/contracts/mainnet/connectors/b.protocol/liquity/main.sol/ConnectV2BLiquity.json") +import connectorLiquityArtifacts from ("../../artifacts/contracts/mainnet/connectors/b.protocol/liquity/main.sol/ConnectV2BLiquity.json") const LUSD_WHALE = "0x66017D22b0f8556afDd19FC67041899Eb65a21bb" // stability pool @@ -22,16 +21,16 @@ const BAMM_ADDRESS = "0x0d3AbAA7E088C2c82f54B2f47613DA438ea8C598" describe("B.Liquity", function () { const connectorName = "B.LIQUITY-TEST-A" - let dsaWallet0; - let dsaWallet1; - let masterSigner; - let instaConnectorsV2; - let connector; - let manager; - let vat; - let lusd; - let bammToken; - let stabilityPool; + let dsaWallet0: any; + let dsaWallet1: any + let masterSigner: any; + let instaConnectorsV2: any; + let connector: any; + let manager: any; + let vat: any; + let lusd: any; + let bammToken: any; + let stabilityPool: any; const wallets = provider.getWallets() const [wallet0, wallet1, wallet2, wallet3] = wallets diff --git a/test/mainnet/b.protocol/b.maker.test.js b/test/mainnet/b.protocol/b.maker.test.ts similarity index 92% rename from test/mainnet/b.protocol/b.maker.test.js rename to test/mainnet/b.protocol/b.maker.test.ts index f6908f04..a04a0f20 100644 --- a/test/mainnet/b.protocol/b.maker.test.js +++ b/test/mainnet/b.protocol/b.maker.test.ts @@ -1,31 +1,31 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); +import { expect } from "chai"; +import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../../scripts/buildDSAv2") -const encodeSpells = require("../../../scripts/encodeSpells.js") -const getMasterSigner = require("../../../scripts/getMasterSigner") -const addresses = require("../../../scripts/constant/addresses"); -const abis = require("../../../scripts/constant/abis"); -const constants = require("../../../scripts/constant/constant"); -const tokens = require("../../../scripts/constant/tokens"); +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/buildDSAv2" +import { encodeSpells } from "../../../scripts/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/getMasterSigner" +import { addresses } from "../../../scripts/constant/addresses"; +import { abis } from "../../../scripts/constant/abis"; +import { constants } from "../../../scripts/constant/constant"; +import { tokens } from "../../../scripts/constant/tokens"; -const connectorMakerArtifacts = require("../../artifacts/contracts/mainnet/connectors/b.protocol/makerdao/main.sol/ConnectV2BMakerDAO.json") +import connectorMakerArtifacts from ("../../artifacts/contracts/mainnet/connectors/b.protocol/makerdao/main.sol/ConnectV2BMakerDAO.json") describe("B.Maker", function () { const connectorName = "B.MAKER-TEST-A" - let dsaWallet0; - let dsaWallet1; - let masterSigner; - let instaConnectorsV2; - let connector; - let manager; - let vat; - let dai; + let dsaWallet0: any; + let dsaWallet1: any; + let masterSigner: any; + let instaConnectorsV2: any; + let connector: any; + let manager: any; + let vat: any; + let dai: any; const wallets = provider.getWallets() const [wallet0, wallet1, wallet2, wallet3] = wallets diff --git a/test/mainnet/basic-ERC1155/ERC1155-transfer.js b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts similarity index 78% rename from test/mainnet/basic-ERC1155/ERC1155-transfer.js rename to test/mainnet/basic-ERC1155/ERC1155-transfer.ts index ff8d8e4a..66130bac 100644 --- a/test/mainnet/basic-ERC1155/ERC1155-transfer.js +++ b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts @@ -1,21 +1,21 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); +import { expect } from "chai" +import hre from "hardhat" const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -const { abi: implementationsABI } = require("../../../scripts/constant/abi/core/InstaImplementations.json") +import { abi: implementationsABI } from "../../../scripts/constant/abi/core/InstaImplementations.json" -const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../../scripts/buildDSAv2") -const encodeSpells = require("../../../scripts/encodeSpells.js") -const getMasterSigner = require("../../../scripts/getMasterSigner") +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/buildDSAv2" +import { encodeSpells } from "../../../scripts/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/getMasterSigner" -const addresses = require("../../../scripts/constant/addresses"); -const abis = require("../../../scripts/constant/abis"); -const constants = require("../../../scripts/constant/constant"); -const tokens = require("../../../scripts/constant/tokens"); +import { addresses } from "../../../scripts/constant/addresses" +import { abis } from "../../../scripts/constant/abis" +import { constants } from "../../../scripts/constant/constant" +import { tokens } from "../../../scripts/constant/tokens" -const connectV2BasicERC1155Artifacts = require("../../artifacts/contracts/mainnet/connectors/basic-ERC1155/main.sol/ConnectV2BasicERC1155.json") -const erc1155Artifacts = require("../../artifacts/@openzeppelin/contracts/token/ERC1155/IERC1155.sol/IERC1155.json") +import connectV2BasicERC1155Artifacts from "../../artifacts/contracts/mainnet/connectors/basic-ERC1155/main.sol/ConnectV2BasicERC1155.json" +import erc1155Artifacts from "../../artifacts/@openzeppelin/contracts/token/ERC1155/IERC1155.sol/IERC1155.json" const TOKEN_CONTRACT_ADDR = "0x1ca3262009b21F944e6b92a2a88D039D06F1acFa"; const TOKEN_OWNER_ADDR = "0x1ca3262009b21F944e6b92a2a88D039D06F1acFa"; @@ -26,13 +26,15 @@ const implementationsMappingAddr = "0xCBA828153d3a85b30B5b912e1f2daCac5816aE9D" describe("BASIC-ERC1155", function () { const connectorName = "BASIC-ERC1155-A" - let dsaWallet0 - let masterSigner; - let instaConnectorsV2; - let connector; - let nftContract; - let tokenOwner; - let instaImplementationsMapping; + let dsaWallet0: any; + let masterSigner: any; + let instaConnectorsV2: any; + let connector: any; + let nftContract: any; + let tokenOwner: any; + let instaImplementationsMapping: any; + let InstaAccountV2DefaultImpl: any; + let instaAccountV2DefaultImpl: any; const wallets = provider.getWallets() diff --git a/test/mainnet/basic-ERC721/ERC721-transfer.js b/test/mainnet/basic-ERC721/ERC721-transfer.ts similarity index 78% rename from test/mainnet/basic-ERC721/ERC721-transfer.js rename to test/mainnet/basic-ERC721/ERC721-transfer.ts index c11f02b4..63b96004 100644 --- a/test/mainnet/basic-ERC721/ERC721-transfer.js +++ b/test/mainnet/basic-ERC721/ERC721-transfer.ts @@ -1,21 +1,23 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); +import { expect } from "chai"; +import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -const { abi: implementationsABI } = require("../../../scripts/constant/abi/core/InstaImplementations.json") +import { abi : implementationsABI } from "../../../scripts/constant/abi/core/InstaImplementations.json" -const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../../scripts/buildDSAv2") -const encodeSpells = require("../../../scripts/encodeSpells.js") -const getMasterSigner = require("../../../scripts/getMasterSigner") -const addresses = require("../../../scripts/constant/addresses"); -const abis = require("../../../scripts/constant/abis"); -const constants = require("../../../scripts/constant/constant"); -const tokens = require("../../../scripts/constant/tokens"); +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/buildDSAv2" +import { encodeSpells } from "../../../scripts/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/getMasterSigner" -const connectV2BasicERC721Artifacts = require("../../artifacts/contracts/mainnet/connectors/basic-ERC721/main.sol/ConnectV2BasicERC721.json") -const erc721Artifacts = require("../../artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.json") + +import { addresses } from "../../../scripts/constant/addresses" +import { abis } from "../../../scripts/constant/abis" +import { constants } from "../../../scripts/constant/constant" +import { tokens } from "../../../scripts/constant/tokens" + +import connectV2BasicERC721Artifacts from "../../artifacts/contracts/mainnet/connectors/basic-ERC721/main.sol/ConnectV2BasicERC721.json" +import erc721Artifacts from "../../artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.json" const TOKEN_CONTRACT_ADDR = "0x4d695c615a7aacf2d7b9c481b66045bb2457dfde"; const TOKEN_OWNER_ADDR = "0x8c6b10d42ff08e56133fca0dac75e1931b1fcc23"; @@ -26,14 +28,15 @@ const implementationsMappingAddr = "0xCBA828153d3a85b30B5b912e1f2daCac5816aE9D" describe("BASIC-ERC721", function () { const connectorName = "BASIC-ERC721-A" - let dsaWallet0 - let masterSigner; - let instaConnectorsV2; - let connector; - let nftContract; - let tokenOwner; - let instaImplementationsMapping; - + let dsaWallet0: any; + let masterSigner: any; + let instaConnectorsV2: any; + let connector: any; + let nftContract: any; + let tokenOwner: any; + let instaImplementationsMapping: any; + let InstaAccountV2DefaultImpl: any; + let instaAccountV2DefaultImpl: any; const wallets = provider.getWallets() const [wallet0, wallet1, wallet2, wallet3] = wallets diff --git a/test/mainnet/compound/compound.test.js b/test/mainnet/compound/compound.test.ts similarity index 83% rename from test/mainnet/compound/compound.test.js rename to test/mainnet/compound/compound.test.ts index c977ca71..bf43420c 100644 --- a/test/mainnet/compound/compound.test.js +++ b/test/mainnet/compound/compound.test.ts @@ -1,27 +1,27 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); -const { web3, deployments, waffle, ethers } = hre; -const { provider, deployContract } = waffle +import { expect } from "chai"; +import hre from "hardhat"; +import { web3, deployments, waffle, ethers } = hre; +import { provider, deployContract } = waffle -const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../../scripts/buildDSAv2") -const encodeSpells = require("../../../scripts/encodeSpells.js") -const getMasterSigner = require("../../../scripts/getMasterSigner") +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/buildDSAv2" +import { encodeSpells } from "../../../scripts/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/getMasterSigner" -const addresses = require("../../../scripts/constant/addresses"); -const abis = require("../../../scripts/constant/abis"); -const constants = require("../../../scripts/constant/constant"); -const tokens = require("../../../scripts/constant/tokens"); +import { addresses } from "../../../scripts/constant/addresses"; +import { abis } from "../../../scripts/constant/abis"; +import { constants } from "../../../scripts/constant/constant"; +import { tokens } from "../../../scripts/constant/tokens"; -const connectV2CompoundArtifacts = require("../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json") +import connectV2CompoundArtifacts from "../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json" describe("Compound", function () { const connectorName = "COMPOUND-TEST-A" - let dsaWallet0 - let masterSigner; - let instaConnectorsV2; - let connector; + let dsaWallet0: any; + let masterSigner: any; + let instaConnectorsV2: any; + let connector: any; const wallets = provider.getWallets() const [wallet0, wallet1, wallet2, wallet3] = wallets diff --git a/test/mainnet/instapool/instapool.test.js b/test/mainnet/instapool/instapool.test.ts similarity index 77% rename from test/mainnet/instapool/instapool.test.js rename to test/mainnet/instapool/instapool.test.ts index 32fefb6f..11365223 100644 --- a/test/mainnet/instapool/instapool.test.js +++ b/test/mainnet/instapool/instapool.test.ts @@ -1,28 +1,29 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); +import { expect } from "chai"; +import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../../scripts/buildDSAv2") -const encodeSpells = require("../../../scripts/encodeSpells.js") -const encodeFlashcastData = require("../../../scripts/encodeFlashcastData.js") -const getMasterSigner = require("../../../scripts/getMasterSigner") +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/buildDSAv2" +import { encodeSpells } from "../../../scripts/encodeSpells.js" +import { encodeFlashcastData } from "../../../scripts/encodeFlashcastData.js" +import { getMasterSigner } from "../../../scripts/getMasterSigner" -const addresses = require("../../../scripts/constant/addresses"); -const abis = require("../../../scripts/constant/abis"); -const constants = require("../../../scripts/constant/constant"); -const tokens = require("../../../scripts/constant/tokens"); +import { addresses } from "../../../scripts/constant/addresses"; +import { abis } from "../../../scripts/constant/abis"; +import { constants } from "../../../scripts/constant/constant"; +import { tokens } from "../../../scripts/constant/tokens"; -const connectV2CompoundArtifacts = require("../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json") + +import connectV2CompoundArtifacts from "../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json" describe("Instapool", function () { const connectorName = "COMPOUND-TEST-A" - let dsaWallet0 - let masterSigner; - let instaConnectorsV2; - let connector; + let dsaWallet0: any; + let masterSigner: any; + let instaConnectorsV2: any; + let connector: any; const wallets = provider.getWallets() const [wallet0, wallet1, wallet2, wallet3] = wallets diff --git a/test/mainnet/liquity/liquity.contracts.js b/test/mainnet/liquity/liquity.contracts.ts similarity index 100% rename from test/mainnet/liquity/liquity.contracts.js rename to test/mainnet/liquity/liquity.contracts.ts diff --git a/test/mainnet/liquity/liquity.helpers.js b/test/mainnet/liquity/liquity.helpers.ts similarity index 89% rename from test/mainnet/liquity/liquity.helpers.js rename to test/mainnet/liquity/liquity.helpers.ts index ad5a5bc4..457a1412 100644 --- a/test/mainnet/liquity/liquity.helpers.js +++ b/test/mainnet/liquity/liquity.helpers.ts @@ -1,23 +1,23 @@ -const hre = require("hardhat"); -const hardhatConfig = require("../../../hardhat.config"); +import hre from "hardhat"; +import hardhatConfig from "../../../hardhat.config"; // Instadapp deployment and testing helpers -const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js"); -const encodeSpells = require("../../../scripts/encodeSpells.js"); -const getMasterSigner = require("../../../scripts/getMasterSigner"); -const buildDSAv2 = require("../../../scripts/buildDSAv2"); +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/buildDSAv2" +import { encodeSpells } from "../../../scripts/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/getMasterSigner" // Instadapp instadappAddresses/ABIs -const instadappAddresses = require("../../../scripts/constant/addresses"); -const instadappAbi = require("../../../scripts/constant/abis"); +import { instadappAddresses } from "../../../scripts/important/addresses"; +import { instadappAbi } from "../../../scripts/constant/abis"; // Instadapp Liquity Connector artifacts -const connectV2LiquityArtifacts = require("../../artifacts/contracts/mainnet/connectors/liquity/main.sol/ConnectV2Liquity.json"); -const connectV2BasicV1Artifacts = require("../../artifacts/contracts/mainnet/connectors/basic/main.sol/ConnectV2Basic.json"); -const { ethers } = require("hardhat"); +import connectV2LiquityArtifacts from "../../artifacts/contracts/mainnet/connectors/liquity/main.sol/ConnectV2Liquity.json"; +import connectV2BasicV1Artifacts from "../../artifacts/contracts/mainnet/connectors/basic/main.sol/ConnectV2Basic.json"; +import { ethers } from "hardhat"; // Instadapp uses a fake address to represent native ETH -const { eth_addr: ETH_ADDRESS } = require("../../../scripts/constant/constant"); +import { eth_addr: ETH_ADDRESS } from "../../../scripts/constant/constant"; const LIQUITY_CONNECTOR = "LIQUITY-v1-TEST"; const LUSD_GAS_COMPENSATION = hre.ethers.utils.parseUnits("200", 18); // 200 LUSD gas compensation repaid after loan repayment @@ -29,12 +29,12 @@ const INSTADAPP_BASIC_V1_CONNECTOR = "Basic-v1"; const openTroveSpell = async ( dsa, - signer, - depositAmount, - borrowAmount, - upperHint, - lowerHint, - maxFeePercentage + signer: any, + depositAmount: any, + borrowAmount: any, + upperHint: any, + lowerHint: any, + maxFeePercentage: any ) => { let address = signer.address; if (signer.address === undefined) { diff --git a/test/mainnet/liquity/liquity.test.js b/test/mainnet/liquity/liquity.test.ts similarity index 99% rename from test/mainnet/liquity/liquity.test.js rename to test/mainnet/liquity/liquity.test.ts index e2acde15..70bf96db 100644 --- a/test/mainnet/liquity/liquity.test.js +++ b/test/mainnet/liquity/liquity.test.ts @@ -1,15 +1,15 @@ -const hre = require("hardhat"); -const { expect } = require("chai"); +import hre from "hardhat"; +import { expect } from "chai"; // Instadapp deployment and testing helpers -const buildDSAv2 = require("../../scripts/buildDSAv2"); -const encodeSpells = require("../../scripts/encodeSpells.js"); +import { buildDSAv2 } from "../../../scripts/buildDSAv2"; +import { encodeSpells } from "../../../scripts/encodeSpells.js"; // Liquity smart contracts -const contracts = require("./liquity.contracts"); +import contracts from "./liquity.contracts"; // Liquity helpers -const helpers = require("./liquity.helpers"); +import helpers from "./liquity.helpers"; describe("Liquity", () => { const { waffle, ethers } = hre; diff --git a/test/mainnet/mappings/mappings.test.js b/test/mainnet/mappings/mappings.test.ts similarity index 95% rename from test/mainnet/mappings/mappings.test.js rename to test/mainnet/mappings/mappings.test.ts index 9a6546a3..bea79b0d 100644 --- a/test/mainnet/mappings/mappings.test.js +++ b/test/mainnet/mappings/mappings.test.ts @@ -1,7 +1,7 @@ -const { ethers, network } = require("hardhat"); -const chai = require("chai"); -const chaiPromise = require("chai-as-promised"); -const { solidity } = require("ethereum-waffle"); +import { ethers, network } from "hardhat"; +import chai from "chai"; +import chaiPromise from "chai-as-promised"; +import { solidity } from "ethereum-waffle"; chai.use(chaiPromise); chai.use(solidity); @@ -13,9 +13,9 @@ const getMapping = (address, signer) => { }; describe("Test InstaMapping contract", () => { - let account, instaMaster; - let mappingAddress; - let masterMapping; + let account: any, instaMaster: any; + let mappingAddress: any; + let masterMapping: any; const indexInterfaceAddress = "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723"; const testRoleAddress = "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723"; diff --git a/test/mainnet/pooltogether-polygon/pooltogether.test.js b/test/mainnet/pooltogether-polygon/pooltogether.test.js deleted file mode 100644 index 54f3f408..00000000 --- a/test/mainnet/pooltogether-polygon/pooltogether.test.js +++ /dev/null @@ -1,420 +0,0 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); -const { web3, deployments, waffle, ethers } = hre; -const { provider, deployContract } = waffle - -const ALCHEMY_ID = process.env.ALCHEMY_ID; - -const deployAndEnableConnector = require("../../../scripts/polygon/deployAndEnableConnector.js") -const buildDSAv2 = require("../../../scripts/polygon/buildDSAv2") -const encodeSpells = require("../../../scripts/polygon/encodeSpells.js") -const getMasterSigner = require("../../../scripts/polygon/getMasterSigner") - -const addresses = require("../../../scripts/polygon/constant/addresses"); -const abis = require("../../../scripts/constant/abis"); -const constants = require("../../../scripts/polygon/constant/constant"); -const tokens = require("../../../scripts/polygon/constant/tokens"); - -const connectV2AaveV2Artifacts = require("../../artifacts/contracts/polygon/connectors/aave/v2/main.sol/ConnectV2AaveV2Polygon.json") -const connectV2PoolTogetherArtifacts = require("../../artifacts/contracts/polygon/connectors/pooltogether/main.sol/ConnectV2PoolTogetherPolygon.json") - -const DAI_TOKEN_ADDR = tokens.dai.address // DAI Token -// PoolTogether Address: https://docs.pooltogether.com/resources/networks/matic -const USDC_PRIZE_POOL_ADDR = "0xEE06AbE9e2Af61cabcb13170e01266Af2DEFa946" // USDC Prize Pool -const PT_USDC_TICKET_ADDR = "0x473E484c722EF9ec6f63B509b07Bb9cfB258820b" // PT USDC Ticket -const PT_USDC_SPONGSOR_TICKET_ADDR = "0x19c0e557ee5a9b456f613ba3d025a4dc45b52c35" // PT USDC Sponsor Ticket -const USDC_POOL_FAUCET_ADDR = "0x6cbc003fE015D753180f072d904bA841b2415498" // USDC POOL Faucet -const POOL_TOKEN_ADDRESS = "0x25788a1a171ec66Da6502f9975a15B609fF54CF6" // POOL Tocken -const TOKEN_FAUCET_PROXY_FACTORY_ADDR = "0xeaa636304a7C8853324B6b603dCdE55F92dfbab1" // TokenFaucetProxyFactory for claimAll - -// Community WETH Prize Pool (Rari): https://reference-app.pooltogether.com/pools/mainnet/0xa88ca010b32a54d446fc38091ddbca55750cbfc3/manage#stats -const WETH_PRIZE_POOL_ADDR = "0xa88ca010b32a54d446fc38091ddbca55750cbfc3" // Community WETH Prize Pool (Rari) -const WETH_POOL_TICKET_ADDR = "0x9b5c30aeb9ce2a6a121cea9a85bc0d662f6d9b40" // Community WETH Prize Pool Ticket (Rari) - -const prizePoolABI = [ - "function calculateEarlyExitFee( address from, address controlledToken, uint256 amount) external returns ( uint256 exitFee, uint256 burnedCredit)", - "function creditPlanOf( address controlledToken) external view returns ( uint128 creditLimitMantissa, uint128 creditRateMantissa)" -] - -const connectorsABI = [ - "function isConnectors(string[] calldata connectorNames) external view returns (bool, address[] memory)" -] - -describe("PoolTogether", function () { - const connectorName = "AAVEV2-TEST-A" - const ptConnectorName = "POOLTOGETHER-TEST-A" - - let dsaWallet0 - let masterSigner; - let instaConnectorsV2; - let connector; - let ptConnector; - - const wallets = provider.getWallets() - const [wallet0, wallet1, wallet2, wallet3] = wallets - before(async () => { - await hre.network.provider.request({ - method: "hardhat_reset", - params: [ - { - forking: { - jsonRpcUrl: `https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_ID}`, - blockNumber: 18717337, - }, - }, - ], - }); - - masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); - - // Deploy and enable Compound Connector - connector = await deployAndEnableConnector({ - connectorName, - contractArtifact: connectV2AaveV2Artifacts, - signer: masterSigner, - connectors: instaConnectorsV2 - }) - - // Deploy and enable Pool Together Connector - ptConnector = await deployAndEnableConnector({ - connectorName: ptConnectorName, - contractArtifact: connectV2PoolTogetherArtifacts, - signer: masterSigner, - connectors: instaConnectorsV2 - }) - }) - - it("Should have contracts deployed.", async function () { - expect(!!instaConnectorsV2.address).to.be.true; - expect(!!connector.address).to.be.true; - expect(!!ptConnector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; - }); - - describe("DSA wallet setup", function () { - it("Should build DSA v2", async function () { - dsaWallet0 = await buildDSAv2(wallet0.address) - expect(!!dsaWallet0.address).to.be.true; - }); - - it("Deposit 1000 MATIC into DSA wallet", async function () { - await wallet0.sendTransaction({ - to: dsaWallet0.address, - value: ethers.utils.parseEther("1000") - }); - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("1000")); - }); - }); - - describe("Main - USDC Prize Pool Test", function () { - - it("Should deposit 100 MATIC in AAVE V2", async function () { - const amount = ethers.utils.parseEther("100") // 100 MATIC - const spells = [ - { - connector: connectorName, - method: "deposit", - args: [tokens.matic.address, amount, 0, 0] - } - ] - - const tx = await dsaWallet0.cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("900")); - }); - - it("Should borrow 10 USDC from AAVE V2 and deposit USDC into USDC Prize Pool", async function () { - const amount = ethers.utils.parseUnits("10", 6) // 10 USDC - const setId = "83478237" - const spells = [ - { - connector: connectorName, - method: "borrow", - args: [tokens.usdc.address, amount, 2, 0, setId] - }, - { - connector: ptConnectorName, - method: "depositTo", - args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_SPONGSOR_TICKET_ADDR, setId, 0] - } - ] - // Before Spell - let usdcToken = await ethers.getContractAt(abis.basic.erc20, tokens.usdc.address) - let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - expect(usdcBalance, `USDC balance is 0`).to.be.eq(ethers.utils.parseUnits("0", 6)); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_USDC_SPONGSOR_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance,`PoolTogether USDC Ticket balance is 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - expect(usdcBalance, `Expect USDC balance to still equal 0 since it was deposited into Prize Pool`).to.be.eq(0); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether USDC Ticket balance equals 10`).to.be.eq(ethers.utils.parseUnits("10", 6)); - - // ETH used for transaction - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("900")); - }); - - it("Should wait 11 days, withdraw all PrizePool, get back 10 USDC, and claim POOL", async function () { - const amount = ethers.utils.parseUnits("10", 6) // 10 USDC - - let prizePoolContract = new ethers.Contract(USDC_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); - // const { creditLimitMantissa, creditRateMantissa } = await prizePoolContract.creditPlanOf(PT_USDC_TICKET_ADDR); - // console.log("CreditLimitMantiss: ", creditLimitMantissa.toString()); - // console.log("CreditRateMantiss: ", creditRateMantissa.toString()); - let earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_USDC_SPONGSOR_TICKET_ADDR, amount); - expect(earlyExitFee.exitFee, "Exit Fee equal to 0 USDC because 0% fee for sponsorship ticket").to.be.eq(ethers.utils.parseUnits("0", 6)); - - const spells = [ - { - connector: ptConnectorName, - method: "claim", - args: [USDC_POOL_FAUCET_ADDR, 0] - }, - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_SPONGSOR_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] - } - - ] - - // Before spell - let usdcToken = await ethers.getContractAt(abis.basic.erc20, tokens.usdc.address) - let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - expect(usdcBalance, `USDC balance equals 0`).to.be.eq(ethers.utils.parseEther("0")); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_USDC_SPONGSOR_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance, `PoolTogether USDC Ticket is 10`).to.be.eq(ethers.utils.parseUnits("10", 6)); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token equals 0`).to.be.eq(ethers.utils.parseEther("0")); - - // Increase time by 11 days so we get back all USDC without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [15*24*60*60]); - await ethers.provider.send("evm_mine"); - - earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_USDC_SPONGSOR_TICKET_ADDR, amount); - expect(earlyExitFee.exitFee, "Exit Fee equal to 0 DAI because past 14 days").to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - console.log("USDC BALANCE: ", usdcBalance.toString()); - console.log("USDC BALANCE: ", ethers.utils.parseUnits("10", 6).toString()); - expect(usdcBalance, - `USDC balance to be equal to 10, because of no early withdrawal fee` - ).to.be.eq(ethers.utils.parseUnits("10", 6)); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether USDC Ticket to equal 0`).to.be.eq(0); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - console.log("POOL BALANCE AFTER:" ,poolBalanceAfter.toString()); - expect(poolBalanceAfter, `POOL Token Balance to be greater than 0`).to.be.gt(ethers.utils.parseEther("0")); - }); - - it("Should deposit and withdraw all PrizePool, get back less than 10 USDC", async function() { - const amount = ethers.utils.parseUnits("10", 6) // 10 USDC - const exitFee = ethers.utils.parseUnits(".1", 6) // 1 USDC is 1% of 100 USDC - const spells = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_TICKET_ADDR, 0, 0] - }, - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_TICKET_ADDR, exitFee, 0, 0] - } - ] - - // Before spell - let usdcToken = await ethers.getContractAt(abis.basic.erc20, tokens.usdc.address) - let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - expect(usdcBalance, `USDC Balance equals 100`).to.be.eq(ethers.utils.parseUnits("10", 6)); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_USDC_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance, `PoolTogether USDC Ticket equals 0`).to.be.eq(0); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `PoolTogether Token greater than 0`).to.be.gt(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - expect(usdcBalance, - `USDC balance to be less than 10, because of early withdrawal fee` - ).to.be.lt(ethers.utils.parseUnits("10",6)); - - console.log("USDC BALANCE AFTER:", usdcBalance.toString()); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether USDC Ticket to equal 0`).to.be.eq(0); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `POOL Token Balance to greater than 0`).to.be.gt(ethers.utils.parseEther("0")); - - }); - - it("Should deposit, wait 11 days, and withdraw all PrizePool, get 10 USDC, and claim all POOL using claimAll", async function() { - const amount = ethers.utils.parseUnits("9.9", 6) // 9 USDC - const depositSpells = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_SPONGSOR_TICKET_ADDR, 0, 0] - } - ] - - // Before spell - let usdcToken = await ethers.getContractAt(abis.basic.erc20, tokens.usdc.address) - let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - expect(usdcBalance, `USDC balance less than 10`).to.be.lt(ethers.utils.parseUnits("10", 6)); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_USDC_SPONGSOR_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance, `PoolTogether USDC Ticket equal 0`).to.be.eq(0); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token is greater than 0`).to.be.gt(ethers.utils.parseEther("0")); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(depositSpells), wallet1.address) - const receipt = await tx.wait() - - const prizePoolContract = new ethers.Contract(USDC_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); - let earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_USDC_SPONGSOR_TICKET_ADDR, amount); - expect(earlyExitFee.exitFee, "Exit Fee equal to 0 USDC because fee 0%").to.be.eq(0); - - // Increase time by 11 days so we get back all DAI without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [11*24*60*60]); - await ethers.provider.send("evm_mine"); - - const withdrawSpells = [ - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_SPONGSOR_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] - }, - { - connector: ptConnectorName, - method: "claimAll", - args: [TOKEN_FAUCET_PROXY_FACTORY_ADDR, [USDC_POOL_FAUCET_ADDR]] - } - ] - - // Run spell transaction - const tx2 = await dsaWallet0.connect(wallet0).cast(...encodeSpells(withdrawSpells), wallet1.address) - const receipt2 = await tx2.wait() - - // After spell - usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - expect(usdcBalance, `USDC balance equals 9.9`).to.be.eq(ethers.utils.parseUnits("9.9", 6)); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether USDC Ticket equal 0`).to.be.eq(0); - - // Expect - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - console.log("POOL BALANCE AFTER:" ,poolBalanceAfter.toString()); - expect(poolBalanceAfter, `Pool Token to be greater than before`).to.be.gt(poolBalance); - }); - // }) - -// NO WMATIC POOLS: https://reference-app.pooltogether.com/pools/polygon -// describe("Main - WETH Prize Pool Test", function () { -// it("Deposit 1 ETH into WETH Prize Pool and withdraw immediately", async function () { -// const amount = ethers.utils.parseEther("1") // 1 ETH -// const setId = "83478237" -// const spells = [ -// { -// connector: ptConnectorName, -// method: "depositTo", -// args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, setId] -// }, -// { -// connector: ptConnectorName, -// method: "withdrawInstantlyFrom", -// args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, amount, setId, 0] -// }, -// ] -// // Before Spell -// const ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); - -// // Run spell transaction -// const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) -// const receipt = await tx.wait() - -// // After spell -// const ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - -// // ETH used for transaction -// expect(ethBalanceAfter, `ETH Balance less than before spell because of early withdrawal fee`).to.be.lte(ethBalanceBefore); -// }); - -// it("Deposit 1 ETH into WETH Prize Pool, wait 14 days, then withdraw", async function () { -// const amount = ethers.utils.parseEther("1") // 1 ETH -// const depositSpell = [ -// { -// connector: ptConnectorName, -// method: "depositTo", -// args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, 0] -// } -// ] - -// const withdrawSpell = [ -// { -// connector: ptConnectorName, -// method: "withdrawInstantlyFrom", -// args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, amount, 0, 0] -// } -// ] - -// // Before Deposit Spell -// let ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); - -// // Run deposit spell transaction -// const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(depositSpell), wallet1.address) -// const receipt = await tx.wait() - -// // After Deposit spell -// let ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - -// expect(ethBalanceAfter, `ETH Balance less than before spell`).to.be.lte(ethBalanceBefore); - -// // Increase time by 11 days so we get back all ETH without early withdrawal fee -// await ethers.provider.send("evm_increaseTime", [14*24*60*60]); -// await ethers.provider.send("evm_mine"); - -// // Run withdraw spell transaction -// const tx2 = await dsaWallet0.connect(wallet0).cast(...encodeSpells(withdrawSpell), wallet1.address) -// const receipt2 = await tx.wait() - -// // After Deposit spell -// ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - -// expect(ethBalanceAfter, `ETH Balance equal to before spell because no early exit fee`).to.be.eq(ethBalanceBefore); -// }); - }); -}) \ No newline at end of file diff --git a/test/mainnet/pooltogether-polygon/pooltogether.test.ts b/test/mainnet/pooltogether-polygon/pooltogether.test.ts new file mode 100644 index 00000000..61eaa370 --- /dev/null +++ b/test/mainnet/pooltogether-polygon/pooltogether.test.ts @@ -0,0 +1,422 @@ +import { expect } from "chai"; +import hre from "hardhat"; +const { web3, deployments, waffle, ethers } = hre; +const { provider, deployContract } = waffle + +const ALCHEMY_ID = process.env.ALCHEMY_ID; + +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/buildDSAv2" +import { encodeSpells } from "../../../scripts/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/getMasterSigner" + + +import { addresses } from "../../../scripts/constant/addresses" +import { abis } from "../../../scripts/constant/abis" +import { constants } from "../../../scripts/constant/constant" +import { tokens } from "../../../scripts/constant/tokens" + + +import connectV2AaveV2Artifacts from "../../artifacts/contracts/polygon/connectors/aave/v2/main.sol/ConnectV2AaveV2Polygon.json" +import connectV2PoolTogetherArtifacts from "../../artifacts/contracts/polygon/connectors/pooltogether/main.sol/ConnectV2PoolTogetherPolygon.json" + +const DAI_TOKEN_ADDR = tokens.dai.address // DAI Token +// PoolTogether Address: https://docs.pooltogether.com/resources/networks/matic +const USDC_PRIZE_POOL_ADDR = "0xEE06AbE9e2Af61cabcb13170e01266Af2DEFa946" // USDC Prize Pool +const PT_USDC_TICKET_ADDR = "0x473E484c722EF9ec6f63B509b07Bb9cfB258820b" // PT USDC Ticket +const PT_USDC_SPONGSOR_TICKET_ADDR = "0x19c0e557ee5a9b456f613ba3d025a4dc45b52c35" // PT USDC Sponsor Ticket +const USDC_POOL_FAUCET_ADDR = "0x6cbc003fE015D753180f072d904bA841b2415498" // USDC POOL Faucet +const POOL_TOKEN_ADDRESS = "0x25788a1a171ec66Da6502f9975a15B609fF54CF6" // POOL Tocken +const TOKEN_FAUCET_PROXY_FACTORY_ADDR = "0xeaa636304a7C8853324B6b603dCdE55F92dfbab1" // TokenFaucetProxyFactory for claimAll + +// Community WETH Prize Pool (Rari): https://reference-app.pooltogether.com/pools/mainnet/0xa88ca010b32a54d446fc38091ddbca55750cbfc3/manage#stats +const WETH_PRIZE_POOL_ADDR = "0xa88ca010b32a54d446fc38091ddbca55750cbfc3" // Community WETH Prize Pool (Rari) +const WETH_POOL_TICKET_ADDR = "0x9b5c30aeb9ce2a6a121cea9a85bc0d662f6d9b40" // Community WETH Prize Pool Ticket (Rari) + +const prizePoolABI = [ + "function calculateEarlyExitFee( address from, address controlledToken, uint256 amount) external returns ( uint256 exitFee, uint256 burnedCredit)", + "function creditPlanOf( address controlledToken) external view returns ( uint128 creditLimitMantissa, uint128 creditRateMantissa)" +] + +const connectorsABI = [ + "function isConnectors(string[] calldata connectorNames) external view returns (bool, address[] memory)" +] + +describe("PoolTogether", function () { + const connectorName = "AAVEV2-TEST-A" + const ptConnectorName = "POOLTOGETHER-TEST-A" + + let dsaWallet0 + let masterSigner; + let instaConnectorsV2; + let connector; + let ptConnector; + + const wallets = provider.getWallets() + const [wallet0, wallet1, wallet2, wallet3] = wallets + before(async () => { + await hre.network.provider.request({ + method: "hardhat_reset", + params: [ + { + forking: { + jsonRpcUrl: `https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_ID}`, + blockNumber: 18717337, + }, + }, + ], + }); + + masterSigner = await getMasterSigner() + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); + + // Deploy and enable Compound Connector + connector = await deployAndEnableConnector({ + connectorName, + contractArtifact: connectV2AaveV2Artifacts, + signer: masterSigner, + connectors: instaConnectorsV2 + }) + + // Deploy and enable Pool Together Connector + ptConnector = await deployAndEnableConnector({ + connectorName: ptConnectorName, + contractArtifact: connectV2PoolTogetherArtifacts, + signer: masterSigner, + connectors: instaConnectorsV2 + }) + }) + + it("Should have contracts deployed.", async function () { + expect(!!instaConnectorsV2.address).to.be.true; + expect(!!connector.address).to.be.true; + expect(!!ptConnector.address).to.be.true; + expect(!!masterSigner.address).to.be.true; + }); + + describe("DSA wallet setup", function () { + it("Should build DSA v2", async function () { + dsaWallet0 = await buildDSAv2(wallet0.address) + expect(!!dsaWallet0.address).to.be.true; + }); + + it("Deposit 1000 MATIC into DSA wallet", async function () { + await wallet0.sendTransaction({ + to: dsaWallet0.address, + value: ethers.utils.parseEther("1000") + }); + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("1000")); + }); + }); + + describe("Main - USDC Prize Pool Test", function () { + + it("Should deposit 100 MATIC in AAVE V2", async function () { + const amount = ethers.utils.parseEther("100") // 100 MATIC + const spells = [ + { + connector: connectorName, + method: "deposit", + args: [tokens.matic.address, amount, 0, 0] + } + ] + + const tx = await dsaWallet0.cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("900")); + }); + + it("Should borrow 10 USDC from AAVE V2 and deposit USDC into USDC Prize Pool", async function () { + const amount = ethers.utils.parseUnits("10", 6) // 10 USDC + const setId = "83478237" + const spells = [ + { + connector: connectorName, + method: "borrow", + args: [tokens.usdc.address, amount, 2, 0, setId] + }, + { + connector: ptConnectorName, + method: "depositTo", + args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_SPONGSOR_TICKET_ADDR, setId, 0] + } + ] + // Before Spell + let usdcToken = await ethers.getContractAt(abis.basic.erc20, tokens.usdc.address) + let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + expect(usdcBalance, `USDC balance is 0`).to.be.eq(ethers.utils.parseUnits("0", 6)); + + let cToken = await ethers.getContractAt(abis.basic.erc20, PT_USDC_SPONGSOR_TICKET_ADDR) + const balance = await cToken.balanceOf(dsaWallet0.address) + expect(balance, `PoolTogether USDC Ticket balance is 0`).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After spell + usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + expect(usdcBalance, `Expect USDC balance to still equal 0 since it was deposited into Prize Pool`).to.be.eq(0); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address) + expect(balanceAfter, `PoolTogether USDC Ticket balance equals 10`).to.be.eq(ethers.utils.parseUnits("10", 6)); + + // ETH used for transaction + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("900")); + }); + + it("Should wait 11 days, withdraw all PrizePool, get back 10 USDC, and claim POOL", async function () { + const amount = ethers.utils.parseUnits("10", 6) // 10 USDC + + let prizePoolContract = new ethers.Contract(USDC_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); + // const { creditLimitMantissa, creditRateMantissa } = await prizePoolContract.creditPlanOf(PT_USDC_TICKET_ADDR); + // console.log("CreditLimitMantiss: ", creditLimitMantissa.toString()); + // console.log("CreditRateMantiss: ", creditRateMantissa.toString()); + let earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_USDC_SPONGSOR_TICKET_ADDR, amount); + expect(earlyExitFee.exitFee, "Exit Fee equal to 0 USDC because 0% fee for sponsorship ticket").to.be.eq(ethers.utils.parseUnits("0", 6)); + + const spells = [ + { + connector: ptConnectorName, + method: "claim", + args: [USDC_POOL_FAUCET_ADDR, 0] + }, + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_SPONGSOR_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] + } + + ] + + // Before spell + let usdcToken = await ethers.getContractAt(abis.basic.erc20, tokens.usdc.address) + let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + expect(usdcBalance, `USDC balance equals 0`).to.be.eq(ethers.utils.parseEther("0")); + + let cToken = await ethers.getContractAt(abis.basic.erc20, PT_USDC_SPONGSOR_TICKET_ADDR) + const balance = await cToken.balanceOf(dsaWallet0.address) + expect(balance, `PoolTogether USDC Ticket is 10`).to.be.eq(ethers.utils.parseUnits("10", 6)); + + let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) + const poolBalance = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalance, `POOL Token equals 0`).to.be.eq(ethers.utils.parseEther("0")); + + // Increase time by 11 days so we get back all USDC without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [15 * 24 * 60 * 60]); + await ethers.provider.send("evm_mine"); + + earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_USDC_SPONGSOR_TICKET_ADDR, amount); + expect(earlyExitFee.exitFee, "Exit Fee equal to 0 DAI because past 14 days").to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After spell + usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + console.log("USDC BALANCE: ", usdcBalance.toString()); + console.log("USDC BALANCE: ", ethers.utils.parseUnits("10", 6).toString()); + expect(usdcBalance, + `USDC balance to be equal to 10, because of no early withdrawal fee` + ).to.be.eq(ethers.utils.parseUnits("10", 6)); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address) + expect(balanceAfter, `PoolTogether USDC Ticket to equal 0`).to.be.eq(0); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) + console.log("POOL BALANCE AFTER:", poolBalanceAfter.toString()); + expect(poolBalanceAfter, `POOL Token Balance to be greater than 0`).to.be.gt(ethers.utils.parseEther("0")); + }); + + it("Should deposit and withdraw all PrizePool, get back less than 10 USDC", async function () { + const amount = ethers.utils.parseUnits("10", 6) // 10 USDC + const exitFee = ethers.utils.parseUnits(".1", 6) // 1 USDC is 1% of 100 USDC + const spells = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_TICKET_ADDR, 0, 0] + }, + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_TICKET_ADDR, exitFee, 0, 0] + } + ] + + // Before spell + let usdcToken = await ethers.getContractAt(abis.basic.erc20, tokens.usdc.address) + let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + expect(usdcBalance, `USDC Balance equals 100`).to.be.eq(ethers.utils.parseUnits("10", 6)); + + let cToken = await ethers.getContractAt(abis.basic.erc20, PT_USDC_TICKET_ADDR) + const balance = await cToken.balanceOf(dsaWallet0.address) + expect(balance, `PoolTogether USDC Ticket equals 0`).to.be.eq(0); + + let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) + const poolBalance = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalance, `PoolTogether Token greater than 0`).to.be.gt(0); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After spell + usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + expect(usdcBalance, + `USDC balance to be less than 10, because of early withdrawal fee` + ).to.be.lt(ethers.utils.parseUnits("10", 6)); + + console.log("USDC BALANCE AFTER:", usdcBalance.toString()); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address) + expect(balanceAfter, `PoolTogether USDC Ticket to equal 0`).to.be.eq(0); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalanceAfter, `POOL Token Balance to greater than 0`).to.be.gt(ethers.utils.parseEther("0")); + + }); + + it("Should deposit, wait 11 days, and withdraw all PrizePool, get 10 USDC, and claim all POOL using claimAll", async function () { + const amount = ethers.utils.parseUnits("9.9", 6) // 9 USDC + const depositSpells = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_SPONGSOR_TICKET_ADDR, 0, 0] + } + ] + + // Before spell + let usdcToken = await ethers.getContractAt(abis.basic.erc20, tokens.usdc.address) + let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + expect(usdcBalance, `USDC balance less than 10`).to.be.lt(ethers.utils.parseUnits("10", 6)); + + let cToken = await ethers.getContractAt(abis.basic.erc20, PT_USDC_SPONGSOR_TICKET_ADDR) + const balance = await cToken.balanceOf(dsaWallet0.address) + expect(balance, `PoolTogether USDC Ticket equal 0`).to.be.eq(0); + + let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) + const poolBalance = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalance, `POOL Token is greater than 0`).to.be.gt(ethers.utils.parseEther("0")); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(depositSpells), wallet1.address) + const receipt = await tx.wait() + + const prizePoolContract = new ethers.Contract(USDC_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); + let earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_USDC_SPONGSOR_TICKET_ADDR, amount); + expect(earlyExitFee.exitFee, "Exit Fee equal to 0 USDC because fee 0%").to.be.eq(0); + + // Increase time by 11 days so we get back all DAI without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); + await ethers.provider.send("evm_mine"); + + const withdrawSpells = [ + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_SPONGSOR_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] + }, + { + connector: ptConnectorName, + method: "claimAll", + args: [TOKEN_FAUCET_PROXY_FACTORY_ADDR, [USDC_POOL_FAUCET_ADDR]] + } + ] + + // Run spell transaction + const tx2 = await dsaWallet0.connect(wallet0).cast(...encodeSpells(withdrawSpells), wallet1.address) + const receipt2 = await tx2.wait() + + // After spell + usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + expect(usdcBalance, `USDC balance equals 9.9`).to.be.eq(ethers.utils.parseUnits("9.9", 6)); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address) + expect(balanceAfter, `PoolTogether USDC Ticket equal 0`).to.be.eq(0); + + // Expect + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) + console.log("POOL BALANCE AFTER:", poolBalanceAfter.toString()); + expect(poolBalanceAfter, `Pool Token to be greater than before`).to.be.gt(poolBalance); + }); + // }) + + // NO WMATIC POOLS: https://reference-app.pooltogether.com/pools/polygon + // describe("Main - WETH Prize Pool Test", function () { + // it("Deposit 1 ETH into WETH Prize Pool and withdraw immediately", async function () { + // const amount = ethers.utils.parseEther("1") // 1 ETH + // const setId = "83478237" + // const spells = [ + // { + // connector: ptConnectorName, + // method: "depositTo", + // args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, setId] + // }, + // { + // connector: ptConnectorName, + // method: "withdrawInstantlyFrom", + // args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, amount, setId, 0] + // }, + // ] + // // Before Spell + // const ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); + + // // Run spell transaction + // const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + // const receipt = await tx.wait() + + // // After spell + // const ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); + + // // ETH used for transaction + // expect(ethBalanceAfter, `ETH Balance less than before spell because of early withdrawal fee`).to.be.lte(ethBalanceBefore); + // }); + + // it("Deposit 1 ETH into WETH Prize Pool, wait 14 days, then withdraw", async function () { + // const amount = ethers.utils.parseEther("1") // 1 ETH + // const depositSpell = [ + // { + // connector: ptConnectorName, + // method: "depositTo", + // args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, 0] + // } + // ] + + // const withdrawSpell = [ + // { + // connector: ptConnectorName, + // method: "withdrawInstantlyFrom", + // args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, amount, 0, 0] + // } + // ] + + // // Before Deposit Spell + // let ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); + + // // Run deposit spell transaction + // const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(depositSpell), wallet1.address) + // const receipt = await tx.wait() + + // // After Deposit spell + // let ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); + + // expect(ethBalanceAfter, `ETH Balance less than before spell`).to.be.lte(ethBalanceBefore); + + // // Increase time by 11 days so we get back all ETH without early withdrawal fee + // await ethers.provider.send("evm_increaseTime", [14*24*60*60]); + // await ethers.provider.send("evm_mine"); + + // // Run withdraw spell transaction + // const tx2 = await dsaWallet0.connect(wallet0).cast(...encodeSpells(withdrawSpell), wallet1.address) + // const receipt2 = await tx.wait() + + // // After Deposit spell + // ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); + + // expect(ethBalanceAfter, `ETH Balance equal to before spell because no early exit fee`).to.be.eq(ethBalanceBefore); + // }); + }); +}) \ No newline at end of file diff --git a/test/mainnet/pooltogether/pooltogether.test.js b/test/mainnet/pooltogether/pooltogether.test.js deleted file mode 100644 index f3822fa6..00000000 --- a/test/mainnet/pooltogether/pooltogether.test.js +++ /dev/null @@ -1,811 +0,0 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); -const { web3, deployments, waffle, ethers } = hre; -const { provider, deployContract } = waffle - -const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../../scripts/buildDSAv2") -const encodeSpells = require("../../../scripts/encodeSpells.js") -const getMasterSigner = require("../../../scripts/getMasterSigner") - -const addresses = require("../../../scripts/constant/addresses"); -const abis = require("../../../scripts/constant/abis"); -const constants = require("../../../scripts/constant/constant"); -const tokens = require("../../../scripts/constant/tokens"); - -const connectV2CompoundArtifacts = require("../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json") -const connectV2PoolTogetherArtifacts = require("../../artifacts/contracts/mainnet/connectors/pooltogether/main.sol/ConnectV2PoolTogether.json") -const connectV2UniswapArtifacts = require("../../artifacts/contracts/mainnet/connectors/uniswap/main.sol/ConnectV2UniswapV2.json") - -const DAI_TOKEN_ADDR = tokens.dai.address // DAI Token - -// PoolTogether Address: https://docs.pooltogether.com/resources/networks/ethereum -const DAI_PRIZE_POOL_ADDR = "0xEBfb47A7ad0FD6e57323C8A42B2E5A6a4F68fc1a" // DAI Prize Pool -const PT_DAI_TICKET_ADDR = "0x334cBb5858417Aee161B53Ee0D5349cCF54514CF" // PT DAI Ticket -const DAI_POOL_FAUCET_ADDR = "0xF362ce295F2A4eaE4348fFC8cDBCe8d729ccb8Eb" // DAI POOL Faucet -const POOL_TOKEN_ADDRESS = "0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e" // POOL Tocken -const TOKEN_FAUCET_PROXY_FACTORY_ADDR = "0xE4E9cDB3E139D7E8a41172C20b6Ed17b6750f117" // TokenFaucetProxyFactory for claimAll -const DAI_POD_ADDR = "0x2f994e2E4F3395649eeE8A89092e63Ca526dA829" // DAI Pod -const UNISWAP_POOLETHLP_PRIZE_POOL_ADDR = "0x3AF7072D29Adde20FC7e173a7CB9e45307d2FB0A" // Uniswap Pool/ETH LP PrizePool -const UNISWAP_POOLETHLP_FAUCET_ADDR = "0x9A29401EF1856b669f55Ae5b24505b3B6fAEb370" // Uniswap Pool/ETH LP Faucet -const UNISWAP_POOLETHLP_TOKEN_ADDR = "0x85cb0bab616fe88a89a35080516a8928f38b518b" // Uniswap Pool/ETH Token -const PT_UNISWAP_POOLETHLP_TICKET_ADDR = "0xeb8928ee92efb06c44d072a24c2bcb993b61e543" // Pool Together Uniswap Pool/ETH LP Ticket -const POOL_PRIZE_POOL_ADDR = "0x396b4489da692788e327e2e4b2b0459a5ef26791" // POOL Prize Pool -const PT_POOL_TICKET_ADDR = "0x27d22a7648e955e510a40bdb058333e9190d12d4" // Pool Together POOL Ticket -const WETH_ADDR = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" // WETH -const DAI_POD_TOKEN_DROP = "0xc5209623E3dFdf9C0cCbe497c8012883C4147731" - -// Community WETH Prize Pool (Rari): https://reference-app.pooltogether.com/pools/mainnet/0xa88ca010b32a54d446fc38091ddbca55750cbfc3/manage#stats -const WETH_PRIZE_POOL_ADDR = "0xa88ca010b32a54d446fc38091ddbca55750cbfc3" // Community WETH Prize Pool (Rari) -const WETH_POOL_TICKET_ADDR = "0x9b5c30aeb9ce2a6a121cea9a85bc0d662f6d9b40" // Community WETH Prize Pool Ticket (Rari) - -const prizePoolABI = [ - "function calculateEarlyExitFee( address from, address controlledToken, uint256 amount) external returns ( uint256 exitFee, uint256 burnedCredit)" -] - -const podABI = [ - "function getEarlyExitFee(uint256 amount) external returns (uint256)", - "function balanceOfUnderlying(address user) external view returns (uint256 amount)", - "function drop() public returns (uint256)", - "function balanceOf(address account) external view returns (uint256)" -] - -const POD_FACTORY_ADDRESS = "0x4e3a9f9fbafb2ec49727cffa2a411f7a0c1c4ce1" -const podFactoryABI = [ - "function create( address _prizePool, address _ticket, address _faucet, address _manager, uint8 _decimals) external returns (address pod)" -] - -const tokenDropABI = [ - "function claim(address user) external returns (uint256)", -] - -describe("PoolTogether", function () { - const connectorName = "COMPOUND-TEST-A" - const uniswapConnectorName = "UNISWAP-TEST-A" - const ptConnectorName = "POOLTOGETHER-TEST-A" - - let dsaWallet0 - let masterSigner; - let instaConnectorsV2; - let connector; - let ptConnector; - let uniswapConnector; - - const wallets = provider.getWallets() - const [wallet0, wallet1, wallet2, wallet3] = wallets - before(async () => { - masterSigner = await getMasterSigner(wallet3) - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); - - // Deploy and enable Compound Connector - connector = await deployAndEnableConnector({ - connectorName, - contractArtifact: connectV2CompoundArtifacts, - signer: masterSigner, - connectors: instaConnectorsV2 - }) - - // Deploy and enable Pool Together Connector - ptConnector = await deployAndEnableConnector({ - connectorName: ptConnectorName, - contractArtifact: connectV2PoolTogetherArtifacts, - signer: masterSigner, - connectors: instaConnectorsV2 - }) - - // Deploy and enable Uniswap Connector - uniswapConnector = await deployAndEnableConnector({ - connectorName: uniswapConnectorName, - contractArtifact: connectV2UniswapArtifacts, - signer: masterSigner, - connectors: instaConnectorsV2 - }) - }) - - it("Should have contracts deployed.", async function () { - expect(!!instaConnectorsV2.address).to.be.true; - expect(!!connector.address).to.be.true; - expect(!!ptConnector.address).to.be.true; - expect(!!uniswapConnector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; - }); - - describe("DSA wallet setup", function () { - it("Should build DSA v2", async function () { - dsaWallet0 = await buildDSAv2(wallet0.address) - expect(!!dsaWallet0.address).to.be.true; - }); - - it("Deposit 10 ETH into DSA wallet", async function () { - await wallet0.sendTransaction({ - to: dsaWallet0.address, - value: ethers.utils.parseEther("10") - }); - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("10")); - }); - }); - - describe("Main - DAI Prize Pool Test", function () { - - it("Should deposit 1 ETH in Compound", async function () { - const amount = ethers.utils.parseEther("1") // 1 ETH - const spells = [ - { - connector: connectorName, - method: "deposit", - args: ["ETH-A", amount, 0, 0] - } - ] - - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("9")); - }); - - it("Should borrow 100 DAI from Compound and deposit DAI into DAI Prize Pool", async function () { - const amount = ethers.utils.parseEther("100") // 100 DAI - const setId = "83478237" - const spells = [ - { - connector: connectorName, - method: "borrow", - args: ["DAI-A", amount, 0, setId] - }, - { - connector: ptConnectorName, - method: "depositTo", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, setId, 0] - } - ] - // Before Spell - let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance is 0`).to.be.eq(ethers.utils.parseEther("0")); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_DAI_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance,`PoolTogether DAI Ticket balance is 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `Expect DAI balance to still equal 0 since it was deposited into Prize Pool`).to.be.eq(0); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether DAI Ticket balance equals 100`).to.be.eq(ethers.utils.parseEther("100")); - - // ETH used for transaction - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("9")); - }); - - it("Should wait 11 days, withdraw all PrizePool, get back 100 DAI, and claim POOL", async function () { - const amount = ethers.utils.parseEther("100") // 100 DAI - - let prizePoolContract = new ethers.Contract(DAI_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); - let earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); - expect(earlyExitFee.exitFee, "Exit Fee equal to 1 DAI because starts at 10%").to.be.eq(ethers.utils.parseEther("1")); - - const spells = [ - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] - }, - { - connector: ptConnectorName, - method: "claim", - args: [DAI_POOL_FAUCET_ADDR, 0] - } - ] - - // Before spell - let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance equals 0`).to.be.eq(ethers.utils.parseEther("0")); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_DAI_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance, `PoolTogether Dai Ticket is 100`).to.be.eq(ethers.utils.parseEther("100")); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token equals 0`).to.be.eq(ethers.utils.parseEther("0")); - - // Increase time by 11 days so we get back all DAI without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [11*24*60*60]); - await ethers.provider.send("evm_mine"); - - earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); - expect(earlyExitFee.exitFee, "Exit Fee equal to 0 DAI because past 10 days").to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, - `DAI balance to be equal to 100, because of no early withdrawal fee` - ).to.be.eq(ethers.utils.parseEther("100")); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `POOL Token Balance to be greater than 0`).to.be.gt(ethers.utils.parseEther("0")); - }); - - it("Should deposit and withdraw all PrizePool, get back less than 100 DAI", async function() { - const amount = ethers.utils.parseEther("100") // 100 DAI - const exitFee = ethers.utils.parseEther("1") // 1 DAI is 10% of 100 DAI - const spells = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0] - }, - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, exitFee, 0, 0] - } - ] - - // Before spell - let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI Balance equals 0`).to.be.eq(ethers.utils.parseEther("100")); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_DAI_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance, `PoolTogether DAI Ticket equals 0`).to.be.eq(0); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `PoolTogether Token greater than 0`).to.be.gt(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, - `DAI balance to be less than 100, because of early withdrawal fee` - ).to.be.lt(ethers.utils.parseEther("100")); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `POOL Token Balance to greater than 0`).to.be.gt(ethers.utils.parseEther("0")); - - }); - - it("Should deposit, wait 11 days, and withdraw all PrizePool, get 99 DAI, and claim all POOL using claimAll", async function() { - const amount = ethers.utils.parseEther("99") // 99 DAI - const depositSpells = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0] - } - ] - - // Before spell - let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance less than 100`).to.be.lt(ethers.utils.parseEther("100")); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_DAI_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token is greater than 0`).to.be.gt(ethers.utils.parseEther("0")); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(depositSpells), wallet1.address) - const receipt = await tx.wait() - - const prizePoolContract = new ethers.Contract(DAI_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); - let earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); - expect(earlyExitFee.exitFee, "Exit Fee equal to .99 DAI because starts at 10%").to.be.eq(ethers.utils.parseEther(".99")); - - - // Increase time by 11 days so we get back all DAI without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [11*24*60*60]); - await ethers.provider.send("evm_mine"); - - earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); - expect(earlyExitFee.exitFee, "Exit Fee equal to 0 DAI because past 10 days").to.be.eq(0); - - const withdrawSpells = [ - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] - }, - { - connector: ptConnectorName, - method: "claimAll", - args: [TOKEN_FAUCET_PROXY_FACTORY_ADDR, [DAI_POOL_FAUCET_ADDR]] - } - ] - - // Run spell transaction - const tx2 = await dsaWallet0.connect(wallet0).cast(...encodeSpells(withdrawSpells), wallet1.address) - const receipt2 = await tx2.wait() - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance equals 99`).to.be.eq(ethers.utils.parseEther("99")); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); - - // Expect - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `Pool Token to be greateir than 0`).to.be.gt(ethers.utils.parseEther("0")); - }); - }) - - describe("Main - DAI Pod Test", function() { - it("Should deposit 99 DAI in DAI Pod", async function() { - const amount = ethers.utils.parseEther("99") // 99 DAI - const spells = [ - { - connector: ptConnectorName, - method: "depositToPod", - args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0] - } - ] - - // Before spell - let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance equals 99`).to.be.eq(ethers.utils.parseEther("99")); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR) - const podBalance = await podToken.balanceOf(dsaWallet0.address) - expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI equals 0`).to.be.eq(0); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `POOL Token greater than 0`).to.be.gt(0); - - const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address) - expect(podBalanceAfter, `Pod DAI token greater than 0`).to.be.eq(ethers.utils.parseEther("99")); - }); - - it("Should claim rewards from pod token drop", async function() { - const spells = [ - { - connector: ptConnectorName, - method: "claimPodTokenDrop", - args: [DAI_POD_TOKEN_DROP, 0] - } - ] - - const tokenDropContract = new ethers.Contract(DAI_POD_TOKEN_DROP, tokenDropABI, ethers.provider); - const podContract = new ethers.Contract(DAI_POD_ADDR, podABI, masterSigner); - - // drop(): Claim TokenDrop asset for PrizePool Pod and transfers token(s) to external Pod TokenDrop - // dropt() also calls batch which, Deposit Pod float into PrizePool. Deposits the current float - // amount into the PrizePool and claims current POOL rewards. - const dropTx = await podContract.drop(); - await dropTx.wait(); - - // POOL Rewards able to claim from Pod Token Drop - let claimAmount = await tokenDropContract.callStatic["claim"](dsaWallet0.address); - - // Before spell - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - const total = claimAmount.add(poolBalance); - expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq(total); - }); - - it("Should wait 11 days, withdraw all podTokens, get back 99 DAI", async function () { - const amount = ethers.utils.parseEther("99") // 99 DAI - - const podContract = new ethers.Contract(DAI_POD_ADDR, podABI, ethers.provider); - let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); - // maxFee depends on if token has been deposited to PrizePool yet - // since we called drop in previous test case, the tokens were deposited to PrizePool - expect(maxFee, "Exit Fee equal to .99 DAI because token still in float").to.be.eq(ethers.utils.parseEther(".99")); - - const spells = [ - { - connector: ptConnectorName, - method: "withdrawFromPod", - args: [DAI_POD_ADDR, amount, maxFee, 0, 0] - } - ] - - // Before spell - let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI Balance equals 0`).to.be.eq(0); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token balance greater than 0`).to.be.gt(0); - - let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR) - const podBalance = await podToken.balanceOf(dsaWallet0.address) - expect(podBalance, `Pod DAI Token equals 99`).to.be.eq(ethers.utils.parseEther("99")); - - // Increase time by 11 days so we get back all DAI without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [11*24*60*60]); - await ethers.provider.send("evm_mine"); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, - `DAI balance equals 99, because of no early withdrawal fee` - ).to.be.eq(ethers.utils.parseEther("99")); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `POOL Token to be greater than 0`).to.be.gt(0); - - const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address) - expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq(0); - }); - - - - - it("Should deposit and withdraw from pod, get back same amount of 99 DAI", async function() { - const amount = ethers.utils.parseEther("99") - const maxFee = 0; // maxFee 0 since it doesn't give chance for Pod to actually deposit into PrizePool - - const spells = [ - { - connector: ptConnectorName, - method: "depositToPod", - args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0] - }, - { - connector: ptConnectorName, - method: "withdrawFromPod", - args: [DAI_POD_ADDR, amount, maxFee, 0, 0] - } - ] - - // Before spell - let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI equals 99`).to.be.eq(ethers.utils.parseEther("99")); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - // PodToken is 0 - let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR) - const podBalance = await podToken.balanceOf(dsaWallet0.address) - expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, - `DAI balance to be equal to 99, because funds still in 'float` - ).to.be.eq(ethers.utils.parseEther("99")); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq(poolBalance); - - // Expect Pod Token Balance to equal 0 - const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address) - expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq(ethers.utils.parseEther("0")); - }); - }) - - describe("Main - UNISWAP POOL/ETH Prize Pool Test", function () { - it("Should use uniswap to swap ETH for POOL, deposit to POOL/ETH LP, deposit POOL/ETH LP to PrizePool", async function () { - const amount = ethers.utils.parseEther("100") // 100 POOL - const slippage = ethers.utils.parseEther("0.03"); - const setId = "83478237" - - const UniswapV2Router02ABI = [ - "function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts)" - ]; - - // Get amount of ETH for 100 POOL from Uniswap - const UniswapV2Router02 = await ethers.getContractAt(UniswapV2Router02ABI, "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"); - const amounts = await UniswapV2Router02.getAmountsOut(amount, [POOL_TOKEN_ADDRESS, WETH_ADDR]); - const unitAmount = ethers.utils.parseEther(((amounts[1]*1.03)/amounts[0]).toString()); - - const spells = [ - { - connector: uniswapConnectorName, - method: "buy", - args: [POOL_TOKEN_ADDRESS, tokens.eth.address, amount, unitAmount, 0, setId] - }, - { - connector: uniswapConnectorName, - method: "deposit", - args: [POOL_TOKEN_ADDRESS, tokens.eth.address, amount, unitAmount, slippage, 0, setId] - }, - { - connector: ptConnectorName, - method: "depositTo", - args: [UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, 0, PT_UNISWAP_POOLETHLP_TICKET_ADDR, setId, 0] - } - ] - - // Before Spell - let ethBalance = await ethers.provider.getBalance(dsaWallet0.address); - expect(ethBalance, `ETH Balance equals 9`).to.be.eq(ethers.utils.parseEther("9")); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - let uniswapLPToken = await ethers.getContractAt(abis.basic.erc20, UNISWAP_POOLETHLP_TOKEN_ADDR) - const uniswapPoolEthBalance = await uniswapLPToken.balanceOf(dsaWallet0.address) - expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); - - let ptUniswapPoolEthToken = await ethers.getContractAt(abis.basic.erc20, PT_UNISWAP_POOLETHLP_TICKET_ADDR) - const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf(dsaWallet0.address) - expect(ptUniswapPoolEthBalance, `PoolTogether Uniswap POOL?ETH LP equals 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - ethBalance = await ethers.provider.getBalance(dsaWallet0.address); - expect(ethBalance, `ETH Balance less than 9`).to.be.lt(ethers.utils.parseEther("9")); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `POOL Token to be same after spell`).to.be.eq(poolBalance); - - const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf(dsaWallet0.address) - expect(uniswapPoolEthBalanceAfter, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); - - const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf(dsaWallet0.address) - expect(ptUniswapPoolEthBalanceAfter, `PT Uniswap POOL/ETH LP to greater than 0`).to.be.gt(0); - }); - - it("Should withdraw all PrizePool, get back Uniswap LP, claim POOL, deposit claimed POOL into Pool PrizePool", async function () { - let ptUniswapPoolEthToken = await ethers.getContractAt(abis.basic.erc20, PT_UNISWAP_POOLETHLP_TICKET_ADDR) - const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf(dsaWallet0.address) - const setId = "83478237" - - let uniswapPrizePoolContract = new ethers.Contract(UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); - let earlyExitFee = await uniswapPrizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_UNISWAP_POOLETHLP_TICKET_ADDR, ptUniswapPoolEthBalance); - expect(earlyExitFee.exitFee, "Exit Fee equals 0 because no early exit fee for this prize pool").to.be.eq(0); - - const spells = [ - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, ptUniswapPoolEthBalance, PT_UNISWAP_POOLETHLP_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] - }, - { - connector: ptConnectorName, - method: "claim", - args: [UNISWAP_POOLETHLP_FAUCET_ADDR , setId] - }, - { - connector: ptConnectorName, - method: "depositTo", - args: [POOL_PRIZE_POOL_ADDR, 0, PT_POOL_TICKET_ADDR, setId, 0] - } - ] - - // Before spell - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - // Uniswap POOL/ETH LP is 0 - let uniswapLPToken = await ethers.getContractAt(abis.basic.erc20, UNISWAP_POOLETHLP_TOKEN_ADDR) - const uniswapPoolEthBalance = await uniswapLPToken.balanceOf(dsaWallet0.address) - expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); - - expect(ptUniswapPoolEthBalance, `PT Uniswap POOL/ETH LP greater than 0`).to.be.gt(0); - - let poolPoolTicket = await ethers.getContractAt(abis.basic.erc20, PT_POOL_TICKET_ADDR) - const poolPoolTicketBalance = await poolPoolTicket.balanceOf(dsaWallet0.address) - expect(poolPoolTicketBalance, `PoolTogether POOL Ticket equals 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `Pool Token Balance equal to balance before spell`).to.be.eq(poolBalance); - - const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf(dsaWallet0.address) - expect(uniswapPoolEthBalanceAfter, `Uniswap POOL/ETH LP to greater than 0`).to.be.gt(0); - - const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf(dsaWallet0.address) - expect(ptUniswapPoolEthBalanceAfter, `PT Uniswap POOL/ETH LP equal 0`).to.be.eq(0); - - const poolPoolTicketBalanceAfter = await poolPoolTicket.balanceOf(dsaWallet0.address) - expect(poolPoolTicketBalanceAfter, `PoolTogether POOL Ticket greater than 0`).to.be.gt(0); - }); - }) - - describe("Main - WETH Prize Pool Test", function () { - it("Deposit 1 ETH into WETH Prize Pool and withdraw immediately", async function () { - const amount = ethers.utils.parseEther("1") // 1 ETH - const setId = "83478237" - const spells = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, setId] - }, - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, amount, setId, 0] - }, - ] - // Before Spell - const ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - const ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - - // ETH used for transaction - expect(ethBalanceAfter, `ETH Balance less than before spell because of early withdrawal fee`).to.be.lte(ethBalanceBefore); - }); - - it("Deposit 1 ETH into WETH Prize Pool, wait 14 days, then withdraw", async function () { - const amount = ethers.utils.parseEther("1") // 1 ETH - const depositSpell = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, 0] - } - ] - - const withdrawSpell = [ - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, amount, 0, 0] - } - ] - - // Before Deposit Spell - let ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); - - // Run deposit spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(depositSpell), wallet1.address) - const receipt = await tx.wait() - - // After Deposit spell - let ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - - expect(ethBalanceAfter, `ETH Balance less than before spell`).to.be.lte(ethBalanceBefore); - - // Increase time by 11 days so we get back all ETH without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [14*24*60*60]); - await ethers.provider.send("evm_mine"); - - // Run withdraw spell transaction - const tx2 = await dsaWallet0.connect(wallet0).cast(...encodeSpells(withdrawSpell), wallet1.address) - const receipt2 = await tx.wait() - - // After Deposit spell - ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - - expect(ethBalanceAfter, `ETH Balance equal to before spell because no early exit fee`).to.be.eq(ethBalanceBefore); - }); - }); - - describe("Main - WETH Pod Test", function() { - let podAddress - it("Should deposit 1 ETH in WETH Pod and get Pod Ticket", async function() { - const amount = ethers.utils.parseEther("1") - - // Create Pod for WETH Prize Pool (Rari) - const podFactoryContract = new ethers.Contract(POD_FACTORY_ADDRESS, podFactoryABI, masterSigner) - podAddress = await podFactoryContract.callStatic.create(WETH_PRIZE_POOL_ADDR, WETH_POOL_TICKET_ADDR, constants.address_zero, wallet0.address, 18) - await podFactoryContract.create(WETH_PRIZE_POOL_ADDR, WETH_POOL_TICKET_ADDR, constants.address_zero, wallet0.address, 18) - - const spells = [ - { - connector: ptConnectorName, - method: "depositToPod", - args: [WETH_ADDR, podAddress, amount, 0, 0] - } - ] - - // Before Deposit Spell - const podContract = new ethers.Contract(podAddress, podABI, ethers.provider); - let podBalanceBefore = await podContract.balanceOfUnderlying(dsaWallet0.address) - expect(podBalanceBefore, `Pod balance equal to 0`).to.be.eq(0); - - let ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After Deposit spell - let ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - expect(ethBalanceAfter, `ETH balance less than before`).to.be.lt(ethBalanceBefore); - - podBalanceAfter = await podContract.balanceOfUnderlying(dsaWallet0.address) - expect(podBalanceAfter, `Pod balance equal to 1`).to.be.eq(ethers.utils.parseEther("1")); - }); - - it("Should withdraw 1 Ticket from WETH Pod and get back ETH", async function() { - const amount = ethers.utils.parseEther("1") - - const podContract = new ethers.Contract(podAddress, podABI, ethers.provider); - let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); - expect(maxFee, "Exit Fee equal to 0 DAI because token still in float").to.be.eq(0); - // maxFee depends on if token has been deposited to PrizePool yet - - const spells = [ - { - connector: ptConnectorName, - method: "withdrawFromPod", - args: [podAddress, amount, maxFee, 0, 0] - } - ] - - // Before Deposit Spell - let podBalanceBefore = await podContract.balanceOfUnderlying(dsaWallet0.address) - expect(podBalanceBefore, `Pod balance equal to 1`).to.be.eq(ethers.utils.parseEther("1")); - - let ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After Deposit spell - let ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - expect(ethBalanceAfter, `ETH balance greater than before`).to.be.gt(ethBalanceBefore); - - podBalanceAfter = await podContract.balanceOfUnderlying(dsaWallet0.address) - expect(podBalanceAfter, `Pod balance equal to 0`).to.be.eq(ethers.utils.parseEther("0")); - }); - }); -}) \ No newline at end of file diff --git a/test/mainnet/pooltogether/pooltogether.test.ts b/test/mainnet/pooltogether/pooltogether.test.ts new file mode 100644 index 00000000..e980b2ba --- /dev/null +++ b/test/mainnet/pooltogether/pooltogether.test.ts @@ -0,0 +1,811 @@ +import { expect } from "chai"; +import hre from "hardhat"; +const { web3, deployments, waffle, ethers } = hre; +const { provider, deployContract } = waffle + +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/buildDSAv2" +import { encodeSpells } from "../../../scripts/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/getMasterSigner" + +import { addresses } from "../../../scripts/constant/addresses" +import { abis } from "../../../scripts/constant/abis" +import { constants } from "../../../scripts/constant/constant" +import { tokens } from "../../../scripts/constant/tokens" + +import connectV2CompoundArtifacts from "../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json" +import connectV2PoolTogetherArtifacts from "../../artifacts/contracts/mainnet/connectors/pooltogether/main.sol/ConnectV2PoolTogether.json" +import connectV2UniswapArtifacts from "../../artifacts/contracts/mainnet/connectors/uniswap/main.sol/ConnectV2UniswapV2.json" + +const DAI_TOKEN_ADDR = tokens.dai.address // DAI Token + +// PoolTogether Address: https://docs.pooltogether.com/resources/networks/ethereum +const DAI_PRIZE_POOL_ADDR = "0xEBfb47A7ad0FD6e57323C8A42B2E5A6a4F68fc1a" // DAI Prize Pool +const PT_DAI_TICKET_ADDR = "0x334cBb5858417Aee161B53Ee0D5349cCF54514CF" // PT DAI Ticket +const DAI_POOL_FAUCET_ADDR = "0xF362ce295F2A4eaE4348fFC8cDBCe8d729ccb8Eb" // DAI POOL Faucet +const POOL_TOKEN_ADDRESS = "0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e" // POOL Tocken +const TOKEN_FAUCET_PROXY_FACTORY_ADDR = "0xE4E9cDB3E139D7E8a41172C20b6Ed17b6750f117" // TokenFaucetProxyFactory for claimAll +const DAI_POD_ADDR = "0x2f994e2E4F3395649eeE8A89092e63Ca526dA829" // DAI Pod +const UNISWAP_POOLETHLP_PRIZE_POOL_ADDR = "0x3AF7072D29Adde20FC7e173a7CB9e45307d2FB0A" // Uniswap Pool/ETH LP PrizePool +const UNISWAP_POOLETHLP_FAUCET_ADDR = "0x9A29401EF1856b669f55Ae5b24505b3B6fAEb370" // Uniswap Pool/ETH LP Faucet +const UNISWAP_POOLETHLP_TOKEN_ADDR = "0x85cb0bab616fe88a89a35080516a8928f38b518b" // Uniswap Pool/ETH Token +const PT_UNISWAP_POOLETHLP_TICKET_ADDR = "0xeb8928ee92efb06c44d072a24c2bcb993b61e543" // Pool Together Uniswap Pool/ETH LP Ticket +const POOL_PRIZE_POOL_ADDR = "0x396b4489da692788e327e2e4b2b0459a5ef26791" // POOL Prize Pool +const PT_POOL_TICKET_ADDR = "0x27d22a7648e955e510a40bdb058333e9190d12d4" // Pool Together POOL Ticket +const WETH_ADDR = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" // WETH +const DAI_POD_TOKEN_DROP = "0xc5209623E3dFdf9C0cCbe497c8012883C4147731" + +// Community WETH Prize Pool (Rari): https://reference-app.pooltogether.com/pools/mainnet/0xa88ca010b32a54d446fc38091ddbca55750cbfc3/manage#stats +const WETH_PRIZE_POOL_ADDR = "0xa88ca010b32a54d446fc38091ddbca55750cbfc3" // Community WETH Prize Pool (Rari) +const WETH_POOL_TICKET_ADDR = "0x9b5c30aeb9ce2a6a121cea9a85bc0d662f6d9b40" // Community WETH Prize Pool Ticket (Rari) + +const prizePoolABI = [ + "function calculateEarlyExitFee( address from, address controlledToken, uint256 amount) external returns ( uint256 exitFee, uint256 burnedCredit)" +] + +const podABI = [ + "function getEarlyExitFee(uint256 amount) external returns (uint256)", + "function balanceOfUnderlying(address user) external view returns (uint256 amount)", + "function drop() public returns (uint256)", + "function balanceOf(address account) external view returns (uint256)" +] + +const POD_FACTORY_ADDRESS = "0x4e3a9f9fbafb2ec49727cffa2a411f7a0c1c4ce1" +const podFactoryABI = [ + "function create( address _prizePool, address _ticket, address _faucet, address _manager, uint8 _decimals) external returns (address pod)" +] + +const tokenDropABI = [ + "function claim(address user) external returns (uint256)", +] + +describe("PoolTogether", function () { + const connectorName = "COMPOUND-TEST-A" + const uniswapConnectorName = "UNISWAP-TEST-A" + const ptConnectorName = "POOLTOGETHER-TEST-A" + + let dsaWallet0: any + let masterSigner: any; + let instaConnectorsV2: any; + let connector: any; + let ptConnector: any; + let uniswapConnector: any; + + const wallets = provider.getWallets() + const [wallet0, wallet1, wallet2, wallet3] = wallets + before(async () => { + masterSigner = await getMasterSigner(wallet3) + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); + + // Deploy and enable Compound Connector + connector = await deployAndEnableConnector({ + connectorName, + contractArtifact: connectV2CompoundArtifacts, + signer: masterSigner, + connectors: instaConnectorsV2 + }) + + // Deploy and enable Pool Together Connector + ptConnector = await deployAndEnableConnector({ + connectorName: ptConnectorName, + contractArtifact: connectV2PoolTogetherArtifacts, + signer: masterSigner, + connectors: instaConnectorsV2 + }) + + // Deploy and enable Uniswap Connector + uniswapConnector = await deployAndEnableConnector({ + connectorName: uniswapConnectorName, + contractArtifact: connectV2UniswapArtifacts, + signer: masterSigner, + connectors: instaConnectorsV2 + }) + }) + + it("Should have contracts deployed.", async function () { + expect(!!instaConnectorsV2.address).to.be.true; + expect(!!connector.address).to.be.true; + expect(!!ptConnector.address).to.be.true; + expect(!!uniswapConnector.address).to.be.true; + expect(!!masterSigner.address).to.be.true; + }); + + describe("DSA wallet setup", function () { + it("Should build DSA v2", async function () { + dsaWallet0 = await buildDSAv2(wallet0.address) + expect(!!dsaWallet0.address).to.be.true; + }); + + it("Deposit 10 ETH into DSA wallet", async function () { + await wallet0.sendTransaction({ + to: dsaWallet0.address, + value: ethers.utils.parseEther("10") + }); + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("10")); + }); + }); + + describe("Main - DAI Prize Pool Test", function () { + + it("Should deposit 1 ETH in Compound", async function () { + const amount = ethers.utils.parseEther("1") // 1 ETH + const spells = [ + { + connector: connectorName, + method: "deposit", + args: ["ETH-A", amount, 0, 0] + } + ] + + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("9")); + }); + + it("Should borrow 100 DAI from Compound and deposit DAI into DAI Prize Pool", async function () { + const amount = ethers.utils.parseEther("100") // 100 DAI + const setId = "83478237" + const spells = [ + { + connector: connectorName, + method: "borrow", + args: ["DAI-A", amount, 0, setId] + }, + { + connector: ptConnectorName, + method: "depositTo", + args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, setId, 0] + } + ] + // Before Spell + let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance is 0`).to.be.eq(ethers.utils.parseEther("0")); + + let cToken = await ethers.getContractAt(abis.basic.erc20, PT_DAI_TICKET_ADDR) + const balance = await cToken.balanceOf(dsaWallet0.address) + expect(balance, `PoolTogether DAI Ticket balance is 0`).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `Expect DAI balance to still equal 0 since it was deposited into Prize Pool`).to.be.eq(0); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address) + expect(balanceAfter, `PoolTogether DAI Ticket balance equals 100`).to.be.eq(ethers.utils.parseEther("100")); + + // ETH used for transaction + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("9")); + }); + + it("Should wait 11 days, withdraw all PrizePool, get back 100 DAI, and claim POOL", async function () { + const amount = ethers.utils.parseEther("100") // 100 DAI + + let prizePoolContract = new ethers.Contract(DAI_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); + let earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); + expect(earlyExitFee.exitFee, "Exit Fee equal to 1 DAI because starts at 10%").to.be.eq(ethers.utils.parseEther("1")); + + const spells = [ + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] + }, + { + connector: ptConnectorName, + method: "claim", + args: [DAI_POOL_FAUCET_ADDR, 0] + } + ] + + // Before spell + let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance equals 0`).to.be.eq(ethers.utils.parseEther("0")); + + let cToken = await ethers.getContractAt(abis.basic.erc20, PT_DAI_TICKET_ADDR) + const balance = await cToken.balanceOf(dsaWallet0.address) + expect(balance, `PoolTogether Dai Ticket is 100`).to.be.eq(ethers.utils.parseEther("100")); + + let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) + const poolBalance = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalance, `POOL Token equals 0`).to.be.eq(ethers.utils.parseEther("0")); + + // Increase time by 11 days so we get back all DAI without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); + await ethers.provider.send("evm_mine"); + + earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); + expect(earlyExitFee.exitFee, "Exit Fee equal to 0 DAI because past 10 days").to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, + `DAI balance to be equal to 100, because of no early withdrawal fee` + ).to.be.eq(ethers.utils.parseEther("100")); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address) + expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalanceAfter, `POOL Token Balance to be greater than 0`).to.be.gt(ethers.utils.parseEther("0")); + }); + + it("Should deposit and withdraw all PrizePool, get back less than 100 DAI", async function () { + const amount = ethers.utils.parseEther("100") // 100 DAI + const exitFee = ethers.utils.parseEther("1") // 1 DAI is 10% of 100 DAI + const spells = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0] + }, + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, exitFee, 0, 0] + } + ] + + // Before spell + let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI Balance equals 0`).to.be.eq(ethers.utils.parseEther("100")); + + let cToken = await ethers.getContractAt(abis.basic.erc20, PT_DAI_TICKET_ADDR) + const balance = await cToken.balanceOf(dsaWallet0.address) + expect(balance, `PoolTogether DAI Ticket equals 0`).to.be.eq(0); + + let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) + const poolBalance = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalance, `PoolTogether Token greater than 0`).to.be.gt(0); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, + `DAI balance to be less than 100, because of early withdrawal fee` + ).to.be.lt(ethers.utils.parseEther("100")); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address) + expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalanceAfter, `POOL Token Balance to greater than 0`).to.be.gt(ethers.utils.parseEther("0")); + + }); + + it("Should deposit, wait 11 days, and withdraw all PrizePool, get 99 DAI, and claim all POOL using claimAll", async function () { + const amount = ethers.utils.parseEther("99") // 99 DAI + const depositSpells = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0] + } + ] + + // Before spell + let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance less than 100`).to.be.lt(ethers.utils.parseEther("100")); + + let cToken = await ethers.getContractAt(abis.basic.erc20, PT_DAI_TICKET_ADDR) + const balance = await cToken.balanceOf(dsaWallet0.address) + expect(balance, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); + + let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) + const poolBalance = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalance, `POOL Token is greater than 0`).to.be.gt(ethers.utils.parseEther("0")); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(depositSpells), wallet1.address) + const receipt = await tx.wait() + + const prizePoolContract = new ethers.Contract(DAI_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); + let earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); + expect(earlyExitFee.exitFee, "Exit Fee equal to .99 DAI because starts at 10%").to.be.eq(ethers.utils.parseEther(".99")); + + + // Increase time by 11 days so we get back all DAI without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); + await ethers.provider.send("evm_mine"); + + earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); + expect(earlyExitFee.exitFee, "Exit Fee equal to 0 DAI because past 10 days").to.be.eq(0); + + const withdrawSpells = [ + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] + }, + { + connector: ptConnectorName, + method: "claimAll", + args: [TOKEN_FAUCET_PROXY_FACTORY_ADDR, [DAI_POOL_FAUCET_ADDR]] + } + ] + + // Run spell transaction + const tx2 = await dsaWallet0.connect(wallet0).cast(...encodeSpells(withdrawSpells), wallet1.address) + const receipt2 = await tx2.wait() + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance equals 99`).to.be.eq(ethers.utils.parseEther("99")); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address) + expect(balanceAfter, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); + + // Expect + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalanceAfter, `Pool Token to be greateir than 0`).to.be.gt(ethers.utils.parseEther("0")); + }); + }) + + describe("Main - DAI Pod Test", function () { + it("Should deposit 99 DAI in DAI Pod", async function () { + const amount = ethers.utils.parseEther("99") // 99 DAI + const spells = [ + { + connector: ptConnectorName, + method: "depositToPod", + args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0] + } + ] + + // Before spell + let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance equals 99`).to.be.eq(ethers.utils.parseEther("99")); + + let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) + const poolBalance = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + + let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR) + const podBalance = await podToken.balanceOf(dsaWallet0.address) + expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI equals 0`).to.be.eq(0); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalanceAfter, `POOL Token greater than 0`).to.be.gt(0); + + const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address) + expect(podBalanceAfter, `Pod DAI token greater than 0`).to.be.eq(ethers.utils.parseEther("99")); + }); + + it("Should claim rewards from pod token drop", async function () { + const spells = [ + { + connector: ptConnectorName, + method: "claimPodTokenDrop", + args: [DAI_POD_TOKEN_DROP, 0] + } + ] + + const tokenDropContract = new ethers.Contract(DAI_POD_TOKEN_DROP, tokenDropABI, ethers.provider); + const podContract = new ethers.Contract(DAI_POD_ADDR, podABI, masterSigner); + + // drop(): Claim TokenDrop asset for PrizePool Pod and transfers token(s) to external Pod TokenDrop + // dropt() also calls batch which, Deposit Pod float into PrizePool. Deposits the current float + // amount into the PrizePool and claims current POOL rewards. + const dropTx = await podContract.drop(); + await dropTx.wait(); + + // POOL Rewards able to claim from Pod Token Drop + let claimAmount = await tokenDropContract.callStatic["claim"](dsaWallet0.address); + + // Before spell + let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) + const poolBalance = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After spell + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) + const total = claimAmount.add(poolBalance); + expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq(total); + }); + + it("Should wait 11 days, withdraw all podTokens, get back 99 DAI", async function () { + const amount = ethers.utils.parseEther("99") // 99 DAI + + const podContract = new ethers.Contract(DAI_POD_ADDR, podABI, ethers.provider); + let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); + // maxFee depends on if token has been deposited to PrizePool yet + // since we called drop in previous test case, the tokens were deposited to PrizePool + expect(maxFee, "Exit Fee equal to .99 DAI because token still in float").to.be.eq(ethers.utils.parseEther(".99")); + + const spells = [ + { + connector: ptConnectorName, + method: "withdrawFromPod", + args: [DAI_POD_ADDR, amount, maxFee, 0, 0] + } + ] + + // Before spell + let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI Balance equals 0`).to.be.eq(0); + + let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) + const poolBalance = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalance, `POOL Token balance greater than 0`).to.be.gt(0); + + let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR) + const podBalance = await podToken.balanceOf(dsaWallet0.address) + expect(podBalance, `Pod DAI Token equals 99`).to.be.eq(ethers.utils.parseEther("99")); + + // Increase time by 11 days so we get back all DAI without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); + await ethers.provider.send("evm_mine"); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, + `DAI balance equals 99, because of no early withdrawal fee` + ).to.be.eq(ethers.utils.parseEther("99")); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalanceAfter, `POOL Token to be greater than 0`).to.be.gt(0); + + const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address) + expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq(0); + }); + + + + + it("Should deposit and withdraw from pod, get back same amount of 99 DAI", async function () { + const amount = ethers.utils.parseEther("99") + const maxFee = 0; // maxFee 0 since it doesn't give chance for Pod to actually deposit into PrizePool + + const spells = [ + { + connector: ptConnectorName, + method: "depositToPod", + args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0] + }, + { + connector: ptConnectorName, + method: "withdrawFromPod", + args: [DAI_POD_ADDR, amount, maxFee, 0, 0] + } + ] + + // Before spell + let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI equals 99`).to.be.eq(ethers.utils.parseEther("99")); + + let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) + const poolBalance = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + + // PodToken is 0 + let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR) + const podBalance = await podToken.balanceOf(dsaWallet0.address) + expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, + `DAI balance to be equal to 99, because funds still in 'float` + ).to.be.eq(ethers.utils.parseEther("99")); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq(poolBalance); + + // Expect Pod Token Balance to equal 0 + const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address) + expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq(ethers.utils.parseEther("0")); + }); + }) + + describe("Main - UNISWAP POOL/ETH Prize Pool Test", function () { + it("Should use uniswap to swap ETH for POOL, deposit to POOL/ETH LP, deposit POOL/ETH LP to PrizePool", async function () { + const amount = ethers.utils.parseEther("100") // 100 POOL + const slippage = ethers.utils.parseEther("0.03"); + const setId = "83478237" + + const UniswapV2Router02ABI = [ + "function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts)" + ]; + + // Get amount of ETH for 100 POOL from Uniswap + const UniswapV2Router02 = await ethers.getContractAt(UniswapV2Router02ABI, "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"); + const amounts = await UniswapV2Router02.getAmountsOut(amount, [POOL_TOKEN_ADDRESS, WETH_ADDR]); + const unitAmount = ethers.utils.parseEther(((amounts[1] * 1.03) / amounts[0]).toString()); + + const spells = [ + { + connector: uniswapConnectorName, + method: "buy", + args: [POOL_TOKEN_ADDRESS, tokens.eth.address, amount, unitAmount, 0, setId] + }, + { + connector: uniswapConnectorName, + method: "deposit", + args: [POOL_TOKEN_ADDRESS, tokens.eth.address, amount, unitAmount, slippage, 0, setId] + }, + { + connector: ptConnectorName, + method: "depositTo", + args: [UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, 0, PT_UNISWAP_POOLETHLP_TICKET_ADDR, setId, 0] + } + ] + + // Before Spell + let ethBalance = await ethers.provider.getBalance(dsaWallet0.address); + expect(ethBalance, `ETH Balance equals 9`).to.be.eq(ethers.utils.parseEther("9")); + + let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) + const poolBalance = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + + let uniswapLPToken = await ethers.getContractAt(abis.basic.erc20, UNISWAP_POOLETHLP_TOKEN_ADDR) + const uniswapPoolEthBalance = await uniswapLPToken.balanceOf(dsaWallet0.address) + expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); + + let ptUniswapPoolEthToken = await ethers.getContractAt(abis.basic.erc20, PT_UNISWAP_POOLETHLP_TICKET_ADDR) + const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf(dsaWallet0.address) + expect(ptUniswapPoolEthBalance, `PoolTogether Uniswap POOL?ETH LP equals 0`).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After spell + ethBalance = await ethers.provider.getBalance(dsaWallet0.address); + expect(ethBalance, `ETH Balance less than 9`).to.be.lt(ethers.utils.parseEther("9")); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalanceAfter, `POOL Token to be same after spell`).to.be.eq(poolBalance); + + const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf(dsaWallet0.address) + expect(uniswapPoolEthBalanceAfter, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); + + const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf(dsaWallet0.address) + expect(ptUniswapPoolEthBalanceAfter, `PT Uniswap POOL/ETH LP to greater than 0`).to.be.gt(0); + }); + + it("Should withdraw all PrizePool, get back Uniswap LP, claim POOL, deposit claimed POOL into Pool PrizePool", async function () { + let ptUniswapPoolEthToken = await ethers.getContractAt(abis.basic.erc20, PT_UNISWAP_POOLETHLP_TICKET_ADDR) + const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf(dsaWallet0.address) + const setId = "83478237" + + let uniswapPrizePoolContract = new ethers.Contract(UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); + let earlyExitFee = await uniswapPrizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_UNISWAP_POOLETHLP_TICKET_ADDR, ptUniswapPoolEthBalance); + expect(earlyExitFee.exitFee, "Exit Fee equals 0 because no early exit fee for this prize pool").to.be.eq(0); + + const spells = [ + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, ptUniswapPoolEthBalance, PT_UNISWAP_POOLETHLP_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] + }, + { + connector: ptConnectorName, + method: "claim", + args: [UNISWAP_POOLETHLP_FAUCET_ADDR, setId] + }, + { + connector: ptConnectorName, + method: "depositTo", + args: [POOL_PRIZE_POOL_ADDR, 0, PT_POOL_TICKET_ADDR, setId, 0] + } + ] + + // Before spell + let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) + const poolBalance = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + + // Uniswap POOL/ETH LP is 0 + let uniswapLPToken = await ethers.getContractAt(abis.basic.erc20, UNISWAP_POOLETHLP_TOKEN_ADDR) + const uniswapPoolEthBalance = await uniswapLPToken.balanceOf(dsaWallet0.address) + expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); + + expect(ptUniswapPoolEthBalance, `PT Uniswap POOL/ETH LP greater than 0`).to.be.gt(0); + + let poolPoolTicket = await ethers.getContractAt(abis.basic.erc20, PT_POOL_TICKET_ADDR) + const poolPoolTicketBalance = await poolPoolTicket.balanceOf(dsaWallet0.address) + expect(poolPoolTicketBalance, `PoolTogether POOL Ticket equals 0`).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After spell + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) + expect(poolBalanceAfter, `Pool Token Balance equal to balance before spell`).to.be.eq(poolBalance); + + const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf(dsaWallet0.address) + expect(uniswapPoolEthBalanceAfter, `Uniswap POOL/ETH LP to greater than 0`).to.be.gt(0); + + const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf(dsaWallet0.address) + expect(ptUniswapPoolEthBalanceAfter, `PT Uniswap POOL/ETH LP equal 0`).to.be.eq(0); + + const poolPoolTicketBalanceAfter = await poolPoolTicket.balanceOf(dsaWallet0.address) + expect(poolPoolTicketBalanceAfter, `PoolTogether POOL Ticket greater than 0`).to.be.gt(0); + }); + }) + + describe("Main - WETH Prize Pool Test", function () { + it("Deposit 1 ETH into WETH Prize Pool and withdraw immediately", async function () { + const amount = ethers.utils.parseEther("1") // 1 ETH + const setId = "83478237" + const spells = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, setId] + }, + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, amount, setId, 0] + }, + ] + // Before Spell + const ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After spell + const ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); + + // ETH used for transaction + expect(ethBalanceAfter, `ETH Balance less than before spell because of early withdrawal fee`).to.be.lte(ethBalanceBefore); + }); + + it("Deposit 1 ETH into WETH Prize Pool, wait 14 days, then withdraw", async function () { + const amount = ethers.utils.parseEther("1") // 1 ETH + const depositSpell = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, 0] + } + ] + + const withdrawSpell = [ + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, amount, 0, 0] + } + ] + + // Before Deposit Spell + let ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); + + // Run deposit spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(depositSpell), wallet1.address) + const receipt = await tx.wait() + + // After Deposit spell + let ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); + + expect(ethBalanceAfter, `ETH Balance less than before spell`).to.be.lte(ethBalanceBefore); + + // Increase time by 11 days so we get back all ETH without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [14 * 24 * 60 * 60]); + await ethers.provider.send("evm_mine"); + + // Run withdraw spell transaction + const tx2 = await dsaWallet0.connect(wallet0).cast(...encodeSpells(withdrawSpell), wallet1.address) + const receipt2 = await tx.wait() + + // After Deposit spell + ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); + + expect(ethBalanceAfter, `ETH Balance equal to before spell because no early exit fee`).to.be.eq(ethBalanceBefore); + }); + }); + + describe("Main - WETH Pod Test", function () { + let podAddress + it("Should deposit 1 ETH in WETH Pod and get Pod Ticket", async function () { + const amount = ethers.utils.parseEther("1") + + // Create Pod for WETH Prize Pool (Rari) + const podFactoryContract = new ethers.Contract(POD_FACTORY_ADDRESS, podFactoryABI, masterSigner) + podAddress = await podFactoryContract.callStatic.create(WETH_PRIZE_POOL_ADDR, WETH_POOL_TICKET_ADDR, constants.address_zero, wallet0.address, 18) + await podFactoryContract.create(WETH_PRIZE_POOL_ADDR, WETH_POOL_TICKET_ADDR, constants.address_zero, wallet0.address, 18) + + const spells = [ + { + connector: ptConnectorName, + method: "depositToPod", + args: [WETH_ADDR, podAddress, amount, 0, 0] + } + ] + + // Before Deposit Spell + const podContract = new ethers.Contract(podAddress, podABI, ethers.provider); + let podBalanceBefore = await podContract.balanceOfUnderlying(dsaWallet0.address) + expect(podBalanceBefore, `Pod balance equal to 0`).to.be.eq(0); + + let ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After Deposit spell + let ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); + expect(ethBalanceAfter, `ETH balance less than before`).to.be.lt(ethBalanceBefore); + + podBalanceAfter = await podContract.balanceOfUnderlying(dsaWallet0.address) + expect(podBalanceAfter, `Pod balance equal to 1`).to.be.eq(ethers.utils.parseEther("1")); + }); + + it("Should withdraw 1 Ticket from WETH Pod and get back ETH", async function () { + const amount = ethers.utils.parseEther("1") + + const podContract = new ethers.Contract(podAddress, podABI, ethers.provider); + let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); + expect(maxFee, "Exit Fee equal to 0 DAI because token still in float").to.be.eq(0); + // maxFee depends on if token has been deposited to PrizePool yet + + const spells = [ + { + connector: ptConnectorName, + method: "withdrawFromPod", + args: [podAddress, amount, maxFee, 0, 0] + } + ] + + // Before Deposit Spell + let podBalanceBefore = await podContract.balanceOfUnderlying(dsaWallet0.address) + expect(podBalanceBefore, `Pod balance equal to 1`).to.be.eq(ethers.utils.parseEther("1")); + + let ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); + + // Run spell transaction + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + const receipt = await tx.wait() + + // After Deposit spell + let ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); + expect(ethBalanceAfter, `ETH balance greater than before`).to.be.gt(ethBalanceBefore); + + podBalanceAfter = await podContract.balanceOfUnderlying(dsaWallet0.address) + expect(podBalanceAfter, `Pod balance equal to 0`).to.be.eq(ethers.utils.parseEther("0")); + }); + }); +}) \ No newline at end of file diff --git a/test/mainnet/uniswap-sell-beta/uniswap-sell-beta.js b/test/mainnet/uniswap-sell-beta/uniswap-sell-beta.ts similarity index 93% rename from test/mainnet/uniswap-sell-beta/uniswap-sell-beta.js rename to test/mainnet/uniswap-sell-beta/uniswap-sell-beta.ts index 0530e2b4..b607a822 100644 --- a/test/mainnet/uniswap-sell-beta/uniswap-sell-beta.js +++ b/test/mainnet/uniswap-sell-beta/uniswap-sell-beta.ts @@ -1,12 +1,12 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); +import { expect } from "chai"; +import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; -const { provider, deployContract } = waffle; +const { provider, deployContract } = waffle const USDC_ADDR = "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"; const WETH_ADDR = "0x82af49447d8a07e3bd95bd0d56f35241523fbab1"; -describe("Uniswap-sell-beta", function() { +describe("Uniswap-sell-beta", function () { let UniswapSellBeta, uniswapSellBeta; async function setBalance(address) { @@ -64,7 +64,7 @@ describe("Uniswap-sell-beta", function() { await uniswapSellBeta.deployed(); }); - it("Should have contracts deployed.", async function() { + it("Should have contracts deployed.", async function () { expect(uniswapSellBeta.address).to.exist; }); diff --git a/test/mainnet/uniswap/uniswap.test.js b/test/mainnet/uniswap/uniswap.test.ts similarity index 83% rename from test/mainnet/uniswap/uniswap.test.js rename to test/mainnet/uniswap/uniswap.test.ts index 1ed88892..e9cb8acd 100644 --- a/test/mainnet/uniswap/uniswap.test.js +++ b/test/mainnet/uniswap/uniswap.test.ts @@ -1,26 +1,27 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); +import { expect } from "chai"; +import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; -const { provider, deployContract } = waffle; +const { provider, deployContract } = waffle -const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js"); -const buildDSAv2 = require("../../../scripts/buildDSAv2"); -const encodeSpells = require("../../../scripts/encodeSpells.js"); -const encodeFlashcastData = require("../../../scripts/encodeFlashcastData.js"); -const getMasterSigner = require("../../../scripts/getMasterSigner"); -const addLiquidity = require("../../../scripts/addLiquidity"); +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js"; +import { buildDSAv2 } from "../../../scripts/buildDSAv2"; +import { encodeSpells } from "../../../scripts/encodeSpells.js"; +import { encodeFlashcastData } from "../../../scripts/encodeFlashcastData.js"; +import { getMasterSigner } from "../../../scripts/getMasterSigner"; +import { addLiquidity } from "../../../scripts/addLiquidity"; -const addresses = require("../../../scripts/constant/addresses"); -const abis = require("../../../scripts/constant/abis"); -const constants = require("../../../scripts/constant/constant"); -const tokens = require("../../../scripts/constant/tokens"); -const { +import { addresses } from "../../../scripts/constant/addresses"; +import { abis } from "../../../scripts/constant/abis"; +import { constants } from "../../../scripts/constant/constant"; +import { tokens } from "../../../scripts/constant/tokens"; + +import { abi: nftManagerAbi, -} = require("@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json"); +} from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json"; -const connectV2UniswapV3Artifacts = require("../../artifacts/contracts/mainnet/connectors/uniswap/v3/main.sol/ConnectV2UniswapV3.json"); -const { eth } = require("../../../scripts/constant/tokens"); -const { BigNumber } = require("ethers"); +import connectV2UniswapV3Artifacts from "../../artifacts/contracts/mainnet/connectors/uniswap/v3/main.sol/ConnectV2UniswapV3.json" +import { eth } from "../../../scripts/constant/tokens" +import { BigNumber } from "ethers" const FeeAmount = { LOW: 500, @@ -41,7 +42,7 @@ let tokenIds = []; let liquidities = []; const abiCoder = ethers.utils.defaultAbiCoder; -describe("UniswapV3", function() { +describe("UniswapV3", function () { const connectorName = "UniswapV3-v1"; let dsaWallet0; @@ -82,19 +83,19 @@ describe("UniswapV3", function() { console.log("Connector address", connector.address); }); - it("Should have contracts deployed.", async function() { + it("Should have contracts deployed.", async function () { expect(!!instaConnectorsV2.address).to.be.true; expect(!!connector.address).to.be.true; expect(!!masterSigner.address).to.be.true; }); - describe("DSA wallet setup", function() { - it("Should build DSA v2", async function() { + describe("DSA wallet setup", function () { + it("Should build DSA v2", async function () { dsaWallet0 = await buildDSAv2(wallet0.address); expect(!!dsaWallet0.address).to.be.true; }); - it("Deposit ETH & DAI into DSA wallet", async function() { + it("Deposit ETH & DAI into DSA wallet", async function () { await wallet0.sendTransaction({ to: dsaWallet0.address, value: ethers.utils.parseEther("10"), @@ -110,7 +111,7 @@ describe("UniswapV3", function() { ); }); - it("Deposit ETH & USDT into DSA wallet", async function() { + it("Deposit ETH & USDT into DSA wallet", async function () { await wallet0.sendTransaction({ to: dsaWallet0.address, value: ethers.utils.parseEther("10"), @@ -127,8 +128,8 @@ describe("UniswapV3", function() { }); }); - describe("Main", function() { - it("Should mint successfully", async function() { + describe("Main", function () { + it("Should mint successfully", async function () { const ethAmount = ethers.utils.parseEther("0.1"); // 1 ETH const daiAmount = ethers.utils.parseEther("400"); // 1 ETH const usdtAmount = ethers.utils.parseEther("400") / Math.pow(10, 12); // 1 ETH @@ -236,7 +237,7 @@ describe("UniswapV3", function() { expect(data.liquidity).to.be.equals(liquidities[0]); }).timeout(10000000000); - it("Should deposit successfully", async function() { + it("Should deposit successfully", async function () { const daiAmount = ethers.utils.parseEther("400"); // 1 ETH const ethAmount = ethers.utils.parseEther("0.1"); // 1 ETH const usdtAmount = ethers.utils.parseEther("400") / Math.pow(10, 12); // 1 ETH @@ -302,7 +303,7 @@ describe("UniswapV3", function() { expect(data.liquidity).to.be.equals(liquidities[0]); }); - it("Should withdraw successfully", async function() { + it("Should withdraw successfully", async function () { const getId = "0"; const setIds = ["0", "0"]; @@ -331,7 +332,7 @@ describe("UniswapV3", function() { expect(data1.liquidity.toNumber()).to.be.equals(0); }); - it("Should collect successfully", async function() { + it("Should collect successfully", async function () { const ethAmount = ethers.utils.parseEther("0.2"); // 1 ETH const daiAmount = ethers.utils.parseEther("800"); // 1 ETH const getIds = ["0", "0"]; @@ -351,7 +352,7 @@ describe("UniswapV3", function() { const receipt = await tx.wait(); }); - it("Should burn successfully", async function() { + it("Should burn successfully", async function () { const spells = [ { connector: connectorName, diff --git a/test/mainnet/uniswapStake/uniswapStake.test.js b/test/mainnet/uniswapStake/uniswapStake.test.ts similarity index 87% rename from test/mainnet/uniswapStake/uniswapStake.test.js rename to test/mainnet/uniswapStake/uniswapStake.test.ts index abf1929f..54f26b57 100644 --- a/test/mainnet/uniswapStake/uniswapStake.test.js +++ b/test/mainnet/uniswapStake/uniswapStake.test.ts @@ -1,20 +1,20 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); -const { waffle, ethers } = hre; +import { expect } from "chai"; +import hre from "hardhat"; +const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../../scripts/buildDSAv2") -const encodeSpells = require("../../../scripts/encodeSpells.js") -const getMasterSigner = require("../../../scripts/getMasterSigner") -const addLiquidity = require("../../../scripts/addLiquidity"); +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js"; +import { buildDSAv2 } from "../../../scripts/buildDSAv2"; +import { encodeSpells } from "../../../scripts/encodeSpells.js"; +import { getMasterSigner } from "../../../scripts/getMasterSigner"; +import { addLiquidity } from "../../../scripts/addLiquidity"; -const addresses = require("../../../scripts/constant/addresses"); -const abis = require("../../../scripts/constant/abis"); -const { abi: nftManagerAbi } = require("@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json") +import { addresses } from "../../../scripts/constant/addresses"; +import { abis } from "../../../scripts/constant/abis"; +import { abi: nftManagerAbi } from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json" -const connectV2UniswapStakerArtifacts = require("../../artifacts/contracts/mainnet/connectors/uniswap/v3_staker/main.sol/ConnectV2UniswapV3Staker.json"); -const connectV2UniswapV3Artifacts = require("../../artifacts/contracts/mainnet/connectors/uniswap/v3/main.sol/ConnectV2UniswapV3.json"); +import connectV2UniswapStakerArtifacts from "../../artifacts/contracts/mainnet/connectors/uniswap/v3_staker/main.sol/ConnectV2UniswapV3Staker.json"; +import connectV2UniswapV3Artifacts from "../../artifacts/contracts/mainnet/connectors/uniswap/v3/main.sol/ConnectV2UniswapV3.json"; const FeeAmount = { LOW: 500, @@ -39,11 +39,11 @@ describe("UniswapV3", function () { const connectorStaker = "UniswapStaker-v1" const connectorUniswap = "UniswapV3-v1" - let dsaWallet0 - let masterSigner; - let instaConnectorsV2; - let connector; - let startTime, endTime; + let dsaWallet0: any + let masterSigner: any; + let instaConnectorsV2: any; + let connector: any; + let startTime: any, endTime: any; const wallets = provider.getWallets() const [wallet0, wallet1, wallet2, wallet3] = wallets @@ -61,7 +61,7 @@ describe("UniswapV3", function () { }); masterSigner = await getMasterSigner(wallet3) instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); - nftManager = await ethers.getContractAt(nftManagerAbi, "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"); + let nftManager = await ethers.getContractAt(nftManagerAbi, "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"); connector = await deployAndEnableConnector({ connectorName: connectorStaker, contractArtifact: connectV2UniswapStakerArtifacts, @@ -70,7 +70,7 @@ describe("UniswapV3", function () { }) console.log("Connector address", connector.address) - uniswapConnector = await deployAndEnableConnector({ + let uniswapConnector = await deployAndEnableConnector({ connectorName: connectorUniswap, contractArtifact: connectV2UniswapV3Artifacts, signer: masterSigner, @@ -214,8 +214,8 @@ describe("UniswapV3", function () { let castEvent = new Promise((resolve, reject) => { dsaWallet0.on('LogCast', (origin, sender, value, targetNames, targets, eventNames, eventParams, event) => { - const params = abiCoder.decode(["bytes32","address","address","uint256","uint256","uint256"], eventParams[0]); - const params1 = abiCoder.decode(["bytes32","address","address","uint256","uint256","uint256"], eventParams[1]); + const params = abiCoder.decode(["bytes32", "address", "address", "uint256", "uint256", "uint256"], eventParams[0]); + const params1 = abiCoder.decode(["bytes32", "address", "address", "uint256", "uint256", "uint256"], eventParams[1]); event.removeListener(); resolve({ start: [params[3], params1[3]], end: [params[4], params1[4]] }); @@ -287,6 +287,8 @@ describe("UniswapV3", function () { ethAddress, "1000", ], + }, + { connector: connectorStaker, method: "claimRewards", args: [ diff --git a/test/mainnet/yearn/yearn.test.js b/test/mainnet/yearn/yearn.test.js deleted file mode 100644 index 8a9cd382..00000000 --- a/test/mainnet/yearn/yearn.test.js +++ /dev/null @@ -1,153 +0,0 @@ -const { expect } = require("chai"); -const hre = require("hardhat"); -const { waffle, ethers } = hre; -const { provider } = waffle - -const deployAndEnableConnector = require("../../../scripts/deployAndEnableConnector.js") -const buildDSAv2 = require("../../../scripts/buildDSAv2") -const encodeSpells = require("../../../scripts/encodeSpells.js") -const getMasterSigner = require("../../../scripts/getMasterSigner") - -const tokens = require("../../../scripts/constant/tokens"); -const addresses = require("../../../scripts/constant/addresses"); -const abis = require("../../../scripts/constant/abis"); -const connectV2YearnArtifacts = require("../../artifacts/contracts/mainnet/connectors/yearn_v2/main.sol/ConnectV2YearnV2.json") - -const toBytes32 = (bn) => { - return ethers.utils.hexlify(ethers.utils.zeroPad(bn.toHexString(), 32)); -}; -const setStorageAt = async (address, index, value) => { - await ethers.provider.send("hardhat_setStorageAt", [address, index, value]); - await ethers.provider.send("evm_mine", []); // Just mines to the next block -}; - -describe("Yearn", function () { - const connectorName = "YEARN-TEST-A" - - let dsaWallet0 - let masterSigner; - let instaConnectorsV2; - let connector; - - const wallets = provider.getWallets() - const [wallet0, wallet1, wallet2, wallet3] = wallets - before(async () => { - await hre.network.provider.request({ - method: "hardhat_reset", - params: [ - { - forking: { - jsonRpcUrl: hre.config.networks.hardhat.forking.url, - blockNumber: 12996975, - }, - }, - ], - }); - masterSigner = await getMasterSigner(wallet3) - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); - connector = await deployAndEnableConnector({ - connectorName, - contractArtifact: connectV2YearnArtifacts, - signer: masterSigner, - connectors: instaConnectorsV2 - }) - console.log("Connector address", connector.address) - }) - - it("Should have contracts deployed.", async function () { - expect(!!instaConnectorsV2.address).to.be.true; - expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; - }); - - describe("DSA wallet setup", function () { - it("Should build DSA v2", async function () { - dsaWallet0 = await buildDSAv2(wallet0.address) - expect(!!dsaWallet0.address).to.be.true; - }); - - it("Deposit ETH into DSA wallet", async function () { - await wallet0.sendTransaction({ - to: dsaWallet0.address, - value: ethers.utils.parseEther("10") - }); - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("10")); - }); - }); - - describe("Main", function () { - - it("Should increase the DAI balance to 100 DAI", async function () { - const DAI = new ethers.Contract(tokens.dai.address, abis.basic.erc20, ethers.provider); - const DAI_SLOT = 2; - const locallyManipulatedBalance = ethers.utils.parseEther("100"); - - // Get storage slot index - const index = ethers.utils.solidityKeccak256( - ["uint256", "uint256"], - [dsaWallet0.address, DAI_SLOT] - ); - // Manipulate local balance (needs to be bytes32 string) - await setStorageAt( - tokens.dai.address, - index.toString(), - toBytes32(locallyManipulatedBalance).toString() - ); - - // Get DAI balance - const balance = await DAI.balanceOf(dsaWallet0.address); - expect(await ethers.BigNumber.from(balance).eq(ethers.utils.parseEther("100"))); - }); - - it("Should deposit and withdraw 50 DAI in/out the Yearn Vault", async function () { - const DAI = new ethers.Contract(tokens.dai.address, abis.basic.erc20, ethers.provider); - const DAI_VAULT = '0xdA816459F1AB5631232FE5e97a05BBBb94970c95'; - const amount = ethers.utils.parseEther("50") // 50 DAI - const setId = "132456"; - const spells = [ - { - connector: connectorName, - method: "deposit", - args: [DAI_VAULT, amount, 0, setId] - }, - { - connector: connectorName, - method: "withdraw", - args: [DAI_VAULT, amount, setId, 0] - } - ] - - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet0.address); - await tx.wait(); - - // Get DAI balance - const balance = await DAI.balanceOf(dsaWallet0.address); - expect(await ethers.BigNumber.from(balance).eq(ethers.utils.parseEther("100"))); - }); - - it("Should deposit 70 DAI in the Yearn Vault", async function () { - const DAI_VAULT = '0xdA816459F1AB5631232FE5e97a05BBBb94970c95'; - const DAI = new ethers.Contract(tokens.dai.address, abis.basic.erc20, ethers.provider); - const YVDAI = new ethers.Contract(DAI_VAULT, abis.basic.erc20, ethers.provider); - const amount = ethers.utils.parseEther("70") // 70 DAI - const setId = "568445"; - const spells = [ - { - connector: connectorName, - method: "deposit", - args: [DAI_VAULT, amount, 0, setId] - } - ] - - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet0.address); - await tx.wait(); - - // Get DAI balance - const yvDAIBalance = await YVDAI.balanceOf(dsaWallet0.address); - const daiBalance = await DAI.balanceOf(dsaWallet0.address); - const correctDaiBalance = await ethers.BigNumber.from(daiBalance).eq(ethers.utils.parseEther("30")); - const correctYVDaiBalance = await ethers.BigNumber.from(yvDAIBalance).lte(ethers.utils.parseEther("70")); - expect(correctDaiBalance && correctYVDaiBalance); - }); - }) -}) diff --git a/test/mainnet/yearn/yearn.test.ts b/test/mainnet/yearn/yearn.test.ts new file mode 100644 index 00000000..ce762575 --- /dev/null +++ b/test/mainnet/yearn/yearn.test.ts @@ -0,0 +1,154 @@ +import { expect } from "chai"; +import hre from "hardhat"; +const { web3, deployments, waffle, ethers } = hre; +const { provider, deployContract } = waffle + +import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/buildDSAv2" +import { encodeSpells } from "../../../scripts/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/getMasterSigner" + +import { addresses } from "../../../scripts/constant/addresses"; +import { abis } from "../../../scripts/constant/abis"; +import { tokens } from "../../../scripts/constant/tokens"; + +import connectV2YearnArtifacts from "../../artifacts/contracts/mainnet/connectors/yearn_v2/main.sol/ConnectV2YearnV2.json" + +const toBytes32 = (bn) => { + return ethers.utils.hexlify(ethers.utils.zeroPad(bn.toHexString(), 32)); +}; +const setStorageAt = async (address, index, value) => { + await ethers.provider.send("hardhat_setStorageAt", [address, index, value]); + await ethers.provider.send("evm_mine", []); // Just mines to the next block +}; + +describe("Yearn", function () { + const connectorName = "YEARN-TEST-A" + + let dsaWallet0 + let masterSigner; + let instaConnectorsV2; + let connector; + + const wallets = provider.getWallets() + const [wallet0, wallet1, wallet2, wallet3] = wallets + before(async () => { + await hre.network.provider.request({ + method: "hardhat_reset", + params: [ + { + forking: { + jsonRpcUrl: hre.config.networks.hardhat.forking.url, + blockNumber: 12996975, + }, + }, + ], + }); + masterSigner = await getMasterSigner(wallet3) + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); + connector = await deployAndEnableConnector({ + connectorName, + contractArtifact: connectV2YearnArtifacts, + signer: masterSigner, + connectors: instaConnectorsV2 + }) + console.log("Connector address", connector.address) + }) + + it("Should have contracts deployed.", async function () { + expect(!!instaConnectorsV2.address).to.be.true; + expect(!!connector.address).to.be.true; + expect(!!masterSigner.address).to.be.true; + }); + + describe("DSA wallet setup", function () { + it("Should build DSA v2", async function () { + dsaWallet0 = await buildDSAv2(wallet0.address) + expect(!!dsaWallet0.address).to.be.true; + }); + + it("Deposit ETH into DSA wallet", async function () { + await wallet0.sendTransaction({ + to: dsaWallet0.address, + value: ethers.utils.parseEther("10") + }); + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("10")); + }); + }); + + describe("Main", function () { + + it("Should increase the DAI balance to 100 DAI", async function () { + const DAI = new ethers.Contract(tokens.dai.address, abis.basic.erc20, ethers.provider); + const DAI_SLOT = 2; + const locallyManipulatedBalance = ethers.utils.parseEther("100"); + + // Get storage slot index + const index = ethers.utils.solidityKeccak256( + ["uint256", "uint256"], + [dsaWallet0.address, DAI_SLOT] + ); + // Manipulate local balance (needs to be bytes32 string) + await setStorageAt( + tokens.dai.address, + index.toString(), + toBytes32(locallyManipulatedBalance).toString() + ); + + // Get DAI balance + const balance = await DAI.balanceOf(dsaWallet0.address); + expect(await ethers.BigNumber.from(balance).eq(ethers.utils.parseEther("100"))); + }); + + it("Should deposit and withdraw 50 DAI in/out the Yearn Vault", async function () { + const DAI = new ethers.Contract(tokens.dai.address, abis.basic.erc20, ethers.provider); + const DAI_VAULT = '0xdA816459F1AB5631232FE5e97a05BBBb94970c95'; + const amount = ethers.utils.parseEther("50") // 50 DAI + const setId = "132456"; + const spells = [ + { + connector: connectorName, + method: "deposit", + args: [DAI_VAULT, amount, 0, setId] + }, + { + connector: connectorName, + method: "withdraw", + args: [DAI_VAULT, amount, setId, 0] + } + ] + + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet0.address); + await tx.wait(); + + // Get DAI balance + const balance = await DAI.balanceOf(dsaWallet0.address); + expect(await ethers.BigNumber.from(balance).eq(ethers.utils.parseEther("100"))); + }); + + it("Should deposit 70 DAI in the Yearn Vault", async function () { + const DAI_VAULT = '0xdA816459F1AB5631232FE5e97a05BBBb94970c95'; + const DAI = new ethers.Contract(tokens.dai.address, abis.basic.erc20, ethers.provider); + const YVDAI = new ethers.Contract(DAI_VAULT, abis.basic.erc20, ethers.provider); + const amount = ethers.utils.parseEther("70") // 70 DAI + const setId = "568445"; + const spells = [ + { + connector: connectorName, + method: "deposit", + args: [DAI_VAULT, amount, 0, setId] + } + ] + + const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet0.address); + await tx.wait(); + + // Get DAI balance + const yvDAIBalance = await YVDAI.balanceOf(dsaWallet0.address); + const daiBalance = await DAI.balanceOf(dsaWallet0.address); + const correctDaiBalance = await ethers.BigNumber.from(daiBalance).eq(ethers.utils.parseEther("30")); + const correctYVDaiBalance = await ethers.BigNumber.from(yvDAIBalance).lte(ethers.utils.parseEther("70")); + expect(correctDaiBalance && correctYVDaiBalance); + }); + }) +}) diff --git a/yarn.lock b/yarn.lock index 01f4fd13..3af4c4c9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5343,19 +5343,6 @@ "resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" "version" "1.0.0" -"fsevents@^1.2.7", "fsevents@~2.1.1": - "integrity" "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==" - "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz" - "version" "1.2.13" - dependencies: - "bindings" "^1.5.0" - "nan" "^2.12.1" - -"fsevents@~2.3.2": - "integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==" - "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" - "version" "2.3.2" - "function-bind@^1.1.1", "function-bind@~1.1.1": "integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" "resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" @@ -7730,16 +7717,16 @@ "fmix" "^0.1.0" "imul" "^1.0.0" -"nan@^2.12.1", "nan@2.13.2": - "integrity" "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" - "resolved" "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz" - "version" "2.13.2" - "nan@^2.14.0": "integrity" "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==" "resolved" "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz" "version" "2.14.2" +"nan@2.13.2": + "integrity" "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" + "resolved" "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz" + "version" "2.13.2" + "nano-base32@^1.0.1": "integrity" "sha1-ulSMh578+5DaHE2eCX20pGySVe8=" "resolved" "https://registry.npmjs.org/nano-base32/-/nano-base32-1.0.1.tgz" From dfb388ce8d8134a8b6e7d8b70faf53d62296153e Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sun, 5 Dec 2021 10:53:21 +0530 Subject: [PATCH 07/39] updated scripts --- package.json | 1 + scripts/constant/addresses.ts | 1 - scripts/constant/constant.ts | 10 +- scripts/deployAvaxConnector.js | 27 -- scripts/deployCompoundMapping.js | 82 ---- scripts/deployConnectorsFromCmd.js | 105 ---- scripts/deployInstaMappingController.js | 36 -- scripts/deployMappingContract.js | 38 -- scripts/deploySingle.js | 23 - scripts/encodeFlashcastData.js | 16 - scripts/polygon/buildDSAv2.js | 15 - scripts/polygon/buildDSAv2.ts | 20 + .../constant/{addresses.js => addresses.ts} | 2 +- scripts/polygon/constant/constant.js | 7 - scripts/polygon/constant/constant.ts | 7 + scripts/polygon/constant/tokens.js | 30 -- scripts/polygon/constant/tokens.ts | 30 ++ scripts/polygon/deployAndEnableConnector.js | 19 - scripts/polygon/deployAndEnableConnector.ts | 26 + scripts/polygon/encodeSpells.js | 18 - scripts/polygon/encodeSpells.ts | 18 + ...{getMasterSigner.js => getMasterSigner.ts} | 9 +- status-checks/check.js | 370 --------------- status-checks/check.ts | 448 ++++++++++++++++++ status-checks/checks.js | 13 - status-checks/checks.ts | 15 + status-checks/huskyCheck.js | 9 - status-checks/huskyCheck.ts | 9 + status-checks/index.js | 54 --- status-checks/index.ts | 57 +++ 30 files changed, 641 insertions(+), 874 deletions(-) delete mode 100644 scripts/deployAvaxConnector.js delete mode 100644 scripts/deployCompoundMapping.js delete mode 100644 scripts/deployConnectorsFromCmd.js delete mode 100644 scripts/deployInstaMappingController.js delete mode 100644 scripts/deployMappingContract.js delete mode 100644 scripts/deploySingle.js delete mode 100644 scripts/encodeFlashcastData.js delete mode 100644 scripts/polygon/buildDSAv2.js create mode 100644 scripts/polygon/buildDSAv2.ts rename scripts/polygon/constant/{addresses.js => addresses.ts} (91%) delete mode 100644 scripts/polygon/constant/constant.js create mode 100644 scripts/polygon/constant/constant.ts delete mode 100644 scripts/polygon/constant/tokens.js create mode 100644 scripts/polygon/constant/tokens.ts delete mode 100644 scripts/polygon/deployAndEnableConnector.js create mode 100644 scripts/polygon/deployAndEnableConnector.ts delete mode 100644 scripts/polygon/encodeSpells.js create mode 100644 scripts/polygon/encodeSpells.ts rename scripts/polygon/{getMasterSigner.js => getMasterSigner.ts} (73%) delete mode 100644 status-checks/check.js create mode 100644 status-checks/check.ts delete mode 100644 status-checks/checks.js create mode 100644 status-checks/checks.ts delete mode 100644 status-checks/huskyCheck.js create mode 100644 status-checks/huskyCheck.ts delete mode 100644 status-checks/index.js create mode 100644 status-checks/index.ts diff --git a/package.json b/package.json index a4cc56d4..62a20560 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "homepage": "https://github.com/InstaDApp/dsa-connectors-new#readme", "dependencies": { "@openzeppelin/contracts": "^3.4.0-solc-0.7", + "@typechain/ethers-v5": "^8.0.5", "@typechain/hardhat": "^3.0.0", "@uniswap/v3-core": "^1.0.0", "@uniswap/v3-periphery": "^1.2.1", diff --git a/scripts/constant/addresses.ts b/scripts/constant/addresses.ts index 86af9b6a..28b6afec 100644 --- a/scripts/constant/addresses.ts +++ b/scripts/constant/addresses.ts @@ -9,4 +9,3 @@ export const addresses = { instaIndex: "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723", }, }; -  \ No newline at end of file diff --git a/scripts/constant/constant.ts b/scripts/constant/constant.ts index 0139c186..14fcbe2f 100644 --- a/scripts/constant/constant.ts +++ b/scripts/constant/constant.ts @@ -1,6 +1,6 @@ export const constants = { - address_zero: "0x0000000000000000000000000000000000000000", - eth_addr: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - max_value: "115792089237316195423570985008687907853269984665640564039457584007913129639935" - }; - \ No newline at end of file + address_zero: "0x0000000000000000000000000000000000000000", + eth_addr: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", + max_value: + "115792089237316195423570985008687907853269984665640564039457584007913129639935", +}; diff --git a/scripts/deployAvaxConnector.js b/scripts/deployAvaxConnector.js deleted file mode 100644 index f385fc8c..00000000 --- a/scripts/deployAvaxConnector.js +++ /dev/null @@ -1,27 +0,0 @@ -const hre = require("hardhat"); -const { ethers, deployments, getUnnamedAccounts } = hre; -const { deploy } = deployments; - - -async function main() { - - const deployer = (await getUnnamedAccounts())[0] - - const connector = "ConnectV2InstaPoolV3Avalanche" - - const connectorInstance = await deploy(connector, { - from: deployer, - }) - console.log(`${connector} deployed: `, connectorInstance.address); - - await hre.run("sourcify", { - address: connectorInstance.address, - }) -} - -main() - .then(() => process.exit(0)) - .catch(error => { - console.error(error); - process.exit(1); - }); \ No newline at end of file diff --git a/scripts/deployCompoundMapping.js b/scripts/deployCompoundMapping.js deleted file mode 100644 index 498b00d5..00000000 --- a/scripts/deployCompoundMapping.js +++ /dev/null @@ -1,82 +0,0 @@ -const hre = require("hardhat"); -const { ethers } = hre; - -async function main() { - - const CONNECTORS_V2 = "0x97b0B3A8bDeFE8cB9563a3c610019Ad10DB8aD11"; - - const ctokenMapping = { - "ETH-A": "0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5", - "BAT-A": "0x6c8c6b02e7b2be14d4fa6022dfd6d75921d90e4e", - "COMP-A": "0x70e36f6bf80a52b3b46b3af8e106cc0ed743e8e4", - "DAI-A": "0x5d3a536e4d6dbd6114cc1ead35777bab948e3643", - "REP-A": "0x158079ee67fce2f58472a96584a73c7ab9ac95c1", - "UNI-A": "0x35a18000230da775cac24873d00ff85bccded550", - "USDC-A": "0x39aa39c021dfbae8fac545936693ac917d5e7563", - "USDT-A": "0xf650c3d88d12db855b8bf7d11be6c55a4e07dcc9", - "WBTC-A": "0xc11b1268c1a384e55c48c2391d8d480264a3a7f4", - "WBTC-B": "0xccF4429DB6322D5C611ee964527D42E5d685DD6a", - "ZRX-A": "0xb3319f5d18bc0d84dd1b4825dcde5d5f7266d407", - "YFI-A": "0x80a2ae356fc9ef4305676f7a3e2ed04e12c33946", - "SUSHI-A": "0x4b0181102a0112a2ef11abee5563bb4a3176c9d7", - "MKR-A": "0x95b4ef2869ebd94beb4eee400a99824bf5dc325b", - "AAVE-A": "0xe65cdb6479bac1e22340e4e755fae7e509ecd06c", - "TUSD-A": "0x12392f67bdf24fae0af363c24ac620a2f67dad86", - "LINK-A": "0xface851a4921ce59e912d19329929ce6da6eb0c7", - } - - const tokenMapping = { - "ETH-A": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - "BAT-A": "0x0D8775F648430679A709E98d2b0Cb6250d2887EF", - "COMP-A": "0xc00e94cb662c3520282e6f5717214004a7f26888", - "DAI-A": "0x6b175474e89094c44da98b954eedeac495271d0f", - "REP-A": "0x1985365e9f78359a9B6AD760e32412f4a445E862", - "UNI-A": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", - "USDC-A": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "USDT-A": "0xdac17f958d2ee523a2206206994597c13d831ec7", - "WBTC-A": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "WBTC-B": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "ZRX-A": "0xe41d2489571d322189246dafa5ebde1f4699f498", - "YFI-A": "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e", - "SUSHI-A": "0x6B3595068778DD592e39A122f4f5a5cF09C90fE2", - "MKR-A": "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2", - "AAVE-A": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9", - "TUSD-A": "0x0000000000085d4780B73119b644AE5ecd22b376", - "LINK-A": "0x514910771af9ca656af840dff83e8264ecf986ca", - } - - const Mapping = await ethers.getContractFactory("InstaCompoundMapping"); - const mapping = await Mapping.deploy( - CONNECTORS_V2, - Object.keys(ctokenMapping), - Object.values(tokenMapping), - Object.values(ctokenMapping) - ); - await mapping.deployed(); - - console.log(`InstaCompoundMapping Deployed: ${mapping.address}`); - - try { - await hre.run("verify:verify", { - address: mapping.address, - constructorArguments: [ - CONNECTORS_V2, - Object.keys(ctokenMapping), - Object.values(tokenMapping), - Object.values(ctokenMapping) - ] - } - ) -} catch (error) { - console.log(`Failed to verify: InstaCompoundMapping@${mapping.address}`) - console.log(error) - console.log() -} -} - -main() - .then(() => process.exit(0)) - .catch(error => { - console.error(error); - process.exit(1); - }); \ No newline at end of file diff --git a/scripts/deployConnectorsFromCmd.js b/scripts/deployConnectorsFromCmd.js deleted file mode 100644 index f2584fa5..00000000 --- a/scripts/deployConnectorsFromCmd.js +++ /dev/null @@ -1,105 +0,0 @@ -const fs = require("fs"); -const hre = require("hardhat"); -const { ethers } = hre; - -let args = process.argv; -args = args.splice(2, args.length); -let params = {}; - -for (let i = 0; i < args.length; i += 2) { - if (args[i][0] !== "-" || args[i][1] !== "-") { - console.log("Please add '--' for the key"); - process.exit(-1); - } - let key = args[i].slice(2, args[i].length); - params[key] = args[i + 1]; -} - -if (!params.hasOwnProperty('connector')) { - console.error("Should include connector params") - process.exit(-1); -} - -if (!params.hasOwnProperty('network')) { - console.error("Should include network params") - process.exit(-1); -} - -if (!params.hasOwnProperty('gasPrice')) { - console.error("Should include gas params") - process.exit(-1); -} - -let privateKey = process.env.PRIVATE_KEY; -let provider = new ethers.providers.JsonRpcProvider(hre.config.networks[params['network']].url); -let wallet = new ethers.Wallet(privateKey, provider); - -hre.network.name = params['networkName']; -hre.network.config = hre.config.networks[params['networkName']]; -hre.network.provider = provider; -let contracts = []; - -const parseFile = async (filePath) => { - const data = fs.readFileSync(filePath, "utf-8"); - let parsedData = data.split("contract "); - parsedData = parsedData[parsedData.length - 1].split(" "); - parsedData = parsedData[0]; - return parsedData; -} - -const parseDir = async (root, basePath, addPath) => { - for(let i = 0; i < root.length; i++) { - addPath = "/" + root[i]; - const dir = fs.readdirSync(basePath + addPath); - if(dir.indexOf("main.sol") !== -1) { - const fileData = await parseFile(basePath + addPath + "/main.sol"); - contracts.push(fileData) - } else { - await parseDir(dir, basePath + addPath, ""); - } - } -} - -const main = async () => { - const mainnet = fs.readdirSync("./contracts/mainnet/connectors/"); - const polygon = fs.readdirSync("./contracts/polygon/connectors/"); - let basePathMainnet = "./contracts/mainnet/connectors/"; - let basePathPolygon = "./contracts/polygon/connectors/"; - - const connectorName = params['connector']; - - await parseDir(mainnet, basePathMainnet, ""); - await parseDir(polygon, basePathPolygon, ""); - - if(contracts.indexOf(connectorName) === -1) { - throw new Error("can not find the connector!\n" + "supported connector names are:\n" + contracts.join("\n")); - } - - const Connector = await ethers.getContractFactory(connectorName); - const connector = await Connector.connect(wallet).deploy({ gasPrice: ethers.utils.parseUnits(params['gasPrice'], "gwei") }); - await connector.deployed(); - - console.log(`${connectorName} Deployed: ${connector.address}`); - try { - await hre.run("verify:verify", { - address: connector.address, - constructorArguments: [] - } - ) - } catch (error) { - console.log(`Failed to verify: ${connectorName}@${connector.address}`) - console.log(error) - } - - return connector.address -} - -main() - .then(() => { - console.log("Done successfully"); - process.exit(0) - }) - .catch(err => { - console.log("error:", err); - process.exit(1); - }) \ No newline at end of file diff --git a/scripts/deployInstaMappingController.js b/scripts/deployInstaMappingController.js deleted file mode 100644 index f6919bb2..00000000 --- a/scripts/deployInstaMappingController.js +++ /dev/null @@ -1,36 +0,0 @@ -const hre = require('hardhat') -const { ethers } = hre - -async function main () { - if (hre.network.name === 'mainnet') { - console.log( - '\n\n Deploying Contracts to mainnet. Hit ctrl + c to abort' - ) - } else if (hre.network.name === 'hardhat') { - console.log( - '\n\n Deploying Contracts to hardhat.' - ) - } - - const InstaMappingController = await ethers.getContractFactory('InstaMappingController') - const instaMappingController = await InstaMappingController.deploy() - await instaMappingController.deployed() - - console.log('InstaMappingController deployed: ', instaMappingController.address) - - if (hre.network.name === 'mainnet') { - await hre.run('verify:verify', { - address: instaMappingController.address, - constructorArguments: [] - }) - } else if (hre.network.name === 'hardhat') { - console.log("Contracts deployed.") - } -} - -main() - .then(() => process.exit(0)) - .catch(error => { - console.error(error) - process.exit(1) - }) diff --git a/scripts/deployMappingContract.js b/scripts/deployMappingContract.js deleted file mode 100644 index 7fce2acd..00000000 --- a/scripts/deployMappingContract.js +++ /dev/null @@ -1,38 +0,0 @@ -const hre = require('hardhat') -const { ethers } = hre - -async function main () { - if (hre.network.name === 'mainnet') { - console.log( - '\n\n Deploying Contracts to mainnet. Hit ctrl + c to abort' - ) - } else if (hre.network.name === 'hardhat') { - console.log( - '\n\n Deploying Contracts to hardhat.' - ) - } - - const mappingContract = "CONTRACT_NAME" - - const InstaProtocolMapping = await ethers.getContractFactory(mappingContract) - const instaProtocolMapping = await InstaProtocolMapping.deploy() - await instaProtocolMapping.deployed() - - console.log(`${mappingContract} deployed: `, instaProtocolMapping.address) - - if (hre.network.name === 'mainnet') { - await hre.run('verify:verify', { - address: instaProtocolMapping.address, - constructorArguments: [] - }) - } else if (hre.network.name === 'hardhat') { - console.log("Contracts deployed.") - } -} - -main() - .then(() => process.exit(0)) - .catch(error => { - console.error(error) - process.exit(1) - }) diff --git a/scripts/deploySingle.js b/scripts/deploySingle.js deleted file mode 100644 index 50ed7298..00000000 --- a/scripts/deploySingle.js +++ /dev/null @@ -1,23 +0,0 @@ -const hre = require("hardhat"); -const { ethers } = hre; - -const deployConnector = require("./deployConnector"); - -async function main() { - const address = await deployConnector("ConnectOne") // Example - - const connectorsAbi = [ - "function addConnectors(string[] _connectorNames, address[] _connectors)" - ] - - const connectorsContract = new ethers.Contract("0x84b457c6D31025d56449D5A01F0c34bF78636f67", connectorsAbi, ethers.provider); - - await connectorsContract.addConnectors(['1inch'], [address]) -} - -main() - .then(() => process.exit(0)) - .catch(error => { - console.error(error); - process.exit(1); - }); \ No newline at end of file diff --git a/scripts/encodeFlashcastData.js b/scripts/encodeFlashcastData.js deleted file mode 100644 index a674c1af..00000000 --- a/scripts/encodeFlashcastData.js +++ /dev/null @@ -1,16 +0,0 @@ -const abis = require("./constant/abis"); -const addresses = require("./constant/addresses"); -const { web3 } = hre; - -const encodeSpells = require("./encodeSpells.js") - - -module.exports = function (spells) { - const encodeSpellsData = encodeSpells(spells); - const targetType = "string[]"; - let argTypes = [targetType, "bytes[]"]; - return web3.eth.abi.encodeParameters(argTypes, [ - encodeSpellsData[0], - encodeSpellsData[1], - ]); -}; diff --git a/scripts/polygon/buildDSAv2.js b/scripts/polygon/buildDSAv2.js deleted file mode 100644 index 967d879f..00000000 --- a/scripts/polygon/buildDSAv2.js +++ /dev/null @@ -1,15 +0,0 @@ -const hre = require("hardhat"); -const { ethers } = hre; -const addresses = require("./constant/addresses"); -const abis = require("../constant/abis"); - -const instaImplementations_m1 = require("../../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json") - -module.exports = async function (owner) { - const instaIndex = await ethers.getContractAt(abis.core.instaIndex, addresses.core.instaIndex) - - const tx = await instaIndex.build(owner, 2, owner); - const receipt = await tx.wait() - const event = receipt.events.find(a => a.event === "LogAccountCreated") - return await ethers.getContractAt(instaImplementations_m1.abi, event.args.account) -}; diff --git a/scripts/polygon/buildDSAv2.ts b/scripts/polygon/buildDSAv2.ts new file mode 100644 index 00000000..de623b32 --- /dev/null +++ b/scripts/polygon/buildDSAv2.ts @@ -0,0 +1,20 @@ +import { ethers } from "hardhat"; + +import { addresses } from "./constant/addresses"; +import { abis } from "../constant/abis"; + +import { abi } from "../../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json"; + +module.exports = async function(owner: any) { + const instaIndex = await ethers.getContractAt( + abis.core.instaIndex, + addresses.core.instaIndex + ); + + const tx = await instaIndex.build(owner, 2, owner); + const receipt = await tx.wait(); + const event = receipt.events.find( + (a: { event: string }) => a.event === "LogAccountCreated" + ); + return await ethers.getContractAt(abi, event.args.account); +}; diff --git a/scripts/polygon/constant/addresses.js b/scripts/polygon/constant/addresses.ts similarity index 91% rename from scripts/polygon/constant/addresses.js rename to scripts/polygon/constant/addresses.ts index baaaa3da..d60133c0 100644 --- a/scripts/polygon/constant/addresses.js +++ b/scripts/polygon/constant/addresses.ts @@ -1,4 +1,4 @@ -module.exports = { +export const addresses = { connectors: { basic: "0x1cAF5EC802ca602E98139AD96A8f2B7BC524264E", auth: "0xf6474aD0dA75A0dE15D2c915e601D9f754B9e6fe", diff --git a/scripts/polygon/constant/constant.js b/scripts/polygon/constant/constant.js deleted file mode 100644 index 62933314..00000000 --- a/scripts/polygon/constant/constant.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - address_zero: "0x0000000000000000000000000000000000000000", - eth_addr: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - matic_addr: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - max_value: "115792089237316195423570985008687907853269984665640564039457584007913129639935" - }; - \ No newline at end of file diff --git a/scripts/polygon/constant/constant.ts b/scripts/polygon/constant/constant.ts new file mode 100644 index 00000000..4059e9e5 --- /dev/null +++ b/scripts/polygon/constant/constant.ts @@ -0,0 +1,7 @@ +export const constant = { + address_zero: "0x0000000000000000000000000000000000000000", + eth_addr: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", + matic_addr: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", + max_value: + "115792089237316195423570985008687907853269984665640564039457584007913129639935", +}; diff --git a/scripts/polygon/constant/tokens.js b/scripts/polygon/constant/tokens.js deleted file mode 100644 index 55946203..00000000 --- a/scripts/polygon/constant/tokens.js +++ /dev/null @@ -1,30 +0,0 @@ -module.exports = { - "matic": { - "type": "token", - "symbol": "MATIC", - "name": "Matic", - "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - "decimals": 18 - }, - "eth": { - "type": "token", - "symbol": "ETH", - "name": "Ethereum", - "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - "decimals": 18 - }, - "dai": { - "type": "token", - "symbol": "DAI", - "name": "DAI Stable", - "address": "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", - "decimals": 18 - }, - "usdc": { - "type": "token", - "symbol": "USDC", - "name": "USD Coin", - "address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", - "decimals": 6 - } -} \ No newline at end of file diff --git a/scripts/polygon/constant/tokens.ts b/scripts/polygon/constant/tokens.ts new file mode 100644 index 00000000..d621b68e --- /dev/null +++ b/scripts/polygon/constant/tokens.ts @@ -0,0 +1,30 @@ +export const tokens = { + matic: { + type: "token", + symbol: "MATIC", + name: "Matic", + address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + decimals: 18, + }, + eth: { + type: "token", + symbol: "ETH", + name: "Ethereum", + address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + decimals: 18, + }, + dai: { + type: "token", + symbol: "DAI", + name: "DAI Stable", + address: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + decimals: 18, + }, + usdc: { + type: "token", + symbol: "USDC", + name: "USD Coin", + address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", + decimals: 6, + }, +}; diff --git a/scripts/polygon/deployAndEnableConnector.js b/scripts/polygon/deployAndEnableConnector.js deleted file mode 100644 index 52d80b5e..00000000 --- a/scripts/polygon/deployAndEnableConnector.js +++ /dev/null @@ -1,19 +0,0 @@ -const abis = require("../constant/abis"); -const addresses = require("./constant/addresses"); - -const hre = require("hardhat"); -const { ethers, waffle } = hre; -const { deployContract } = waffle; -const fs = require("fs") - - -module.exports = async function ({connectorName, contractArtifact, signer, connectors}) { - const connectorInstanace = await deployContract(signer, contractArtifact, []); - - await connectors.connect(signer).addConnectors([connectorName], [connectorInstanace.address]) - - addresses.connectors[connectorName] = connectorInstanace.address - abis.connectors[connectorName] = contractArtifact.abi; - - return connectorInstanace; -}; diff --git a/scripts/polygon/deployAndEnableConnector.ts b/scripts/polygon/deployAndEnableConnector.ts new file mode 100644 index 00000000..a62806dd --- /dev/null +++ b/scripts/polygon/deployAndEnableConnector.ts @@ -0,0 +1,26 @@ +import "@nomiclabs/hardhat-waffle"; + +import { addresses } from "./constant/addresses"; +import { abis } from "../constant/abis"; + +import * as hre from "hardhat"; +const { ethers, waffle } = hre; +const { deployContract } = waffle; + +module.exports = async function({ + connectorName, + contractArtifact, + signer, + connectors, +}) { + const connectorInstanace = await deployContract(signer, contractArtifact, []); + + await connectors + .connect(signer) + .addConnectors([connectorName], [connectorInstanace.address]); + + addresses.connectors[connectorName] = connectorInstanace.address; + abis.connectors[connectorName] = contractArtifact.abi; + + return connectorInstanace; +}; diff --git a/scripts/polygon/encodeSpells.js b/scripts/polygon/encodeSpells.js deleted file mode 100644 index ba1cddcb..00000000 --- a/scripts/polygon/encodeSpells.js +++ /dev/null @@ -1,18 +0,0 @@ -const abis = require("../constant/abis"); -const addresses = require("./constant/addresses"); -const { web3 } = hre; - -module.exports = function (spells) { - const targets = spells.map(a => a.connector) - const calldatas = spells.map(a => { - const functionName = a.method; - // console.log(functionName) - const abi = abis.connectors[a.connector].find(b => { - return b.name === functionName - }); - // console.log(functionName) - if (!abi) throw new Error("Couldn't find function") - return web3.eth.abi.encodeFunctionCall(abi, a.args) - }) - return [targets, calldatas] -}; diff --git a/scripts/polygon/encodeSpells.ts b/scripts/polygon/encodeSpells.ts new file mode 100644 index 00000000..c7e43755 --- /dev/null +++ b/scripts/polygon/encodeSpells.ts @@ -0,0 +1,18 @@ +import { addresses } from "./constant/addresses"; +import { abis } from "../constant/abis"; +import { web3 } from "hardhat"; + +module.exports = function(spells: any[]) { + const targets = spells.map((a) => a.connector); + const calldatas = spells.map((a) => { + const functionName = a.method; + // console.log(functionName) + const abi = abis.connectors[a.connector].find((b: { name: any }) => { + return b.name === functionName; + }); + // console.log(functionName) + if (!abi) throw new Error("Couldn't find function"); + return web3.eth.abi.encodeFunctionCall(abi, a.args); + }); + return [targets, calldatas]; +}; diff --git a/scripts/polygon/getMasterSigner.js b/scripts/polygon/getMasterSigner.ts similarity index 73% rename from scripts/polygon/getMasterSigner.js rename to scripts/polygon/getMasterSigner.ts index 9edb0417..558f3a27 100644 --- a/scripts/polygon/getMasterSigner.js +++ b/scripts/polygon/getMasterSigner.ts @@ -1,7 +1,6 @@ -const hre = require("hardhat"); -const { ethers } = hre; -const addresses = require("./constant/addresses"); -const abis = require("../constant/abis"); +const { ethers, network } = "hardhat"; +import { addresses } from "./constant/addresses"; +import { abis } from "../constant/abis"; module.exports = async function() { const [_, __, ___, wallet3] = await ethers.getSigners(); @@ -12,7 +11,7 @@ module.exports = async function() { ); const masterAddress = await instaIndex.master(); // TODO: make it constant? - await hre.network.provider.request({ + await network.provider.request({ method: "hardhat_impersonateAccount", params: [masterAddress], }); diff --git a/status-checks/check.js b/status-checks/check.js deleted file mode 100644 index c0848d77..00000000 --- a/status-checks/check.js +++ /dev/null @@ -1,370 +0,0 @@ -const fs = require('fs') -const path = require('path') - -const forbiddenStrings = ['selfdestruct'] - -const getConnectorsList = async (connectorsRootsDirs) => { - try { - const connectors = [] - for (let index = 0; index < connectorsRootsDirs.length; index++) { - const dirs = [connectorsRootsDirs[index]] - while (dirs.length) { - const currentDir = dirs.pop() - const subs = fs.readdirSync(currentDir, { withFileTypes: true }) - for (let index = 0; index < subs.length; index++) { - const sub = subs[index] - if (sub.isFile() && sub.name === 'main.sol') { - connectors.push(currentDir) - } else if (sub.isDirectory()) { - dirs.push(`${currentDir}/${sub.name}`) - } - } - } - } - return connectors.map(dir => ({ path: dir })) - } catch (error) { - return Promise.reject(error) - } -} - -const checkCodeForbidden = async (code, codePath) => { - try { - const forbidden = [] - for (let i1 = 0; i1 < forbiddenStrings.length; i1++) { - const forbiddenStr = forbiddenStrings[i1] - const strs = code.split('\n') - for (let i2 = 0; i2 < strs.length; i2++) { - if (strs[i2].includes(forbiddenStr)) { - forbidden.push(`found '${forbiddenStr}' in ${codePath}:${i2 + 1}`) - } - } - } - return forbidden - } catch (error) { - return Promise.reject(error) - } -} - -const checkForbidden = async (parentPath, codePath = './main.sol') => { - try { - if (codePath.startsWith('@')) { - codePath = path.resolve('node_modules', `./${codePath}`) - } else { - codePath = path.resolve(parentPath, codePath) - } - const code = fs.readFileSync(codePath, { encoding: 'utf8' }) - const forbidden = await checkCodeForbidden(code, codePath) - if (code.includes('import')) { - const importsPathes = code - .split('\n') - .filter(str => str.includes('import') && str.includes('from') && str.includes('.sol')) - .map(str => str.split('from')[1].replace(/["; ]/gi, '')) - for (let index = 0; index < importsPathes.length; index++) { - const forbiddenErrors = await checkForbidden( - path.parse(codePath).dir, - importsPathes[index] - ) - forbidden.push(...forbiddenErrors) - } - } - return codePath.endsWith('main.sol') ? { forbiddenErrors: forbidden, code } : forbidden - } catch (error) { - return Promise.reject(error) - } -} - -const checkEvents = async (connector) => { - try { - const errors = [] - const warnings = [] - const eventsPath = `${connector.path}/events.sol` - const mainPath = `${connector.path}/main.sol` - if (connector.events.length) { - const eventNames = [] - for (let i1 = 0; i1 < connector.mainEvents.length; i1++) { - const mainEvent = connector.mainEvents[i1] - const name = mainEvent.split('(')[0] - eventNames.push(name) - const event = connector.events.find(e => e.split('(')[0].split(' ')[1] === name) - if (event) { - const mainEventArgs = mainEvent.split('(')[1].split(')')[0].split(',').map(a => a.trim()) - const eventArgs = event.split('(')[1].split(')')[0].split(',').map(a => a.trim()) - if (mainEventArgs.length !== eventArgs.length) { - errors.push(`arguments amount don't match for ${name} at ${mainPath}:${connector.mainEventsLines[i1]}`) - continue - } - for (let i2 = 0; i2 < mainEventArgs.length; i2++) { - if (!mainEventArgs[i2].startsWith(eventArgs[i2].split(' ')[0])) { - errors.push(`invalid argument #${i2 + 1} for ${name} at ${mainPath}:${connector.mainEventsLines[i1]}`) - } - } - } else { - errors.push(`event ${name} missing at ${eventsPath}`) - } - } - if (connector.mainEvents.length < connector.events.length) { - const deprecatedEvents = connector.events.filter(e => { - let used = false - for (let index = 0; index < eventNames.length; index++) { - if (e.split('(')[0].split(' ')[1] === eventNames[index]) used = true - } - return !used - }) - warnings.push(`${deprecatedEvents.map(e => e.split('(')[0].split(' ')[1]).join(', ')} event(s) not used at ${connector.path}/main.sol`) - } - } else { - warnings.push(`missing events file for ${connector.path}/main.sol`) - } - return { eventsErrors: errors, eventsWarnings: warnings } - } catch (error) { - return Promise.reject(error) - } -} - -const getCommments = async (strs) => { - try { - const comments = [] - let type - for (let index = strs.length - 1; index >= 0; index--) { - const str = strs[index] - if (!type) { - if (str.trim().startsWith('//')) { - type = 'single' - } else if (str.trim().startsWith('*/')) { - type = 'multiple' - } - } - if (type === 'single' && str.trim().startsWith('//')) { - comments.push(str.replace(/[/]/gi, '').trim()) - } else if (type === 'multiple' && !str.trim().startsWith('/**') && !str.trim().startsWith('*/')) { - comments.push(str.replace(/[*]/gi, '').trim()) - } else if (type === 'single' && !str.trim().startsWith('//')) { - break - } else if (type === 'multiple' && str.trim().startsWith('/**')) { - break - } - } - return comments - } catch (error) { - return Promise.reject(error) - } -} - -const parseCode = async (connector) => { - try { - const strs = connector.code.split('\n') - const events = [] - const eventsFirstLines = [] - let func = [] - let funcs = [] - let event = [] - let mainEvents = [] - let firstLine - let mainEventsLines = [] - for (let index = 0; index < strs.length; index++) { - const str = strs[index] - if (str.includes('function') && !str.trim().startsWith('//')) { - func = [str] - firstLine = index + 1 - } else if (func.length && !str.trim().startsWith('//')) { - func.push(str) - } - if (func.length && str.startsWith(`${func[0].split('function')[0]}}`)) { - funcs.push({ - raw: func.map(str => str.trim()).join(' '), - comments: await getCommments(strs.slice(0, firstLine)), - firstLine - }) - func = [] - } - } - const allPublicFuncs = funcs - .filter(({ raw }) => { - return raw.includes('external') || raw.includes('public') - }) - .map(f => { - const name = f.raw.split('(')[0].split('function')[1].trim() - return { - ...f, - name - } - }) - funcs = allPublicFuncs - .filter(({ raw }) => { - if (raw.includes('returns')) { - const returns = raw.split('returns')[1].split('(')[1].split(')')[0] - return returns.includes('string') && returns.includes('bytes') - } - return false - }) - .map(f => { - const args = f.raw.split('(')[1].split(')')[0].split(',') - .map(arg => arg.trim()) - .filter(arg => arg !== '') - return { - ...f, - args - } - }) - const eventsPath = `${connector.path}/events.sol` - if (fs.existsSync(eventsPath)) { - mainEvents = funcs - .map(({ raw }) => raw.split('_eventName')[2].trim().split('"')[1]) - .filter(raw => !!raw) - mainEventsLines = mainEvents.map(me => strs.findIndex(str => str.includes(me)) + 1) - const eventsCode = fs.readFileSync(eventsPath, { encoding: 'utf8' }) - const eventsStrs = eventsCode.split('\n') - for (let index = 0; index < eventsStrs.length; index++) { - const str = eventsStrs[index] - if (str.includes('event')) { - event = [str] - firstLine = index + 1 - } else if (event.length && !str.trim().startsWith('//')) { - event.push(str) - } - if (event.length && str.includes(')')) { - events.push(event.map(str => str.trim()).join(' ')) - eventsFirstLines.push(firstLine) - event = [] - } - } - } - return { - ...connector, - events, - eventsFirstLines, - mainEvents, - mainEventsLines, - funcs, - allPublicFuncs - } - } catch (error) { - return Promise.reject(error) - } -} - -const checkComments = async (connector) => { - try { - const errors = [] - for (let i1 = 0; i1 < connector.funcs.length; i1++) { - const func = connector.funcs[i1] - for (let i2 = 0; i2 < func.args.length; i2++) { - const argName = func.args[i2].split(' ').pop() - if (!func.comments.some( - comment => comment.startsWith('@param') && comment.split(' ')[1] === argName - )) { - errors.push(`argument ${argName} has no @param for function ${func.name} at ${connector.path}/main.sol:${func.firstLine}`) - } - } - const reqs = ['@dev', '@notice'] - for (let i3 = 0; i3 < reqs.length; i3++) { - if (!func.comments.some(comment => comment.startsWith(reqs[i3]))) { - errors.push(`no ${reqs[i3]} for function ${func.name} at ${connector.path}/main.sol:${func.firstLine}`) - } - } - } - return errors - } catch (error) { - return Promise.reject(error) - } -} - -const checkPublicFuncs = async (connector) => { - try { - const errors = [] - for (let i1 = 0; i1 < connector.allPublicFuncs.length; i1++) { - const { raw, firstLine, name } = connector.allPublicFuncs[i1] - if (!raw.includes('payable')) { - errors.push(`public function ${name} is not payable at ${connector.path}/main.sol:${firstLine}`) - } - } - return errors - } catch (error) { - return Promise.reject(error) - } -} - -const checkName = async (connector) => { - try { - const strs = connector.code.split('\n') - let haveName = false - for (let index = strs.length - 1; index > 0; index--) { - const str = strs[index] - if (str.includes('string') && str.includes('public') && str.includes('name = ')) { - haveName = true - } - } - return haveName ? [] : [`name variable missing in ${connector.path}/main.sol`] - } catch (error) { - return Promise.reject(error) - } -} - -const checkHeadComments = async (connector) => { - try { - const errors = [] - const strs = connector.code.split('\n') - let haveTitle = false - let haveDev = false - for (let index = 0; index < strs.length; index++) { - if (!strs[index].includes('{')) { - if (strs[index].includes('@title')) haveTitle = true - if (strs[index].includes('@dev')) haveDev = true - } else { - break - } - } - if (!haveTitle) errors.push(`@title missing in ${connector.path}/main.sol`) - if (!haveDev) errors.push(`@dev missing in ${connector.path}/main.sol`) - return errors - } catch (error) { - return Promise.reject(error) - } -} - -async function checkMain () { - try { - const connectorsRootsDirsDefault = ['mainnet', 'polygon'].map(v=> `contracts/${v}/connectors`) - const customPathArg = process.argv.find(a => a.startsWith('connector=')) - const connectorsRootsDirs = customPathArg - ? [customPathArg.slice(10)] - : connectorsRootsDirsDefault - const errors = [] - const warnings = [] - const connectors = await getConnectorsList(connectorsRootsDirs) - for (let index = 0; index < connectors.length; index++) { - const { forbiddenErrors, code } = await checkForbidden(connectors[index].path) - connectors[index].code = code - connectors[index] = await parseCode(connectors[index]) - const { eventsErrors, eventsWarnings } = await checkEvents(connectors[index]) - const commentsErrors = await checkComments(connectors[index]) - const nameErrors = await checkName(connectors[index]) - const headCommentsErrors = await checkHeadComments(connectors[index]) - const publicFuncsErrors = await checkPublicFuncs(connectors[index]) - - errors.push(...forbiddenErrors) - errors.push(...eventsErrors) - errors.push(...commentsErrors) - errors.push(...nameErrors) - errors.push(...headCommentsErrors) - errors.push(...publicFuncsErrors) - warnings.push(...eventsWarnings) - } - if (errors.length) { - console.log('\x1b[31m%s\x1b[0m', `Total errors: ${errors.length}`) - errors.forEach(error => console.log('\x1b[31m%s\x1b[0m', error)) - } else { - console.log('\x1b[32m%s\x1b[0m', 'No Errors Found') - } - if (warnings.length) { - console.log('\x1b[33m%s\x1b[0m', `Total warnings: ${warnings.length}`) - warnings.forEach(warning => console.log('\x1b[33m%s\x1b[0m', warning)) - } else { - console.log('\x1b[32m%s\x1b[0m', 'No Warnings Found') - } - if (errors.length) return Promise.reject(errors.join('\n')) - } catch (error) { - console.error('check execution error:', error) - } -} -module.exports = checkMain diff --git a/status-checks/check.ts b/status-checks/check.ts new file mode 100644 index 00000000..9c0b442d --- /dev/null +++ b/status-checks/check.ts @@ -0,0 +1,448 @@ +import * as fs from "fs"; +import * as path from "path"; + +const forbiddenStrings: any = ["selfdestruct"]; + +const getConnectorsList = async (connectorsRootsDirs: string | any[]) => { + try { + const connectors = []; + for (let index = 0; index < connectorsRootsDirs.length; index++) { + const dirs = [connectorsRootsDirs[index]]; + while (dirs.length) { + const currentDir = dirs.pop(); + const subs = fs.readdirSync(currentDir, { withFileTypes: true }); + for (let index = 0; index < subs.length; index++) { + const sub = subs[index]; + if (sub.isFile() && sub.name === "main.sol") { + connectors.push(currentDir); + } else if (sub.isDirectory()) { + dirs.push(`${currentDir}/${sub.name}`); + } + } + } + } + return connectors.map((dir) => ({ path: dir })); + } catch (error) { + return Promise.reject(error); + } +}; + +const checkCodeForbidden = async (code: string, codePath: string) => { + try { + const forbidden = []; + for (let i1 = 0; i1 < forbiddenStrings.length; i1++) { + const forbiddenStr = forbiddenStrings[i1]; + const strs = code.split("\n"); + for (let i2 = 0; i2 < strs.length; i2++) { + if (strs[i2].includes(forbiddenStr)) { + forbidden.push(`found '${forbiddenStr}' in ${codePath}:${i2 + 1}`); + } + } + } + return forbidden; + } catch (error) { + return Promise.reject(error); + } +}; + +const checkForbidden = async (parentPath: string, codePath = "./main.sol") => { + try { + if (codePath.startsWith("@")) { + codePath = path.resolve("node_modules", `./${codePath}`); + } else { + codePath = path.resolve(parentPath, codePath); + } + const code = fs.readFileSync(codePath, { encoding: "utf8" }); + const forbidden: any = await checkCodeForbidden(code, codePath); + if (code.includes("import")) { + const importsPathes = code + .split("\n") + .filter( + (str) => + str.includes("import") && + str.includes("from") && + str.includes(".sol") + ) + .map((str) => str.split("from")[1].replace(/["; ]/gi, "")); + for (let index = 0; index < importsPathes.length; index++) { + const forbiddenErrors = await checkForbidden( + path.parse(codePath).dir, + importsPathes[index] + ); + forbidden.push(...forbiddenErrors); + } + } + return codePath.endsWith("main.sol") + ? { forbiddenErrors: forbidden, code } + : forbidden; + } catch (error) { + return Promise.reject(error); + } +}; + +const checkEvents = async (connector: { + path: any; + events?: any; + mainEvents?: any; + mainEventsLines?: any; +}) => { + try { + const errors = []; + const warnings = []; + const eventsPath = `${connector.path}/events.sol`; + const mainPath = `${connector.path}/main.sol`; + if (connector.events.length) { + const eventNames = []; + for (let i1 = 0; i1 < connector.mainEvents.length; i1++) { + const mainEvent = connector.mainEvents[i1]; + const name = mainEvent.split("(")[0]; + eventNames.push(name); + const event = connector.events.find( + (e: string) => e.split("(")[0].split(" ")[1] === name + ); + if (event) { + const mainEventArgs = mainEvent + .split("(")[1] + .split(")")[0] + .split(",") + .map((a: string) => a.trim()); + const eventArgs = event + .split("(")[1] + .split(")")[0] + .split(",") + .map((a: string) => a.trim()); + if (mainEventArgs.length !== eventArgs.length) { + errors.push( + `arguments amount don't match for ${name} at ${mainPath}:${connector.mainEventsLines[i1]}` + ); + continue; + } + for (let i2 = 0; i2 < mainEventArgs.length; i2++) { + if (!mainEventArgs[i2].startsWith(eventArgs[i2].split(" ")[0])) { + errors.push( + `invalid argument #${i2 + 1} for ${name} at ${mainPath}:${ + connector.mainEventsLines[i1] + }` + ); + } + } + } else { + errors.push(`event ${name} missing at ${eventsPath}`); + } + } + if (connector.mainEvents.length < connector.events.length) { + const deprecatedEvents = connector.events.filter((e) => { + let used = false; + for (let index = 0; index < eventNames.length; index++) { + if (e.split("(")[0].split(" ")[1] === eventNames[index]) + used = true; + } + return !used; + }); + warnings.push( + `${deprecatedEvents + .map((e: string) => e.split("(")[0].split(" ")[1]) + .join(", ")} event(s) not used at ${connector.path}/main.sol` + ); + } + } else { + warnings.push(`missing events file for ${connector.path}/main.sol`); + } + return { eventsErrors: errors, eventsWarnings: warnings }; + } catch (error) { + return Promise.reject(error); + } +}; + +const getCommments = async (strs: string | any[]) => { + try { + const comments = []; + let type: string; + for (let index = strs.length - 1; index >= 0; index--) { + const str = strs[index]; + if (!type) { + if (str.trim().startsWith("//")) { + type = "single"; + } else if (str.trim().startsWith("*/")) { + type = "multiple"; + } + } + if (type === "single" && str.trim().startsWith("//")) { + comments.push(str.replace(/[/]/gi, "").trim()); + } else if ( + type === "multiple" && + !str.trim().startsWith("/**") && + !str.trim().startsWith("*/") + ) { + comments.push(str.replace(/[*]/gi, "").trim()); + } else if (type === "single" && !str.trim().startsWith("//")) { + break; + } else if (type === "multiple" && str.trim().startsWith("/**")) { + break; + } + } + return comments; + } catch (error) { + return Promise.reject(error); + } +}; + +const parseCode = async (connector: { path: any; code?: any }) => { + try { + const strs = connector.code.split("\n"); + const events = []; + const eventsFirstLines = []; + let func = []; + let funcs = []; + let event = []; + let mainEvents = []; + let firstLine: number; + let mainEventsLines = []; + for (let index = 0; index < strs.length; index++) { + const str = strs[index]; + if (str.includes("function") && !str.trim().startsWith("//")) { + func = [str]; + firstLine = index + 1; + } else if (func.length && !str.trim().startsWith("//")) { + func.push(str); + } + if (func.length && str.startsWith(`${func[0].split("function")[0]}}`)) { + funcs.push({ + raw: func.map((str) => str.trim()).join(" "), + comments: await getCommments(strs.slice(0, firstLine)), + firstLine, + }); + func = []; + } + } + const allPublicFuncs = funcs + .filter(({ raw }) => { + return raw.includes("external") || raw.includes("public"); + }) + .map((f) => { + const name = f.raw + .split("(")[0] + .split("function")[1] + .trim(); + return { + ...f, + name, + }; + }); + funcs = allPublicFuncs + .filter(({ raw }) => { + if (raw.includes("returns")) { + const returns = raw + .split("returns")[1] + .split("(")[1] + .split(")")[0]; + return returns.includes("string") && returns.includes("bytes"); + } + return false; + }) + .map((f) => { + const args = f.raw + .split("(")[1] + .split(")")[0] + .split(",") + .map((arg) => arg.trim()) + .filter((arg) => arg !== ""); + return { + ...f, + args, + }; + }); + const eventsPath = `${connector.path}/events.sol`; + if (fs.existsSync(eventsPath)) { + mainEvents = funcs + .map( + ({ raw }) => + raw + .split("_eventName")[2] + .trim() + .split('"')[1] + ) + .filter((raw) => !!raw); + mainEventsLines = mainEvents.map( + (me) => strs.findIndex((str: string | any[]) => str.includes(me)) + 1 + ); + const eventsCode = fs.readFileSync(eventsPath, { encoding: "utf8" }); + const eventsStrs = eventsCode.split("\n"); + for (let index = 0; index < eventsStrs.length; index++) { + const str = eventsStrs[index]; + if (str.includes("event")) { + event = [str]; + firstLine = index + 1; + } else if (event.length && !str.trim().startsWith("//")) { + event.push(str); + } + if (event.length && str.includes(")")) { + events.push(event.map((str) => str.trim()).join(" ")); + eventsFirstLines.push(firstLine); + event = []; + } + } + } + return { + ...connector, + events, + eventsFirstLines, + mainEvents, + mainEventsLines, + funcs, + allPublicFuncs, + }; + } catch (error) { + return Promise.reject(error); + } +}; + +const checkComments = async (connector) => { + try { + const errors = []; + for (let i1 = 0; i1 < connector.funcs.length; i1++) { + const func = connector.funcs[i1]; + for (let i2 = 0; i2 < func.args.length; i2++) { + const argName = func.args[i2].split(" ").pop(); + if ( + !func.comments.some( + (comment: string) => + comment.startsWith("@param") && comment.split(" ")[1] === argName + ) + ) { + errors.push( + `argument ${argName} has no @param for function ${func.name} at ${connector.path}/main.sol:${func.firstLine}` + ); + } + } + const reqs = ["@dev", "@notice"]; + for (let i3 = 0; i3 < reqs.length; i3++) { + if (!func.comments.some((comment) => comment.startsWith(reqs[i3]))) { + errors.push( + `no ${reqs[i3]} for function ${func.name} at ${connector.path}/main.sol:${func.firstLine}` + ); + } + } + } + return errors; + } catch (error) { + return Promise.reject(error); + } +}; + +const checkPublicFuncs = async (connector: { + path: any; + allPublicFuncs?: any; +}) => { + try { + const errors = []; + for (let i1 = 0; i1 < connector.allPublicFuncs.length; i1++) { + const { raw, firstLine, name } = connector.allPublicFuncs[i1]; + if (!raw.includes("payable")) { + errors.push( + `public function ${name} is not payable at ${connector.path}/main.sol:${firstLine}` + ); + } + } + return errors; + } catch (error) { + return Promise.reject(error); + } +}; + +const checkName = async (connector: { path: any; code?: any }) => { + try { + const strs = connector.code.split("\n"); + let haveName = false; + for (let index = strs.length - 1; index > 0; index--) { + const str = strs[index]; + if ( + str.includes("string") && + str.includes("public") && + str.includes("name = ") + ) { + haveName = true; + } + } + return haveName + ? [] + : [`name variable missing in ${connector.path}/main.sol`]; + } catch (error) { + return Promise.reject(error); + } +}; + +const checkHeadComments = async (connector: { path: any; code?: any }) => { + try { + const errors = []; + const strs = connector.code.split("\n"); + let haveTitle = false; + let haveDev = false; + for (let index = 0; index < strs.length; index++) { + if (!strs[index].includes("{")) { + if (strs[index].includes("@title")) haveTitle = true; + if (strs[index].includes("@dev")) haveDev = true; + } else { + break; + } + } + if (!haveTitle) errors.push(`@title missing in ${connector.path}/main.sol`); + if (!haveDev) errors.push(`@dev missing in ${connector.path}/main.sol`); + return errors; + } catch (error) { + return Promise.reject(error); + } +}; + +async function checkMain() { + try { + const connectorsRootsDirsDefault = ["mainnet", "polygon"].map( + (v) => `contracts/${v}/connectors` + ); + const customPathArg = process.argv.find((a) => a.startsWith("connector=")); + const connectorsRootsDirs = customPathArg + ? [customPathArg.slice(10)] + : connectorsRootsDirsDefault; + const errors = []; + const warnings = []; + const connectors = await getConnectorsList(connectorsRootsDirs); + for (let index = 0; index < connectors.length; index++) { + const { forbiddenErrors, code } = await checkForbidden( + connectors[index].path + ); + connectors[index].code = code; + connectors[index] = await parseCode(connectors[index]); + const { eventsErrors, eventsWarnings } = await checkEvents( + connectors[index] + ); + const commentsErrors = await checkComments(connectors[index]); + const nameErrors = await checkName(connectors[index]); + const headCommentsErrors = await checkHeadComments(connectors[index]); + const publicFuncsErrors = await checkPublicFuncs(connectors[index]); + + errors.push(...forbiddenErrors); + errors.push(...eventsErrors); + errors.push(...commentsErrors); + errors.push(...nameErrors); + errors.push(...headCommentsErrors); + errors.push(...publicFuncsErrors); + warnings.push(...eventsWarnings); + } + if (errors.length) { + console.log("\x1b[31m%s\x1b[0m", `Total errors: ${errors.length}`); + errors.forEach((error) => console.log("\x1b[31m%s\x1b[0m", error)); + } else { + console.log("\x1b[32m%s\x1b[0m", "No Errors Found"); + } + if (warnings.length) { + console.log("\x1b[33m%s\x1b[0m", `Total warnings: ${warnings.length}`); + warnings.forEach((warning) => console.log("\x1b[33m%s\x1b[0m", warning)); + } else { + console.log("\x1b[32m%s\x1b[0m", "No Warnings Found"); + } + if (errors.length) return Promise.reject(errors.join("\n")); + } catch (error) { + console.error("check execution error:", error); + } +} +export default checkMain; diff --git a/status-checks/checks.js b/status-checks/checks.js deleted file mode 100644 index 871dccf0..00000000 --- a/status-checks/checks.js +++ /dev/null @@ -1,13 +0,0 @@ -const checkMain = require('./check') - -module.exports = [{ - name: 'Solidity check', - callback: async () => { - try { - await checkMain() - return 'Check passed!' - } catch (error) { - throw new Error('Check failed!') - } - } -}] diff --git a/status-checks/checks.ts b/status-checks/checks.ts new file mode 100644 index 00000000..be76ccdf --- /dev/null +++ b/status-checks/checks.ts @@ -0,0 +1,15 @@ +import checkMain from "./check"; + +module.exports = [ + { + name: "Solidity check", + callback: async () => { + try { + await checkMain(); + return "Check passed!"; + } catch (error) { + throw new Error("Check failed!"); + } + }, + }, +]; diff --git a/status-checks/huskyCheck.js b/status-checks/huskyCheck.js deleted file mode 100644 index c7f7fc82..00000000 --- a/status-checks/huskyCheck.js +++ /dev/null @@ -1,9 +0,0 @@ -const checkMain = require('./check'); - -(async function runHusky () { - try { - await checkMain() - } catch (error) { - process.exit(1) - } -})() diff --git a/status-checks/huskyCheck.ts b/status-checks/huskyCheck.ts new file mode 100644 index 00000000..658a76d9 --- /dev/null +++ b/status-checks/huskyCheck.ts @@ -0,0 +1,9 @@ +import checkMain from "./check"; + +(async function runHusky() { + try { + await checkMain(); + } catch (error) { + process.exit(1); + } +})(); diff --git a/status-checks/index.js b/status-checks/index.js deleted file mode 100644 index 0be169ba..00000000 --- a/status-checks/index.js +++ /dev/null @@ -1,54 +0,0 @@ -const cp = require('child_process') -const fetch = require('node-fetch') - -const checks = require('./checks') - -const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/') - -function getCurrentCommitSha () { - return cp - .execSync('git rev-parse HEAD') - .toString() - .trim() -} -// The SHA provied by GITHUB_SHA is the merge (PR) commit. -// We need to get the current commit sha ourself. -const sha = getCurrentCommitSha() - -async function setStatus (context, state, description) { - return fetch(`https://api.github.com/repos/${owner}/${repo}/statuses/${sha}`, { - method: 'POST', - body: JSON.stringify({ - state, - description, - context - }), - headers: { - Authorization: `Bearer ${process.env.GITHUB_TOKEN}`, - 'Content-Type': 'application/json' - } - }) -} - -(async () => { - console.log(`Starting status checks for commit ${sha}`) - - // Run in parallel - await Promise.all( - checks.map(async check => { - const { name, callback } = check - - await setStatus(name, 'pending', 'Running check..') - - try { - const response = await callback() - await setStatus(name, 'success', response) - } catch (err) { - const message = err ? err.message : 'Something went wrong' - await setStatus(name, 'failure', message) - } - }) - ) - - console.log('Finished status checks') -})() diff --git a/status-checks/index.ts b/status-checks/index.ts new file mode 100644 index 00000000..738beed3 --- /dev/null +++ b/status-checks/index.ts @@ -0,0 +1,57 @@ +import * as cp from "child_process"; +import fetch from "node-fetch"; + +import checkMain from "./check"; + +const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/"); + +function getCurrentCommitSha() { + return cp + .execSync("git rev-parse HEAD") + .toString() + .trim(); +} +// The SHA provied by GITHUB_SHA is the merge (PR) commit. +// We need to get the current commit sha ourself. +const sha = getCurrentCommitSha(); + +async function setStatus(context, state, description) { + return fetch( + `https://api.github.com/repos/${owner}/${repo}/statuses/${sha}`, + { + method: "POST", + body: JSON.stringify({ + state, + description, + context, + }), + headers: { + Authorization: `Bearer ${process.env.GITHUB_TOKEN}`, + "Content-Type": "application/json", + }, + } + ); +} + +(async () => { + console.log(`Starting status checks for commit ${sha}`); + + // Run in parallel + await Promise.all( + checks.map(async (check) => { + const { name, callback } = check; + + await setStatus(name, "pending", "Running check.."); + + try { + const response = await callback(); + await setStatus(name, "success", response); + } catch (err) { + const message = err ? err.message : "Something went wrong"; + await setStatus(name, "failure", message); + } + }) + ); + + console.log("Finished status checks"); +})(); From c4d17ace2e985b7ceb2a4f4e592e1e5708ad6429 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sun, 5 Dec 2021 22:49:39 +0530 Subject: [PATCH 08/39] updates hardhat.config --- hardhat.config.ts | 71 ++++++++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 4150cc68..4cb81269 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -28,22 +28,23 @@ const chainIds = { polygon: 137, }; -// Ensure that we have all the environment variables we need. -const mnemonic = process.env.MNEMONIC; -if (!mnemonic) { - throw new Error("Please set your MNEMONIC in a .env file"); -} - const alchemyApiKey = process.env.ALCHEMY_API_KEY; if (!alchemyApiKey) { - throw new Error("Please set your ALCHEMY_ETH_API_KEY in a .env file"); + throw new Error("Please set your ALCHEMY_API_KEY in a .env file"); } const PRIVATE_KEY = process.env.PRIVATE_KEY; -const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY; +const ETHERSCAN_API = process.env.ETHERSCAN_API_KEY; +const POLYGONSCAN_API = process.env.POLYGON_API_KEY; +const ARBISCAN_API = process.env.ARBISCAN_API_KEY; +const SNOWTRACE_API = process.env.SNOWTRACE_API_KEY; +const mnemonic = process.env.MNEMONIC; -function createTestnetConfig(network: keyof typeof chainIds): NetworkUserConfig { - const url: string = "https://eth-" + network + ".alchemyapi.io/v2/" + alchemyApiKey; +function createTestnetConfig( + network: keyof typeof chainIds +): NetworkUserConfig { + const url: string = + "https://eth-" + network + ".alchemyapi.io/v2/" + alchemyApiKey; return { accounts: { count: 10, @@ -58,25 +59,26 @@ function createTestnetConfig(network: keyof typeof chainIds): NetworkUserConfig function getNetworkUrl(networkType: string) { //console.log(process.env); - if (networkType === "avalanche") return "https://api.avax.network/ext/bc/C/rpc"; - else if (networkType === "polygon") return `https://polygon-mainnet.g.alchemy.com/v2/${alchemyApiKey}`; - else if (networkType === "arbitrum") return `https://arb-mainnet.g.alchemy.com/v2/${alchemyApiKey}`; + if (networkType === "avalanche") + return "https://api.avax.network/ext/bc/C/rpc"; + else if (networkType === "polygon") + return `https://polygon-mainnet.g.alchemy.com/v2/${alchemyApiKey}`; + else if (networkType === "arbitrum") + return `https://arb-mainnet.g.alchemy.com/v2/${alchemyApiKey}`; else return `https://eth-mainnet.alchemyapi.io/v2/${alchemyApiKey}`; } -function getBlockNumber(networkType: string) { - let web3 = new Web3(new Web3.providers.HttpProvider(getNetworkUrl(networkType))); - let blockNumber; - web3.eth.getBlockNumber().then((x: any) => { - blockNumber = x; - }); - - return blockNumber; +function getScanApiKey(networkType: string) { + if (networkType === "avalanche") return SNOWTRACE_API; + else if (networkType === "polygon") return POLYGONSCAN_API; + else if (networkType === "arbitrum") return ARBISCAN_API; + else return ETHERSCAN_API; } + /** * @type import('hardhat/config').HardhatUserConfig */ - const config: HardhatUserConfig = { +const config: HardhatUserConfig = { solidity: { compilers: [ { @@ -107,13 +109,24 @@ function getBlockNumber(networkType: string) { chainId: chainIds.hardhat, forking: { url: String(getNetworkUrl(String(process.env.networkType))), - blockNumber: getBlockNumber(String(process.env.networkType)), }, }, goerli: createTestnetConfig("goerli"), kovan: createTestnetConfig("kovan"), rinkeby: createTestnetConfig("rinkeby"), ropsten: createTestnetConfig("ropsten"), + mainnet: { + url: getNetworkUrl("mainnet"), + }, + polygon: { + url: getNetworkUrl("polygon"), + }, + avalanche: { + url: getNetworkUrl("avalanche"), + }, + arbitrum: { + url: getNetworkUrl("arbiturm"), + }, }, paths: { artifacts: "./artifacts", @@ -122,19 +135,19 @@ function getBlockNumber(networkType: string) { tests: "./test", }, etherscan: { - apiKey: ETHERSCAN_API_KEY, - }, - tenderly: { - project: process.env.TENDERLY_PROJECT, - username: process.env.TENDERLY_USERNAME, + apiKey: getScanApiKey(getNetworkUrl(String(process.env.networkType))), }, typechain: { outDir: "typechain", target: "ethers-v5", }, mocha: { - timeout: 10000 * 1000, + timeout: 10000 * 1000, // 10,000 seconds }, + // tenderly: { + // project: process.env.TENDERLY_PROJECT, + // username: process.env.TENDERLY_USERNAME, + // }, }; export default config; From daff34ca79e4525242f72cc8140e2b62b4903bd6 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sun, 5 Dec 2021 22:51:55 +0530 Subject: [PATCH 09/39] update --- hardhat.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/hardhat.config.ts b/hardhat.config.ts index 4cb81269..94eaa311 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -26,6 +26,7 @@ const chainIds = { ropsten: 3, avalanche: 43114, polygon: 137, + arbitrum: 42161, }; const alchemyApiKey = process.env.ALCHEMY_API_KEY; From b74fecff3d8849b3ead8b099d3c299bcf5b163fe Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sun, 5 Dec 2021 23:32:28 +0530 Subject: [PATCH 10/39] updated package.json --- package.json | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 62a20560..cd3d62d9 100644 --- a/package.json +++ b/package.json @@ -25,35 +25,36 @@ "@typechain/ethers-v5": "^8.0.5", "@typechain/hardhat": "^3.0.0", "@uniswap/v3-core": "^1.0.0", - "@uniswap/v3-periphery": "^1.2.1", - "chalk": "^4.1.2", + "@uniswap/v3-periphery": "^1.3.0", + "chalk": "^5.0.0", "dotenv": "^10.0.0", - "hardhat-docgen": "^1.1.2", + "hardhat-docgen": "^1.2.0", "minimist": "^1.2.5", - "solc": "^0.7.0" + "solc": "^0.8.10", + "typechain": "^6.0.5" }, "devDependencies": { - "@nomiclabs/hardhat-ethers": "^2.0.2", - "@nomiclabs/hardhat-etherscan": "^2.1.7", + "@nomiclabs/hardhat-ethers": "^2.0.3", + "@nomiclabs/hardhat-etherscan": "^2.1.8", "@nomiclabs/hardhat-waffle": "^2.0.1", "@nomiclabs/hardhat-web3": "^2.0.0", "@openzeppelin/test-helpers": "^0.5.15", "@studydefi/money-legos": "^2.4.2", - "@tenderly/hardhat-tenderly": "^1.0.12", + "@tenderly/hardhat-tenderly": "^1.0.13", "@types/chai": "^4.2.22", "@types/mocha": "^9.0.0", - "@types/node": "^16.11.10", + "@types/node": "^16.11.11", "chai": "^4.3.4", "chai-as-promised": "^7.1.1", "ethereum-waffle": "^3.4.0", - "ethers": "^5.5.1", - "hardhat": "^2.6.7", - "hardhat-deploy": "^0.9.4", + "ethers": "^5.5.2", + "hardhat": "^2.7.0", + "hardhat-deploy": "^0.9.14", "hardhat-deploy-ethers": "^0.3.0-beta.11", "husky": "^7.0.4", - "solidity-coverage": "0.5.11", + "solidity-coverage": "0.7.17", "ts-node": "^10.4.0", "typescript": "^4.5.2", - "web3": "^1.5.2" + "web3": "^1.6.1" } } From 6863f08c5fc8f929f1adb5def934b3df50bf9273 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Mon, 6 Dec 2021 00:40:22 +0530 Subject: [PATCH 11/39] segregated scripts --- scripts/constant/constant.ts | 2 +- scripts/{ => deployment}/deploy.ts | 0 .../{ => deployment}/deployAvaxConnector.ts | 0 .../{ => deployment}/deployCompoundMapping.ts | 0 scripts/{ => deployment}/deployConnector.ts | 0 .../deployConnectorsFromCmd.ts | 0 .../deployInstaMappingController.ts | 0 .../{ => deployment}/deployMappingContract.ts | 0 scripts/{ => deployment}/deploySingle.ts | 3 +- scripts/{ => tests}/addLiquidity.ts | 0 scripts/{polygon => tests}/buildDSAv2.ts | 7 ++- .../{ => tests}/deployAndEnableConnector.ts | 13 ++--- scripts/{ => tests}/encodeFlashcastData.ts | 2 - scripts/{polygon => tests}/encodeSpells.ts | 7 ++- scripts/{ => tests}/getMasterSigner.ts | 4 +- scripts/{ => tests}/impersonate.ts | 0 scripts/{ => tests/polygon}/buildDSAv2.ts | 8 ++-- .../{ => tests}/polygon/constant/addresses.ts | 0 .../{ => tests}/polygon/constant/constant.ts | 0 .../{ => tests}/polygon/constant/tokens.ts | 0 .../polygon/deployAndEnableConnector.ts | 2 +- scripts/{ => tests/polygon}/encodeSpells.ts | 5 +- .../{ => tests}/polygon/getMasterSigner.ts | 2 +- status-checks/readme.md | 1 - test/mainnet/aave/v1.test.ts | 10 ++-- test/mainnet/aave/v2.test.ts | 47 +++++++++---------- test/mainnet/b.protocol/b.compound.test.ts | 8 ++-- test/mainnet/b.protocol/b.liquity.test.ts | 8 ++-- test/mainnet/b.protocol/b.maker.test.ts | 8 ++-- .../mainnet/basic-ERC1155/ERC1155-transfer.ts | 8 ++-- test/mainnet/basic-ERC721/ERC721-transfer.ts | 8 ++-- test/mainnet/compound/compound.test.ts | 8 ++-- test/mainnet/instapool/instapool.test.ts | 10 ++-- test/mainnet/liquity/liquity.helpers.ts | 8 ++-- test/mainnet/liquity/liquity.test.ts | 4 +- .../pooltogether-polygon/pooltogether.test.ts | 8 ++-- .../mainnet/pooltogether/pooltogether.test.ts | 8 ++-- test/mainnet/uniswap/uniswap.test.ts | 12 ++--- .../mainnet/uniswapStake/uniswapStake.test.ts | 10 ++-- test/mainnet/yearn/yearn.test.ts | 8 ++-- tsconfig.json | 27 +++++++++++ 41 files changed, 138 insertions(+), 118 deletions(-) rename scripts/{ => deployment}/deploy.ts (100%) rename scripts/{ => deployment}/deployAvaxConnector.ts (100%) rename scripts/{ => deployment}/deployCompoundMapping.ts (100%) rename scripts/{ => deployment}/deployConnector.ts (100%) rename scripts/{ => deployment}/deployConnectorsFromCmd.ts (100%) rename scripts/{ => deployment}/deployInstaMappingController.ts (100%) rename scripts/{ => deployment}/deployMappingContract.ts (100%) rename scripts/{ => deployment}/deploySingle.ts (91%) rename scripts/{ => tests}/addLiquidity.ts (100%) rename scripts/{polygon => tests}/buildDSAv2.ts (84%) rename scripts/{ => tests}/deployAndEnableConnector.ts (56%) rename scripts/{ => tests}/encodeFlashcastData.ts (80%) rename scripts/{polygon => tests}/encodeSpells.ts (84%) rename scripts/{ => tests}/getMasterSigner.ts (86%) rename scripts/{ => tests}/impersonate.ts (100%) rename scripts/{ => tests/polygon}/buildDSAv2.ts (69%) rename scripts/{ => tests}/polygon/constant/addresses.ts (100%) rename scripts/{ => tests}/polygon/constant/constant.ts (100%) rename scripts/{ => tests}/polygon/constant/tokens.ts (100%) rename scripts/{ => tests}/polygon/deployAndEnableConnector.ts (93%) rename scripts/{ => tests/polygon}/encodeSpells.ts (75%) rename scripts/{ => tests}/polygon/getMasterSigner.ts (93%) create mode 100644 tsconfig.json diff --git a/scripts/constant/constant.ts b/scripts/constant/constant.ts index 14fcbe2f..9e659d77 100644 --- a/scripts/constant/constant.ts +++ b/scripts/constant/constant.ts @@ -1,6 +1,6 @@ export const constants = { address_zero: "0x0000000000000000000000000000000000000000", - eth_addr: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", + native_address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", max_value: "115792089237316195423570985008687907853269984665640564039457584007913129639935", }; diff --git a/scripts/deploy.ts b/scripts/deployment/deploy.ts similarity index 100% rename from scripts/deploy.ts rename to scripts/deployment/deploy.ts diff --git a/scripts/deployAvaxConnector.ts b/scripts/deployment/deployAvaxConnector.ts similarity index 100% rename from scripts/deployAvaxConnector.ts rename to scripts/deployment/deployAvaxConnector.ts diff --git a/scripts/deployCompoundMapping.ts b/scripts/deployment/deployCompoundMapping.ts similarity index 100% rename from scripts/deployCompoundMapping.ts rename to scripts/deployment/deployCompoundMapping.ts diff --git a/scripts/deployConnector.ts b/scripts/deployment/deployConnector.ts similarity index 100% rename from scripts/deployConnector.ts rename to scripts/deployment/deployConnector.ts diff --git a/scripts/deployConnectorsFromCmd.ts b/scripts/deployment/deployConnectorsFromCmd.ts similarity index 100% rename from scripts/deployConnectorsFromCmd.ts rename to scripts/deployment/deployConnectorsFromCmd.ts diff --git a/scripts/deployInstaMappingController.ts b/scripts/deployment/deployInstaMappingController.ts similarity index 100% rename from scripts/deployInstaMappingController.ts rename to scripts/deployment/deployInstaMappingController.ts diff --git a/scripts/deployMappingContract.ts b/scripts/deployment/deployMappingContract.ts similarity index 100% rename from scripts/deployMappingContract.ts rename to scripts/deployment/deployMappingContract.ts diff --git a/scripts/deploySingle.ts b/scripts/deployment/deploySingle.ts similarity index 91% rename from scripts/deploySingle.ts rename to scripts/deployment/deploySingle.ts index a8bb344a..51a0eb47 100644 --- a/scripts/deploySingle.ts +++ b/scripts/deployment/deploySingle.ts @@ -1,7 +1,6 @@ import * as hre from "hardhat"; const { ethers } = hre; - -const deployConnector = require("./deployConnector"); +import { deployConnector } from "./deployConnector"; async function main() { const address = await deployConnector("ConnectOne"); // Example diff --git a/scripts/addLiquidity.ts b/scripts/tests/addLiquidity.ts similarity index 100% rename from scripts/addLiquidity.ts rename to scripts/tests/addLiquidity.ts diff --git a/scripts/polygon/buildDSAv2.ts b/scripts/tests/buildDSAv2.ts similarity index 84% rename from scripts/polygon/buildDSAv2.ts rename to scripts/tests/buildDSAv2.ts index de623b32..0820b14e 100644 --- a/scripts/polygon/buildDSAv2.ts +++ b/scripts/tests/buildDSAv2.ts @@ -1,11 +1,10 @@ import { ethers } from "hardhat"; -import { addresses } from "./constant/addresses"; +import { addresses } from "../constant/addresses"; import { abis } from "../constant/abis"; - import { abi } from "../../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json"; -module.exports = async function(owner: any) { +export async function buildDSAv2(owner: any) { const instaIndex = await ethers.getContractAt( abis.core.instaIndex, addresses.core.instaIndex @@ -17,4 +16,4 @@ module.exports = async function(owner: any) { (a: { event: string }) => a.event === "LogAccountCreated" ); return await ethers.getContractAt(abi, event.args.account); -}; +} diff --git a/scripts/deployAndEnableConnector.ts b/scripts/tests/deployAndEnableConnector.ts similarity index 56% rename from scripts/deployAndEnableConnector.ts rename to scripts/tests/deployAndEnableConnector.ts index 456f5076..362277f2 100644 --- a/scripts/deployAndEnableConnector.ts +++ b/scripts/tests/deployAndEnableConnector.ts @@ -1,10 +1,10 @@ -import { addresses } from "./constant/addresses"; -import { abis } from "./constant/abis"; +import { addresses } from "../constant/addresses"; +import { abis } from "../constant/abis"; // const { deployContract } = waffle; -import { ethers } from "hardhat"; -import { promises as fs } from "fs"; -import { deployContract } from "ethereum-waffle"; +// import { ethers } from "hardhat"; +// import { promises as fs } from "fs"; +// import { deployContract } from "ethereum-waffle"; export async function deployAndEnableConnector({ connectorName, @@ -12,7 +12,8 @@ export async function deployAndEnableConnector({ signer, connectors, }) { - const connectorInstanace = await deployContract(signer, contractArtifact, []); + const deployer = new contractArtifact(signer); + const connectorInstanace = await deployer.deploy(); await connectors .connect(signer) diff --git a/scripts/encodeFlashcastData.ts b/scripts/tests/encodeFlashcastData.ts similarity index 80% rename from scripts/encodeFlashcastData.ts rename to scripts/tests/encodeFlashcastData.ts index 3bfdd432..d7051737 100644 --- a/scripts/encodeFlashcastData.ts +++ b/scripts/tests/encodeFlashcastData.ts @@ -1,5 +1,3 @@ -import { addresses } from "./constant/addresses"; -import { abis } from "./constant/abis"; import * as hre from "hardhat"; const { web3 } = hre; diff --git a/scripts/polygon/encodeSpells.ts b/scripts/tests/encodeSpells.ts similarity index 84% rename from scripts/polygon/encodeSpells.ts rename to scripts/tests/encodeSpells.ts index c7e43755..62a7a8bb 100644 --- a/scripts/polygon/encodeSpells.ts +++ b/scripts/tests/encodeSpells.ts @@ -1,8 +1,7 @@ -import { addresses } from "./constant/addresses"; -import { abis } from "../constant/abis"; import { web3 } from "hardhat"; +import { abis } from "../constant/abis"; -module.exports = function(spells: any[]) { +export function encodeSpells(spells: any[]) { const targets = spells.map((a) => a.connector); const calldatas = spells.map((a) => { const functionName = a.method; @@ -15,4 +14,4 @@ module.exports = function(spells: any[]) { return web3.eth.abi.encodeFunctionCall(abi, a.args); }); return [targets, calldatas]; -}; +} diff --git a/scripts/getMasterSigner.ts b/scripts/tests/getMasterSigner.ts similarity index 86% rename from scripts/getMasterSigner.ts rename to scripts/tests/getMasterSigner.ts index 0c0778d5..59f59afb 100644 --- a/scripts/getMasterSigner.ts +++ b/scripts/tests/getMasterSigner.ts @@ -1,6 +1,6 @@ import { ethers, network } from "hardhat"; -import { addresses } from "./constant/addresses"; -import { abis } from "./constant/abis"; +import { addresses } from "../constant/addresses"; +import { abis } from "../constant/abis"; export async function getMasterSigner() { const [_, __, ___, wallet3] = await ethers.getSigners(); diff --git a/scripts/impersonate.ts b/scripts/tests/impersonate.ts similarity index 100% rename from scripts/impersonate.ts rename to scripts/tests/impersonate.ts diff --git a/scripts/buildDSAv2.ts b/scripts/tests/polygon/buildDSAv2.ts similarity index 69% rename from scripts/buildDSAv2.ts rename to scripts/tests/polygon/buildDSAv2.ts index 5b582e18..3c7b81f7 100644 --- a/scripts/buildDSAv2.ts +++ b/scripts/tests/polygon/buildDSAv2.ts @@ -1,10 +1,10 @@ import { ethers } from "hardhat"; import { addresses } from "./constant/addresses"; -import { abis } from "./constant/abis"; -import { abi } from "../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json"; +import { abis } from "../../constant/abis"; +import { abi } from "../../../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json"; -export async function buildDSAv2(owner: any) { +module.exports = async function(owner: any) { const instaIndex = await ethers.getContractAt( abis.core.instaIndex, addresses.core.instaIndex @@ -16,4 +16,4 @@ export async function buildDSAv2(owner: any) { (a: { event: string }) => a.event === "LogAccountCreated" ); return await ethers.getContractAt(abi, event.args.account); -} +}; diff --git a/scripts/polygon/constant/addresses.ts b/scripts/tests/polygon/constant/addresses.ts similarity index 100% rename from scripts/polygon/constant/addresses.ts rename to scripts/tests/polygon/constant/addresses.ts diff --git a/scripts/polygon/constant/constant.ts b/scripts/tests/polygon/constant/constant.ts similarity index 100% rename from scripts/polygon/constant/constant.ts rename to scripts/tests/polygon/constant/constant.ts diff --git a/scripts/polygon/constant/tokens.ts b/scripts/tests/polygon/constant/tokens.ts similarity index 100% rename from scripts/polygon/constant/tokens.ts rename to scripts/tests/polygon/constant/tokens.ts diff --git a/scripts/polygon/deployAndEnableConnector.ts b/scripts/tests/polygon/deployAndEnableConnector.ts similarity index 93% rename from scripts/polygon/deployAndEnableConnector.ts rename to scripts/tests/polygon/deployAndEnableConnector.ts index a62806dd..355da3ac 100644 --- a/scripts/polygon/deployAndEnableConnector.ts +++ b/scripts/tests/polygon/deployAndEnableConnector.ts @@ -1,7 +1,7 @@ import "@nomiclabs/hardhat-waffle"; import { addresses } from "./constant/addresses"; -import { abis } from "../constant/abis"; +import { abis } from "../../constant/abis"; import * as hre from "hardhat"; const { ethers, waffle } = hre; diff --git a/scripts/encodeSpells.ts b/scripts/tests/polygon/encodeSpells.ts similarity index 75% rename from scripts/encodeSpells.ts rename to scripts/tests/polygon/encodeSpells.ts index 9f4ac21b..d35b4277 100644 --- a/scripts/encodeSpells.ts +++ b/scripts/tests/polygon/encodeSpells.ts @@ -1,13 +1,12 @@ +import { abis } from "../../constant/abis"; import { web3 } from "hardhat"; -import { addresses } from "./constant/addresses"; -import { abis } from "./constant/abis"; export function encodeSpells(spells: any[]) { const targets = spells.map((a) => a.connector); const calldatas = spells.map((a) => { const functionName = a.method; // console.log(functionName) - const abi = abis.connectors[a.connector].find((b) => { + const abi = abis.connectors[a.connector].find((b: { name: any }) => { return b.name === functionName; }); // console.log(functionName) diff --git a/scripts/polygon/getMasterSigner.ts b/scripts/tests/polygon/getMasterSigner.ts similarity index 93% rename from scripts/polygon/getMasterSigner.ts rename to scripts/tests/polygon/getMasterSigner.ts index 558f3a27..43cf5e12 100644 --- a/scripts/polygon/getMasterSigner.ts +++ b/scripts/tests/polygon/getMasterSigner.ts @@ -1,6 +1,6 @@ const { ethers, network } = "hardhat"; import { addresses } from "./constant/addresses"; -import { abis } from "../constant/abis"; +import { abis } from "../../constant/abis"; module.exports = async function() { const [_, __, ___, wallet3] = await ethers.getSigners(); diff --git a/status-checks/readme.md b/status-checks/readme.md index ed376c25..aa1ff952 100644 --- a/status-checks/readme.md +++ b/status-checks/readme.md @@ -1,4 +1,3 @@ - # Check run use diff --git a/test/mainnet/aave/v1.test.ts b/test/mainnet/aave/v1.test.ts index f1a9d7e6..52e1607c 100644 --- a/test/mainnet/aave/v1.test.ts +++ b/test/mainnet/aave/v1.test.ts @@ -2,16 +2,16 @@ import { expect } from "chai"; import "hardhat"; import { abis } from "../../../scripts/constant/abis"; import { addresses } from "../../../scripts/constant/addresses"; -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector"; -import { getMasterSigner } from "../../../scripts/getMasterSigner"; -import { buildDSAv2 } from "../../../scripts/buildDSAv2"; +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import ConnectV2AaveV1 from "../../artifacts/contracts/mainnet/connectors/aave/v1/main.sol/ConnectV2AaveV1.json"; import { parseEther } from "@ethersproject/units"; -import { encodeSpells } from "../../../scripts/encodeSpells"; +import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { tokens } from "../../../scripts/constant/tokens"; import { constants } from "../../../scripts/constant/constant"; -import { addLiquidity } from "../../../scripts/addLiquidity"; +import { addLiquidity } from "../../../scripts/tests/addLiquidity"; // const { ethers } = hre; const ALCHEMY_ID = process.env.ALCHEMY_ID; diff --git a/test/mainnet/aave/v2.test.ts b/test/mainnet/aave/v2.test.ts index b836b088..f8b28ad2 100644 --- a/test/mainnet/aave/v2.test.ts +++ b/test/mainnet/aave/v2.test.ts @@ -2,38 +2,37 @@ import { expect } from "chai"; import hre from "hardhat"; import { abis } from "../../../scripts/constant/abis"; import { addresses } from "../../../scripts/constant/addresses"; -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector"; -import { getMasterSigner } from "../../../scripts/getMasterSigner"; -import { buildDSAv2 } from "../../../scripts/buildDSAv2"; -import { ConnectV2AaveV2 } from "../../artifacts/contracts/mainnet/connectors/aave/v2/main.sol/ConnectV2AaveV2.json"; +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; +import { ConnectV2AaveV2, ConnectV2AaveV2__factory } from "../../../typechain"; import { parseEther } from "@ethersproject/units"; -import { encodeSpells } from "../../../scripts/encodeSpells"; +import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { tokens } from "../../../scripts/constant/tokens"; import { constants } from "../../../scripts/constant/constant"; -import { addLiquidity } from "../../../scripts/addLiquidity"; -// const { ethers } = hre; +import { addLiquidity } from "../../../scripts/tests/addLiquidity"; +const { ethers } = hre; describe("Aave V2", function () { const connectorName = "AAVEV2-TEST-A"; + let connector: ConnectV2AaveV2; - let wallet0: any, wallet1: any; + let wallet0: any, wallet1: { address: any; }; let dsaWallet0: any; - let instaConnectorsV2: any; - let connector: any; - let masterSigner: any; - + let instaConnectorsV2: { address: any; }; + let masterSigner: { address: any; }; before(async () => { - await hre.network.provider.request({ - method: "hardhat_reset", - params: [ - { - forking: { - jsonRpcUrl: hre.config.networks.hardhat.forking.url, - blockNumber: 12796965, - }, - }, - ], - }); + // await hre.network.provider.request({ + // method: "hardhat_reset", + // params: [ + // { + // forking: { + // jsonRpcUrl: hre.config.networks.hardhat.forking.url, + // blockNumber: 12796965, + // }, + // }, + // ], + // }); [wallet0, wallet1] = await ethers.getSigners(); masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( @@ -42,7 +41,7 @@ describe("Aave V2", function () { ); connector = await deployAndEnableConnector({ connectorName, - contractArtifact: ConnectV2AaveV2, + contractArtifact: ConnectV2AaveV2__factory, signer: masterSigner, connectors: instaConnectorsV2, }); diff --git a/test/mainnet/b.protocol/b.compound.test.ts b/test/mainnet/b.protocol/b.compound.test.ts index a8bfffe7..1f0f20fa 100644 --- a/test/mainnet/b.protocol/b.compound.test.ts +++ b/test/mainnet/b.protocol/b.compound.test.ts @@ -3,10 +3,10 @@ import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; //check const { provider, deployContract } = waffle -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/buildDSAv2" -import { encodeSpells } from "../../../scripts/encodeSpells.js" -import { getMasterSigner } from "../../../scripts/getMasterSigner" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; diff --git a/test/mainnet/b.protocol/b.liquity.test.ts b/test/mainnet/b.protocol/b.liquity.test.ts index a59299a0..dd4e74ba 100644 --- a/test/mainnet/b.protocol/b.liquity.test.ts +++ b/test/mainnet/b.protocol/b.liquity.test.ts @@ -3,10 +3,10 @@ import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; //check const { provider, deployContract } = waffle -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/buildDSAv2" -import { encodeSpells } from "../../../scripts/encodeSpells.js" -import { getMasterSigner } from "../../../scripts/getMasterSigner" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; diff --git a/test/mainnet/b.protocol/b.maker.test.ts b/test/mainnet/b.protocol/b.maker.test.ts index a04a0f20..35f42390 100644 --- a/test/mainnet/b.protocol/b.maker.test.ts +++ b/test/mainnet/b.protocol/b.maker.test.ts @@ -4,10 +4,10 @@ const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/buildDSAv2" -import { encodeSpells } from "../../../scripts/encodeSpells.js" -import { getMasterSigner } from "../../../scripts/getMasterSigner" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; diff --git a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts index 66130bac..ea7c3bd6 100644 --- a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts +++ b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts @@ -4,10 +4,10 @@ const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle import { abi: implementationsABI } from "../../../scripts/constant/abi/core/InstaImplementations.json" -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/buildDSAv2" -import { encodeSpells } from "../../../scripts/encodeSpells.js" -import { getMasterSigner } from "../../../scripts/getMasterSigner" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses" import { abis } from "../../../scripts/constant/abis" diff --git a/test/mainnet/basic-ERC721/ERC721-transfer.ts b/test/mainnet/basic-ERC721/ERC721-transfer.ts index 63b96004..bdc1ab80 100644 --- a/test/mainnet/basic-ERC721/ERC721-transfer.ts +++ b/test/mainnet/basic-ERC721/ERC721-transfer.ts @@ -5,10 +5,10 @@ const { provider, deployContract } = waffle import { abi : implementationsABI } from "../../../scripts/constant/abi/core/InstaImplementations.json" -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/buildDSAv2" -import { encodeSpells } from "../../../scripts/encodeSpells.js" -import { getMasterSigner } from "../../../scripts/getMasterSigner" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses" diff --git a/test/mainnet/compound/compound.test.ts b/test/mainnet/compound/compound.test.ts index bf43420c..f08c2415 100644 --- a/test/mainnet/compound/compound.test.ts +++ b/test/mainnet/compound/compound.test.ts @@ -3,10 +3,10 @@ import hre from "hardhat"; import { web3, deployments, waffle, ethers } = hre; import { provider, deployContract } = waffle -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/buildDSAv2" -import { encodeSpells } from "../../../scripts/encodeSpells.js" -import { getMasterSigner } from "../../../scripts/getMasterSigner" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; diff --git a/test/mainnet/instapool/instapool.test.ts b/test/mainnet/instapool/instapool.test.ts index 11365223..4904c652 100644 --- a/test/mainnet/instapool/instapool.test.ts +++ b/test/mainnet/instapool/instapool.test.ts @@ -3,11 +3,11 @@ import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/buildDSAv2" -import { encodeSpells } from "../../../scripts/encodeSpells.js" -import { encodeFlashcastData } from "../../../scripts/encodeFlashcastData.js" -import { getMasterSigner } from "../../../scripts/getMasterSigner" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { encodeFlashcastData } from "../../../scripts/tests/encodeFlashcastData.js" +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; diff --git a/test/mainnet/liquity/liquity.helpers.ts b/test/mainnet/liquity/liquity.helpers.ts index 457a1412..5e1dd77f 100644 --- a/test/mainnet/liquity/liquity.helpers.ts +++ b/test/mainnet/liquity/liquity.helpers.ts @@ -2,10 +2,10 @@ import hre from "hardhat"; import hardhatConfig from "../../../hardhat.config"; // Instadapp deployment and testing helpers -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/buildDSAv2" -import { encodeSpells } from "../../../scripts/encodeSpells.js" -import { getMasterSigner } from "../../../scripts/getMasterSigner" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" // Instadapp instadappAddresses/ABIs import { instadappAddresses } from "../../../scripts/important/addresses"; diff --git a/test/mainnet/liquity/liquity.test.ts b/test/mainnet/liquity/liquity.test.ts index 70bf96db..fd5ccd69 100644 --- a/test/mainnet/liquity/liquity.test.ts +++ b/test/mainnet/liquity/liquity.test.ts @@ -2,8 +2,8 @@ import hre from "hardhat"; import { expect } from "chai"; // Instadapp deployment and testing helpers -import { buildDSAv2 } from "../../../scripts/buildDSAv2"; -import { encodeSpells } from "../../../scripts/encodeSpells.js"; +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js"; // Liquity smart contracts import contracts from "./liquity.contracts"; diff --git a/test/mainnet/pooltogether-polygon/pooltogether.test.ts b/test/mainnet/pooltogether-polygon/pooltogether.test.ts index 61eaa370..462d7d4b 100644 --- a/test/mainnet/pooltogether-polygon/pooltogether.test.ts +++ b/test/mainnet/pooltogether-polygon/pooltogether.test.ts @@ -5,10 +5,10 @@ const { provider, deployContract } = waffle const ALCHEMY_ID = process.env.ALCHEMY_ID; -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/buildDSAv2" -import { encodeSpells } from "../../../scripts/encodeSpells.js" -import { getMasterSigner } from "../../../scripts/getMasterSigner" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses" diff --git a/test/mainnet/pooltogether/pooltogether.test.ts b/test/mainnet/pooltogether/pooltogether.test.ts index e980b2ba..2aadfa8e 100644 --- a/test/mainnet/pooltogether/pooltogether.test.ts +++ b/test/mainnet/pooltogether/pooltogether.test.ts @@ -3,10 +3,10 @@ import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/buildDSAv2" -import { encodeSpells } from "../../../scripts/encodeSpells.js" -import { getMasterSigner } from "../../../scripts/getMasterSigner" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses" import { abis } from "../../../scripts/constant/abis" diff --git a/test/mainnet/uniswap/uniswap.test.ts b/test/mainnet/uniswap/uniswap.test.ts index e9cb8acd..cb1dc61e 100644 --- a/test/mainnet/uniswap/uniswap.test.ts +++ b/test/mainnet/uniswap/uniswap.test.ts @@ -3,12 +3,12 @@ import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js"; -import { buildDSAv2 } from "../../../scripts/buildDSAv2"; -import { encodeSpells } from "../../../scripts/encodeSpells.js"; -import { encodeFlashcastData } from "../../../scripts/encodeFlashcastData.js"; -import { getMasterSigner } from "../../../scripts/getMasterSigner"; -import { addLiquidity } from "../../../scripts/addLiquidity"; +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js"; +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js"; +import { encodeFlashcastData } from "../../../scripts/tests/encodeFlashcastData.js"; +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; +import { addLiquidity } from "../../../scripts/tests/addLiquidity"; import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; diff --git a/test/mainnet/uniswapStake/uniswapStake.test.ts b/test/mainnet/uniswapStake/uniswapStake.test.ts index 54f26b57..7051acec 100644 --- a/test/mainnet/uniswapStake/uniswapStake.test.ts +++ b/test/mainnet/uniswapStake/uniswapStake.test.ts @@ -3,11 +3,11 @@ import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js"; -import { buildDSAv2 } from "../../../scripts/buildDSAv2"; -import { encodeSpells } from "../../../scripts/encodeSpells.js"; -import { getMasterSigner } from "../../../scripts/getMasterSigner"; -import { addLiquidity } from "../../../scripts/addLiquidity"; +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js"; +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js"; +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; +import { addLiquidity } from "../../../scripts/tests/addLiquidity"; import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; diff --git a/test/mainnet/yearn/yearn.test.ts b/test/mainnet/yearn/yearn.test.ts index ce762575..c3e9028c 100644 --- a/test/mainnet/yearn/yearn.test.ts +++ b/test/mainnet/yearn/yearn.test.ts @@ -3,10 +3,10 @@ import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -import { deployAndEnableConnector } from "../../../scripts/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/buildDSAv2" -import { encodeSpells } from "../../../scripts/encodeSpells.js" -import { getMasterSigner } from "../../../scripts/getMasterSigner" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..98421cca --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,27 @@ +// tsconfig.json +{ + "compilerOptions": { + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es5", "es6"], + "module": "commonjs", + "moduleResolution": "node", + "noImplicitAny": true, + "outDir": "dist", + "resolveJsonModule": true, + "sourceMap": true, + "strict": true, + "target": "es5", + }, + "exclude": ["artifacts", "node_modules"], + "files": ["./hardhat.config.ts"], + "include": [ + "artifacts/**/*", + "artifacts/**/*.json", + "scripts/**/*", + "tasks/**/*", + "test/**/*", + "typechain/**/*", + "types/**/*" + ] +} From 632318e69acd903f7d63cdc49307dbd76466a1ba Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Mon, 6 Dec 2021 00:55:51 +0530 Subject: [PATCH 12/39] updated package-lock.json --- package-lock.json | 4649 ++++++++++++++++++++++++--------------------- yarn.lock | 1025 +++++----- 2 files changed, 3014 insertions(+), 2660 deletions(-) diff --git a/package-lock.json b/package-lock.json index ac293b3c..25dce20f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,38 +10,40 @@ "license": "ISC", "dependencies": { "@openzeppelin/contracts": "^3.4.0-solc-0.7", + "@typechain/ethers-v5": "^8.0.5", "@typechain/hardhat": "^3.0.0", "@uniswap/v3-core": "^1.0.0", - "@uniswap/v3-periphery": "^1.2.1", - "chalk": "^4.1.2", + "@uniswap/v3-periphery": "^1.3.0", + "chalk": "^5.0.0", "dotenv": "^10.0.0", - "hardhat-docgen": "^1.1.2", + "hardhat-docgen": "^1.2.0", "minimist": "^1.2.5", - "solc": "^0.7.0" + "solc": "^0.8.10", + "typechain": "^6.0.5" }, "devDependencies": { - "@nomiclabs/hardhat-ethers": "^2.0.2", - "@nomiclabs/hardhat-etherscan": "^2.1.7", + "@nomiclabs/hardhat-ethers": "^2.0.3", + "@nomiclabs/hardhat-etherscan": "^2.1.8", "@nomiclabs/hardhat-waffle": "^2.0.1", "@nomiclabs/hardhat-web3": "^2.0.0", "@openzeppelin/test-helpers": "^0.5.15", "@studydefi/money-legos": "^2.4.2", - "@tenderly/hardhat-tenderly": "^1.0.12", + "@tenderly/hardhat-tenderly": "^1.0.13", "@types/chai": "^4.2.22", "@types/mocha": "^9.0.0", - "@types/node": "^16.11.10", + "@types/node": "^16.11.11", "chai": "^4.3.4", "chai-as-promised": "^7.1.1", "ethereum-waffle": "^3.4.0", - "ethers": "^5.5.1", - "hardhat": "^2.6.7", - "hardhat-deploy": "^0.9.4", + "ethers": "^5.5.2", + "hardhat": "^2.7.0", + "hardhat-deploy": "^0.9.14", "hardhat-deploy-ethers": "^0.3.0-beta.11", "husky": "^7.0.4", - "solidity-coverage": "0.5.11", + "solidity-coverage": "0.7.17", "ts-node": "^10.4.0", "typescript": "^4.5.2", - "web3": "^1.5.2" + "web3": "^1.6.1" } }, "node_modules/@babel/runtime": { @@ -839,12 +841,12 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "node_modules/@ethereumjs/common": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.4.0.tgz", - "integrity": "sha512-UdkhFWzWcJCZVsj1O/H8/oqj/0RVYjLc1OhPjBrQdALAkQHpCp8xXI4WLnuGTADqTdJZww0NtgwG+TRPkXt27w==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.0.tgz", + "integrity": "sha512-Cq2qS0FTu6O2VU1sgg+WyU9Ps0M6j/BEMHN+hRaECXCV/r0aI78u4N6p52QW/BDVhwWZpCdrvG8X7NJdzlpNUA==", "dependencies": { "crc-32": "^1.2.0", - "ethereumjs-util": "^7.1.0" + "ethereumjs-util": "^7.1.3" } }, "node_modules/@ethereumjs/common/node_modules/@types/bn.js": { @@ -861,15 +863,14 @@ "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" }, "node_modules/@ethereumjs/common/node_modules/ethereumjs-util": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.0.tgz", - "integrity": "sha512-kR+vhu++mUDARrsMMhsjjzPduRVAeundLGXucGRHF3B4oEltOUspfgCVco4kckucj3FMlLaZHUl9n7/kdmr6Tw==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.3.tgz", + "integrity": "sha512-y+82tEbyASO0K0X1/SRhbJJoAlfcvq8JbrG4a5cjrOks7HS/36efU/0j2flxCPOUM++HFahk33kr/ZxyC4vNuw==", "dependencies": { "@types/bn.js": "^5.1.0", "bn.js": "^5.1.2", "create-hash": "^1.1.2", "ethereum-cryptography": "^0.1.3", - "ethjs-util": "0.1.6", "rlp": "^2.2.4" }, "engines": { @@ -925,12 +926,12 @@ } }, "node_modules/@ethereumjs/tx": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.3.0.tgz", - "integrity": "sha512-yTwEj2lVzSMgE6Hjw9Oa1DZks/nKTWM8Wn4ykDNapBPua2f4nXO3qKnni86O6lgDj5fVNRqbDsD0yy7/XNGDEA==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.4.0.tgz", + "integrity": "sha512-WWUwg1PdjHKZZxPPo274ZuPsJCWV3SqATrEKQP1n2DrVYVP1aZIYpo/mFaA0BDoE0tIQmBeimRCEA0Lgil+yYw==", "dependencies": { - "@ethereumjs/common": "^2.4.0", - "ethereumjs-util": "^7.1.0" + "@ethereumjs/common": "^2.6.0", + "ethereumjs-util": "^7.1.3" } }, "node_modules/@ethereumjs/tx/node_modules/@types/bn.js": { @@ -947,15 +948,14 @@ "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" }, "node_modules/@ethereumjs/tx/node_modules/ethereumjs-util": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.0.tgz", - "integrity": "sha512-kR+vhu++mUDARrsMMhsjjzPduRVAeundLGXucGRHF3B4oEltOUspfgCVco4kckucj3FMlLaZHUl9n7/kdmr6Tw==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.3.tgz", + "integrity": "sha512-y+82tEbyASO0K0X1/SRhbJJoAlfcvq8JbrG4a5cjrOks7HS/36efU/0j2flxCPOUM++HFahk33kr/ZxyC4vNuw==", "dependencies": { "@types/bn.js": "^5.1.0", "bn.js": "^5.1.2", "create-hash": "^1.1.2", "ethereum-cryptography": "^0.1.3", - "ethjs-util": "0.1.6", "rlp": "^2.2.4" }, "engines": { @@ -1140,7 +1140,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.5.0.tgz", "integrity": "sha512-ZIodwhHpVJ0Y3hUCfUucmxKsWQA5TMnavp5j/UOuDdzZWzJlRmuOjcTMIGgHCYuZmHt36BfiSyQPSRskPxbfaQ==", - "dev": true, "funding": [ { "type": "individual", @@ -1216,7 +1215,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.5.0.tgz", "integrity": "sha512-2viY7NzyvJkh+Ug17v7g3/IJC8HqZBDcOjYARZLdzRxrfGlRgmYgl6xPRKVbEzy1dWKw/iv7chDcS83pg6cLxg==", - "dev": true, "funding": [ { "type": "individual", @@ -1244,7 +1242,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.5.0.tgz", "integrity": "sha512-loW7I4AohP5KycATvc0MgujU6JyCHPqHdeoo9z3Nr9xEiNioxa65ccdm1+fsoJhkuhdRtfcL8cfyGamz2AxZ5w==", - "dev": true, "funding": [ { "type": "individual", @@ -1322,7 +1319,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.5.0.tgz", "integrity": "sha512-mcSOo9zeUg1L0CoJH7zmxwUG5ggQHU1UrRf8jyTYy6HxdZV+r0PBoL1bxr+JHIPXRzS6u/UW4mEn43y0tmyF8Q==", - "dev": true, "funding": [ { "type": "individual", @@ -1352,7 +1348,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.5.0.tgz", "integrity": "sha512-9lA21XQnCdcS72xlBn1jfQdj2A1VUxZzOzi9UkNdnokNKke/9Ya2xA9aIK1SC3PQyBDLt4C+dfps7ULpkvKikQ==", - "dev": true, "funding": [ { "type": "individual", @@ -1419,9 +1414,9 @@ ] }, "node_modules/@ethersproject/networks": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.0.tgz", - "integrity": "sha512-KWfP3xOnJeF89Uf/FCJdV1a2aDJe5XTN2N52p4fcQ34QhDqQFkgQKZ39VGtiqUgHcLI8DfT0l9azC3KFTunqtA==", + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.1.tgz", + "integrity": "sha512-tYRDM4zZtSUcKnD4UMuAlj7SeXH/k5WC4SP2u1Pn57++JdXHkRu2zwNkgNogZoxHzhm9Q6qqurDBVptHOsW49Q==", "funding": [ { "type": "individual", @@ -1440,7 +1435,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.5.0.tgz", "integrity": "sha512-SaDvQFvXPnz1QGpzr6/HToLifftSXGoXrbpZ6BvoZhmx4bNLHrxDe8MZisuecyOziP1aVEwzC2Hasj+86TgWVg==", - "dev": true, "funding": [ { "type": "individual", @@ -1475,10 +1469,9 @@ } }, "node_modules/@ethersproject/providers": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.5.0.tgz", - "integrity": "sha512-xqMbDnS/FPy+J/9mBLKddzyLLAQFjrVff5g00efqxPzcAwXiR+SiCGVy6eJ5iAIirBOATjx7QLhDNPGV+AEQsw==", - "dev": true, + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.5.1.tgz", + "integrity": "sha512-2zdD5sltACDWhjUE12Kucg2PcgM6V2q9JMyVvObtVGnzJu+QSmibbP+BHQyLWZUBfLApx2942+7DC5D+n4wBQQ==", "funding": [ { "type": "individual", @@ -1515,7 +1508,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.5.0.tgz", "integrity": "sha512-egGYZwZ/YIFKMHcoBUo8t3a8Hb/TKYX8BCBoLjudVCZh892welR3jOxgOmb48xznc9bTcMm7Tpwc1gHC1PFNFQ==", - "dev": true, "funding": [ { "type": "individual", @@ -1554,7 +1546,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.5.0.tgz", "integrity": "sha512-B5UBoglbCiHamRVPLA110J+2uqsifpZaTmid2/7W5rbtYVz6gus6/hSDieIU/6gaKIDcOj12WnOdiymEUHIAOA==", - "dev": true, "funding": [ { "type": "individual", @@ -1598,7 +1589,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.5.0.tgz", "integrity": "sha512-9NgZs9LhGMj6aCtHXhtmFQ4AN4sth5HuFXVvAQtzmm0jpSCNOTGtrHZJAeYTh7MBjRR8brylWZxBZR9zDStXbw==", - "dev": true, "funding": [ { "type": "individual", @@ -1668,7 +1658,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.5.0.tgz", "integrity": "sha512-7+DpjiZk4v6wrikj+TCyWWa9dXLNU73tSTa7n0TSJDxkYbV3Yf1eRh9ToMLlZtuctNYu9RDNNy2USq3AdqSbag==", - "dev": true, "funding": [ { "type": "individual", @@ -1689,7 +1678,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.5.0.tgz", "integrity": "sha512-Mlu13hIctSYaZmUOo7r2PhNSd8eaMPVXe1wxrz4w4FCE4tDYBywDH+bAR1Xz2ADyXGwqYMwstzTrtUVIsKDO0Q==", - "dev": true, "funding": [ { "type": "individual", @@ -1719,9 +1707,9 @@ } }, "node_modules/@ethersproject/web": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.0.tgz", - "integrity": "sha512-BEgY0eL5oH4mAo37TNYVrFeHsIXLRxggCRG/ksRIxI2X5uj5IsjGmcNiRN/VirQOlBxcUhCgHhaDLG4m6XAVoA==", + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz", + "integrity": "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==", "funding": [ { "type": "individual", @@ -1744,7 +1732,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.5.0.tgz", "integrity": "sha512-bL0UTReWDiaQJJYOC9sh/XcRu/9i2jMrzf8VLRmPKx58ckSlOJiohODkECCO50dtLZHcGU6MLXQ4OOrgBwP77Q==", - "dev": true, "funding": [ { "type": "individual", @@ -2031,10 +2018,45 @@ "dev": true, "peer": true }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@nomiclabs/hardhat-ethers": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.2.tgz", - "integrity": "sha512-6quxWe8wwS4X5v3Au8q1jOvXYEPkS1Fh+cME5u6AwNdnI4uERvPlVjlgRWzpnb+Rrt1l/cEqiNRH9GlsBMSDQg==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.3.tgz", + "integrity": "sha512-IJ0gBotVtO7YyLZyHNgbxzskUtFok+JkRlKPo8YELqj1ms9XL6Qm3vsfsGdZr22wnJeVEF5TQPotKuwQk21Dag==", "dev": true, "peerDependencies": { "ethers": "^5.0.0", @@ -2042,11 +2064,10 @@ } }, "node_modules/@nomiclabs/hardhat-etherscan": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-2.1.7.tgz", - "integrity": "sha512-9nt9EXubnkd2aTMnQIqKtp80bQFhun88krfB31FN2wB0T54b8YuK0riG2d+EKq/D3t1Kb00oA7oFSFpHLIbLDQ==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-2.1.8.tgz", + "integrity": "sha512-0+rj0SsZotVOcTLyDOxnOc3Gulo8upo0rsw/h+gBPcmtj91YqYJNhdARHoBxOhhE8z+5IUQPx+Dii04lXT14PA==", "dev": true, - "license": "MIT", "dependencies": { "@ethersproject/abi": "^5.1.2", "@ethersproject/address": "^5.0.2", @@ -2461,9 +2482,9 @@ } }, "node_modules/@tenderly/hardhat-tenderly": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/@tenderly/hardhat-tenderly/-/hardhat-tenderly-1.0.12.tgz", - "integrity": "sha512-zx2zVpbBxGWVp+aLgf59sZR5lxdqfq/PjqUhga6+iazukQNu/Y6pLfVnCcF1ggvLsf7gnMjwLe3YEx/GxCAykQ==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@tenderly/hardhat-tenderly/-/hardhat-tenderly-1.0.13.tgz", + "integrity": "sha512-XsrF2QIUh8YmzCcWHmPnSNQjZNBQkyrHER8bcrWsFIgL7ub49hmPbpGVB2Isb6gUV/IGBpBm7R69jpmoTvJ17g==", "dev": true, "dependencies": { "axios": "^0.21.1", @@ -3089,18 +3110,6 @@ "highlightjs-solidity": "^2.0.1" } }, - "node_modules/@truffle/debug-utils/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/@truffle/debug-utils/node_modules/bn.js": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", @@ -3121,21 +3130,6 @@ "node": ">=4" } }, - "node_modules/@truffle/debug-utils/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@truffle/debug-utils/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, "node_modules/@truffle/debug-utils/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -3599,6 +3593,370 @@ "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "dev": true }, + "node_modules/@truffle/provider": { + "version": "0.2.42", + "resolved": "https://registry.npmjs.org/@truffle/provider/-/provider-0.2.42.tgz", + "integrity": "sha512-ZNoglPho4alYIjJR+sLTgX0x6ho7m4OAUWuJ50RAWmoEqYc4AM6htdrI+lTSoRrOHHbmgasv22a7rFPMnmDrTg==", + "dev": true, + "dependencies": { + "@truffle/error": "^0.0.14", + "@truffle/interface-adapter": "^0.5.8", + "web3": "1.5.3" + } + }, + "node_modules/@truffle/provider/node_modules/@types/node": { + "version": "12.20.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", + "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", + "dev": true + }, + "node_modules/@truffle/provider/node_modules/bignumber.js": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", + "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/@truffle/provider/node_modules/eth-lib": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", + "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", + "dev": true, + "dependencies": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "node_modules/@truffle/provider/node_modules/ethereumjs-util": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.3.tgz", + "integrity": "sha512-y+82tEbyASO0K0X1/SRhbJJoAlfcvq8JbrG4a5cjrOks7HS/36efU/0j2flxCPOUM++HFahk33kr/ZxyC4vNuw==", + "dev": true, + "dependencies": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "rlp": "^2.2.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/ethereumjs-util/node_modules/@types/bn.js": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", + "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@truffle/provider/node_modules/ethereumjs-util/node_modules/bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==", + "dev": true + }, + "node_modules/@truffle/provider/node_modules/uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "dev": true, + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/@truffle/provider/node_modules/web3": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3/-/web3-1.5.3.tgz", + "integrity": "sha512-eyBg/1K44flfv0hPjXfKvNwcUfIVDI4NX48qHQe6wd7C8nPSdbWqo9vLy6ksZIt9NLa90HjI8HsGYgnMSUxn6w==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "web3-bzz": "1.5.3", + "web3-core": "1.5.3", + "web3-eth": "1.5.3", + "web3-eth-personal": "1.5.3", + "web3-net": "1.5.3", + "web3-shh": "1.5.3", + "web3-utils": "1.5.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-bzz": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.5.3.tgz", + "integrity": "sha512-SlIkAqG0eS6cBS9Q2eBOTI1XFzqh83RqGJWnyrNZMDxUwsTVHL+zNnaPShVPvrWQA1Ub5b0bx1Kc5+qJVxsTJg==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@types/node": "^12.12.6", + "got": "9.6.0", + "swarm-js": "^0.1.40" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-core": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.5.3.tgz", + "integrity": "sha512-ACTbu8COCu+0eUNmd9pG7Q9EVsNkAg2w3Y7SqhDr+zjTgbSHZV01jXKlapm9z+G3AN/BziV3zGwudClJ4u4xXQ==", + "dev": true, + "dependencies": { + "@types/bn.js": "^4.11.5", + "@types/node": "^12.12.6", + "bignumber.js": "^9.0.0", + "web3-core-helpers": "1.5.3", + "web3-core-method": "1.5.3", + "web3-core-requestmanager": "1.5.3", + "web3-utils": "1.5.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-core-method": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.5.3.tgz", + "integrity": "sha512-8wJrwQ2qD9ibWieF9oHXwrJsUGrv3XAtEkNeyvyNMpktNTIjxJ2jaFGQUuLiyUrMubD18XXgLk4JS6PJU4Loeg==", + "dev": true, + "dependencies": { + "@ethereumjs/common": "^2.4.0", + "@ethersproject/transactions": "^5.0.0-beta.135", + "web3-core-helpers": "1.5.3", + "web3-core-promievent": "1.5.3", + "web3-core-subscriptions": "1.5.3", + "web3-utils": "1.5.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-core-requestmanager": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.5.3.tgz", + "integrity": "sha512-9k/Bze2rs8ONix5IZR+hYdMNQv+ark2Ek2kVcrFgWO+LdLgZui/rn8FikPunjE+ub7x7pJaKCgVRbYFXjo3ZWg==", + "dev": true, + "dependencies": { + "util": "^0.12.0", + "web3-core-helpers": "1.5.3", + "web3-providers-http": "1.5.3", + "web3-providers-ipc": "1.5.3", + "web3-providers-ws": "1.5.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-core-subscriptions": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.5.3.tgz", + "integrity": "sha512-L2m9vG1iRN6thvmv/HQwO2YLhOQlmZU8dpLG6GSo9FBN14Uch868Swk0dYVr3rFSYjZ/GETevSXU+O+vhCummA==", + "dev": true, + "dependencies": { + "eventemitter3": "4.0.4", + "web3-core-helpers": "1.5.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-eth": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.5.3.tgz", + "integrity": "sha512-saFurA1L23Bd7MEf7cBli6/jRdMhD4X/NaMiO2mdMMCXlPujoudlIJf+VWpRWJpsbDFdu7XJ2WHkmBYT5R3p1Q==", + "dev": true, + "dependencies": { + "web3-core": "1.5.3", + "web3-core-helpers": "1.5.3", + "web3-core-method": "1.5.3", + "web3-core-subscriptions": "1.5.3", + "web3-eth-abi": "1.5.3", + "web3-eth-accounts": "1.5.3", + "web3-eth-contract": "1.5.3", + "web3-eth-ens": "1.5.3", + "web3-eth-iban": "1.5.3", + "web3-eth-personal": "1.5.3", + "web3-net": "1.5.3", + "web3-utils": "1.5.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-eth-accounts": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.5.3.tgz", + "integrity": "sha512-pdGhXgeBaEJENMvRT6W9cmji3Zz/46ugFSvmnLLw79qi5EH7XJhKISNVb41eWCrs4am5GhI67GLx5d2s2a72iw==", + "dev": true, + "dependencies": { + "@ethereumjs/common": "^2.3.0", + "@ethereumjs/tx": "^3.2.1", + "crypto-browserify": "3.12.0", + "eth-lib": "0.2.8", + "ethereumjs-util": "^7.0.10", + "scrypt-js": "^3.0.1", + "uuid": "3.3.2", + "web3-core": "1.5.3", + "web3-core-helpers": "1.5.3", + "web3-core-method": "1.5.3", + "web3-utils": "1.5.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-eth-contract": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.5.3.tgz", + "integrity": "sha512-Gdlt1L6cdHe83k7SdV6xhqCytVtOZkjD0kY/15x441AuuJ4JLubCHuqu69k2Dr3tWifHYVys/vG8QE/W16syGg==", + "dev": true, + "dependencies": { + "@types/bn.js": "^4.11.5", + "web3-core": "1.5.3", + "web3-core-helpers": "1.5.3", + "web3-core-method": "1.5.3", + "web3-core-promievent": "1.5.3", + "web3-core-subscriptions": "1.5.3", + "web3-eth-abi": "1.5.3", + "web3-utils": "1.5.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-eth-ens": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.5.3.tgz", + "integrity": "sha512-QmGFFtTGElg0E+3xfCIFhiUF+1imFi9eg/cdsRMUZU4F1+MZCC/ee+IAelYLfNTGsEslCqfAusliKOT9DdGGnw==", + "dev": true, + "dependencies": { + "content-hash": "^2.5.2", + "eth-ens-namehash": "2.0.8", + "web3-core": "1.5.3", + "web3-core-helpers": "1.5.3", + "web3-core-promievent": "1.5.3", + "web3-eth-abi": "1.5.3", + "web3-eth-contract": "1.5.3", + "web3-utils": "1.5.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-eth-personal": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.5.3.tgz", + "integrity": "sha512-JzibJafR7ak/Icas8uvos3BmUNrZw1vShuNR5Cxjo+vteOC8XMqz1Vr7RH65B4bmlfb3bm9xLxetUHO894+Sew==", + "dev": true, + "dependencies": { + "@types/node": "^12.12.6", + "web3-core": "1.5.3", + "web3-core-helpers": "1.5.3", + "web3-core-method": "1.5.3", + "web3-net": "1.5.3", + "web3-utils": "1.5.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-net": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.5.3.tgz", + "integrity": "sha512-0W/xHIPvgVXPSdLu0iZYnpcrgNnhzHMC888uMlGP5+qMCt8VuflUZHy7tYXae9Mzsg1kxaJAS5lHVNyeNw4CoQ==", + "dev": true, + "dependencies": { + "web3-core": "1.5.3", + "web3-core-method": "1.5.3", + "web3-utils": "1.5.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-providers-http": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.5.3.tgz", + "integrity": "sha512-5DpUyWGHtDAr2RYmBu34Fu+4gJuBAuNx2POeiJIooUtJ+Mu6pIx4XkONWH6V+Ez87tZAVAsFOkJRTYuzMr3rPw==", + "dev": true, + "dependencies": { + "web3-core-helpers": "1.5.3", + "xhr2-cookies": "1.1.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-providers-ipc": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.5.3.tgz", + "integrity": "sha512-JmeAptugVpmXI39LGxUSAymx0NOFdgpuI1hGQfIhbEAcd4sv7fhfd5D+ZU4oLHbRI8IFr4qfGU0uhR8BXhDzlg==", + "dev": true, + "dependencies": { + "oboe": "2.1.5", + "web3-core-helpers": "1.5.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-providers-ws": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.5.3.tgz", + "integrity": "sha512-6DhTw4Q7nm5CFYEUHOJM0gAb3xFx+9gWpVveg3YxJ/ybR1BUvEWo3bLgIJJtX56cYX0WyY6DS35a7f0LOI1kVg==", + "dev": true, + "dependencies": { + "eventemitter3": "4.0.4", + "web3-core-helpers": "1.5.3", + "websocket": "^1.0.32" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-shh": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.5.3.tgz", + "integrity": "sha512-COfEXfsqoV/BkcsNLRxQqnWc1Teb8/9GxdGag5GtPC5gQC/vsN+7hYVJUwNxY9LtJPKYTij2DHHnx6UkITng+Q==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "web3-core": "1.5.3", + "web3-core-method": "1.5.3", + "web3-core-subscriptions": "1.5.3", + "web3-net": "1.5.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@truffle/provider/node_modules/web3-utils": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.5.3.tgz", + "integrity": "sha512-56nRgA+Ad9SEyCv39g36rTcr5fpsd4L9LgV3FK0aB66nAMazLAA6Qz4lH5XrUKPDyBIPGJIR+kJsyRtwcu2q1Q==", + "dev": true, + "dependencies": { + "bn.js": "^4.11.9", + "eth-lib": "0.2.8", + "ethereum-bloom-filters": "^1.0.6", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/@trufflesuite/chromafi": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/@trufflesuite/chromafi/-/chromafi-2.2.2.tgz", @@ -3621,18 +3979,6 @@ "super-split": "^1.1.0" } }, - "node_modules/@trufflesuite/chromafi/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/@trufflesuite/chromafi/node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -3647,21 +3993,6 @@ "node": ">=4" } }, - "node_modules/@trufflesuite/chromafi/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@trufflesuite/chromafi/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, "node_modules/@trufflesuite/chromafi/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -3707,6 +4038,31 @@ "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", "dev": true }, + "node_modules/@typechain/ethers-v5": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/@typechain/ethers-v5/-/ethers-v5-8.0.5.tgz", + "integrity": "sha512-ntpj4cS3v4WlDu+hSKSyj9A3o1tKtWC30RX1gobeYymZColeJiUemC1Kgfa0MWGmInm5CKxoHVhEvYVgPOZn1A==", + "dependencies": { + "lodash": "^4.17.15", + "ts-essentials": "^7.0.1" + }, + "peerDependencies": { + "@ethersproject/abi": "^5.0.0", + "@ethersproject/bytes": "^5.0.0", + "@ethersproject/providers": "^5.0.0", + "ethers": "^5.1.3", + "typechain": "^6.0.4", + "typescript": ">=4.0.0" + } + }, + "node_modules/@typechain/ethers-v5/node_modules/ts-essentials": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-7.0.3.tgz", + "integrity": "sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ==", + "peerDependencies": { + "typescript": ">=3.7.0" + } + }, "node_modules/@typechain/hardhat": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@typechain/hardhat/-/hardhat-3.0.0.tgz", @@ -3782,6 +4138,16 @@ "integrity": "sha512-tFfcE+DSTzWAgifkjik9AySNqIyNoYwmR+uecPwwD/XRNfvOjmC/FjCxpiUGDkDVDphPfCUecSQVFw+lN3M3kQ==", "dev": true }, + "node_modules/@types/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", + "dev": true, + "dependencies": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, "node_modules/@types/level-errors": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/level-errors/-/level-errors-3.0.0.tgz", @@ -3802,6 +4168,12 @@ "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.0.tgz", "integrity": "sha512-RaE0B+14ToE4l6UqdarKPnXwVDuigfFv+5j9Dze/Nqr23yyuqdNvzcZi3xB+3Agvi5R4EOgAksfv3lXX4vBt9w==" }, + "node_modules/@types/minimatch": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", + "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==", + "dev": true + }, "node_modules/@types/mkdirp": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-0.5.2.tgz", @@ -3818,9 +4190,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.11.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.10.tgz", - "integrity": "sha512-3aRnHa1KlOEEhJ6+CvyHKK5vE9BcLGjtUpwvqYLRvYNQKMfabu3BwfJaA/SLW8dxe28LsNDjtHwePTuzn3gmOA==" + "version": "16.11.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.11.tgz", + "integrity": "sha512-KB0sixD67CeecHC33MYn+eYARkqTheIRNuu97y2XMjR7Wu3XibO1vaY6VBV6O/a89SPI81cEUIYT87UqUWlZNw==" }, "node_modules/@types/node-fetch": { "version": "2.5.12", @@ -3942,9 +4314,9 @@ } }, "node_modules/@uniswap/v3-periphery": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@uniswap/v3-periphery/-/v3-periphery-1.2.1.tgz", - "integrity": "sha512-45W8hT8X1j9ZcXa+y3NSVao90hMZtgtoJyDlMOg91wmUGi2idXAiGivOQYdB7+7Lq8Gc6Upv/ggFZknixZrv7g==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@uniswap/v3-periphery/-/v3-periphery-1.3.0.tgz", + "integrity": "sha512-HjHdI5RkjBl8zz3bqHShrbULFoZSrjbbrRHoO2vbzn+WRzTa6xY4PWphZv2Tlcb38YEKfKHp6NPl5hVedac8uw==", "dependencies": { "@openzeppelin/contracts": "3.4.1-solc-0.7-2", "@uniswap/lib": "^4.0.1-alpha", @@ -4252,6 +4624,15 @@ "node": ">=0.4.0" } }, + "node_modules/address": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/address/-/address-1.1.2.tgz", + "integrity": "sha512-aT6camzM4xEA54YVJYSqxz1kv4IHnQZRtThJJHhUMRExaU5spC7jX5ugSwTaTgJliIgs4VhZOk7htClvQ/LmRA==", + "dev": true, + "engines": { + "node": ">= 0.12.0" + } + }, "node_modules/adm-zip": { "version": "0.4.16", "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz", @@ -4263,8 +4644,7 @@ "node_modules/aes-js": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", - "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=", - "dev": true + "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" }, "node_modules/agent-base": { "version": "6.0.2", @@ -4386,18 +4766,6 @@ "super-split": "^1.1.0" } }, - "node_modules/ansi-mark/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/ansi-mark/node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -4412,21 +4780,6 @@ "node": ">=4" } }, - "node_modules/ansi-mark/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/ansi-mark/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, "node_modules/ansi-mark/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -4457,17 +4810,14 @@ } }, "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dependencies": { - "color-convert": "^2.0.1" + "color-convert": "^1.9.0" }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">=4" } }, "node_modules/antlr4ts": { @@ -4559,6 +4909,15 @@ "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", "dev": true }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/array-uniq": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", @@ -4816,8 +5175,7 @@ "node_modules/bech32": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==", - "dev": true + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" }, "node_modules/big-integer": { "version": "1.6.36", @@ -5042,22 +5400,6 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" }, - "node_modules/browserify-sha3": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.4.tgz", - "integrity": "sha1-CGxHuMgjFsnUcCLCYYWVRXbdjiY=", - "dev": true, - "dependencies": { - "js-sha3": "^0.6.1", - "safe-buffer": "^5.1.1" - } - }, - "node_modules/browserify-sha3/node_modules/js-sha3": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.6.1.tgz", - "integrity": "sha1-W4n3enR3Z5h39YxKB1JAk0sflcA=", - "dev": true - }, "node_modules/browserify-sign": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", @@ -5374,15 +5716,11 @@ } }, "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.0.tgz", + "integrity": "sha512-/duVOqst+luxCQRKEo4bNxinsOQtMP80ZYm7mMqzuh5PociNL0PvmHFvREJ9ueYL2TxlHjBcmLCdmocx9Vg+IQ==", "engines": { - "node": ">=10" + "node": "^12.17.0 || ^14.13 || >=16.0.0" }, "funding": { "url": "https://github.com/chalk/chalk?sponsor=1" @@ -5738,20 +6076,17 @@ } }, "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" + "color-name": "1.1.3" } }, "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, "node_modules/colors": { "version": "1.4.0", @@ -5792,6 +6127,14 @@ "command-line-args": "bin/cli.js" } }, + "node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "engines": { + "node": ">= 12" + } + }, "node_modules/commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -6116,12 +6459,6 @@ "node": "*" } }, - "node_modules/crypto-js": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.3.0.tgz", - "integrity": "sha512-DIT51nX0dCfKltpRiXV+/TVZq+Qq2NgF4644+K7Ttnla7zEzqc+kjJyiB96BHNyUTBxyjzRcZYpUdZa+QAqi6Q==", - "dev": true - }, "node_modules/css-loader": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-2.1.1.tgz", @@ -6297,9 +6634,9 @@ } }, "node_modules/deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, "node_modules/defer-to-connect": { @@ -6421,6 +6758,38 @@ "node": ">=0.10" } }, + "node_modules/detect-port": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/detect-port/-/detect-port-1.3.0.tgz", + "integrity": "sha512-E+B1gzkl2gqxt1IhUzwjrxBKRqx1UzC3WLONHinn8S3T6lwV/agVCyitiFOsGJ/eYuEUBvD71MZHy3Pv1G9doQ==", + "dev": true, + "dependencies": { + "address": "^1.0.1", + "debug": "^2.6.0" + }, + "bin": { + "detect": "bin/detect-port", + "detect-port": "bin/detect-port" + }, + "engines": { + "node": ">= 4.2.1" + } + }, + "node_modules/detect-port/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/detect-port/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, "node_modules/diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -6439,6 +6808,27 @@ "randombytes": "^2.0.0" } }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dir-glob/node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/dom-converter": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz", @@ -7163,18 +7553,6 @@ "testrpc": "build/cli.node.js" } }, - "node_modules/ethereumjs-testrpc-sc": { - "version": "6.1.6", - "resolved": "https://registry.npmjs.org/ethereumjs-testrpc-sc/-/ethereumjs-testrpc-sc-6.1.6.tgz", - "integrity": "sha512-iv2qiGBFgk9mn5Nq2enX8dG5WQ7Lk+FCqpnxfPfH4Ns8KLPwttmNOy264nh3SXDJJvcQwz/XnlLteDQVILotbg==", - "dev": true, - "dependencies": { - "source-map-support": "^0.5.3" - }, - "bin": { - "testrpc-sc": "build/cli.node.js" - } - }, "node_modules/ethereumjs-testrpc/node_modules/acorn": { "version": "5.7.4", "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", @@ -7598,10 +7976,9 @@ } }, "node_modules/ethers": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.5.1.tgz", - "integrity": "sha512-RodEvUFZI+EmFcE6bwkuJqpCYHazdzeR1nMzg+YWQSmQEsNtfl1KHGfp/FWZYl48bI/g7cgBeP2IlPthjiVngw==", - "dev": true, + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.5.2.tgz", + "integrity": "sha512-EF5W+6Wwcu6BqVwpgmyR5U2+L4c1FQzlM/02dkZOugN3KF0cG9bzHZP+TDJglmPm2/IzCEJDT7KBxzayk7SAHw==", "funding": [ { "type": "individual", @@ -7612,7 +7989,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "license": "MIT", "dependencies": { "@ethersproject/abi": "5.5.0", "@ethersproject/abstract-provider": "5.5.1", @@ -7629,10 +8005,10 @@ "@ethersproject/json-wallets": "5.5.0", "@ethersproject/keccak256": "5.5.0", "@ethersproject/logger": "5.5.0", - "@ethersproject/networks": "5.5.0", + "@ethersproject/networks": "5.5.1", "@ethersproject/pbkdf2": "5.5.0", "@ethersproject/properties": "5.5.0", - "@ethersproject/providers": "5.5.0", + "@ethersproject/providers": "5.5.1", "@ethersproject/random": "5.5.0", "@ethersproject/rlp": "5.5.0", "@ethersproject/sha2": "5.5.0", @@ -7642,7 +8018,7 @@ "@ethersproject/transactions": "5.5.0", "@ethersproject/units": "5.5.0", "@ethersproject/wallet": "5.5.0", - "@ethersproject/web": "5.5.0", + "@ethersproject/web": "5.5.1", "@ethersproject/wordlists": "5.5.0" } }, @@ -7650,7 +8026,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.5.0.tgz", "integrity": "sha512-loW7I4AohP5KycATvc0MgujU6JyCHPqHdeoo9z3Nr9xEiNioxa65ccdm1+fsoJhkuhdRtfcL8cfyGamz2AxZ5w==", - "dev": true, "funding": [ { "type": "individual", @@ -8165,6 +8540,35 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "node_modules/fast-glob": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", + "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fast-glob/node_modules/micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "dev": true, + "dependencies": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -8176,6 +8580,15 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, + "node_modules/fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, "node_modules/figgy-pudding": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", @@ -20207,6 +20620,54 @@ "assert-plus": "^1.0.0" } }, + "node_modules/ghost-testrpc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/ghost-testrpc/-/ghost-testrpc-0.0.2.tgz", + "integrity": "sha512-i08dAEgJ2g8z5buJIrCTduwPIhih3DP+hOCTyyryikfV8T0bNvHnGXO67i0DD1H4GBDETTclPy9njZbfluQYrQ==", + "dev": true, + "dependencies": { + "chalk": "^2.4.2", + "node-emoji": "^1.10.0" + }, + "bin": { + "testrpc-sc": "index.js" + } + }, + "node_modules/ghost-testrpc/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ghost-testrpc/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/ghost-testrpc/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/github-from-package": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", @@ -20255,6 +20716,51 @@ "process": "^0.11.10" } }, + "node_modules/global-modules": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", + "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==", + "dev": true, + "dependencies": { + "global-prefix": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/global-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", + "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", + "dev": true, + "dependencies": { + "ini": "^1.3.5", + "kind-of": "^6.0.2", + "which": "^1.3.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/globby": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.2.tgz", + "integrity": "sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg==", + "dev": true, + "dependencies": { + "@types/glob": "^7.1.1", + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.0.3", + "glob": "^7.1.3", + "ignore": "^5.1.1", + "merge2": "^1.2.3", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -20347,10 +20853,9 @@ } }, "node_modules/hardhat": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.6.7.tgz", - "integrity": "sha512-Mua01f6ZN1feQLktHSH2p5A5LCdA+Wf7+O2lJDH6wClvWPtI2eqKNNY2gxBwYXoQ28GZrT3K6mqQOZeRWAca6Q==", - "license": "SEE LICENSE IN LICENSE", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.7.0.tgz", + "integrity": "sha512-DqweY3KH5gwExoZ8EtsAfioj0Hk0NBXWXT3fMXWkiQNfyYBoZLrqdPNkbJ/E2LD4mZ+BKF7v/1chYR9ZCn2Z+g==", "dependencies": { "@ethereumjs/block": "^3.4.0", "@ethereumjs/blockchain": "^5.4.0", @@ -20397,7 +20902,7 @@ "stacktrace-parser": "^0.1.10", "true-case-path": "^2.2.1", "tsort": "0.0.1", - "uuid": "^3.3.2", + "uuid": "^8.3.2", "ws": "^7.4.6" }, "bin": { @@ -20408,11 +20913,10 @@ } }, "node_modules/hardhat-deploy": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/hardhat-deploy/-/hardhat-deploy-0.9.4.tgz", - "integrity": "sha512-0Zr8R5SAq6oK/gi170yCDqPTvKNPHdlm6wQe3ZQg/uiIDZxofpRM2frQVPUFlgdI2yUXtVcGBiPcC2r2fEockw==", + "version": "0.9.14", + "resolved": "https://registry.npmjs.org/hardhat-deploy/-/hardhat-deploy-0.9.14.tgz", + "integrity": "sha512-mCwXeXdqtrQN8dL1gOnoGUh0z9Jylfsh56UNVZJC0c8AhjlwjLPgGE3pzNmMuyy88pj9OX4qo53X57bW2W7NJQ==", "dev": true, - "license": "MIT", "dependencies": { "@ethersproject/abi": "^5.4.0", "@ethersproject/abstract-signer": "^5.4.1", @@ -20453,6 +20957,55 @@ "hardhat": "^2.0.0" } }, + "node_modules/hardhat-deploy/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/hardhat-deploy/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/hardhat-deploy/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/hardhat-deploy/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "node_modules/hardhat-deploy/node_modules/debug": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", @@ -20498,6 +21051,15 @@ "node": ">=12" } }, + "node_modules/hardhat-deploy/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/hardhat-deploy/node_modules/jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -20510,6 +21072,18 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/hardhat-deploy/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/hardhat-deploy/node_modules/universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", @@ -20520,9 +21094,9 @@ } }, "node_modules/hardhat-docgen": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/hardhat-docgen/-/hardhat-docgen-1.1.2.tgz", - "integrity": "sha512-gN1UyqA4kYDm/rSMRUACT6rsh7Nw5EsKItxxJxctfNFEin1Pb56C3uUftCuffT282829ofDxbrUcREcvL9+d+A==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/hardhat-docgen/-/hardhat-docgen-1.2.0.tgz", + "integrity": "sha512-HfNxJN+AgmqflAzlSrG3NajrmoVwJRVjRUwvKAwDu8oSToQqj0n8/6P2oUH4y5/r1l4FgDhx2DClAhw4+oDqIA==", "dependencies": { "css-loader": "^2.1.0", "html-webpack-plugin": "^3.2.0", @@ -20533,7 +21107,7 @@ "webpack": "^4.29.5" }, "engines": { - "node": ">=12.10.0" + "node": ">=14.14.0" }, "peerDependencies": { "hardhat": "^2.0.0" @@ -20558,17 +21132,6 @@ "@types/node": "*" } }, - "node_modules/hardhat/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/hardhat/node_modules/bn.js": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", @@ -20587,19 +21150,6 @@ "node": ">=4" } }, - "node_modules/hardhat/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/hardhat/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, "node_modules/hardhat/node_modules/commander": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", @@ -20695,6 +21245,14 @@ "node": ">=4" } }, + "node_modules/hardhat/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -20715,11 +21273,12 @@ } }, "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, "node_modules/has-symbol-support-x": { @@ -21173,6 +21732,15 @@ "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=" }, + "node_modules/ignore": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", + "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/immediate": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz", @@ -21223,9 +21791,7 @@ "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/internal-slot": { "version": "1.0.3", @@ -21748,94 +22314,6 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, - "node_modules/istanbul": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", - "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", - "deprecated": "This module is no longer maintained, try this instead:\n npm i nyc\nVisit https://istanbul.js.org/integrations for other alternatives.", - "dev": true, - "dependencies": { - "abbrev": "1.0.x", - "async": "1.x", - "escodegen": "1.8.x", - "esprima": "2.7.x", - "glob": "^5.0.15", - "handlebars": "^4.0.1", - "js-yaml": "3.x", - "mkdirp": "0.5.x", - "nopt": "3.x", - "once": "1.x", - "resolve": "1.1.x", - "supports-color": "^3.1.0", - "which": "^1.1.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "istanbul": "lib/cli.js" - } - }, - "node_modules/istanbul/node_modules/async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true - }, - "node_modules/istanbul/node_modules/esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/istanbul/node_modules/glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "dev": true, - "dependencies": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/istanbul/node_modules/has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/istanbul/node_modules/resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - }, - "node_modules/istanbul/node_modules/supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", - "dev": true, - "dependencies": { - "has-flag": "^1.0.0" - }, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/isurl": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", @@ -21934,6 +22412,15 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonschema": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.0.tgz", + "integrity": "sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -21962,16 +22449,6 @@ "node": ">=10.0.0" } }, - "node_modules/keccakjs": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.3.tgz", - "integrity": "sha512-BjLkNDcfaZ6l8HBG9tH0tpmDv3sS2mA7FNQxFHpCdzP3Gb2MVruXBSuoM66SnVxKJpAr5dKGdkHD+bDokt8fTg==", - "dev": true, - "dependencies": { - "browserify-sha3": "^0.0.4", - "sha3": "^1.2.2" - } - }, "node_modules/keyv": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", @@ -22279,17 +22756,6 @@ "node": ">=8" } }, - "node_modules/log-symbols/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/log-symbols/node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -22303,19 +22769,6 @@ "node": ">=4" } }, - "node_modules/log-symbols/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/log-symbols/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, "node_modules/log-symbols/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -22538,6 +22991,15 @@ "source-map": "^0.6.1" } }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/merkle-patricia-tree": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-4.2.0.tgz", @@ -23205,7 +23667,7 @@ "version": "2.13.2", "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==", - "devOptional": true + "optional": true }, "node_modules/nano-base32": { "version": "1.0.1", @@ -23309,6 +23771,15 @@ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" }, + "node_modules/node-emoji": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz", + "integrity": "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==", + "dev": true, + "dependencies": { + "lodash": "^4.17.21" + } + }, "node_modules/node-environment-flags": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", @@ -24018,18 +24489,6 @@ "npm": ">5" } }, - "node_modules/patch-package/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/patch-package/node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -24044,21 +24503,6 @@ "node": ">=4" } }, - "node_modules/patch-package/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/patch-package/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, "node_modules/patch-package/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -24192,18 +24636,6 @@ "node": ">=0.12" } }, - "node_modules/pegjs": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.10.0.tgz", - "integrity": "sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0=", - "dev": true, - "bin": { - "pegjs": "bin/pegjs" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -24405,17 +24837,6 @@ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==" }, - "node_modules/postcss/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/postcss/node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -24440,19 +24861,6 @@ "node": ">=4" } }, - "node_modules/postcss/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/postcss/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, "node_modules/postcss/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -24751,6 +25159,26 @@ "node": ">=0.4.x" } }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -24902,6 +25330,18 @@ "node": ">= 0.10" } }, + "node_modules/recursive-readdir": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz", + "integrity": "sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg==", + "dev": true, + "dependencies": { + "minimatch": "3.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/regenerator-runtime": { "version": "0.13.7", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", @@ -24981,30 +25421,6 @@ "node": ">=0.10" } }, - "node_modules/req-cwd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/req-cwd/-/req-cwd-1.0.1.tgz", - "integrity": "sha1-DXOurpJm5penj3l2AZZ352rPD/8=", - "dev": true, - "dependencies": { - "req-from": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/req-from": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/req-from/-/req-from-1.0.1.tgz", - "integrity": "sha1-v4HaUUeUfTLRO5R9wSpYrUWHNQ4=", - "dev": true, - "dependencies": { - "resolve-from": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -25078,15 +25494,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/resolve-from": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", - "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", @@ -25110,6 +25517,16 @@ "node": ">=0.12" } }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/right-align": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", @@ -25162,6 +25579,29 @@ "rlp": "bin/rlp" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/run-queue": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", @@ -25220,6 +25660,72 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "node_modules/sc-istanbul": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/sc-istanbul/-/sc-istanbul-0.4.6.tgz", + "integrity": "sha512-qJFF/8tW/zJsbyfh/iT/ZM5QNHE3CXxtLJbZsL+CzdJLBsPD7SedJZoUA4d8iAcN2IoMp/Dx80shOOd2x96X/g==", + "dev": true, + "dependencies": { + "abbrev": "1.0.x", + "async": "1.x", + "escodegen": "1.8.x", + "esprima": "2.7.x", + "glob": "^5.0.15", + "handlebars": "^4.0.1", + "js-yaml": "3.x", + "mkdirp": "0.5.x", + "nopt": "3.x", + "once": "1.x", + "resolve": "1.1.x", + "supports-color": "^3.1.0", + "which": "^1.1.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "istanbul": "lib/cli.js" + } + }, + "node_modules/sc-istanbul/node_modules/async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "node_modules/sc-istanbul/node_modules/esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sc-istanbul/node_modules/glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "dependencies": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/sc-istanbul/node_modules/resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + }, "node_modules/schema-utils": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", @@ -25422,16 +25928,6 @@ "sha.js": "bin.js" } }, - "node_modules/sha3": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.6.tgz", - "integrity": "sha512-KgLGmJGrmNB4JWVsAV11Yk6KbvsAiygWJc7t5IebWva/0NukNrjJqhtKhzy3Eiv2AKuGvhZZt7dt1mDo7HkoiQ==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "nan": "2.13.2" - } - }, "node_modules/shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -25454,9 +25950,9 @@ } }, "node_modules/shelljs": { - "version": "0.7.8", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", - "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", + "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", "dev": true, "dependencies": { "glob": "^7.0.0", @@ -25467,8 +25963,7 @@ "shjs": "bin/shjs" }, "engines": { - "iojs": "*", - "node": ">=0.11.0" + "node": ">=4" } }, "node_modules/side-channel": { @@ -25728,19 +26223,13 @@ "node": ">=0.10.0" } }, - "node_modules/sol-explore": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/sol-explore/-/sol-explore-1.6.2.tgz", - "integrity": "sha1-Q66MQZ/TrAVqBfip0fsQIs1B7MI=", - "dev": true - }, "node_modules/solc": { - "version": "0.7.6", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.7.6.tgz", - "integrity": "sha512-WsR/W7CXwh2VnmZapB4JrsDeLlshoKBz5Pz/zYNulB6LBsOEHI2Zj/GeKLMFcvv57OHiXHvxq5ZOQB+EdqxlxQ==", + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.10.tgz", + "integrity": "sha512-I/Mcn6J5bEtJqveNLplQm9IRrhemm6v+qkw5S2+wM4x9HItJ1sYdrqVTN3j4DMhFDM3ZbvM0QywVzpPx666PHw==", "dependencies": { "command-exists": "^1.2.8", - "commander": "3.0.2", + "commander": "^8.1.0", "follow-redirects": "^1.12.1", "fs-extra": "^0.30.0", "js-sha3": "0.8.0", @@ -25756,11 +26245,6 @@ "node": ">=8.0.0" } }, - "node_modules/solc/node_modules/commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" - }, "node_modules/solc/node_modules/fs-extra": { "version": "0.30.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", @@ -25795,341 +26279,135 @@ } }, "node_modules/solidity-coverage": { - "version": "0.5.11", - "resolved": "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.5.11.tgz", - "integrity": "sha512-qikdsSi6+9XbfvwA0aI7HUVpF9fIFNqRWTw23M89GMDY+b6Gj0wWU9IngJS0fimoZIAdEp3bfChxvpfVcrUesg==", + "version": "0.7.17", + "resolved": "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.7.17.tgz", + "integrity": "sha512-Erw2hd2xdACAvDX8jUdYkmgJlIIazGznwDJA5dhRaw4def2SisXN9jUjneeyOZnl/E7j6D3XJYug4Zg9iwodsg==", "dev": true, "dependencies": { + "@solidity-parser/parser": "^0.13.2", + "@truffle/provider": "^0.2.24", + "chalk": "^2.4.2", "death": "^1.1.0", - "ethereumjs-testrpc-sc": "6.1.6", - "istanbul": "^0.4.5", - "keccakjs": "^0.2.1", - "req-cwd": "^1.0.1", - "shelljs": "^0.7.4", - "sol-explore": "^1.6.2", - "solidity-parser-sc": "0.4.11", - "tree-kill": "^1.2.0", - "web3": "^0.18.4" + "detect-port": "^1.3.0", + "fs-extra": "^8.1.0", + "ganache-cli": "^6.12.2", + "ghost-testrpc": "^0.0.2", + "global-modules": "^2.0.0", + "globby": "^10.0.1", + "jsonschema": "^1.2.4", + "lodash": "^4.17.15", + "node-emoji": "^1.10.0", + "pify": "^4.0.1", + "recursive-readdir": "^2.2.2", + "sc-istanbul": "^0.4.5", + "semver": "^7.3.4", + "shelljs": "^0.8.3", + "web3-utils": "^1.3.0" }, "bin": { - "solidity-coverage": "bin/exec.js" + "solidity-coverage": "plugins/bin.js" } }, - "node_modules/solidity-coverage/node_modules/bignumber.js": { - "version": "2.0.7", - "resolved": "git+ssh://git@github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2", - "integrity": "sha512-k55rLoPK7DNCwjO/+Esh5n3lNF+lKwzfIIak1alqxXhrXsInC69JJKwEjAyCB8+IehSFkObzxzzu9URR+Q4pyA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/solidity-coverage/node_modules/utf8": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz", - "integrity": "sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY=", - "dev": true - }, - "node_modules/solidity-coverage/node_modules/web3": { - "version": "0.18.4", - "resolved": "https://registry.npmjs.org/web3/-/web3-0.18.4.tgz", - "integrity": "sha1-gewXhBRUkfLqqJVbMcBgSeB8Xn0=", + "node_modules/solidity-coverage/node_modules/@solidity-parser/parser": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.13.2.tgz", + "integrity": "sha512-RwHnpRnfrnD2MSPveYoPh8nhofEvX7fgjHk1Oq+NNvCcLx4r1js91CO9o+F/F3fBzOCyvm8kKRTriFICX/odWw==", "dev": true, "dependencies": { - "bignumber.js": "git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2", - "crypto-js": "^3.1.4", - "utf8": "^2.1.1", - "xhr2": "*", - "xmlhttprequest": "*" + "antlr4ts": "^0.5.0-alpha.4" } }, - "node_modules/solidity-parser-sc": { - "version": "0.4.11", - "resolved": "https://registry.npmjs.org/solidity-parser-sc/-/solidity-parser-sc-0.4.11.tgz", - "integrity": "sha512-1kV5iC7m3CtMDfmHaVNwz2saSGQVIuF16rIxU417Al38MVCWHMQQ5vT6cmLsNwDe60S74auobWij9vNawSeOyw==", + "node_modules/solidity-coverage/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "dependencies": { - "mocha": "^4.1.0", - "pegjs": "^0.10.0", - "yargs": "^4.6.0" - }, - "bin": { - "solidity-parser": "cli.js" - } - }, - "node_modules/solidity-parser-sc/node_modules/ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/solidity-parser-sc/node_modules/browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", - "dev": true - }, - "node_modules/solidity-parser-sc/node_modules/camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/solidity-parser-sc/node_modules/cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "dev": true, - "dependencies": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - } - }, - "node_modules/solidity-parser-sc/node_modules/commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", - "dev": true - }, - "node_modules/solidity-parser-sc/node_modules/debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/solidity-parser-sc/node_modules/diff": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", - "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/solidity-parser-sc/node_modules/get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", - "dev": true - }, - "node_modules/solidity-parser-sc/node_modules/glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/solidity-parser-sc/node_modules/growl": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", - "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", - "dev": true, - "engines": { - "node": ">=4.x" - } - }, - "node_modules/solidity-parser-sc/node_modules/has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/solidity-parser-sc/node_modules/he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true, - "bin": { - "he": "bin/he" - } - }, - "node_modules/solidity-parser-sc/node_modules/is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "dependencies": { - "number-is-nan": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/solidity-parser-sc/node_modules/minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "node_modules/solidity-parser-sc/node_modules/mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", - "dev": true, - "dependencies": { - "minimist": "0.0.8" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/solidity-parser-sc/node_modules/mocha": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.1.0.tgz", - "integrity": "sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA==", - "dev": true, - "dependencies": { - "browser-stdout": "1.3.0", - "commander": "2.11.0", - "debug": "3.1.0", - "diff": "3.3.1", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", - "growl": "1.10.3", - "he": "1.1.1", - "mkdirp": "0.5.1", - "supports-color": "4.4.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/solidity-parser-sc/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "node_modules/solidity-parser-sc/node_modules/require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "node_modules/solidity-parser-sc/node_modules/string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "dependencies": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/solidity-parser-sc/node_modules/strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/solidity-parser-sc/node_modules/supports-color": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", - "dev": true, - "dependencies": { - "has-flag": "^2.0.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" }, "engines": { "node": ">=4" } }, - "node_modules/solidity-parser-sc/node_modules/which-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", - "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", - "dev": true - }, - "node_modules/solidity-parser-sc/node_modules/wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "node_modules/solidity-coverage/node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", "dev": true, "dependencies": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=6 <7 || >=8" } }, - "node_modules/solidity-parser-sc/node_modules/y18n": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", - "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==", + "node_modules/solidity-coverage/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/solidity-coverage/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/solidity-coverage/node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/solidity-coverage/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/solidity-coverage/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/solidity-coverage/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, - "node_modules/solidity-parser-sc/node_modules/yargs": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", - "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", - "dev": true, - "dependencies": { - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "lodash.assign": "^4.0.3", - "os-locale": "^1.4.0", - "read-pkg-up": "^1.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^1.0.1", - "which-module": "^1.0.0", - "window-size": "^0.2.0", - "y18n": "^3.2.1", - "yargs-parser": "^2.4.1" - } - }, - "node_modules/solidity-parser-sc/node_modules/yargs-parser": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", - "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", - "dev": true, - "dependencies": { - "camelcase": "^3.0.0", - "lodash.assign": "^4.0.6" - } - }, "node_modules/source-list-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", @@ -26532,14 +26810,15 @@ "dev": true }, "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, "dependencies": { - "has-flag": "^4.0.0" + "has-flag": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">=0.8.0" } }, "node_modules/swap-case": { @@ -26948,15 +27227,6 @@ "node": ">=6" } }, - "node_modules/tree-kill": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", - "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", - "dev": true, - "bin": { - "tree-kill": "cli.js" - } - }, "node_modules/true-case-path": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-2.2.1.tgz", @@ -26988,18 +27258,6 @@ "ts-generator": "dist/cli/run.js" } }, - "node_modules/ts-generator/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/ts-generator/node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -27014,21 +27272,6 @@ "node": ">=4" } }, - "node_modules/ts-generator/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/ts-generator/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, "node_modules/ts-generator/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -27216,7 +27459,6 @@ "version": "6.0.5", "resolved": "https://registry.npmjs.org/typechain/-/typechain-6.0.5.tgz", "integrity": "sha512-Kr2rATu2Y7Y0wOC/I0zKuyLU8EEUpnuPGkiloZ65ACm4sSLFVF8Tnxn8LEUJSN93dX3RMu2DLF5fwRBOjNB+Gw==", - "peer": true, "dependencies": { "@types/prettier": "^2.1.1", "command-line-args": "^4.0.7", @@ -27239,14 +27481,12 @@ "node_modules/typechain/node_modules/js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", - "peer": true + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" }, "node_modules/typechain/node_modules/mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "peer": true, "bin": { "mkdirp": "bin/cmd.js" }, @@ -27258,7 +27498,6 @@ "version": "2.5.0", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.0.tgz", "integrity": "sha512-FM/zAKgWTxj40rH03VxzIPdXmj39SwSjwG0heUcNFwI+EMZJnY93yAiKXM3dObIKAM5TA88werc8T/EwhB45eg==", - "peer": true, "bin": { "prettier": "bin-prettier.js" }, @@ -27270,7 +27509,6 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-7.0.3.tgz", "integrity": "sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ==", - "peer": true, "peerDependencies": { "typescript": ">=3.7.0" } @@ -27638,6 +27876,7 @@ "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true, "bin": { "uuid": "bin/uuid" } @@ -27973,29 +28212,28 @@ } }, "node_modules/web3": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3/-/web3-1.6.0.tgz", - "integrity": "sha512-rWpXnO88MiVX5yTRqMBCVKASxc7QDkXZZUl1D48sKlbX4dt3BAV+nVMVUKCBKiluZ5Bp8pDrVCUdPx/jIYai5Q==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3/-/web3-1.6.1.tgz", + "integrity": "sha512-c299lLiyb2/WOcxh7TinwvbATaMmrgNIeAzbLbmOKHI0LcwyfsB1eu2ReOIrfrCYDYRW2KAjYr7J7gHawqDNPQ==", "dev": true, "hasInstallScript": true, - "license": "LGPL-3.0", "dependencies": { - "web3-bzz": "1.6.0", - "web3-core": "1.6.0", - "web3-eth": "1.6.0", - "web3-eth-personal": "1.6.0", - "web3-net": "1.6.0", - "web3-shh": "1.6.0", - "web3-utils": "1.6.0" + "web3-bzz": "1.6.1", + "web3-core": "1.6.1", + "web3-eth": "1.6.1", + "web3-eth-personal": "1.6.1", + "web3-net": "1.6.1", + "web3-shh": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-bzz": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.6.0.tgz", - "integrity": "sha512-ugYV6BsinwhIi0CsLWINBz4mqN9wR9vNG0WmyEbdECjxcPyr6vkaWt4qi0zqlUxEnYAwGj4EJXNrbjPILntQTQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.6.1.tgz", + "integrity": "sha512-JbnFNbRlwwHJZPtVuCxo7rC4U4OTg+mPsyhjgPQJJhS0a6Y54OgVWYk9UA/95HqbmTJwTtX329gJoSsseEfrng==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -28008,24 +28246,24 @@ } }, "node_modules/web3-bzz/node_modules/@types/node": { - "version": "12.20.36", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.36.tgz", - "integrity": "sha512-+5haRZ9uzI7rYqzDznXgkuacqb6LJhAti8mzZKWxIXn/WEtvB+GHVJ7AuMwcN1HMvXOSJcrvA6PPoYHYOYYebA==", + "version": "12.20.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", + "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", "dev": true }, "node_modules/web3-core": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.6.0.tgz", - "integrity": "sha512-o0WsLrJ2yD+HAAc29lGMWJef/MutTyuzpJC0UzLJtIAQJqtpDalzWINEu4j8XYXGk34N/V6vudtzRPo23QEE6g==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.6.1.tgz", + "integrity": "sha512-m+b7UfYvU5cQUAh6NRfxRzH/5B3to1AdEQi1HIQt570cDWlObOOmoO9tY6iJnI5w4acxIO19LqjDMqEJGBYyRQ==", "dev": true, "dependencies": { "@types/bn.js": "^4.11.5", "@types/node": "^12.12.6", "bignumber.js": "^9.0.0", - "web3-core-helpers": "1.6.0", - "web3-core-method": "1.6.0", - "web3-core-requestmanager": "1.6.0", - "web3-utils": "1.6.0" + "web3-core-helpers": "1.6.1", + "web3-core-method": "1.6.1", + "web3-core-requestmanager": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" @@ -28074,39 +28312,38 @@ } }, "node_modules/web3-core-method": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.6.0.tgz", - "integrity": "sha512-cHekyEil4mtcCOk6Q1Zh4y+2o5pTwsLIxP6Bpt4BRtZgdsyPiadYJpkLAVT/quch5xN7Qs5ZwG5AvRCS3VwD2g==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.6.1.tgz", + "integrity": "sha512-szH5KyIWIaULQDBdDvevQUCHV9lsExJ/oV0ePqK+w015D2SdMPMuhii0WB+HCePaksWO+rr/GAypvV9g2T3N+w==", "dev": true, "dependencies": { - "@ethereumjs/common": "^2.4.0", "@ethersproject/transactions": "^5.0.0-beta.135", - "web3-core-helpers": "1.6.0", - "web3-core-promievent": "1.6.0", - "web3-core-subscriptions": "1.6.0", - "web3-utils": "1.6.0" + "web3-core-helpers": "1.6.1", + "web3-core-promievent": "1.6.1", + "web3-core-subscriptions": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-core-method/node_modules/web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "dependencies": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-core-method/node_modules/web3-core-promievent": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.6.0.tgz", - "integrity": "sha512-ZzsevjMXWkhqW9dnVfTfb1OUcK7jKcKPvPIbQ4boJccNgvNZPZKlo8xB4pkAX38n4c59O5mC7Lt/z2QL/M5CeQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.6.1.tgz", + "integrity": "sha512-byJ5s2MQxrWdXd27pWFmujfzsTZK4ik8rDgIV1RFDFc+rHZ2nZhq+VWk7t/Nkrj7EaVXncEgTdPEHc18nx+ocQ==", "dev": true, "dependencies": { "eventemitter3": "4.0.4" @@ -28116,13 +28353,13 @@ } }, "node_modules/web3-core-method/node_modules/web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" @@ -28141,90 +28378,90 @@ } }, "node_modules/web3-core-requestmanager": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.6.0.tgz", - "integrity": "sha512-CY5paPdiDXKTXPWaEUZekDfUXSuoE2vPxolwqzsvKwFWH5+H1NaXgrc+D5HpufgSvTXawTw0fy7IAicg8+PWqA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.6.1.tgz", + "integrity": "sha512-4y7etYEUtkfflyYVBfN1oJtCbVFNhNX1omlEYzezhTnPj3/dT7n+dhUXcqvIhx9iKA13unGfpFge80XNFfcB8A==", "dev": true, "dependencies": { "util": "^0.12.0", - "web3-core-helpers": "1.6.0", - "web3-providers-http": "1.6.0", - "web3-providers-ipc": "1.6.0", - "web3-providers-ws": "1.6.0" + "web3-core-helpers": "1.6.1", + "web3-providers-http": "1.6.1", + "web3-providers-ipc": "1.6.1", + "web3-providers-ws": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-core-requestmanager/node_modules/web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "dependencies": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-core-requestmanager/node_modules/web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-core-subscriptions": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.6.0.tgz", - "integrity": "sha512-kY9WZUY/m1URSOv3uTLshoZD9ZDiFKReIzHuPUkxFpD5oYNmr1/aPQNPCrrMxKODR7UVX/D90FxWwCYqHhLaxQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.6.1.tgz", + "integrity": "sha512-WZwxsYttIojyGQ5RqxuQcKg0IJdDCFpUe4EncS3QKZwxPqWzGmgyLwE0rm7tP+Ux1waJn5CUaaoSCBxWGSun1g==", "dev": true, "dependencies": { "eventemitter3": "4.0.4", - "web3-core-helpers": "1.6.0" + "web3-core-helpers": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-core-subscriptions/node_modules/web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "dependencies": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-core-subscriptions/node_modules/web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-core/node_modules/@types/node": { - "version": "12.20.36", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.36.tgz", - "integrity": "sha512-+5haRZ9uzI7rYqzDznXgkuacqb6LJhAti8mzZKWxIXn/WEtvB+GHVJ7AuMwcN1HMvXOSJcrvA6PPoYHYOYYebA==", + "version": "12.20.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", + "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", "dev": true }, "node_modules/web3-core/node_modules/bignumber.js": { @@ -28237,49 +28474,49 @@ } }, "node_modules/web3-core/node_modules/web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "dependencies": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-core/node_modules/web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-eth": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.6.0.tgz", - "integrity": "sha512-qJMvai//r0be6I9ghU24/152f0zgJfYC23TMszN3Y6jse1JtjCBP2TlTibFcvkUN1RRdIUY5giqO7ZqAYAmp7w==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.6.1.tgz", + "integrity": "sha512-kOV1ZgCKypSo5BQyltRArS7ZC3bRpIKAxSgzl7pUFinUb/MxfbM9KGeNxUXoCfTSErcCQJaDjcS6bSre5EMKuQ==", "dev": true, "dependencies": { - "web3-core": "1.6.0", - "web3-core-helpers": "1.6.0", - "web3-core-method": "1.6.0", - "web3-core-subscriptions": "1.6.0", - "web3-eth-abi": "1.6.0", - "web3-eth-accounts": "1.6.0", - "web3-eth-contract": "1.6.0", - "web3-eth-ens": "1.6.0", - "web3-eth-iban": "1.6.0", - "web3-eth-personal": "1.6.0", - "web3-net": "1.6.0", - "web3-utils": "1.6.0" + "web3-core": "1.6.1", + "web3-core-helpers": "1.6.1", + "web3-core-method": "1.6.1", + "web3-core-subscriptions": "1.6.1", + "web3-eth-abi": "1.6.1", + "web3-eth-accounts": "1.6.1", + "web3-eth-contract": "1.6.1", + "web3-eth-ens": "1.6.1", + "web3-eth-iban": "1.6.1", + "web3-eth-personal": "1.6.1", + "web3-net": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" @@ -28345,22 +28582,22 @@ } }, "node_modules/web3-eth-accounts": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.6.0.tgz", - "integrity": "sha512-2f6HS4KIH4laAsNCOfbNX3dRiQosqSY2TRK86C8jtAA/QKGdx+5qlPfYzbI2RjG81iayb2+mVbHIaEaBGZ8sGw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.6.1.tgz", + "integrity": "sha512-rGn3jwnuOKwaQRu4SiShz0YAQ87aVDBKs4HO43+XTCI1q1Y1jn3NOsG3BW9ZHaOckev4+zEyxze/Bsh2oEk24w==", "dev": true, "dependencies": { - "@ethereumjs/common": "^2.3.0", - "@ethereumjs/tx": "^3.2.1", + "@ethereumjs/common": "^2.5.0", + "@ethereumjs/tx": "^3.3.2", "crypto-browserify": "3.12.0", "eth-lib": "0.2.8", "ethereumjs-util": "^7.0.10", "scrypt-js": "^3.0.1", "uuid": "3.3.2", - "web3-core": "1.6.0", - "web3-core-helpers": "1.6.0", - "web3-core-method": "1.6.0", - "web3-utils": "1.6.0" + "web3-core": "1.6.1", + "web3-core-helpers": "1.6.1", + "web3-core-method": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" @@ -28419,45 +28656,45 @@ } }, "node_modules/web3-eth-accounts/node_modules/web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "dependencies": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-eth-accounts/node_modules/web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-eth-contract": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.6.0.tgz", - "integrity": "sha512-ZUtO77zFnxuFtrc+D+iJ3AzNgFXAVcKnhEYN7f1PNz/mFjbtE6dJ+ujO0mvMbxIZF02t9IZv0CIXRpK0rDvZAw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.6.1.tgz", + "integrity": "sha512-GXqTe3mF6kpbOAakiNc7wtJ120/gpuKMTZjuGFKeeY8aobRLfbfgKzM9IpyqVZV2v5RLuGXDuurVN2KPgtu3hQ==", "dev": true, "dependencies": { "@types/bn.js": "^4.11.5", - "web3-core": "1.6.0", - "web3-core-helpers": "1.6.0", - "web3-core-method": "1.6.0", - "web3-core-promievent": "1.6.0", - "web3-core-subscriptions": "1.6.0", - "web3-eth-abi": "1.6.0", - "web3-utils": "1.6.0" + "web3-core": "1.6.1", + "web3-core-helpers": "1.6.1", + "web3-core-method": "1.6.1", + "web3-core-promievent": "1.6.1", + "web3-core-subscriptions": "1.6.1", + "web3-eth-abi": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" @@ -28481,22 +28718,22 @@ } }, "node_modules/web3-eth-contract/node_modules/web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "dependencies": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-eth-contract/node_modules/web3-core-promievent": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.6.0.tgz", - "integrity": "sha512-ZzsevjMXWkhqW9dnVfTfb1OUcK7jKcKPvPIbQ4boJccNgvNZPZKlo8xB4pkAX38n4c59O5mC7Lt/z2QL/M5CeQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.6.1.tgz", + "integrity": "sha512-byJ5s2MQxrWdXd27pWFmujfzsTZK4ik8rDgIV1RFDFc+rHZ2nZhq+VWk7t/Nkrj7EaVXncEgTdPEHc18nx+ocQ==", "dev": true, "dependencies": { "eventemitter3": "4.0.4" @@ -28506,45 +28743,45 @@ } }, "node_modules/web3-eth-contract/node_modules/web3-eth-abi": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.0.tgz", - "integrity": "sha512-fImomGE9McuTMJLwK8Tp0lTUzXqCkWeMm00qPVIwpJ/h7lCw9UFYV9+4m29wSqW6FF+FIZKwc6UBEf9dlx3orA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.1.tgz", + "integrity": "sha512-svhYrAlXP9XQtV7poWKydwDJq2CaNLMtmKydNXoOBLcQec6yGMP+v20pgrxF2H6wyTK+Qy0E3/5ciPOqC/VuoQ==", "dev": true, "dependencies": { "@ethersproject/abi": "5.0.7", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-eth-contract/node_modules/web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-eth-ens": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.6.0.tgz", - "integrity": "sha512-AG24PNv9qbYHSpjHcU2pViOII0jvIR7TeojJ2bxXSDqfcgHuRp3NZGKv6xFvT4uNI4LEQHUhSC7bzHoNF5t8CA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.6.1.tgz", + "integrity": "sha512-ngprtbnoRgxg8s1wXt9nXpD3h1P+p7XnKXrp/8GdFI9uDmrbSQPRfzBw86jdZgOmy78hAnWmrHI6pBInmgi2qQ==", "dev": true, "dependencies": { "content-hash": "^2.5.2", "eth-ens-namehash": "2.0.8", - "web3-core": "1.6.0", - "web3-core-helpers": "1.6.0", - "web3-core-promievent": "1.6.0", - "web3-eth-abi": "1.6.0", - "web3-eth-contract": "1.6.0", - "web3-utils": "1.6.0" + "web3-core": "1.6.1", + "web3-core-helpers": "1.6.1", + "web3-core-promievent": "1.6.1", + "web3-eth-abi": "1.6.1", + "web3-eth-contract": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" @@ -28568,22 +28805,22 @@ } }, "node_modules/web3-eth-ens/node_modules/web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "dependencies": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-eth-ens/node_modules/web3-core-promievent": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.6.0.tgz", - "integrity": "sha512-ZzsevjMXWkhqW9dnVfTfb1OUcK7jKcKPvPIbQ4boJccNgvNZPZKlo8xB4pkAX38n4c59O5mC7Lt/z2QL/M5CeQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.6.1.tgz", + "integrity": "sha512-byJ5s2MQxrWdXd27pWFmujfzsTZK4ik8rDgIV1RFDFc+rHZ2nZhq+VWk7t/Nkrj7EaVXncEgTdPEHc18nx+ocQ==", "dev": true, "dependencies": { "eventemitter3": "4.0.4" @@ -28593,26 +28830,26 @@ } }, "node_modules/web3-eth-ens/node_modules/web3-eth-abi": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.0.tgz", - "integrity": "sha512-fImomGE9McuTMJLwK8Tp0lTUzXqCkWeMm00qPVIwpJ/h7lCw9UFYV9+4m29wSqW6FF+FIZKwc6UBEf9dlx3orA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.1.tgz", + "integrity": "sha512-svhYrAlXP9XQtV7poWKydwDJq2CaNLMtmKydNXoOBLcQec6yGMP+v20pgrxF2H6wyTK+Qy0E3/5ciPOqC/VuoQ==", "dev": true, "dependencies": { "@ethersproject/abi": "5.0.7", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-eth-ens/node_modules/web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" @@ -28661,49 +28898,49 @@ } }, "node_modules/web3-eth-personal": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.6.0.tgz", - "integrity": "sha512-8ohf4qAwbShf4RwES2tLHVqa+pHZnS5Q6tV80sU//bivmlZeyO1W4UWyNn59vu9KPpEYvLseOOC6Muxuvr8mFQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.6.1.tgz", + "integrity": "sha512-ItsC89Ln02+irzJjK6ALcLrMZfbVUCqVbmb/ieDKJ+eLW3pNkBNwoUzaydh92d5NzxNZgNxuQWVdlFyYX2hkEw==", "dev": true, "dependencies": { "@types/node": "^12.12.6", - "web3-core": "1.6.0", - "web3-core-helpers": "1.6.0", - "web3-core-method": "1.6.0", - "web3-net": "1.6.0", - "web3-utils": "1.6.0" + "web3-core": "1.6.1", + "web3-core-helpers": "1.6.1", + "web3-core-method": "1.6.1", + "web3-net": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-eth-personal/node_modules/@types/node": { - "version": "12.20.36", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.36.tgz", - "integrity": "sha512-+5haRZ9uzI7rYqzDznXgkuacqb6LJhAti8mzZKWxIXn/WEtvB+GHVJ7AuMwcN1HMvXOSJcrvA6PPoYHYOYYebA==", + "version": "12.20.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", + "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", "dev": true }, "node_modules/web3-eth-personal/node_modules/web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "dependencies": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-eth-personal/node_modules/web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" @@ -28727,65 +28964,65 @@ } }, "node_modules/web3-eth/node_modules/web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "dependencies": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-eth/node_modules/web3-eth-abi": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.0.tgz", - "integrity": "sha512-fImomGE9McuTMJLwK8Tp0lTUzXqCkWeMm00qPVIwpJ/h7lCw9UFYV9+4m29wSqW6FF+FIZKwc6UBEf9dlx3orA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.1.tgz", + "integrity": "sha512-svhYrAlXP9XQtV7poWKydwDJq2CaNLMtmKydNXoOBLcQec6yGMP+v20pgrxF2H6wyTK+Qy0E3/5ciPOqC/VuoQ==", "dev": true, "dependencies": { "@ethersproject/abi": "5.0.7", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-eth/node_modules/web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-net": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.6.0.tgz", - "integrity": "sha512-LFfG95ovTT2sNHkO1TEfsaKpYcxOSUtbuwHQ0K3G0e5nevKDJkPEFIqIcob40yiwcWoqEjENJP9Bjk8CRrZ99Q==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.6.1.tgz", + "integrity": "sha512-gpnqKEIwfUHh5ik7wsQFlCje1DfcmGv+Sk7LCh1hCqn++HEDQxJ/mZCrMo11ZZpZHCH7c87imdxTg96GJnRxDw==", "dev": true, "dependencies": { - "web3-core": "1.6.0", - "web3-core-method": "1.6.0", - "web3-utils": "1.6.0" + "web3-core": "1.6.1", + "web3-core-method": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-providers-http": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.6.0.tgz", - "integrity": "sha512-sNxHFNv3lnxpmULt34AS6M36IYB/Hzm2Et4yPNzdP1XE644D8sQBZQZaJQdTaza5HfrlwoqU6AOK935armqGuA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.6.1.tgz", + "integrity": "sha512-xBoKOJxu10+kO3ikamXmBfrWZ/xpQOGy0ocdp7Y81B17En5TXELwlmMXt1UlIgWiyYDhjq4OwlH/VODYqHXy3A==", "dev": true, "dependencies": { - "web3-core-helpers": "1.6.0", + "web3-core-helpers": "1.6.1", "xhr2-cookies": "1.1.0" }, "engines": { @@ -28793,78 +29030,78 @@ } }, "node_modules/web3-providers-http/node_modules/web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "dependencies": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-providers-http/node_modules/web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-providers-ipc": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.6.0.tgz", - "integrity": "sha512-ETYdfhpGiGoWpmmSJnONvnPfd3TPivHEGjXyuX+L5FUsbMOVZj9MFLNIS19Cx/YGL8UWJ/8alLJoTcWSIdz/aA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.6.1.tgz", + "integrity": "sha512-anyoIZlpMzwEQI4lwylTzDrHsVp20v0QUtSTp2B5jInBinmQtyCE7vnbX20jEQ4j5uPwfJabKNtoJsk6a3O4WQ==", "dev": true, "dependencies": { "oboe": "2.1.5", - "web3-core-helpers": "1.6.0" + "web3-core-helpers": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-providers-ipc/node_modules/web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "dependencies": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-providers-ipc/node_modules/web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-providers-ws": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.6.0.tgz", - "integrity": "sha512-eNRmlhOPCpuVYwBrKBBQRLGPFb4U1Uo44r9EWV69Cpo4gP6XeBTl6nkawhLz6DS0fq79apyPfItJVuSfAy77pA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.6.1.tgz", + "integrity": "sha512-FWMEFYb4rYFYRgSFBf/O1Ex4p/YKSlN+JydCtdlJwRimd89qm95CTfs4xGjCskwvXMjV2sarH+f1NPwJXicYpg==", "dev": true, "dependencies": { "eventemitter3": "4.0.4", - "web3-core-helpers": "1.6.0", + "web3-core-helpers": "1.6.1", "websocket": "^1.0.32" }, "engines": { @@ -28872,51 +29109,51 @@ } }, "node_modules/web3-providers-ws/node_modules/web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "dependencies": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-providers-ws/node_modules/web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-shh": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.6.0.tgz", - "integrity": "sha512-ymN0OFL81WtEeSyb+PFpuUv39fR3frGwsZnIg5EVPZvrOIdaDSFcGSLDmafUt0vKSubvLMVYIBOCskRD6YdtEQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.6.1.tgz", + "integrity": "sha512-oP00HbAtybLCGlLOZUYXOdeB9xq88k2l0TtStvKBtmFqRt+zVk5TxEeuOnVPRxNhcA2Un8RUw6FtvgZlWStu9A==", "dev": true, "hasInstallScript": true, "dependencies": { - "web3-core": "1.6.0", - "web3-core-method": "1.6.0", - "web3-core-subscriptions": "1.6.0", - "web3-net": "1.6.0" + "web3-core": "1.6.1", + "web3-core-method": "1.6.1", + "web3-core-subscriptions": "1.6.1", + "web3-net": "1.6.1" }, "engines": { "node": ">=8.0.0" } }, "node_modules/web3-utils": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.6.0.tgz", - "integrity": "sha512-bgCAWAeQnJF035YTFxrcHJ5mGEfTi/McsjqldZiXRwlHK7L1PyOqvXiQLE053dlzvy1kdAxWl/sSSfLMyNUAXg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.6.1.tgz", + "integrity": "sha512-RidGKv5kOkcerI6jQqDFDoTllQQqV+rPhTzZHhmbqtFObbYpU93uc+yG1LHivRTQhA6llIx67iudc/vzisgO+w==", "dev": true, "dependencies": { "bn.js": "^4.11.9", @@ -29174,30 +29411,6 @@ "node": ">=6" } }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/wrap-ansi/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/wrap-ansi/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, "node_modules/wrap-ansi/node_modules/string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", @@ -29283,15 +29496,6 @@ "xhr-request": "^1.1.0" } }, - "node_modules/xhr2": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/xhr2/-/xhr2-0.2.1.tgz", - "integrity": "sha512-sID0rrVCqkVNUn8t6xuv9+6FViXjUVXq8H5rWOH2rz9fDNQEd4g0EA2XlcEdJXRz5BMEn4O1pJFdT+z4YHhoWw==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, "node_modules/xhr2-cookies": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", @@ -30183,12 +30387,12 @@ } }, "@ethereumjs/common": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.4.0.tgz", - "integrity": "sha512-UdkhFWzWcJCZVsj1O/H8/oqj/0RVYjLc1OhPjBrQdALAkQHpCp8xXI4WLnuGTADqTdJZww0NtgwG+TRPkXt27w==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.0.tgz", + "integrity": "sha512-Cq2qS0FTu6O2VU1sgg+WyU9Ps0M6j/BEMHN+hRaECXCV/r0aI78u4N6p52QW/BDVhwWZpCdrvG8X7NJdzlpNUA==", "requires": { "crc-32": "^1.2.0", - "ethereumjs-util": "^7.1.0" + "ethereumjs-util": "^7.1.3" }, "dependencies": { "@types/bn.js": { @@ -30205,15 +30409,14 @@ "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" }, "ethereumjs-util": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.0.tgz", - "integrity": "sha512-kR+vhu++mUDARrsMMhsjjzPduRVAeundLGXucGRHF3B4oEltOUspfgCVco4kckucj3FMlLaZHUl9n7/kdmr6Tw==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.3.tgz", + "integrity": "sha512-y+82tEbyASO0K0X1/SRhbJJoAlfcvq8JbrG4a5cjrOks7HS/36efU/0j2flxCPOUM++HFahk33kr/ZxyC4vNuw==", "requires": { "@types/bn.js": "^5.1.0", "bn.js": "^5.1.2", "create-hash": "^1.1.2", "ethereum-cryptography": "^0.1.3", - "ethjs-util": "0.1.6", "rlp": "^2.2.4" } } @@ -30267,12 +30470,12 @@ } }, "@ethereumjs/tx": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.3.0.tgz", - "integrity": "sha512-yTwEj2lVzSMgE6Hjw9Oa1DZks/nKTWM8Wn4ykDNapBPua2f4nXO3qKnni86O6lgDj5fVNRqbDsD0yy7/XNGDEA==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.4.0.tgz", + "integrity": "sha512-WWUwg1PdjHKZZxPPo274ZuPsJCWV3SqATrEKQP1n2DrVYVP1aZIYpo/mFaA0BDoE0tIQmBeimRCEA0Lgil+yYw==", "requires": { - "@ethereumjs/common": "^2.4.0", - "ethereumjs-util": "^7.1.0" + "@ethereumjs/common": "^2.6.0", + "ethereumjs-util": "^7.1.3" }, "dependencies": { "@types/bn.js": { @@ -30289,15 +30492,14 @@ "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" }, "ethereumjs-util": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.0.tgz", - "integrity": "sha512-kR+vhu++mUDARrsMMhsjjzPduRVAeundLGXucGRHF3B4oEltOUspfgCVco4kckucj3FMlLaZHUl9n7/kdmr6Tw==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.3.tgz", + "integrity": "sha512-y+82tEbyASO0K0X1/SRhbJJoAlfcvq8JbrG4a5cjrOks7HS/36efU/0j2flxCPOUM++HFahk33kr/ZxyC4vNuw==", "requires": { "@types/bn.js": "^5.1.0", "bn.js": "^5.1.2", "create-hash": "^1.1.2", "ethereum-cryptography": "^0.1.3", - "ethjs-util": "0.1.6", "rlp": "^2.2.4" } } @@ -30430,7 +30632,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.5.0.tgz", "integrity": "sha512-ZIodwhHpVJ0Y3hUCfUucmxKsWQA5TMnavp5j/UOuDdzZWzJlRmuOjcTMIGgHCYuZmHt36BfiSyQPSRskPxbfaQ==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.5.0", "@ethersproject/properties": "^5.5.0" @@ -30466,7 +30667,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.5.0.tgz", "integrity": "sha512-2viY7NzyvJkh+Ug17v7g3/IJC8HqZBDcOjYARZLdzRxrfGlRgmYgl6xPRKVbEzy1dWKw/iv7chDcS83pg6cLxg==", - "dev": true, "requires": { "@ethersproject/abi": "^5.5.0", "@ethersproject/abstract-provider": "^5.5.0", @@ -30484,7 +30684,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.5.0.tgz", "integrity": "sha512-loW7I4AohP5KycATvc0MgujU6JyCHPqHdeoo9z3Nr9xEiNioxa65ccdm1+fsoJhkuhdRtfcL8cfyGamz2AxZ5w==", - "dev": true, "requires": { "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -30532,7 +30731,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.5.0.tgz", "integrity": "sha512-mcSOo9zeUg1L0CoJH7zmxwUG5ggQHU1UrRf8jyTYy6HxdZV+r0PBoL1bxr+JHIPXRzS6u/UW4mEn43y0tmyF8Q==", - "dev": true, "requires": { "@ethersproject/abstract-signer": "^5.5.0", "@ethersproject/basex": "^5.5.0", @@ -30552,7 +30750,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.5.0.tgz", "integrity": "sha512-9lA21XQnCdcS72xlBn1jfQdj2A1VUxZzOzi9UkNdnokNKke/9Ya2xA9aIK1SC3PQyBDLt4C+dfps7ULpkvKikQ==", - "dev": true, "requires": { "@ethersproject/abstract-signer": "^5.5.0", "@ethersproject/address": "^5.5.0", @@ -30591,9 +30788,9 @@ "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" }, "@ethersproject/networks": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.0.tgz", - "integrity": "sha512-KWfP3xOnJeF89Uf/FCJdV1a2aDJe5XTN2N52p4fcQ34QhDqQFkgQKZ39VGtiqUgHcLI8DfT0l9azC3KFTunqtA==", + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.1.tgz", + "integrity": "sha512-tYRDM4zZtSUcKnD4UMuAlj7SeXH/k5WC4SP2u1Pn57++JdXHkRu2zwNkgNogZoxHzhm9Q6qqurDBVptHOsW49Q==", "requires": { "@ethersproject/logger": "^5.5.0" } @@ -30602,7 +30799,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.5.0.tgz", "integrity": "sha512-SaDvQFvXPnz1QGpzr6/HToLifftSXGoXrbpZ6BvoZhmx4bNLHrxDe8MZisuecyOziP1aVEwzC2Hasj+86TgWVg==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.5.0", "@ethersproject/sha2": "^5.5.0" @@ -30617,10 +30813,9 @@ } }, "@ethersproject/providers": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.5.0.tgz", - "integrity": "sha512-xqMbDnS/FPy+J/9mBLKddzyLLAQFjrVff5g00efqxPzcAwXiR+SiCGVy6eJ5iAIirBOATjx7QLhDNPGV+AEQsw==", - "dev": true, + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.5.1.tgz", + "integrity": "sha512-2zdD5sltACDWhjUE12Kucg2PcgM6V2q9JMyVvObtVGnzJu+QSmibbP+BHQyLWZUBfLApx2942+7DC5D+n4wBQQ==", "requires": { "@ethersproject/abstract-provider": "^5.5.0", "@ethersproject/abstract-signer": "^5.5.0", @@ -30647,7 +30842,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.5.0.tgz", "integrity": "sha512-egGYZwZ/YIFKMHcoBUo8t3a8Hb/TKYX8BCBoLjudVCZh892welR3jOxgOmb48xznc9bTcMm7Tpwc1gHC1PFNFQ==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.5.0", "@ethersproject/logger": "^5.5.0" @@ -30666,7 +30860,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.5.0.tgz", "integrity": "sha512-B5UBoglbCiHamRVPLA110J+2uqsifpZaTmid2/7W5rbtYVz6gus6/hSDieIU/6gaKIDcOj12WnOdiymEUHIAOA==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.5.0", "@ethersproject/logger": "^5.5.0", @@ -30690,7 +30883,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.5.0.tgz", "integrity": "sha512-9NgZs9LhGMj6aCtHXhtmFQ4AN4sth5HuFXVvAQtzmm0jpSCNOTGtrHZJAeYTh7MBjRR8brylWZxBZR9zDStXbw==", - "dev": true, "requires": { "@ethersproject/bignumber": "^5.5.0", "@ethersproject/bytes": "^5.5.0", @@ -30730,7 +30922,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.5.0.tgz", "integrity": "sha512-7+DpjiZk4v6wrikj+TCyWWa9dXLNU73tSTa7n0TSJDxkYbV3Yf1eRh9ToMLlZtuctNYu9RDNNy2USq3AdqSbag==", - "dev": true, "requires": { "@ethersproject/bignumber": "^5.5.0", "@ethersproject/constants": "^5.5.0", @@ -30741,7 +30932,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.5.0.tgz", "integrity": "sha512-Mlu13hIctSYaZmUOo7r2PhNSd8eaMPVXe1wxrz4w4FCE4tDYBywDH+bAR1Xz2ADyXGwqYMwstzTrtUVIsKDO0Q==", - "dev": true, "requires": { "@ethersproject/abstract-provider": "^5.5.0", "@ethersproject/abstract-signer": "^5.5.0", @@ -30761,9 +30951,9 @@ } }, "@ethersproject/web": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.0.tgz", - "integrity": "sha512-BEgY0eL5oH4mAo37TNYVrFeHsIXLRxggCRG/ksRIxI2X5uj5IsjGmcNiRN/VirQOlBxcUhCgHhaDLG4m6XAVoA==", + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz", + "integrity": "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==", "requires": { "@ethersproject/base64": "^5.5.0", "@ethersproject/bytes": "^5.5.0", @@ -30776,7 +30966,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.5.0.tgz", "integrity": "sha512-bL0UTReWDiaQJJYOC9sh/XcRu/9i2jMrzf8VLRmPKx58ckSlOJiohODkECCO50dtLZHcGU6MLXQ4OOrgBwP77Q==", - "dev": true, "requires": { "@ethersproject/bytes": "^5.5.0", "@ethersproject/hash": "^5.5.0", @@ -31024,17 +31213,43 @@ "dev": true, "peer": true }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, "@nomiclabs/hardhat-ethers": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.2.tgz", - "integrity": "sha512-6quxWe8wwS4X5v3Au8q1jOvXYEPkS1Fh+cME5u6AwNdnI4uERvPlVjlgRWzpnb+Rrt1l/cEqiNRH9GlsBMSDQg==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.3.tgz", + "integrity": "sha512-IJ0gBotVtO7YyLZyHNgbxzskUtFok+JkRlKPo8YELqj1ms9XL6Qm3vsfsGdZr22wnJeVEF5TQPotKuwQk21Dag==", "dev": true, "requires": {} }, "@nomiclabs/hardhat-etherscan": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-2.1.7.tgz", - "integrity": "sha512-9nt9EXubnkd2aTMnQIqKtp80bQFhun88krfB31FN2wB0T54b8YuK0riG2d+EKq/D3t1Kb00oA7oFSFpHLIbLDQ==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-2.1.8.tgz", + "integrity": "sha512-0+rj0SsZotVOcTLyDOxnOc3Gulo8upo0rsw/h+gBPcmtj91YqYJNhdARHoBxOhhE8z+5IUQPx+Dii04lXT14PA==", "dev": true, "requires": { "@ethersproject/abi": "^5.1.2", @@ -31396,9 +31611,9 @@ } }, "@tenderly/hardhat-tenderly": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/@tenderly/hardhat-tenderly/-/hardhat-tenderly-1.0.12.tgz", - "integrity": "sha512-zx2zVpbBxGWVp+aLgf59sZR5lxdqfq/PjqUhga6+iazukQNu/Y6pLfVnCcF1ggvLsf7gnMjwLe3YEx/GxCAykQ==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@tenderly/hardhat-tenderly/-/hardhat-tenderly-1.0.13.tgz", + "integrity": "sha512-XsrF2QIUh8YmzCcWHmPnSNQjZNBQkyrHER8bcrWsFIgL7ub49hmPbpGVB2Isb6gUV/IGBpBm7R69jpmoTvJ17g==", "dev": true, "requires": { "axios": "^0.21.1", @@ -31951,15 +32166,6 @@ "highlightjs-solidity": "^2.0.1" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, "bn.js": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", @@ -31977,21 +32183,6 @@ "supports-color": "^5.3.0" } }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -32396,6 +32587,310 @@ } } }, + "@truffle/provider": { + "version": "0.2.42", + "resolved": "https://registry.npmjs.org/@truffle/provider/-/provider-0.2.42.tgz", + "integrity": "sha512-ZNoglPho4alYIjJR+sLTgX0x6ho7m4OAUWuJ50RAWmoEqYc4AM6htdrI+lTSoRrOHHbmgasv22a7rFPMnmDrTg==", + "dev": true, + "requires": { + "@truffle/error": "^0.0.14", + "@truffle/interface-adapter": "^0.5.8", + "web3": "1.5.3" + }, + "dependencies": { + "@types/node": { + "version": "12.20.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", + "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", + "dev": true + }, + "bignumber.js": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", + "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==", + "dev": true + }, + "eth-lib": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", + "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", + "dev": true, + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethereumjs-util": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.3.tgz", + "integrity": "sha512-y+82tEbyASO0K0X1/SRhbJJoAlfcvq8JbrG4a5cjrOks7HS/36efU/0j2flxCPOUM++HFahk33kr/ZxyC4vNuw==", + "dev": true, + "requires": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "rlp": "^2.2.4" + }, + "dependencies": { + "@types/bn.js": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", + "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==", + "dev": true + } + } + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true + }, + "web3": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3/-/web3-1.5.3.tgz", + "integrity": "sha512-eyBg/1K44flfv0hPjXfKvNwcUfIVDI4NX48qHQe6wd7C8nPSdbWqo9vLy6ksZIt9NLa90HjI8HsGYgnMSUxn6w==", + "dev": true, + "requires": { + "web3-bzz": "1.5.3", + "web3-core": "1.5.3", + "web3-eth": "1.5.3", + "web3-eth-personal": "1.5.3", + "web3-net": "1.5.3", + "web3-shh": "1.5.3", + "web3-utils": "1.5.3" + } + }, + "web3-bzz": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.5.3.tgz", + "integrity": "sha512-SlIkAqG0eS6cBS9Q2eBOTI1XFzqh83RqGJWnyrNZMDxUwsTVHL+zNnaPShVPvrWQA1Ub5b0bx1Kc5+qJVxsTJg==", + "dev": true, + "requires": { + "@types/node": "^12.12.6", + "got": "9.6.0", + "swarm-js": "^0.1.40" + } + }, + "web3-core": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.5.3.tgz", + "integrity": "sha512-ACTbu8COCu+0eUNmd9pG7Q9EVsNkAg2w3Y7SqhDr+zjTgbSHZV01jXKlapm9z+G3AN/BziV3zGwudClJ4u4xXQ==", + "dev": true, + "requires": { + "@types/bn.js": "^4.11.5", + "@types/node": "^12.12.6", + "bignumber.js": "^9.0.0", + "web3-core-helpers": "1.5.3", + "web3-core-method": "1.5.3", + "web3-core-requestmanager": "1.5.3", + "web3-utils": "1.5.3" + } + }, + "web3-core-method": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.5.3.tgz", + "integrity": "sha512-8wJrwQ2qD9ibWieF9oHXwrJsUGrv3XAtEkNeyvyNMpktNTIjxJ2jaFGQUuLiyUrMubD18XXgLk4JS6PJU4Loeg==", + "dev": true, + "requires": { + "@ethereumjs/common": "^2.4.0", + "@ethersproject/transactions": "^5.0.0-beta.135", + "web3-core-helpers": "1.5.3", + "web3-core-promievent": "1.5.3", + "web3-core-subscriptions": "1.5.3", + "web3-utils": "1.5.3" + } + }, + "web3-core-requestmanager": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.5.3.tgz", + "integrity": "sha512-9k/Bze2rs8ONix5IZR+hYdMNQv+ark2Ek2kVcrFgWO+LdLgZui/rn8FikPunjE+ub7x7pJaKCgVRbYFXjo3ZWg==", + "dev": true, + "requires": { + "util": "^0.12.0", + "web3-core-helpers": "1.5.3", + "web3-providers-http": "1.5.3", + "web3-providers-ipc": "1.5.3", + "web3-providers-ws": "1.5.3" + } + }, + "web3-core-subscriptions": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.5.3.tgz", + "integrity": "sha512-L2m9vG1iRN6thvmv/HQwO2YLhOQlmZU8dpLG6GSo9FBN14Uch868Swk0dYVr3rFSYjZ/GETevSXU+O+vhCummA==", + "dev": true, + "requires": { + "eventemitter3": "4.0.4", + "web3-core-helpers": "1.5.3" + } + }, + "web3-eth": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.5.3.tgz", + "integrity": "sha512-saFurA1L23Bd7MEf7cBli6/jRdMhD4X/NaMiO2mdMMCXlPujoudlIJf+VWpRWJpsbDFdu7XJ2WHkmBYT5R3p1Q==", + "dev": true, + "requires": { + "web3-core": "1.5.3", + "web3-core-helpers": "1.5.3", + "web3-core-method": "1.5.3", + "web3-core-subscriptions": "1.5.3", + "web3-eth-abi": "1.5.3", + "web3-eth-accounts": "1.5.3", + "web3-eth-contract": "1.5.3", + "web3-eth-ens": "1.5.3", + "web3-eth-iban": "1.5.3", + "web3-eth-personal": "1.5.3", + "web3-net": "1.5.3", + "web3-utils": "1.5.3" + } + }, + "web3-eth-accounts": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.5.3.tgz", + "integrity": "sha512-pdGhXgeBaEJENMvRT6W9cmji3Zz/46ugFSvmnLLw79qi5EH7XJhKISNVb41eWCrs4am5GhI67GLx5d2s2a72iw==", + "dev": true, + "requires": { + "@ethereumjs/common": "^2.3.0", + "@ethereumjs/tx": "^3.2.1", + "crypto-browserify": "3.12.0", + "eth-lib": "0.2.8", + "ethereumjs-util": "^7.0.10", + "scrypt-js": "^3.0.1", + "uuid": "3.3.2", + "web3-core": "1.5.3", + "web3-core-helpers": "1.5.3", + "web3-core-method": "1.5.3", + "web3-utils": "1.5.3" + } + }, + "web3-eth-contract": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.5.3.tgz", + "integrity": "sha512-Gdlt1L6cdHe83k7SdV6xhqCytVtOZkjD0kY/15x441AuuJ4JLubCHuqu69k2Dr3tWifHYVys/vG8QE/W16syGg==", + "dev": true, + "requires": { + "@types/bn.js": "^4.11.5", + "web3-core": "1.5.3", + "web3-core-helpers": "1.5.3", + "web3-core-method": "1.5.3", + "web3-core-promievent": "1.5.3", + "web3-core-subscriptions": "1.5.3", + "web3-eth-abi": "1.5.3", + "web3-utils": "1.5.3" + } + }, + "web3-eth-ens": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.5.3.tgz", + "integrity": "sha512-QmGFFtTGElg0E+3xfCIFhiUF+1imFi9eg/cdsRMUZU4F1+MZCC/ee+IAelYLfNTGsEslCqfAusliKOT9DdGGnw==", + "dev": true, + "requires": { + "content-hash": "^2.5.2", + "eth-ens-namehash": "2.0.8", + "web3-core": "1.5.3", + "web3-core-helpers": "1.5.3", + "web3-core-promievent": "1.5.3", + "web3-eth-abi": "1.5.3", + "web3-eth-contract": "1.5.3", + "web3-utils": "1.5.3" + } + }, + "web3-eth-personal": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.5.3.tgz", + "integrity": "sha512-JzibJafR7ak/Icas8uvos3BmUNrZw1vShuNR5Cxjo+vteOC8XMqz1Vr7RH65B4bmlfb3bm9xLxetUHO894+Sew==", + "dev": true, + "requires": { + "@types/node": "^12.12.6", + "web3-core": "1.5.3", + "web3-core-helpers": "1.5.3", + "web3-core-method": "1.5.3", + "web3-net": "1.5.3", + "web3-utils": "1.5.3" + } + }, + "web3-net": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.5.3.tgz", + "integrity": "sha512-0W/xHIPvgVXPSdLu0iZYnpcrgNnhzHMC888uMlGP5+qMCt8VuflUZHy7tYXae9Mzsg1kxaJAS5lHVNyeNw4CoQ==", + "dev": true, + "requires": { + "web3-core": "1.5.3", + "web3-core-method": "1.5.3", + "web3-utils": "1.5.3" + } + }, + "web3-providers-http": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.5.3.tgz", + "integrity": "sha512-5DpUyWGHtDAr2RYmBu34Fu+4gJuBAuNx2POeiJIooUtJ+Mu6pIx4XkONWH6V+Ez87tZAVAsFOkJRTYuzMr3rPw==", + "dev": true, + "requires": { + "web3-core-helpers": "1.5.3", + "xhr2-cookies": "1.1.0" + } + }, + "web3-providers-ipc": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.5.3.tgz", + "integrity": "sha512-JmeAptugVpmXI39LGxUSAymx0NOFdgpuI1hGQfIhbEAcd4sv7fhfd5D+ZU4oLHbRI8IFr4qfGU0uhR8BXhDzlg==", + "dev": true, + "requires": { + "oboe": "2.1.5", + "web3-core-helpers": "1.5.3" + } + }, + "web3-providers-ws": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.5.3.tgz", + "integrity": "sha512-6DhTw4Q7nm5CFYEUHOJM0gAb3xFx+9gWpVveg3YxJ/ybR1BUvEWo3bLgIJJtX56cYX0WyY6DS35a7f0LOI1kVg==", + "dev": true, + "requires": { + "eventemitter3": "4.0.4", + "web3-core-helpers": "1.5.3", + "websocket": "^1.0.32" + } + }, + "web3-shh": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.5.3.tgz", + "integrity": "sha512-COfEXfsqoV/BkcsNLRxQqnWc1Teb8/9GxdGag5GtPC5gQC/vsN+7hYVJUwNxY9LtJPKYTij2DHHnx6UkITng+Q==", + "dev": true, + "requires": { + "web3-core": "1.5.3", + "web3-core-method": "1.5.3", + "web3-core-subscriptions": "1.5.3", + "web3-net": "1.5.3" + } + }, + "web3-utils": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.5.3.tgz", + "integrity": "sha512-56nRgA+Ad9SEyCv39g36rTcr5fpsd4L9LgV3FK0aB66nAMazLAA6Qz4lH5XrUKPDyBIPGJIR+kJsyRtwcu2q1Q==", + "dev": true, + "requires": { + "bn.js": "^4.11.9", + "eth-lib": "0.2.8", + "ethereum-bloom-filters": "^1.0.6", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + } + } + } + }, "@trufflesuite/chromafi": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/@trufflesuite/chromafi/-/chromafi-2.2.2.tgz", @@ -32418,15 +32913,6 @@ "super-split": "^1.1.0" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -32438,21 +32924,6 @@ "supports-color": "^5.3.0" } }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -32494,6 +32965,23 @@ "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", "dev": true }, + "@typechain/ethers-v5": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/@typechain/ethers-v5/-/ethers-v5-8.0.5.tgz", + "integrity": "sha512-ntpj4cS3v4WlDu+hSKSyj9A3o1tKtWC30RX1gobeYymZColeJiUemC1Kgfa0MWGmInm5CKxoHVhEvYVgPOZn1A==", + "requires": { + "lodash": "^4.17.15", + "ts-essentials": "^7.0.1" + }, + "dependencies": { + "ts-essentials": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-7.0.3.tgz", + "integrity": "sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ==", + "requires": {} + } + } + }, "@typechain/hardhat": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@typechain/hardhat/-/hardhat-3.0.0.tgz", @@ -32557,6 +33045,16 @@ "integrity": "sha512-tFfcE+DSTzWAgifkjik9AySNqIyNoYwmR+uecPwwD/XRNfvOjmC/FjCxpiUGDkDVDphPfCUecSQVFw+lN3M3kQ==", "dev": true }, + "@types/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", + "dev": true, + "requires": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, "@types/level-errors": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/level-errors/-/level-errors-3.0.0.tgz", @@ -32577,6 +33075,12 @@ "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.0.tgz", "integrity": "sha512-RaE0B+14ToE4l6UqdarKPnXwVDuigfFv+5j9Dze/Nqr23yyuqdNvzcZi3xB+3Agvi5R4EOgAksfv3lXX4vBt9w==" }, + "@types/minimatch": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", + "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==", + "dev": true + }, "@types/mkdirp": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-0.5.2.tgz", @@ -32593,9 +33097,9 @@ "dev": true }, "@types/node": { - "version": "16.11.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.10.tgz", - "integrity": "sha512-3aRnHa1KlOEEhJ6+CvyHKK5vE9BcLGjtUpwvqYLRvYNQKMfabu3BwfJaA/SLW8dxe28LsNDjtHwePTuzn3gmOA==" + "version": "16.11.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.11.tgz", + "integrity": "sha512-KB0sixD67CeecHC33MYn+eYARkqTheIRNuu97y2XMjR7Wu3XibO1vaY6VBV6O/a89SPI81cEUIYT87UqUWlZNw==" }, "@types/node-fetch": { "version": "2.5.12", @@ -32707,9 +33211,9 @@ "integrity": "sha512-kSC4djMGKMHj7sLMYVnn61k9nu+lHjMIxgg9CDQT+s2QYLoA56GbSK9Oxr+qJXzzygbkrmuY6cwgP6cW2JXPFA==" }, "@uniswap/v3-periphery": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@uniswap/v3-periphery/-/v3-periphery-1.2.1.tgz", - "integrity": "sha512-45W8hT8X1j9ZcXa+y3NSVao90hMZtgtoJyDlMOg91wmUGi2idXAiGivOQYdB7+7Lq8Gc6Upv/ggFZknixZrv7g==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@uniswap/v3-periphery/-/v3-periphery-1.3.0.tgz", + "integrity": "sha512-HjHdI5RkjBl8zz3bqHShrbULFoZSrjbbrRHoO2vbzn+WRzTa6xY4PWphZv2Tlcb38YEKfKHp6NPl5hVedac8uw==", "requires": { "@openzeppelin/contracts": "3.4.1-solc-0.7-2", "@uniswap/lib": "^4.0.1-alpha", @@ -32994,6 +33498,12 @@ "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true }, + "address": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/address/-/address-1.1.2.tgz", + "integrity": "sha512-aT6camzM4xEA54YVJYSqxz1kv4IHnQZRtThJJHhUMRExaU5spC7jX5ugSwTaTgJliIgs4VhZOk7htClvQ/LmRA==", + "dev": true + }, "adm-zip": { "version": "0.4.16", "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz", @@ -33002,8 +33512,7 @@ "aes-js": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", - "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=", - "dev": true + "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" }, "agent-base": { "version": "6.0.2", @@ -33098,15 +33607,6 @@ "super-split": "^1.1.0" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -33118,21 +33618,6 @@ "supports-color": "^5.3.0" } }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -33156,11 +33641,11 @@ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" }, "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "requires": { - "color-convert": "^2.0.1" + "color-convert": "^1.9.0" } }, "antlr4ts": { @@ -33237,6 +33722,12 @@ "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", "dev": true }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, "array-uniq": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", @@ -33447,8 +33938,7 @@ "bech32": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==", - "dev": true + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" }, "big-integer": { "version": "1.6.36", @@ -33650,24 +34140,6 @@ } } }, - "browserify-sha3": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.4.tgz", - "integrity": "sha1-CGxHuMgjFsnUcCLCYYWVRXbdjiY=", - "dev": true, - "requires": { - "js-sha3": "^0.6.1", - "safe-buffer": "^5.1.1" - }, - "dependencies": { - "js-sha3": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.6.1.tgz", - "integrity": "sha1-W4n3enR3Z5h39YxKB1JAk0sflcA=", - "dev": true - } - } - }, "browserify-sign": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", @@ -33930,13 +34402,9 @@ "requires": {} }, "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.0.tgz", + "integrity": "sha512-/duVOqst+luxCQRKEo4bNxinsOQtMP80ZYm7mMqzuh5PociNL0PvmHFvREJ9ueYL2TxlHjBcmLCdmocx9Vg+IQ==" }, "change-case": { "version": "3.0.2", @@ -34229,17 +34697,17 @@ } }, "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "requires": { - "color-name": "~1.1.4" + "color-name": "1.1.3" } }, "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, "colors": { "version": "1.4.0", @@ -34271,6 +34739,11 @@ "typical": "^2.6.1" } }, + "commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==" + }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -34546,12 +35019,6 @@ "randomfill": "^1.0.3" } }, - "crypto-js": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.3.0.tgz", - "integrity": "sha512-DIT51nX0dCfKltpRiXV+/TVZq+Qq2NgF4644+K7Ttnla7zEzqc+kjJyiB96BHNyUTBxyjzRcZYpUdZa+QAqi6Q==", - "dev": true - }, "css-loader": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-2.1.1.tgz", @@ -34679,9 +35146,9 @@ "peer": true }, "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, "defer-to-connect": { @@ -34778,6 +35245,33 @@ "optional": true, "peer": true }, + "detect-port": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/detect-port/-/detect-port-1.3.0.tgz", + "integrity": "sha512-E+B1gzkl2gqxt1IhUzwjrxBKRqx1UzC3WLONHinn8S3T6lwV/agVCyitiFOsGJ/eYuEUBvD71MZHy3Pv1G9doQ==", + "dev": true, + "requires": { + "address": "^1.0.1", + "debug": "^2.6.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -34793,6 +35287,23 @@ "randombytes": "^2.0.0" } }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + }, + "dependencies": { + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + } + } + }, "dom-converter": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz", @@ -35725,15 +36236,6 @@ } } }, - "ethereumjs-testrpc-sc": { - "version": "6.1.6", - "resolved": "https://registry.npmjs.org/ethereumjs-testrpc-sc/-/ethereumjs-testrpc-sc-6.1.6.tgz", - "integrity": "sha512-iv2qiGBFgk9mn5Nq2enX8dG5WQ7Lk+FCqpnxfPfH4Ns8KLPwttmNOy264nh3SXDJJvcQwz/XnlLteDQVILotbg==", - "dev": true, - "requires": { - "source-map-support": "^0.5.3" - } - }, "ethereumjs-util": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz", @@ -35749,10 +36251,9 @@ } }, "ethers": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.5.1.tgz", - "integrity": "sha512-RodEvUFZI+EmFcE6bwkuJqpCYHazdzeR1nMzg+YWQSmQEsNtfl1KHGfp/FWZYl48bI/g7cgBeP2IlPthjiVngw==", - "dev": true, + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.5.2.tgz", + "integrity": "sha512-EF5W+6Wwcu6BqVwpgmyR5U2+L4c1FQzlM/02dkZOugN3KF0cG9bzHZP+TDJglmPm2/IzCEJDT7KBxzayk7SAHw==", "requires": { "@ethersproject/abi": "5.5.0", "@ethersproject/abstract-provider": "5.5.1", @@ -35769,10 +36270,10 @@ "@ethersproject/json-wallets": "5.5.0", "@ethersproject/keccak256": "5.5.0", "@ethersproject/logger": "5.5.0", - "@ethersproject/networks": "5.5.0", + "@ethersproject/networks": "5.5.1", "@ethersproject/pbkdf2": "5.5.0", "@ethersproject/properties": "5.5.0", - "@ethersproject/providers": "5.5.0", + "@ethersproject/providers": "5.5.1", "@ethersproject/random": "5.5.0", "@ethersproject/rlp": "5.5.0", "@ethersproject/sha2": "5.5.0", @@ -35782,7 +36283,7 @@ "@ethersproject/transactions": "5.5.0", "@ethersproject/units": "5.5.0", "@ethersproject/wallet": "5.5.0", - "@ethersproject/web": "5.5.0", + "@ethersproject/web": "5.5.1", "@ethersproject/wordlists": "5.5.0" }, "dependencies": { @@ -35790,7 +36291,6 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.5.0.tgz", "integrity": "sha512-loW7I4AohP5KycATvc0MgujU6JyCHPqHdeoo9z3Nr9xEiNioxa65ccdm1+fsoJhkuhdRtfcL8cfyGamz2AxZ5w==", - "dev": true, "requires": { "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -36224,6 +36724,31 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "fast-glob": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", + "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "dependencies": { + "micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + } + } + } + }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -36235,6 +36760,15 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, + "fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, "figgy-pudding": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", @@ -45668,6 +46202,44 @@ "assert-plus": "^1.0.0" } }, + "ghost-testrpc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/ghost-testrpc/-/ghost-testrpc-0.0.2.tgz", + "integrity": "sha512-i08dAEgJ2g8z5buJIrCTduwPIhih3DP+hOCTyyryikfV8T0bNvHnGXO67i0DD1H4GBDETTclPy9njZbfluQYrQ==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "node-emoji": "^1.10.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "github-from-package": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", @@ -45707,6 +46279,42 @@ "process": "^0.11.10" } }, + "global-modules": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", + "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==", + "dev": true, + "requires": { + "global-prefix": "^3.0.0" + } + }, + "global-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", + "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", + "dev": true, + "requires": { + "ini": "^1.3.5", + "kind-of": "^6.0.2", + "which": "^1.3.1" + } + }, + "globby": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.2.tgz", + "integrity": "sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg==", + "dev": true, + "requires": { + "@types/glob": "^7.1.1", + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.0.3", + "glob": "^7.1.3", + "ignore": "^5.1.1", + "merge2": "^1.2.3", + "slash": "^3.0.0" + } + }, "got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -45777,9 +46385,9 @@ } }, "hardhat": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.6.7.tgz", - "integrity": "sha512-Mua01f6ZN1feQLktHSH2p5A5LCdA+Wf7+O2lJDH6wClvWPtI2eqKNNY2gxBwYXoQ28GZrT3K6mqQOZeRWAca6Q==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.7.0.tgz", + "integrity": "sha512-DqweY3KH5gwExoZ8EtsAfioj0Hk0NBXWXT3fMXWkiQNfyYBoZLrqdPNkbJ/E2LD4mZ+BKF7v/1chYR9ZCn2Z+g==", "requires": { "@ethereumjs/block": "^3.4.0", "@ethereumjs/blockchain": "^5.4.0", @@ -45826,7 +46434,7 @@ "stacktrace-parser": "^0.1.10", "true-case-path": "^2.2.1", "tsort": "0.0.1", - "uuid": "^3.3.2", + "uuid": "^8.3.2", "ws": "^7.4.6" }, "dependencies": { @@ -45838,14 +46446,6 @@ "@types/node": "*" } }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, "bn.js": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", @@ -45861,19 +46461,6 @@ "supports-color": "^5.3.0" } }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, "commander": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", @@ -45952,13 +46539,18 @@ "requires": { "has-flag": "^3.0.0" } + }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" } } }, "hardhat-deploy": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/hardhat-deploy/-/hardhat-deploy-0.9.4.tgz", - "integrity": "sha512-0Zr8R5SAq6oK/gi170yCDqPTvKNPHdlm6wQe3ZQg/uiIDZxofpRM2frQVPUFlgdI2yUXtVcGBiPcC2r2fEockw==", + "version": "0.9.14", + "resolved": "https://registry.npmjs.org/hardhat-deploy/-/hardhat-deploy-0.9.14.tgz", + "integrity": "sha512-mCwXeXdqtrQN8dL1gOnoGUh0z9Jylfsh56UNVZJC0c8AhjlwjLPgGE3pzNmMuyy88pj9OX4qo53X57bW2W7NJQ==", "dev": true, "requires": { "@ethersproject/abi": "^5.4.0", @@ -45985,6 +46577,40 @@ "qs": "^6.9.4" }, "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "debug": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", @@ -46016,6 +46642,12 @@ "universalify": "^2.0.0" } }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, "jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -46026,6 +46658,15 @@ "universalify": "^2.0.0" } }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, "universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", @@ -46042,9 +46683,9 @@ "requires": {} }, "hardhat-docgen": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/hardhat-docgen/-/hardhat-docgen-1.1.2.tgz", - "integrity": "sha512-gN1UyqA4kYDm/rSMRUACT6rsh7Nw5EsKItxxJxctfNFEin1Pb56C3uUftCuffT282829ofDxbrUcREcvL9+d+A==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/hardhat-docgen/-/hardhat-docgen-1.2.0.tgz", + "integrity": "sha512-HfNxJN+AgmqflAzlSrG3NajrmoVwJRVjRUwvKAwDu8oSToQqj0n8/6P2oUH4y5/r1l4FgDhx2DClAhw4+oDqIA==", "requires": { "css-loader": "^2.1.0", "html-webpack-plugin": "^3.2.0", @@ -46077,9 +46718,10 @@ "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==" }, "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true }, "has-symbol-support-x": { "version": "1.4.2", @@ -46426,6 +47068,12 @@ "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=" }, + "ignore": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", + "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "dev": true + }, "immediate": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz", @@ -46470,9 +47118,7 @@ "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "internal-slot": { "version": "1.0.3", @@ -46824,76 +47470,6 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, - "istanbul": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", - "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", - "dev": true, - "requires": { - "abbrev": "1.0.x", - "async": "1.x", - "escodegen": "1.8.x", - "esprima": "2.7.x", - "glob": "^5.0.15", - "handlebars": "^4.0.1", - "js-yaml": "3.x", - "mkdirp": "0.5.x", - "nopt": "3.x", - "once": "1.x", - "resolve": "1.1.x", - "supports-color": "^3.1.0", - "which": "^1.1.1", - "wordwrap": "^1.0.0" - }, - "dependencies": { - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true - }, - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "dev": true, - "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true - }, - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - }, - "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", - "dev": true, - "requires": { - "has-flag": "^1.0.0" - } - } - } - }, "isurl": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", @@ -46983,6 +47559,12 @@ "graceful-fs": "^4.1.6" } }, + "jsonschema": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.0.tgz", + "integrity": "sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw==", + "dev": true + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -47004,16 +47586,6 @@ "node-gyp-build": "^4.2.0" } }, - "keccakjs": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.3.tgz", - "integrity": "sha512-BjLkNDcfaZ6l8HBG9tH0tpmDv3sS2mA7FNQxFHpCdzP3Gb2MVruXBSuoM66SnVxKJpAr5dKGdkHD+bDokt8fTg==", - "dev": true, - "requires": { - "browserify-sha3": "^0.0.4", - "sha3": "^1.2.2" - } - }, "keyv": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", @@ -47265,14 +47837,6 @@ "chalk": "^2.4.2" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -47283,19 +47847,6 @@ "supports-color": "^5.3.0" } }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -47483,6 +48034,12 @@ "source-map": "^0.6.1" } }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, "merkle-patricia-tree": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-4.2.0.tgz", @@ -48034,7 +48591,7 @@ "version": "2.13.2", "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==", - "devOptional": true + "optional": true }, "nano-base32": { "version": "1.0.1", @@ -48131,6 +48688,15 @@ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" }, + "node-emoji": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz", + "integrity": "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==", + "dev": true, + "requires": { + "lodash": "^4.17.21" + } + }, "node-environment-flags": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", @@ -48708,15 +49274,6 @@ "tmp": "^0.0.33" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -48728,21 +49285,6 @@ "supports-color": "^5.3.0" } }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -48848,12 +49390,6 @@ "sha.js": "^2.4.8" } }, - "pegjs": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.10.0.tgz", - "integrity": "sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0=", - "dev": true - }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -48949,14 +49485,6 @@ "supports-color": "^6.1.0" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -48977,19 +49505,6 @@ } } }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -49276,6 +49791,12 @@ "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=" }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -49404,6 +49925,15 @@ "resolve": "^1.1.6" } }, + "recursive-readdir": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz", + "integrity": "sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg==", + "dev": true, + "requires": { + "minimatch": "3.0.4" + } + }, "regenerator-runtime": { "version": "0.13.7", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", @@ -49467,24 +49997,6 @@ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" }, - "req-cwd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/req-cwd/-/req-cwd-1.0.1.tgz", - "integrity": "sha1-DXOurpJm5penj3l2AZZ352rPD/8=", - "dev": true, - "requires": { - "req-from": "^1.0.1" - } - }, - "req-from": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/req-from/-/req-from-1.0.1.tgz", - "integrity": "sha1-v4HaUUeUfTLRO5R9wSpYrUWHNQ4=", - "dev": true, - "requires": { - "resolve-from": "^2.0.0" - } - }, "request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -49544,12 +50056,6 @@ "path-parse": "^1.0.6" } }, - "resolve-from": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", - "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=", - "dev": true - }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", @@ -49569,6 +50075,12 @@ "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, "right-align": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", @@ -49609,6 +50121,15 @@ "bn.js": "^4.11.1" } }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, "run-queue": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", @@ -49650,6 +50171,61 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "sc-istanbul": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/sc-istanbul/-/sc-istanbul-0.4.6.tgz", + "integrity": "sha512-qJFF/8tW/zJsbyfh/iT/ZM5QNHE3CXxtLJbZsL+CzdJLBsPD7SedJZoUA4d8iAcN2IoMp/Dx80shOOd2x96X/g==", + "dev": true, + "requires": { + "abbrev": "1.0.x", + "async": "1.x", + "escodegen": "1.8.x", + "esprima": "2.7.x", + "glob": "^5.0.15", + "handlebars": "^4.0.1", + "js-yaml": "3.x", + "mkdirp": "0.5.x", + "nopt": "3.x", + "once": "1.x", + "resolve": "1.1.x", + "supports-color": "^3.1.0", + "which": "^1.1.1", + "wordwrap": "^1.0.0" + }, + "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + }, + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + } + } + }, "schema-utils": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", @@ -49824,15 +50400,6 @@ "safe-buffer": "^5.0.1" } }, - "sha3": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.6.tgz", - "integrity": "sha512-KgLGmJGrmNB4JWVsAV11Yk6KbvsAiygWJc7t5IebWva/0NukNrjJqhtKhzy3Eiv2AKuGvhZZt7dt1mDo7HkoiQ==", - "dev": true, - "requires": { - "nan": "2.13.2" - } - }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -49849,9 +50416,9 @@ "dev": true }, "shelljs": { - "version": "0.7.8", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", - "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", + "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", "dev": true, "requires": { "glob": "^7.0.0", @@ -50061,19 +50628,13 @@ } } }, - "sol-explore": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/sol-explore/-/sol-explore-1.6.2.tgz", - "integrity": "sha1-Q66MQZ/TrAVqBfip0fsQIs1B7MI=", - "dev": true - }, "solc": { - "version": "0.7.6", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.7.6.tgz", - "integrity": "sha512-WsR/W7CXwh2VnmZapB4JrsDeLlshoKBz5Pz/zYNulB6LBsOEHI2Zj/GeKLMFcvv57OHiXHvxq5ZOQB+EdqxlxQ==", + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.10.tgz", + "integrity": "sha512-I/Mcn6J5bEtJqveNLplQm9IRrhemm6v+qkw5S2+wM4x9HItJ1sYdrqVTN3j4DMhFDM3ZbvM0QywVzpPx666PHw==", "requires": { "command-exists": "^1.2.8", - "commander": "3.0.2", + "commander": "^8.1.0", "follow-redirects": "^1.12.1", "fs-extra": "^0.30.0", "js-sha3": "0.8.0", @@ -50083,11 +50644,6 @@ "tmp": "0.0.33" }, "dependencies": { - "commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" - }, "fs-extra": { "version": "0.30.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", @@ -50121,285 +50677,107 @@ } }, "solidity-coverage": { - "version": "0.5.11", - "resolved": "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.5.11.tgz", - "integrity": "sha512-qikdsSi6+9XbfvwA0aI7HUVpF9fIFNqRWTw23M89GMDY+b6Gj0wWU9IngJS0fimoZIAdEp3bfChxvpfVcrUesg==", + "version": "0.7.17", + "resolved": "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.7.17.tgz", + "integrity": "sha512-Erw2hd2xdACAvDX8jUdYkmgJlIIazGznwDJA5dhRaw4def2SisXN9jUjneeyOZnl/E7j6D3XJYug4Zg9iwodsg==", "dev": true, "requires": { + "@solidity-parser/parser": "^0.13.2", + "@truffle/provider": "^0.2.24", + "chalk": "^2.4.2", "death": "^1.1.0", - "ethereumjs-testrpc-sc": "6.1.6", - "istanbul": "^0.4.5", - "keccakjs": "^0.2.1", - "req-cwd": "^1.0.1", - "shelljs": "^0.7.4", - "sol-explore": "^1.6.2", - "solidity-parser-sc": "0.4.11", - "tree-kill": "^1.2.0", - "web3": "^0.18.4" + "detect-port": "^1.3.0", + "fs-extra": "^8.1.0", + "ganache-cli": "^6.12.2", + "ghost-testrpc": "^0.0.2", + "global-modules": "^2.0.0", + "globby": "^10.0.1", + "jsonschema": "^1.2.4", + "lodash": "^4.17.15", + "node-emoji": "^1.10.0", + "pify": "^4.0.1", + "recursive-readdir": "^2.2.2", + "sc-istanbul": "^0.4.5", + "semver": "^7.3.4", + "shelljs": "^0.8.3", + "web3-utils": "^1.3.0" }, "dependencies": { - "bignumber.js": { - "version": "git+ssh://git@github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2", - "integrity": "sha512-k55rLoPK7DNCwjO/+Esh5n3lNF+lKwzfIIak1alqxXhrXsInC69JJKwEjAyCB8+IehSFkObzxzzu9URR+Q4pyA==", - "dev": true, - "from": "bignumber.js@git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2" - }, - "utf8": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz", - "integrity": "sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY=", - "dev": true - }, - "web3": { - "version": "0.18.4", - "resolved": "https://registry.npmjs.org/web3/-/web3-0.18.4.tgz", - "integrity": "sha1-gewXhBRUkfLqqJVbMcBgSeB8Xn0=", + "@solidity-parser/parser": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.13.2.tgz", + "integrity": "sha512-RwHnpRnfrnD2MSPveYoPh8nhofEvX7fgjHk1Oq+NNvCcLx4r1js91CO9o+F/F3fBzOCyvm8kKRTriFICX/odWw==", "dev": true, "requires": { - "bignumber.js": "git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2", - "crypto-js": "^3.1.4", - "utf8": "^2.1.1", - "xhr2": "*", - "xmlhttprequest": "*" + "antlr4ts": "^0.5.0-alpha.4" } - } - } - }, - "solidity-parser-sc": { - "version": "0.4.11", - "resolved": "https://registry.npmjs.org/solidity-parser-sc/-/solidity-parser-sc-0.4.11.tgz", - "integrity": "sha512-1kV5iC7m3CtMDfmHaVNwz2saSGQVIuF16rIxU417Al38MVCWHMQQ5vT6cmLsNwDe60S74auobWij9vNawSeOyw==", - "dev": true, - "requires": { - "mocha": "^4.1.0", - "pegjs": "^0.10.0", - "yargs": "^4.6.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true }, - "browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", - "dev": true - }, - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", - "dev": true - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" } }, - "commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", - "dev": true - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", "dev": true, "requires": { - "ms": "2.0.0" + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" } }, - "diff": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", - "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", - "dev": true - }, - "get-caller-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", - "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", - "dev": true - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "growl": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", - "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", - "dev": true - }, "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, "requires": { - "number-is-nan": "^1.0.0" + "yallist": "^4.0.0" } }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", "dev": true }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", "dev": true, "requires": { - "minimist": "0.0.8" - } - }, - "mocha": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.1.0.tgz", - "integrity": "sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA==", - "dev": true, - "requires": { - "browser-stdout": "1.3.0", - "commander": "2.11.0", - "debug": "3.1.0", - "diff": "3.3.1", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", - "growl": "1.10.3", - "he": "1.1.1", - "mkdirp": "0.5.1", - "supports-color": "4.4.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" + "lru-cache": "^6.0.0" } }, "supports-color": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "requires": { - "has-flag": "^2.0.0" + "has-flag": "^3.0.0" } }, - "which-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", - "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - } - }, - "y18n": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", - "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==", - "dev": true - }, - "yargs": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", - "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", - "dev": true, - "requires": { - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "lodash.assign": "^4.0.3", - "os-locale": "^1.4.0", - "read-pkg-up": "^1.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^1.0.1", - "which-module": "^1.0.0", - "window-size": "^0.2.0", - "y18n": "^3.2.1", - "yargs-parser": "^2.4.1" - } - }, - "yargs-parser": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", - "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", - "dev": true, - "requires": { - "camelcase": "^3.0.0", - "lodash.assign": "^4.0.6" - } } } }, @@ -50744,11 +51122,12 @@ "dev": true }, "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, "requires": { - "has-flag": "^4.0.0" + "has-flag": "^1.0.0" } }, "swap-case": { @@ -51093,12 +51472,6 @@ } } }, - "tree-kill": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", - "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", - "dev": true - }, "true-case-path": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-2.2.1.tgz", @@ -51127,15 +51500,6 @@ "ts-essentials": "^1.0.0" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -51147,21 +51511,6 @@ "supports-color": "^5.3.0" } }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -51293,7 +51642,6 @@ "version": "6.0.5", "resolved": "https://registry.npmjs.org/typechain/-/typechain-6.0.5.tgz", "integrity": "sha512-Kr2rATu2Y7Y0wOC/I0zKuyLU8EEUpnuPGkiloZ65ACm4sSLFVF8Tnxn8LEUJSN93dX3RMu2DLF5fwRBOjNB+Gw==", - "peer": true, "requires": { "@types/prettier": "^2.1.1", "command-line-args": "^4.0.7", @@ -51310,26 +51658,22 @@ "js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", - "peer": true + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" }, "mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "peer": true + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" }, "prettier": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.0.tgz", - "integrity": "sha512-FM/zAKgWTxj40rH03VxzIPdXmj39SwSjwG0heUcNFwI+EMZJnY93yAiKXM3dObIKAM5TA88werc8T/EwhB45eg==", - "peer": true + "integrity": "sha512-FM/zAKgWTxj40rH03VxzIPdXmj39SwSjwG0heUcNFwI+EMZJnY93yAiKXM3dObIKAM5TA88werc8T/EwhB45eg==" }, "ts-essentials": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-7.0.3.tgz", "integrity": "sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ==", - "peer": true, "requires": {} } } @@ -51643,7 +51987,8 @@ "uuid": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true }, "validate-npm-package-license": { "version": "3.0.4", @@ -51923,24 +52268,24 @@ } }, "web3": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3/-/web3-1.6.0.tgz", - "integrity": "sha512-rWpXnO88MiVX5yTRqMBCVKASxc7QDkXZZUl1D48sKlbX4dt3BAV+nVMVUKCBKiluZ5Bp8pDrVCUdPx/jIYai5Q==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3/-/web3-1.6.1.tgz", + "integrity": "sha512-c299lLiyb2/WOcxh7TinwvbATaMmrgNIeAzbLbmOKHI0LcwyfsB1eu2ReOIrfrCYDYRW2KAjYr7J7gHawqDNPQ==", "dev": true, "requires": { - "web3-bzz": "1.6.0", - "web3-core": "1.6.0", - "web3-eth": "1.6.0", - "web3-eth-personal": "1.6.0", - "web3-net": "1.6.0", - "web3-shh": "1.6.0", - "web3-utils": "1.6.0" + "web3-bzz": "1.6.1", + "web3-core": "1.6.1", + "web3-eth": "1.6.1", + "web3-eth-personal": "1.6.1", + "web3-net": "1.6.1", + "web3-shh": "1.6.1", + "web3-utils": "1.6.1" } }, "web3-bzz": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.6.0.tgz", - "integrity": "sha512-ugYV6BsinwhIi0CsLWINBz4mqN9wR9vNG0WmyEbdECjxcPyr6vkaWt4qi0zqlUxEnYAwGj4EJXNrbjPILntQTQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.6.1.tgz", + "integrity": "sha512-JbnFNbRlwwHJZPtVuCxo7rC4U4OTg+mPsyhjgPQJJhS0a6Y54OgVWYk9UA/95HqbmTJwTtX329gJoSsseEfrng==", "dev": true, "requires": { "@types/node": "^12.12.6", @@ -51949,32 +52294,32 @@ }, "dependencies": { "@types/node": { - "version": "12.20.36", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.36.tgz", - "integrity": "sha512-+5haRZ9uzI7rYqzDznXgkuacqb6LJhAti8mzZKWxIXn/WEtvB+GHVJ7AuMwcN1HMvXOSJcrvA6PPoYHYOYYebA==", + "version": "12.20.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", + "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", "dev": true } } }, "web3-core": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.6.0.tgz", - "integrity": "sha512-o0WsLrJ2yD+HAAc29lGMWJef/MutTyuzpJC0UzLJtIAQJqtpDalzWINEu4j8XYXGk34N/V6vudtzRPo23QEE6g==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.6.1.tgz", + "integrity": "sha512-m+b7UfYvU5cQUAh6NRfxRzH/5B3to1AdEQi1HIQt570cDWlObOOmoO9tY6iJnI5w4acxIO19LqjDMqEJGBYyRQ==", "dev": true, "requires": { "@types/bn.js": "^4.11.5", "@types/node": "^12.12.6", "bignumber.js": "^9.0.0", - "web3-core-helpers": "1.6.0", - "web3-core-method": "1.6.0", - "web3-core-requestmanager": "1.6.0", - "web3-utils": "1.6.0" + "web3-core-helpers": "1.6.1", + "web3-core-method": "1.6.1", + "web3-core-requestmanager": "1.6.1", + "web3-utils": "1.6.1" }, "dependencies": { "@types/node": { - "version": "12.20.36", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.36.tgz", - "integrity": "sha512-+5haRZ9uzI7rYqzDznXgkuacqb6LJhAti8mzZKWxIXn/WEtvB+GHVJ7AuMwcN1HMvXOSJcrvA6PPoYHYOYYebA==", + "version": "12.20.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", + "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", "dev": true }, "bignumber.js": { @@ -51984,23 +52329,23 @@ "dev": true }, "web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "requires": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" } }, "web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "requires": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } } } @@ -52044,46 +52389,45 @@ } }, "web3-core-method": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.6.0.tgz", - "integrity": "sha512-cHekyEil4mtcCOk6Q1Zh4y+2o5pTwsLIxP6Bpt4BRtZgdsyPiadYJpkLAVT/quch5xN7Qs5ZwG5AvRCS3VwD2g==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.6.1.tgz", + "integrity": "sha512-szH5KyIWIaULQDBdDvevQUCHV9lsExJ/oV0ePqK+w015D2SdMPMuhii0WB+HCePaksWO+rr/GAypvV9g2T3N+w==", "dev": true, "requires": { - "@ethereumjs/common": "^2.4.0", "@ethersproject/transactions": "^5.0.0-beta.135", - "web3-core-helpers": "1.6.0", - "web3-core-promievent": "1.6.0", - "web3-core-subscriptions": "1.6.0", - "web3-utils": "1.6.0" + "web3-core-helpers": "1.6.1", + "web3-core-promievent": "1.6.1", + "web3-core-subscriptions": "1.6.1", + "web3-utils": "1.6.1" }, "dependencies": { "web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "requires": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" } }, "web3-core-promievent": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.6.0.tgz", - "integrity": "sha512-ZzsevjMXWkhqW9dnVfTfb1OUcK7jKcKPvPIbQ4boJccNgvNZPZKlo8xB4pkAX38n4c59O5mC7Lt/z2QL/M5CeQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.6.1.tgz", + "integrity": "sha512-byJ5s2MQxrWdXd27pWFmujfzsTZK4ik8rDgIV1RFDFc+rHZ2nZhq+VWk7t/Nkrj7EaVXncEgTdPEHc18nx+ocQ==", "dev": true, "requires": { "eventemitter3": "4.0.4" } }, "web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "requires": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } } } @@ -52098,90 +52442,90 @@ } }, "web3-core-requestmanager": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.6.0.tgz", - "integrity": "sha512-CY5paPdiDXKTXPWaEUZekDfUXSuoE2vPxolwqzsvKwFWH5+H1NaXgrc+D5HpufgSvTXawTw0fy7IAicg8+PWqA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.6.1.tgz", + "integrity": "sha512-4y7etYEUtkfflyYVBfN1oJtCbVFNhNX1omlEYzezhTnPj3/dT7n+dhUXcqvIhx9iKA13unGfpFge80XNFfcB8A==", "dev": true, "requires": { "util": "^0.12.0", - "web3-core-helpers": "1.6.0", - "web3-providers-http": "1.6.0", - "web3-providers-ipc": "1.6.0", - "web3-providers-ws": "1.6.0" + "web3-core-helpers": "1.6.1", + "web3-providers-http": "1.6.1", + "web3-providers-ipc": "1.6.1", + "web3-providers-ws": "1.6.1" }, "dependencies": { "web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "requires": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" } }, "web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "requires": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } } } }, "web3-core-subscriptions": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.6.0.tgz", - "integrity": "sha512-kY9WZUY/m1URSOv3uTLshoZD9ZDiFKReIzHuPUkxFpD5oYNmr1/aPQNPCrrMxKODR7UVX/D90FxWwCYqHhLaxQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.6.1.tgz", + "integrity": "sha512-WZwxsYttIojyGQ5RqxuQcKg0IJdDCFpUe4EncS3QKZwxPqWzGmgyLwE0rm7tP+Ux1waJn5CUaaoSCBxWGSun1g==", "dev": true, "requires": { "eventemitter3": "4.0.4", - "web3-core-helpers": "1.6.0" + "web3-core-helpers": "1.6.1" }, "dependencies": { "web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "requires": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" } }, "web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "requires": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } } } }, "web3-eth": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.6.0.tgz", - "integrity": "sha512-qJMvai//r0be6I9ghU24/152f0zgJfYC23TMszN3Y6jse1JtjCBP2TlTibFcvkUN1RRdIUY5giqO7ZqAYAmp7w==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.6.1.tgz", + "integrity": "sha512-kOV1ZgCKypSo5BQyltRArS7ZC3bRpIKAxSgzl7pUFinUb/MxfbM9KGeNxUXoCfTSErcCQJaDjcS6bSre5EMKuQ==", "dev": true, "requires": { - "web3-core": "1.6.0", - "web3-core-helpers": "1.6.0", - "web3-core-method": "1.6.0", - "web3-core-subscriptions": "1.6.0", - "web3-eth-abi": "1.6.0", - "web3-eth-accounts": "1.6.0", - "web3-eth-contract": "1.6.0", - "web3-eth-ens": "1.6.0", - "web3-eth-iban": "1.6.0", - "web3-eth-personal": "1.6.0", - "web3-net": "1.6.0", - "web3-utils": "1.6.0" + "web3-core": "1.6.1", + "web3-core-helpers": "1.6.1", + "web3-core-method": "1.6.1", + "web3-core-subscriptions": "1.6.1", + "web3-eth-abi": "1.6.1", + "web3-eth-accounts": "1.6.1", + "web3-eth-contract": "1.6.1", + "web3-eth-ens": "1.6.1", + "web3-eth-iban": "1.6.1", + "web3-eth-personal": "1.6.1", + "web3-net": "1.6.1", + "web3-utils": "1.6.1" }, "dependencies": { "@ethersproject/abi": { @@ -52202,33 +52546,33 @@ } }, "web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "requires": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" } }, "web3-eth-abi": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.0.tgz", - "integrity": "sha512-fImomGE9McuTMJLwK8Tp0lTUzXqCkWeMm00qPVIwpJ/h7lCw9UFYV9+4m29wSqW6FF+FIZKwc6UBEf9dlx3orA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.1.tgz", + "integrity": "sha512-svhYrAlXP9XQtV7poWKydwDJq2CaNLMtmKydNXoOBLcQec6yGMP+v20pgrxF2H6wyTK+Qy0E3/5ciPOqC/VuoQ==", "dev": true, "requires": { "@ethersproject/abi": "5.0.7", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } }, "web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "requires": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } } } @@ -52289,22 +52633,22 @@ } }, "web3-eth-accounts": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.6.0.tgz", - "integrity": "sha512-2f6HS4KIH4laAsNCOfbNX3dRiQosqSY2TRK86C8jtAA/QKGdx+5qlPfYzbI2RjG81iayb2+mVbHIaEaBGZ8sGw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.6.1.tgz", + "integrity": "sha512-rGn3jwnuOKwaQRu4SiShz0YAQ87aVDBKs4HO43+XTCI1q1Y1jn3NOsG3BW9ZHaOckev4+zEyxze/Bsh2oEk24w==", "dev": true, "requires": { - "@ethereumjs/common": "^2.3.0", - "@ethereumjs/tx": "^3.2.1", + "@ethereumjs/common": "^2.5.0", + "@ethereumjs/tx": "^3.3.2", "crypto-browserify": "3.12.0", "eth-lib": "0.2.8", "ethereumjs-util": "^7.0.10", "scrypt-js": "^3.0.1", "uuid": "3.3.2", - "web3-core": "1.6.0", - "web3-core-helpers": "1.6.0", - "web3-core-method": "1.6.0", - "web3-utils": "1.6.0" + "web3-core": "1.6.1", + "web3-core-helpers": "1.6.1", + "web3-core-method": "1.6.1", + "web3-utils": "1.6.1" }, "dependencies": { "@types/bn.js": { @@ -52355,41 +52699,41 @@ "dev": true }, "web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "requires": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" } }, "web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "requires": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } } } }, "web3-eth-contract": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.6.0.tgz", - "integrity": "sha512-ZUtO77zFnxuFtrc+D+iJ3AzNgFXAVcKnhEYN7f1PNz/mFjbtE6dJ+ujO0mvMbxIZF02t9IZv0CIXRpK0rDvZAw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.6.1.tgz", + "integrity": "sha512-GXqTe3mF6kpbOAakiNc7wtJ120/gpuKMTZjuGFKeeY8aobRLfbfgKzM9IpyqVZV2v5RLuGXDuurVN2KPgtu3hQ==", "dev": true, "requires": { "@types/bn.js": "^4.11.5", - "web3-core": "1.6.0", - "web3-core-helpers": "1.6.0", - "web3-core-method": "1.6.0", - "web3-core-promievent": "1.6.0", - "web3-core-subscriptions": "1.6.0", - "web3-eth-abi": "1.6.0", - "web3-utils": "1.6.0" + "web3-core": "1.6.1", + "web3-core-helpers": "1.6.1", + "web3-core-method": "1.6.1", + "web3-core-promievent": "1.6.1", + "web3-core-subscriptions": "1.6.1", + "web3-eth-abi": "1.6.1", + "web3-utils": "1.6.1" }, "dependencies": { "@ethersproject/abi": { @@ -52410,60 +52754,60 @@ } }, "web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "requires": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" } }, "web3-core-promievent": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.6.0.tgz", - "integrity": "sha512-ZzsevjMXWkhqW9dnVfTfb1OUcK7jKcKPvPIbQ4boJccNgvNZPZKlo8xB4pkAX38n4c59O5mC7Lt/z2QL/M5CeQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.6.1.tgz", + "integrity": "sha512-byJ5s2MQxrWdXd27pWFmujfzsTZK4ik8rDgIV1RFDFc+rHZ2nZhq+VWk7t/Nkrj7EaVXncEgTdPEHc18nx+ocQ==", "dev": true, "requires": { "eventemitter3": "4.0.4" } }, "web3-eth-abi": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.0.tgz", - "integrity": "sha512-fImomGE9McuTMJLwK8Tp0lTUzXqCkWeMm00qPVIwpJ/h7lCw9UFYV9+4m29wSqW6FF+FIZKwc6UBEf9dlx3orA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.1.tgz", + "integrity": "sha512-svhYrAlXP9XQtV7poWKydwDJq2CaNLMtmKydNXoOBLcQec6yGMP+v20pgrxF2H6wyTK+Qy0E3/5ciPOqC/VuoQ==", "dev": true, "requires": { "@ethersproject/abi": "5.0.7", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } }, "web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "requires": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } } } }, "web3-eth-ens": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.6.0.tgz", - "integrity": "sha512-AG24PNv9qbYHSpjHcU2pViOII0jvIR7TeojJ2bxXSDqfcgHuRp3NZGKv6xFvT4uNI4LEQHUhSC7bzHoNF5t8CA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.6.1.tgz", + "integrity": "sha512-ngprtbnoRgxg8s1wXt9nXpD3h1P+p7XnKXrp/8GdFI9uDmrbSQPRfzBw86jdZgOmy78hAnWmrHI6pBInmgi2qQ==", "dev": true, "requires": { "content-hash": "^2.5.2", "eth-ens-namehash": "2.0.8", - "web3-core": "1.6.0", - "web3-core-helpers": "1.6.0", - "web3-core-promievent": "1.6.0", - "web3-eth-abi": "1.6.0", - "web3-eth-contract": "1.6.0", - "web3-utils": "1.6.0" + "web3-core": "1.6.1", + "web3-core-helpers": "1.6.1", + "web3-core-promievent": "1.6.1", + "web3-eth-abi": "1.6.1", + "web3-eth-contract": "1.6.1", + "web3-utils": "1.6.1" }, "dependencies": { "@ethersproject/abi": { @@ -52484,42 +52828,42 @@ } }, "web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "requires": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" } }, "web3-core-promievent": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.6.0.tgz", - "integrity": "sha512-ZzsevjMXWkhqW9dnVfTfb1OUcK7jKcKPvPIbQ4boJccNgvNZPZKlo8xB4pkAX38n4c59O5mC7Lt/z2QL/M5CeQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.6.1.tgz", + "integrity": "sha512-byJ5s2MQxrWdXd27pWFmujfzsTZK4ik8rDgIV1RFDFc+rHZ2nZhq+VWk7t/Nkrj7EaVXncEgTdPEHc18nx+ocQ==", "dev": true, "requires": { "eventemitter3": "4.0.4" } }, "web3-eth-abi": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.0.tgz", - "integrity": "sha512-fImomGE9McuTMJLwK8Tp0lTUzXqCkWeMm00qPVIwpJ/h7lCw9UFYV9+4m29wSqW6FF+FIZKwc6UBEf9dlx3orA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.1.tgz", + "integrity": "sha512-svhYrAlXP9XQtV7poWKydwDJq2CaNLMtmKydNXoOBLcQec6yGMP+v20pgrxF2H6wyTK+Qy0E3/5ciPOqC/VuoQ==", "dev": true, "requires": { "@ethersproject/abi": "5.0.7", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } }, "web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "requires": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } } } @@ -52563,171 +52907,171 @@ } }, "web3-eth-personal": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.6.0.tgz", - "integrity": "sha512-8ohf4qAwbShf4RwES2tLHVqa+pHZnS5Q6tV80sU//bivmlZeyO1W4UWyNn59vu9KPpEYvLseOOC6Muxuvr8mFQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.6.1.tgz", + "integrity": "sha512-ItsC89Ln02+irzJjK6ALcLrMZfbVUCqVbmb/ieDKJ+eLW3pNkBNwoUzaydh92d5NzxNZgNxuQWVdlFyYX2hkEw==", "dev": true, "requires": { "@types/node": "^12.12.6", - "web3-core": "1.6.0", - "web3-core-helpers": "1.6.0", - "web3-core-method": "1.6.0", - "web3-net": "1.6.0", - "web3-utils": "1.6.0" + "web3-core": "1.6.1", + "web3-core-helpers": "1.6.1", + "web3-core-method": "1.6.1", + "web3-net": "1.6.1", + "web3-utils": "1.6.1" }, "dependencies": { "@types/node": { - "version": "12.20.36", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.36.tgz", - "integrity": "sha512-+5haRZ9uzI7rYqzDznXgkuacqb6LJhAti8mzZKWxIXn/WEtvB+GHVJ7AuMwcN1HMvXOSJcrvA6PPoYHYOYYebA==", + "version": "12.20.37", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", + "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", "dev": true }, "web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "requires": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" } }, "web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "requires": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } } } }, "web3-net": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.6.0.tgz", - "integrity": "sha512-LFfG95ovTT2sNHkO1TEfsaKpYcxOSUtbuwHQ0K3G0e5nevKDJkPEFIqIcob40yiwcWoqEjENJP9Bjk8CRrZ99Q==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.6.1.tgz", + "integrity": "sha512-gpnqKEIwfUHh5ik7wsQFlCje1DfcmGv+Sk7LCh1hCqn++HEDQxJ/mZCrMo11ZZpZHCH7c87imdxTg96GJnRxDw==", "dev": true, "requires": { - "web3-core": "1.6.0", - "web3-core-method": "1.6.0", - "web3-utils": "1.6.0" + "web3-core": "1.6.1", + "web3-core-method": "1.6.1", + "web3-utils": "1.6.1" } }, "web3-providers-http": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.6.0.tgz", - "integrity": "sha512-sNxHFNv3lnxpmULt34AS6M36IYB/Hzm2Et4yPNzdP1XE644D8sQBZQZaJQdTaza5HfrlwoqU6AOK935armqGuA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.6.1.tgz", + "integrity": "sha512-xBoKOJxu10+kO3ikamXmBfrWZ/xpQOGy0ocdp7Y81B17En5TXELwlmMXt1UlIgWiyYDhjq4OwlH/VODYqHXy3A==", "dev": true, "requires": { - "web3-core-helpers": "1.6.0", + "web3-core-helpers": "1.6.1", "xhr2-cookies": "1.1.0" }, "dependencies": { "web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "requires": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" } }, "web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "requires": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } } } }, "web3-providers-ipc": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.6.0.tgz", - "integrity": "sha512-ETYdfhpGiGoWpmmSJnONvnPfd3TPivHEGjXyuX+L5FUsbMOVZj9MFLNIS19Cx/YGL8UWJ/8alLJoTcWSIdz/aA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.6.1.tgz", + "integrity": "sha512-anyoIZlpMzwEQI4lwylTzDrHsVp20v0QUtSTp2B5jInBinmQtyCE7vnbX20jEQ4j5uPwfJabKNtoJsk6a3O4WQ==", "dev": true, "requires": { "oboe": "2.1.5", - "web3-core-helpers": "1.6.0" + "web3-core-helpers": "1.6.1" }, "dependencies": { "web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "requires": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" } }, "web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "requires": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } } } }, "web3-providers-ws": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.6.0.tgz", - "integrity": "sha512-eNRmlhOPCpuVYwBrKBBQRLGPFb4U1Uo44r9EWV69Cpo4gP6XeBTl6nkawhLz6DS0fq79apyPfItJVuSfAy77pA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.6.1.tgz", + "integrity": "sha512-FWMEFYb4rYFYRgSFBf/O1Ex4p/YKSlN+JydCtdlJwRimd89qm95CTfs4xGjCskwvXMjV2sarH+f1NPwJXicYpg==", "dev": true, "requires": { "eventemitter3": "4.0.4", - "web3-core-helpers": "1.6.0", + "web3-core-helpers": "1.6.1", "websocket": "^1.0.32" }, "dependencies": { "web3-core-helpers": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz", - "integrity": "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz", + "integrity": "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==", "dev": true, "requires": { - "web3-eth-iban": "1.6.0", - "web3-utils": "1.6.0" + "web3-eth-iban": "1.6.1", + "web3-utils": "1.6.1" } }, "web3-eth-iban": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz", - "integrity": "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz", + "integrity": "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==", "dev": true, "requires": { "bn.js": "^4.11.9", - "web3-utils": "1.6.0" + "web3-utils": "1.6.1" } } } }, "web3-shh": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.6.0.tgz", - "integrity": "sha512-ymN0OFL81WtEeSyb+PFpuUv39fR3frGwsZnIg5EVPZvrOIdaDSFcGSLDmafUt0vKSubvLMVYIBOCskRD6YdtEQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.6.1.tgz", + "integrity": "sha512-oP00HbAtybLCGlLOZUYXOdeB9xq88k2l0TtStvKBtmFqRt+zVk5TxEeuOnVPRxNhcA2Un8RUw6FtvgZlWStu9A==", "dev": true, "requires": { - "web3-core": "1.6.0", - "web3-core-method": "1.6.0", - "web3-core-subscriptions": "1.6.0", - "web3-net": "1.6.0" + "web3-core": "1.6.1", + "web3-core-method": "1.6.1", + "web3-core-subscriptions": "1.6.1", + "web3-net": "1.6.1" } }, "web3-utils": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.6.0.tgz", - "integrity": "sha512-bgCAWAeQnJF035YTFxrcHJ5mGEfTi/McsjqldZiXRwlHK7L1PyOqvXiQLE053dlzvy1kdAxWl/sSSfLMyNUAXg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.6.1.tgz", + "integrity": "sha512-RidGKv5kOkcerI6jQqDFDoTllQQqV+rPhTzZHhmbqtFObbYpU93uc+yG1LHivRTQhA6llIx67iudc/vzisgO+w==", "dev": true, "requires": { "bn.js": "^4.11.9", @@ -52937,27 +53281,6 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", @@ -53025,12 +53348,6 @@ "xhr-request": "^1.1.0" } }, - "xhr2": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/xhr2/-/xhr2-0.2.1.tgz", - "integrity": "sha512-sID0rrVCqkVNUn8t6xuv9+6FViXjUVXq8H5rWOH2rz9fDNQEd4g0EA2XlcEdJXRz5BMEn4O1pJFdT+z4YHhoWw==", - "dev": true - }, "xhr2-cookies": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", diff --git a/yarn.lock b/yarn.lock index 3af4c4c9..51e7f458 100644 --- a/yarn.lock +++ b/yarn.lock @@ -155,13 +155,13 @@ "rlp" "^2.2.4" "semaphore-async-await" "^1.5.1" -"@ethereumjs/common@^2.3.0", "@ethereumjs/common@^2.4.0": - "integrity" "sha512-UdkhFWzWcJCZVsj1O/H8/oqj/0RVYjLc1OhPjBrQdALAkQHpCp8xXI4WLnuGTADqTdJZww0NtgwG+TRPkXt27w==" - "resolved" "https://registry.npmjs.org/@ethereumjs/common/-/common-2.4.0.tgz" - "version" "2.4.0" +"@ethereumjs/common@^2.3.0", "@ethereumjs/common@^2.4.0", "@ethereumjs/common@^2.5.0", "@ethereumjs/common@^2.6.0": + "integrity" "sha512-Cq2qS0FTu6O2VU1sgg+WyU9Ps0M6j/BEMHN+hRaECXCV/r0aI78u4N6p52QW/BDVhwWZpCdrvG8X7NJdzlpNUA==" + "resolved" "https://registry.npmjs.org/@ethereumjs/common/-/common-2.6.0.tgz" + "version" "2.6.0" dependencies: "crc-32" "^1.2.0" - "ethereumjs-util" "^7.1.0" + "ethereumjs-util" "^7.1.3" "@ethereumjs/ethash@^1.0.0": "integrity" "sha512-iIqnGG6NMKesyOxv2YctB2guOVX18qMAWlj3QlZyrc+GqfzLqoihti+cVNQnyNxr7eYuPdqwLQOFuPe6g/uKjw==" @@ -173,13 +173,13 @@ "ethereumjs-util" "^7.0.7" "miller-rabin" "^4.0.0" -"@ethereumjs/tx@^3.2.1", "@ethereumjs/tx@^3.3.0": - "integrity" "sha512-yTwEj2lVzSMgE6Hjw9Oa1DZks/nKTWM8Wn4ykDNapBPua2f4nXO3qKnni86O6lgDj5fVNRqbDsD0yy7/XNGDEA==" - "resolved" "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.3.0.tgz" - "version" "3.3.0" +"@ethereumjs/tx@^3.2.1", "@ethereumjs/tx@^3.3.0", "@ethereumjs/tx@^3.3.2": + "integrity" "sha512-WWUwg1PdjHKZZxPPo274ZuPsJCWV3SqATrEKQP1n2DrVYVP1aZIYpo/mFaA0BDoE0tIQmBeimRCEA0Lgil+yYw==" + "resolved" "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.4.0.tgz" + "version" "3.4.0" dependencies: - "@ethereumjs/common" "^2.4.0" - "ethereumjs-util" "^7.1.0" + "@ethereumjs/common" "^2.6.0" + "ethereumjs-util" "^7.1.3" "@ethereumjs/vm@^5.5.2": "integrity" "sha512-AydZ4wfvZAsBuFzs3xVSA2iU0hxhL8anXco3UW3oh9maVC34kTEytOfjHf06LTEfN0MF9LDQ4ciLa7If6ZN/sg==" @@ -200,7 +200,7 @@ "rustbn.js" "~0.2.0" "util.promisify" "^1.0.1" -"@ethersproject/abi@^5.0.1", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.4.0": +"@ethersproject/abi@^5.0.0", "@ethersproject/abi@^5.0.1", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.4.0": "integrity" "sha512-9gU2H+/yK1j2eVMdzm6xvHSnMxk8waIHQGYCZg5uvAyH0rsAzxkModzBSpbAkAuhKFEovC2S9hM4nPuLym8IZw==" "resolved" "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.4.0.tgz" "version" "5.4.0" @@ -373,7 +373,7 @@ "@ethersproject/logger" "^5.5.0" "bn.js" "^4.11.9" -"@ethersproject/bytes@^5.0.4", "@ethersproject/bytes@^5.4.0", "@ethersproject/bytes@^5.5.0", "@ethersproject/bytes@5.5.0": +"@ethersproject/bytes@^5.0.0", "@ethersproject/bytes@^5.0.4", "@ethersproject/bytes@^5.4.0", "@ethersproject/bytes@^5.5.0", "@ethersproject/bytes@5.5.0": "integrity" "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==" "resolved" "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz" "version" "5.5.0" @@ -515,10 +515,10 @@ dependencies: "@ethersproject/logger" "^5.0.8" -"@ethersproject/networks@^5.5.0", "@ethersproject/networks@5.5.0": - "integrity" "sha512-KWfP3xOnJeF89Uf/FCJdV1a2aDJe5XTN2N52p4fcQ34QhDqQFkgQKZ39VGtiqUgHcLI8DfT0l9azC3KFTunqtA==" - "resolved" "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.0.tgz" - "version" "5.5.0" +"@ethersproject/networks@^5.5.0", "@ethersproject/networks@5.5.1": + "integrity" "sha512-tYRDM4zZtSUcKnD4UMuAlj7SeXH/k5WC4SP2u1Pn57++JdXHkRu2zwNkgNogZoxHzhm9Q6qqurDBVptHOsW49Q==" + "resolved" "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.1.tgz" + "version" "5.5.1" dependencies: "@ethersproject/logger" "^5.5.0" @@ -542,10 +542,10 @@ dependencies: "@ethersproject/logger" "^5.0.8" -"@ethersproject/providers@^5.4.4", "@ethersproject/providers@5.5.0": - "integrity" "sha512-xqMbDnS/FPy+J/9mBLKddzyLLAQFjrVff5g00efqxPzcAwXiR+SiCGVy6eJ5iAIirBOATjx7QLhDNPGV+AEQsw==" - "resolved" "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.5.0.tgz" - "version" "5.5.0" +"@ethersproject/providers@^5.0.0", "@ethersproject/providers@^5.4.4", "@ethersproject/providers@5.5.1": + "integrity" "sha512-2zdD5sltACDWhjUE12Kucg2PcgM6V2q9JMyVvObtVGnzJu+QSmibbP+BHQyLWZUBfLApx2942+7DC5D+n4wBQQ==" + "resolved" "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.5.1.tgz" + "version" "5.5.1" dependencies: "@ethersproject/abstract-provider" "^5.5.0" "@ethersproject/abstract-signer" "^5.5.0" @@ -713,10 +713,10 @@ "@ethersproject/properties" "^5.0.7" "@ethersproject/strings" "^5.0.8" -"@ethersproject/web@^5.5.0", "@ethersproject/web@5.5.0": - "integrity" "sha512-BEgY0eL5oH4mAo37TNYVrFeHsIXLRxggCRG/ksRIxI2X5uj5IsjGmcNiRN/VirQOlBxcUhCgHhaDLG4m6XAVoA==" - "resolved" "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.0.tgz" - "version" "5.5.0" +"@ethersproject/web@^5.5.0", "@ethersproject/web@5.5.1": + "integrity" "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==" + "resolved" "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz" + "version" "5.5.1" dependencies: "@ethersproject/base64" "^5.5.0" "@ethersproject/bytes" "^5.5.0" @@ -826,15 +826,36 @@ "resolved" "https://registry.npmjs.org/@ledgerhq/logs/-/logs-5.50.0.tgz" "version" "5.50.0" -"@nomiclabs/hardhat-ethers@^2.0.0", "@nomiclabs/hardhat-ethers@^2.0.2": - "integrity" "sha512-6quxWe8wwS4X5v3Au8q1jOvXYEPkS1Fh+cME5u6AwNdnI4uERvPlVjlgRWzpnb+Rrt1l/cEqiNRH9GlsBMSDQg==" - "resolved" "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.2.tgz" - "version" "2.0.2" +"@nodelib/fs.scandir@2.1.5": + "integrity" "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==" + "resolved" "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz" + "version" "2.1.5" + dependencies: + "@nodelib/fs.stat" "2.0.5" + "run-parallel" "^1.1.9" -"@nomiclabs/hardhat-etherscan@^2.1.7": - "integrity" "sha512-9nt9EXubnkd2aTMnQIqKtp80bQFhun88krfB31FN2wB0T54b8YuK0riG2d+EKq/D3t1Kb00oA7oFSFpHLIbLDQ==" - "resolved" "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-2.1.7.tgz" - "version" "2.1.7" +"@nodelib/fs.stat@^2.0.2", "@nodelib/fs.stat@2.0.5": + "integrity" "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==" + "resolved" "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" + "version" "2.0.5" + +"@nodelib/fs.walk@^1.2.3": + "integrity" "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==" + "resolved" "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz" + "version" "1.2.8" + dependencies: + "@nodelib/fs.scandir" "2.1.5" + "fastq" "^1.6.0" + +"@nomiclabs/hardhat-ethers@^2.0.0", "@nomiclabs/hardhat-ethers@^2.0.3": + "integrity" "sha512-IJ0gBotVtO7YyLZyHNgbxzskUtFok+JkRlKPo8YELqj1ms9XL6Qm3vsfsGdZr22wnJeVEF5TQPotKuwQk21Dag==" + "resolved" "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.3.tgz" + "version" "2.0.3" + +"@nomiclabs/hardhat-etherscan@^2.1.8": + "integrity" "sha512-0+rj0SsZotVOcTLyDOxnOc3Gulo8upo0rsw/h+gBPcmtj91YqYJNhdARHoBxOhhE8z+5IUQPx+Dii04lXT14PA==" + "resolved" "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-2.1.8.tgz" + "version" "2.1.8" dependencies: "@ethersproject/abi" "^5.1.2" "@ethersproject/address" "^5.0.2" @@ -1022,6 +1043,13 @@ dependencies: "@sinonjs/commons" "^1.7.0" +"@solidity-parser/parser@^0.13.2": + "integrity" "sha512-RwHnpRnfrnD2MSPveYoPh8nhofEvX7fgjHk1Oq+NNvCcLx4r1js91CO9o+F/F3fBzOCyvm8kKRTriFICX/odWw==" + "resolved" "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.13.2.tgz" + "version" "0.13.2" + dependencies: + "antlr4ts" "^0.5.0-alpha.4" + "@solidity-parser/parser@^0.14.0": "integrity" "sha512-cX0JJRcmPtNUJpzD2K7FdA7qQsTOk1UZnFx2k7qAg9ZRvuaH5NBe5IEdBMXGlmf2+FmjhqbygJ26H8l2SV7aKQ==" "resolved" "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.14.0.tgz" @@ -1043,10 +1071,10 @@ dependencies: "defer-to-connect" "^1.0.1" -"@tenderly/hardhat-tenderly@^1.0.12": - "integrity" "sha512-zx2zVpbBxGWVp+aLgf59sZR5lxdqfq/PjqUhga6+iazukQNu/Y6pLfVnCcF1ggvLsf7gnMjwLe3YEx/GxCAykQ==" - "resolved" "https://registry.npmjs.org/@tenderly/hardhat-tenderly/-/hardhat-tenderly-1.0.12.tgz" - "version" "1.0.12" +"@tenderly/hardhat-tenderly@^1.0.13": + "integrity" "sha512-XsrF2QIUh8YmzCcWHmPnSNQjZNBQkyrHER8bcrWsFIgL7ub49hmPbpGVB2Isb6gUV/IGBpBm7R69jpmoTvJ17g==" + "resolved" "https://registry.npmjs.org/@tenderly/hardhat-tenderly/-/hardhat-tenderly-1.0.13.tgz" + "version" "1.0.13" dependencies: "axios" "^0.21.1" "fs-extra" "^9.0.1" @@ -1146,6 +1174,15 @@ "ethers" "^4.0.32" "web3" "1.5.3" +"@truffle/provider@^0.2.24": + "integrity" "sha512-ZNoglPho4alYIjJR+sLTgX0x6ho7m4OAUWuJ50RAWmoEqYc4AM6htdrI+lTSoRrOHHbmgasv22a7rFPMnmDrTg==" + "resolved" "https://registry.npmjs.org/@truffle/provider/-/provider-0.2.42.tgz" + "version" "0.2.42" + dependencies: + "@truffle/error" "^0.0.14" + "@truffle/interface-adapter" "^0.5.8" + "web3" "1.5.3" + "@trufflesuite/chromafi@^2.2.2": "integrity" "sha512-mItQwVBsb8qP/vaYHQ1kDt2vJLhjoEXJptT6y6fJGvFophMFhOI/NsTVUa0nJL1nyMeFiS6hSYuNVdpQZzB1gA==" "resolved" "https://registry.npmjs.org/@trufflesuite/chromafi/-/chromafi-2.2.2.tgz" @@ -1193,6 +1230,14 @@ dependencies: "ethers" "^5.0.2" +"@typechain/ethers-v5@^8.0.5": + "integrity" "sha512-ntpj4cS3v4WlDu+hSKSyj9A3o1tKtWC30RX1gobeYymZColeJiUemC1Kgfa0MWGmInm5CKxoHVhEvYVgPOZn1A==" + "resolved" "https://registry.npmjs.org/@typechain/ethers-v5/-/ethers-v5-8.0.5.tgz" + "version" "8.0.5" + dependencies: + "lodash" "^4.17.15" + "ts-essentials" "^7.0.1" + "@typechain/hardhat@^3.0.0": "integrity" "sha512-FpnIIXkDXm54XCHI/Z2iOet7h1MrFSvZfuljX9Uzc6FEjEfb01Tuzu8ywe2iquD3g5JXqovgdv+M54L/2Z6jkg==" "resolved" "https://registry.npmjs.org/@typechain/hardhat/-/hardhat-3.0.0.tgz" @@ -1231,6 +1276,14 @@ "resolved" "https://registry.npmjs.org/@types/chai/-/chai-4.2.22.tgz" "version" "4.2.22" +"@types/glob@^7.1.1": + "integrity" "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==" + "resolved" "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz" + "version" "7.2.0" + dependencies: + "@types/minimatch" "*" + "@types/node" "*" + "@types/level-errors@*": "integrity" "sha512-/lMtoq/Cf/2DVOm6zE6ORyOM+3ZVm/BvzEZVxUhf6bgh8ZHglXlBqxbxSlJeVp8FCbD3IVvk/VbsaNmDjrQvqQ==" "resolved" "https://registry.npmjs.org/@types/level-errors/-/level-errors-3.0.0.tgz" @@ -1250,6 +1303,11 @@ "resolved" "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.0.tgz" "version" "5.1.0" +"@types/minimatch@*": + "integrity" "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==" + "resolved" "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz" + "version" "3.0.5" + "@types/mkdirp@^0.5.2": "integrity" "sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg==" "resolved" "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-0.5.2.tgz" @@ -1270,10 +1328,10 @@ "@types/node" "*" "form-data" "^3.0.0" -"@types/node@*", "@types/node@^16.11.10": - "integrity" "sha512-3aRnHa1KlOEEhJ6+CvyHKK5vE9BcLGjtUpwvqYLRvYNQKMfabu3BwfJaA/SLW8dxe28LsNDjtHwePTuzn3gmOA==" - "resolved" "https://registry.npmjs.org/@types/node/-/node-16.11.10.tgz" - "version" "16.11.10" +"@types/node@*", "@types/node@^16.11.11": + "integrity" "sha512-KB0sixD67CeecHC33MYn+eYARkqTheIRNuu97y2XMjR7Wu3XibO1vaY6VBV6O/a89SPI81cEUIYT87UqUWlZNw==" + "resolved" "https://registry.npmjs.org/@types/node/-/node-16.11.11.tgz" + "version" "16.11.11" "@types/node@^12.12.6": "integrity" "sha512-+5haRZ9uzI7rYqzDznXgkuacqb6LJhAti8mzZKWxIXn/WEtvB+GHVJ7AuMwcN1HMvXOSJcrvA6PPoYHYOYYebA==" @@ -1354,10 +1412,10 @@ "resolved" "https://registry.npmjs.org/@uniswap/v3-core/-/v3-core-1.0.0.tgz" "version" "1.0.0" -"@uniswap/v3-periphery@^1.2.1": - "integrity" "sha512-45W8hT8X1j9ZcXa+y3NSVao90hMZtgtoJyDlMOg91wmUGi2idXAiGivOQYdB7+7Lq8Gc6Upv/ggFZknixZrv7g==" - "resolved" "https://registry.npmjs.org/@uniswap/v3-periphery/-/v3-periphery-1.2.1.tgz" - "version" "1.2.1" +"@uniswap/v3-periphery@^1.3.0": + "integrity" "sha512-HjHdI5RkjBl8zz3bqHShrbULFoZSrjbbrRHoO2vbzn+WRzTa6xY4PWphZv2Tlcb38YEKfKHp6NPl5hVedac8uw==" + "resolved" "https://registry.npmjs.org/@uniswap/v3-periphery/-/v3-periphery-1.3.0.tgz" + "version" "1.3.0" dependencies: "@openzeppelin/contracts" "3.4.1-solc-0.7-2" "@uniswap/lib" "^4.0.1-alpha" @@ -1645,6 +1703,11 @@ "resolved" "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz" "version" "8.6.0" +"address@^1.0.1": + "integrity" "sha512-aT6camzM4xEA54YVJYSqxz1kv4IHnQZRtThJJHhUMRExaU5spC7jX5ugSwTaTgJliIgs4VhZOk7htClvQ/LmRA==" + "resolved" "https://registry.npmjs.org/address/-/address-1.1.2.tgz" + "version" "1.1.2" + "adm-zip@^0.4.16": "integrity" "sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg==" "resolved" "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz" @@ -1750,14 +1813,7 @@ "ansi-styles@^2.2.1": "version" "2.2.1" -"ansi-styles@^3.2.0": - "integrity" "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==" - "resolved" "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz" - "version" "3.2.1" - dependencies: - "color-convert" "^1.9.0" - -"ansi-styles@^3.2.1": +"ansi-styles@^3.2.0", "ansi-styles@^3.2.1": "integrity" "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==" "resolved" "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz" "version" "3.2.1" @@ -1858,6 +1914,11 @@ "resolved" "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz" "version" "1.1.1" +"array-union@^2.1.0": + "integrity" "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==" + "resolved" "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz" + "version" "2.1.0" + "array-uniq@^1.0.3": "integrity" "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" "resolved" "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz" @@ -2480,11 +2541,6 @@ "resolved" "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz" "version" "9.0.1" -"bignumber.js@git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2": - "integrity" "sha512-k55rLoPK7DNCwjO/+Esh5n3lNF+lKwzfIIak1alqxXhrXsInC69JJKwEjAyCB8+IehSFkObzxzzu9URR+Q4pyA==" - "resolved" "git+ssh://git@github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2" - "version" "2.0.7" - "binary-extensions@^1.0.0": "integrity" "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==" "resolved" "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz" @@ -2631,11 +2687,6 @@ "resolved" "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz" "version" "1.1.0" -"browser-stdout@1.3.0": - "integrity" "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=" - "resolved" "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz" - "version" "1.3.0" - "browser-stdout@1.3.1": "integrity" "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" "resolved" "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz" @@ -2680,14 +2731,6 @@ "bn.js" "^5.0.0" "randombytes" "^2.0.1" -"browserify-sha3@^0.0.4": - "integrity" "sha1-CGxHuMgjFsnUcCLCYYWVRXbdjiY=" - "resolved" "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.4.tgz" - "version" "0.0.4" - dependencies: - "js-sha3" "^0.6.1" - "safe-buffer" "^5.1.1" - "browserify-sign@^4.0.0": "integrity" "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==" "resolved" "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz" @@ -2995,6 +3038,11 @@ "ansi-styles" "^4.1.0" "supports-color" "^7.1.0" +"chalk@^5.0.0": + "integrity" "sha512-/duVOqst+luxCQRKEo4bNxinsOQtMP80ZYm7mMqzuh5PociNL0PvmHFvREJ9ueYL2TxlHjBcmLCdmocx9Vg+IQ==" + "resolved" "https://registry.npmjs.org/chalk/-/chalk-5.0.0.tgz" + "version" "5.0.0" + "change-case@3.0.2": "integrity" "sha512-Mww+SLF6MZ0U6kdg11algyKd5BARbyM4TbFBepwowYSR5ClfQGCGtxNXgykpN0uF/bstWeaGDT4JWaDh8zWAHA==" "resolved" "https://registry.npmjs.org/change-case/-/change-case-3.0.2.tgz" @@ -3263,16 +3311,16 @@ "resolved" "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz" "version" "2.20.3" +"commander@^8.1.0": + "integrity" "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==" + "resolved" "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz" + "version" "8.3.0" + "commander@~2.19.0": "integrity" "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==" "resolved" "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz" "version" "2.19.0" -"commander@2.11.0": - "integrity" "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==" - "resolved" "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz" - "version" "2.11.0" - "commander@2.17.x": "integrity" "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==" "resolved" "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz" @@ -3541,11 +3589,6 @@ "randombytes" "^2.0.0" "randomfill" "^1.0.3" -"crypto-js@^3.1.4": - "integrity" "sha512-DIT51nX0dCfKltpRiXV+/TVZq+Qq2NgF4644+K7Ttnla7zEzqc+kjJyiB96BHNyUTBxyjzRcZYpUdZa+QAqi6Q==" - "resolved" "https://registry.npmjs.org/crypto-js/-/crypto-js-3.3.0.tgz" - "version" "3.3.0" - "css-loader@*", "css-loader@^2.1.0": "integrity" "sha512-OcKJU/lt232vl1P9EEDamhoO9iKY3tIjY5GU+XDLblAykTdgs6Ux9P1hTHve8nFKy5KPpOXOsVI/hIwi3841+w==" "resolved" "https://registry.npmjs.org/css-loader/-/css-loader-2.1.1.tgz" @@ -3628,6 +3671,13 @@ dependencies: "ms" "2.0.0" +"debug@^2.6.0": + "integrity" "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==" + "resolved" "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" + "version" "2.6.9" + dependencies: + "ms" "2.0.0" + "debug@^2.6.8": "version" "2.6.9" dependencies: @@ -3666,13 +3716,6 @@ dependencies: "ms" "2.0.0" -"debug@3.1.0": - "integrity" "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==" - "resolved" "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz" - "version" "3.1.0" - dependencies: - "ms" "2.0.0" - "debug@3.2.6": "integrity" "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==" "resolved" "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz" @@ -3727,9 +3770,9 @@ "version" "0.6.0" "deep-is@~0.1.3": - "integrity" "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" - "resolved" "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz" - "version" "0.1.3" + "integrity" "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + "resolved" "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" + "version" "0.1.4" "defer-to-connect@^1.0.1": "integrity" "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==" @@ -3830,16 +3873,19 @@ "resolved" "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz" "version" "1.0.3" +"detect-port@^1.3.0": + "integrity" "sha512-E+B1gzkl2gqxt1IhUzwjrxBKRqx1UzC3WLONHinn8S3T6lwV/agVCyitiFOsGJ/eYuEUBvD71MZHy3Pv1G9doQ==" + "resolved" "https://registry.npmjs.org/detect-port/-/detect-port-1.3.0.tgz" + "version" "1.3.0" + dependencies: + "address" "^1.0.1" + "debug" "^2.6.0" + "diff@^4.0.1": "integrity" "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" "resolved" "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz" "version" "4.0.2" -"diff@3.3.1": - "integrity" "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==" - "resolved" "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz" - "version" "3.3.1" - "diff@3.5.0": "integrity" "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==" "resolved" "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz" @@ -3854,6 +3900,13 @@ "miller-rabin" "^4.0.0" "randombytes" "^2.0.0" +"dir-glob@^3.0.1": + "integrity" "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==" + "resolved" "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz" + "version" "3.0.1" + dependencies: + "path-type" "^4.0.0" + "dom-converter@^0.2.0": "integrity" "sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA==" "resolved" "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz" @@ -4547,13 +4600,6 @@ "ethereumjs-common@^1.1.0", "ethereumjs-common@^1.3.2", "ethereumjs-common@^1.5.0", "ethereumjs-common@1.5.0": "version" "1.5.0" -"ethereumjs-testrpc-sc@6.1.6": - "integrity" "sha512-iv2qiGBFgk9mn5Nq2enX8dG5WQ7Lk+FCqpnxfPfH4Ns8KLPwttmNOy264nh3SXDJJvcQwz/XnlLteDQVILotbg==" - "resolved" "https://registry.npmjs.org/ethereumjs-testrpc-sc/-/ethereumjs-testrpc-sc-6.1.6.tgz" - "version" "6.1.6" - dependencies: - "source-map-support" "^0.5.3" - "ethereumjs-testrpc@^6.0.3": "integrity" "sha512-lAxxsxDKK69Wuwqym2K49VpXtBvLEsXr1sryNG4AkvL5DomMdeCBbu3D87UEevKenLHBiT8GTjARwN6Yj039gA==" "resolved" "https://registry.npmjs.org/ethereumjs-testrpc/-/ethereumjs-testrpc-6.0.3.tgz" @@ -4666,6 +4712,17 @@ "ethjs-util" "0.1.6" "rlp" "^2.2.4" +"ethereumjs-util@^7.1.3": + "integrity" "sha512-y+82tEbyASO0K0X1/SRhbJJoAlfcvq8JbrG4a5cjrOks7HS/36efU/0j2flxCPOUM++HFahk33kr/ZxyC4vNuw==" + "resolved" "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.3.tgz" + "version" "7.1.3" + dependencies: + "@types/bn.js" "^5.1.0" + "bn.js" "^5.1.2" + "create-hash" "^1.1.2" + "ethereum-cryptography" "^0.1.3" + "rlp" "^2.2.4" + "ethereumjs-vm@^2.1.0": "version" "2.6.0" dependencies: @@ -4758,10 +4815,10 @@ "uuid" "2.0.1" "xmlhttprequest" "1.8.0" -"ethers@^5.0.0", "ethers@^5.0.1", "ethers@^5.0.13", "ethers@^5.0.2", "ethers@^5.1.0", "ethers@^5.4.7", "ethers@^5.5.1": - "integrity" "sha512-RodEvUFZI+EmFcE6bwkuJqpCYHazdzeR1nMzg+YWQSmQEsNtfl1KHGfp/FWZYl48bI/g7cgBeP2IlPthjiVngw==" - "resolved" "https://registry.npmjs.org/ethers/-/ethers-5.5.1.tgz" - "version" "5.5.1" +"ethers@^5.0.0", "ethers@^5.0.1", "ethers@^5.0.13", "ethers@^5.0.2", "ethers@^5.1.0", "ethers@^5.1.3", "ethers@^5.4.7", "ethers@^5.5.2": + "integrity" "sha512-EF5W+6Wwcu6BqVwpgmyR5U2+L4c1FQzlM/02dkZOugN3KF0cG9bzHZP+TDJglmPm2/IzCEJDT7KBxzayk7SAHw==" + "resolved" "https://registry.npmjs.org/ethers/-/ethers-5.5.2.tgz" + "version" "5.5.2" dependencies: "@ethersproject/abi" "5.5.0" "@ethersproject/abstract-provider" "5.5.1" @@ -4778,10 +4835,10 @@ "@ethersproject/json-wallets" "5.5.0" "@ethersproject/keccak256" "5.5.0" "@ethersproject/logger" "5.5.0" - "@ethersproject/networks" "5.5.0" + "@ethersproject/networks" "5.5.1" "@ethersproject/pbkdf2" "5.5.0" "@ethersproject/properties" "5.5.0" - "@ethersproject/providers" "5.5.0" + "@ethersproject/providers" "5.5.1" "@ethersproject/random" "5.5.0" "@ethersproject/rlp" "5.5.0" "@ethersproject/sha2" "5.5.0" @@ -4791,7 +4848,7 @@ "@ethersproject/transactions" "5.5.0" "@ethersproject/units" "5.5.0" "@ethersproject/wallet" "5.5.0" - "@ethersproject/web" "5.5.0" + "@ethersproject/web" "5.5.1" "@ethersproject/wordlists" "5.5.0" "ethjs-abi@^0.2.1": @@ -5003,6 +5060,17 @@ "resolved" "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" "version" "3.1.3" +"fast-glob@^3.0.3": + "integrity" "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==" + "resolved" "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz" + "version" "3.2.7" + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + "glob-parent" "^5.1.2" + "merge2" "^1.3.0" + "micromatch" "^4.0.4" + "fast-json-stable-stringify@^2.0.0": "integrity" "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" "resolved" "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz" @@ -5013,6 +5081,13 @@ "resolved" "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz" "version" "2.0.6" +"fastq@^1.6.0": + "integrity" "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==" + "resolved" "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz" + "version" "1.13.0" + dependencies: + "reusify" "^1.0.4" + "fetch-ponyfill@^4.0.0": "version" "4.1.0" dependencies: @@ -5343,6 +5418,19 @@ "resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" "version" "1.0.0" +"fsevents@^1.2.7", "fsevents@~2.1.1": + "integrity" "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==" + "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz" + "version" "1.2.13" + dependencies: + "bindings" "^1.5.0" + "nan" "^2.12.1" + +"fsevents@~2.3.2": + "integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==" + "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" + "version" "2.3.2" + "function-bind@^1.1.1", "function-bind@~1.1.1": "integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" "resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" @@ -5353,7 +5441,7 @@ "resolved" "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz" "version" "1.0.1" -"ganache-cli@^6.1.0": +"ganache-cli@^6.1.0", "ganache-cli@^6.12.2": "integrity" "sha512-bnmwnJDBDsOWBUP8E/BExWf85TsdDEFelQSzihSJm9VChVO1SHp94YXLP5BlA4j/OTxp0wR4R1Tje9OHOuAJVw==" "resolved" "https://registry.npmjs.org/ganache-cli/-/ganache-cli-6.12.2.tgz" "version" "6.12.2" @@ -5483,6 +5571,14 @@ dependencies: "assert-plus" "^1.0.0" +"ghost-testrpc@^0.0.2": + "integrity" "sha512-i08dAEgJ2g8z5buJIrCTduwPIhih3DP+hOCTyyryikfV8T0bNvHnGXO67i0DD1H4GBDETTclPy9njZbfluQYrQ==" + "resolved" "https://registry.npmjs.org/ghost-testrpc/-/ghost-testrpc-0.0.2.tgz" + "version" "0.0.2" + dependencies: + "chalk" "^2.4.2" + "node-emoji" "^1.10.0" + "github-from-package@0.0.0": "integrity" "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=" "resolved" "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz" @@ -5496,7 +5592,7 @@ "is-glob" "^3.1.0" "path-dirname" "^1.0.0" -"glob-parent@~5.1.0", "glob-parent@~5.1.2": +"glob-parent@^5.1.2", "glob-parent@~5.1.0", "glob-parent@~5.1.2": "integrity" "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==" "resolved" "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" "version" "5.1.2" @@ -5536,18 +5632,6 @@ "once" "^1.3.0" "path-is-absolute" "^1.0.0" -"glob@7.1.2": - "integrity" "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==" - "resolved" "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz" - "version" "7.1.2" - dependencies: - "fs.realpath" "^1.0.0" - "inflight" "^1.0.4" - "inherits" "2" - "minimatch" "^3.0.4" - "once" "^1.3.0" - "path-is-absolute" "^1.0.0" - "glob@7.1.3": "integrity" "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==" "resolved" "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz" @@ -5560,6 +5644,22 @@ "once" "^1.3.0" "path-is-absolute" "^1.0.0" +"global-modules@^2.0.0": + "integrity" "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==" + "resolved" "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz" + "version" "2.0.0" + dependencies: + "global-prefix" "^3.0.0" + +"global-prefix@^3.0.0": + "integrity" "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==" + "resolved" "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz" + "version" "3.0.0" + dependencies: + "ini" "^1.3.5" + "kind-of" "^6.0.2" + "which" "^1.3.1" + "global@~4.4.0": "integrity" "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==" "resolved" "https://registry.npmjs.org/global/-/global-4.4.0.tgz" @@ -5571,6 +5671,20 @@ "globals@^9.18.0": "version" "9.18.0" +"globby@^10.0.1": + "integrity" "sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg==" + "resolved" "https://registry.npmjs.org/globby/-/globby-10.0.2.tgz" + "version" "10.0.2" + dependencies: + "@types/glob" "^7.1.1" + "array-union" "^2.1.0" + "dir-glob" "^3.0.1" + "fast-glob" "^3.0.3" + "glob" "^7.1.3" + "ignore" "^5.1.1" + "merge2" "^1.2.3" + "slash" "^3.0.0" + "got@^7.1.0": "integrity" "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==" "resolved" "https://registry.npmjs.org/got/-/got-7.1.0.tgz" @@ -5613,11 +5727,6 @@ "resolved" "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz" "version" "4.2.6" -"growl@1.10.3": - "integrity" "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==" - "resolved" "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz" - "version" "1.10.3" - "growl@1.10.5": "integrity" "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==" "resolved" "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz" @@ -5653,10 +5762,10 @@ "resolved" "https://registry.npmjs.org/hardhat-deploy-ethers/-/hardhat-deploy-ethers-0.3.0-beta.11.tgz" "version" "0.3.0-beta.11" -"hardhat-deploy@^0.9.4": - "integrity" "sha512-0Zr8R5SAq6oK/gi170yCDqPTvKNPHdlm6wQe3ZQg/uiIDZxofpRM2frQVPUFlgdI2yUXtVcGBiPcC2r2fEockw==" - "resolved" "https://registry.npmjs.org/hardhat-deploy/-/hardhat-deploy-0.9.4.tgz" - "version" "0.9.4" +"hardhat-deploy@^0.9.14": + "integrity" "sha512-mCwXeXdqtrQN8dL1gOnoGUh0z9Jylfsh56UNVZJC0c8AhjlwjLPgGE3pzNmMuyy88pj9OX4qo53X57bW2W7NJQ==" + "resolved" "https://registry.npmjs.org/hardhat-deploy/-/hardhat-deploy-0.9.14.tgz" + "version" "0.9.14" dependencies: "@ethersproject/abi" "^5.4.0" "@ethersproject/abstract-signer" "^5.4.1" @@ -5681,10 +5790,10 @@ "murmur-128" "^0.2.1" "qs" "^6.9.4" -"hardhat-docgen@^1.1.2": - "integrity" "sha512-gN1UyqA4kYDm/rSMRUACT6rsh7Nw5EsKItxxJxctfNFEin1Pb56C3uUftCuffT282829ofDxbrUcREcvL9+d+A==" - "resolved" "https://registry.npmjs.org/hardhat-docgen/-/hardhat-docgen-1.1.2.tgz" - "version" "1.1.2" +"hardhat-docgen@^1.2.0": + "integrity" "sha512-HfNxJN+AgmqflAzlSrG3NajrmoVwJRVjRUwvKAwDu8oSToQqj0n8/6P2oUH4y5/r1l4FgDhx2DClAhw4+oDqIA==" + "resolved" "https://registry.npmjs.org/hardhat-docgen/-/hardhat-docgen-1.2.0.tgz" + "version" "1.2.0" dependencies: "css-loader" "^2.1.0" "html-webpack-plugin" "^3.2.0" @@ -5701,10 +5810,10 @@ dependencies: "chokidar" "^3.4.3" -"hardhat@^2.0.0", "hardhat@^2.0.10", "hardhat@^2.0.3", "hardhat@^2.0.4", "hardhat@^2.6.7": - "integrity" "sha512-Mua01f6ZN1feQLktHSH2p5A5LCdA+Wf7+O2lJDH6wClvWPtI2eqKNNY2gxBwYXoQ28GZrT3K6mqQOZeRWAca6Q==" - "resolved" "https://registry.npmjs.org/hardhat/-/hardhat-2.6.7.tgz" - "version" "2.6.7" +"hardhat@^2.0.0", "hardhat@^2.0.10", "hardhat@^2.0.3", "hardhat@^2.0.4", "hardhat@^2.7.0": + "integrity" "sha512-DqweY3KH5gwExoZ8EtsAfioj0Hk0NBXWXT3fMXWkiQNfyYBoZLrqdPNkbJ/E2LD4mZ+BKF7v/1chYR9ZCn2Z+g==" + "resolved" "https://registry.npmjs.org/hardhat/-/hardhat-2.7.0.tgz" + "version" "2.7.0" dependencies: "@ethereumjs/block" "^3.4.0" "@ethereumjs/blockchain" "^5.4.0" @@ -5751,7 +5860,7 @@ "stacktrace-parser" "^0.1.10" "true-case-path" "^2.2.1" "tsort" "0.0.1" - "uuid" "^3.3.2" + "uuid" "^8.3.2" "ws" "^7.4.6" "has-ansi@^2.0.0": @@ -5886,11 +5995,6 @@ "resolved" "https://registry.npmjs.org/he/-/he-1.2.0.tgz" "version" "1.2.0" -"he@1.1.1": - "integrity" "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=" - "resolved" "https://registry.npmjs.org/he/-/he-1.1.1.tgz" - "version" "1.1.1" - "header-case@^1.0.0": "integrity" "sha1-lTWXMZfBRLCWE81l0xfvGZY70C0=" "resolved" "https://registry.npmjs.org/header-case/-/header-case-1.0.1.tgz" @@ -6077,6 +6181,11 @@ "resolved" "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz" "version" "0.1.5" +"ignore@^5.1.1": + "integrity" "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==" + "resolved" "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz" + "version" "5.1.9" + "immediate@^3.2.3": "integrity" "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==" "resolved" "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz" @@ -6130,7 +6239,7 @@ "resolved" "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" "version" "2.0.3" -"ini@~1.3.0": +"ini@^1.3.5", "ini@~1.3.0": "integrity" "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" "resolved" "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz" "version" "1.3.8" @@ -6555,26 +6664,6 @@ "resolved" "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz" "version" "0.1.2" -"istanbul@^0.4.5": - "integrity" "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=" - "resolved" "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz" - "version" "0.4.5" - dependencies: - "abbrev" "1.0.x" - "async" "1.x" - "escodegen" "1.8.x" - "esprima" "2.7.x" - "glob" "^5.0.15" - "handlebars" "^4.0.1" - "js-yaml" "3.x" - "mkdirp" "0.5.x" - "nopt" "3.x" - "once" "1.x" - "resolve" "1.1.x" - "supports-color" "^3.1.0" - "which" "^1.1.1" - "wordwrap" "^1.0.0" - "isurl@^1.0.0-alpha5": "integrity" "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==" "resolved" "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz" @@ -6588,11 +6677,6 @@ "resolved" "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz" "version" "0.5.7" -"js-sha3@^0.6.1": - "integrity" "sha1-W4n3enR3Z5h39YxKB1JAk0sflcA=" - "resolved" "https://registry.npmjs.org/js-sha3/-/js-sha3-0.6.1.tgz" - "version" "0.6.1" - "js-sha3@^0.8.0", "js-sha3@0.8.0": "integrity" "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" "resolved" "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz" @@ -6739,6 +6823,11 @@ "jsonify@~0.0.0": "version" "0.0.0" +"jsonschema@^1.2.4": + "integrity" "sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw==" + "resolved" "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.0.tgz" + "version" "1.4.0" + "jsprim@^1.2.2": "integrity" "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=" "resolved" "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz" @@ -6757,14 +6846,6 @@ "node-addon-api" "^2.0.0" "node-gyp-build" "^4.2.0" -"keccakjs@^0.2.1": - "integrity" "sha512-BjLkNDcfaZ6l8HBG9tH0tpmDv3sS2mA7FNQxFHpCdzP3Gb2MVruXBSuoM66SnVxKJpAr5dKGdkHD+bDokt8fTg==" - "resolved" "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.3.tgz" - "version" "0.2.3" - dependencies: - "browserify-sha3" "^0.0.4" - "sha3" "^1.2.2" - "keyv@^3.0.0": "integrity" "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==" "resolved" "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz" @@ -7353,6 +7434,11 @@ dependencies: "source-map" "^0.6.1" +"merge2@^1.2.3", "merge2@^1.3.0": + "integrity" "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" + "resolved" "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz" + "version" "1.4.1" + "merkle-patricia-tree@^2.1.2", "merkle-patricia-tree@^2.3.2": "version" "2.3.2" dependencies: @@ -7421,6 +7507,14 @@ "braces" "^3.0.1" "picomatch" "^2.2.3" +"micromatch@^4.0.4": + "integrity" "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==" + "resolved" "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz" + "version" "4.0.4" + dependencies: + "braces" "^3.0.1" + "picomatch" "^2.2.3" + "miller-rabin@^4.0.0": "integrity" "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==" "resolved" "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz" @@ -7503,11 +7597,6 @@ "resolved" "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz" "version" "1.2.5" -"minimist@0.0.8": - "integrity" "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" - "resolved" "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz" - "version" "0.0.8" - "minipass@^2.6.0", "minipass@^2.8.6", "minipass@^2.9.0": "integrity" "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==" "resolved" "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz" @@ -7576,13 +7665,6 @@ "resolved" "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz" "version" "1.0.4" -"mkdirp@0.5.1": - "integrity" "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=" - "resolved" "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz" - "version" "0.5.1" - dependencies: - "minimist" "0.0.8" - "mnemonist@^0.38.0": "integrity" "sha512-2K9QYubXx/NAjv4VLq1d1Ly8pWNC5L3BrixtdkyTegXWJIqY+zLNDhhX/A+ZwWt70tB1S8H4BE8FLYEFyNoOBw==" "resolved" "https://registry.npmjs.org/mnemonist/-/mnemonist-0.38.3.tgz" @@ -7590,22 +7672,6 @@ dependencies: "obliterator" "^1.6.1" -"mocha@^4.1.0": - "integrity" "sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA==" - "resolved" "https://registry.npmjs.org/mocha/-/mocha-4.1.0.tgz" - "version" "4.1.0" - dependencies: - "browser-stdout" "1.3.0" - "commander" "2.11.0" - "debug" "3.1.0" - "diff" "3.3.1" - "escape-string-regexp" "1.0.5" - "glob" "7.1.2" - "growl" "1.10.3" - "he" "1.1.1" - "mkdirp" "0.5.1" - "supports-color" "4.4.0" - "mocha@^7.1.2": "integrity" "sha512-O9CIypScywTVpNaRrCAgoUnJgozpIofjKUYmJhiCIJMiuYnLI6otcb1/kpW9/n/tJODHGZ7i8aLQoDVsMtOKQQ==" "resolved" "https://registry.npmjs.org/mocha/-/mocha-7.2.0.tgz" @@ -7717,16 +7783,16 @@ "fmix" "^0.1.0" "imul" "^1.0.0" +"nan@^2.12.1": + "integrity" "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" + "resolved" "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz" + "version" "2.13.2" + "nan@^2.14.0": "integrity" "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==" "resolved" "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz" "version" "2.14.2" -"nan@2.13.2": - "integrity" "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" - "resolved" "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz" - "version" "2.13.2" - "nano-base32@^1.0.1": "integrity" "sha1-ulSMh578+5DaHE2eCX20pGySVe8=" "resolved" "https://registry.npmjs.org/nano-base32/-/nano-base32-1.0.1.tgz" @@ -7808,6 +7874,13 @@ "resolved" "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.0.2.tgz" "version" "3.0.2" +"node-emoji@^1.10.0": + "integrity" "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==" + "resolved" "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz" + "version" "1.11.0" + dependencies: + "lodash" "^4.17.21" + "node-environment-flags@1.0.6": "integrity" "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==" "resolved" "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz" @@ -8416,6 +8489,11 @@ dependencies: "pify" "^2.0.0" +"path-type@^4.0.0": + "integrity" "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" + "resolved" "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz" + "version" "4.0.0" + "pathval@^1.1.1": "integrity" "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==" "resolved" "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz" @@ -8432,11 +8510,6 @@ "safe-buffer" "^5.0.1" "sha.js" "^2.4.8" -"pegjs@^0.10.0": - "integrity" "sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0=" - "resolved" "https://registry.npmjs.org/pegjs/-/pegjs-0.10.0.tgz" - "version" "0.10.0" - "performance-now@^2.1.0": "integrity" "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" "resolved" "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz" @@ -8807,6 +8880,11 @@ "resolved" "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz" "version" "0.2.0" +"queue-microtask@^1.2.2": + "integrity" "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + "resolved" "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz" + "version" "1.2.3" + "randombytes@^2.0.0", "randombytes@^2.0.1", "randombytes@^2.0.5", "randombytes@^2.0.6", "randombytes@^2.1.0": "integrity" "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==" "resolved" "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz" @@ -8984,6 +9062,13 @@ dependencies: "resolve" "^1.1.6" +"recursive-readdir@^2.2.2": + "integrity" "sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg==" + "resolved" "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz" + "version" "2.2.2" + dependencies: + "minimatch" "3.0.4" + "regenerate@^1.2.1": "version" "1.4.2" @@ -9067,20 +9152,6 @@ dependencies: "is-finite" "^1.0.0" -"req-cwd@^1.0.1": - "integrity" "sha1-DXOurpJm5penj3l2AZZ352rPD/8=" - "resolved" "https://registry.npmjs.org/req-cwd/-/req-cwd-1.0.1.tgz" - "version" "1.0.1" - dependencies: - "req-from" "^1.0.1" - -"req-from@^1.0.1": - "integrity" "sha1-v4HaUUeUfTLRO5R9wSpYrUWHNQ4=" - "resolved" "https://registry.npmjs.org/req-from/-/req-from-1.0.1.tgz" - "version" "1.0.1" - dependencies: - "resolve-from" "^2.0.0" - "request@^2.79.0", "request@^2.85.0": "integrity" "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==" "resolved" "https://registry.npmjs.org/request/-/request-2.88.2.tgz" @@ -9132,11 +9203,6 @@ "resolved" "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz" "version" "2.0.0" -"resolve-from@^2.0.0": - "integrity" "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=" - "resolved" "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz" - "version" "2.0.0" - "resolve-url@^0.2.1": "integrity" "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=" "resolved" "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz" @@ -9176,6 +9242,11 @@ "resolved" "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz" "version" "0.1.15" +"reusify@^1.0.4": + "integrity" "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" + "resolved" "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz" + "version" "1.0.4" + "right-align@^0.1.1": "integrity" "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=" "resolved" "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz" @@ -9210,6 +9281,13 @@ dependencies: "bn.js" "^4.11.1" +"run-parallel@^1.1.9": + "integrity" "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==" + "resolved" "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz" + "version" "1.2.0" + dependencies: + "queue-microtask" "^1.2.2" + "run-queue@^1.0.0", "run-queue@^1.0.3": "integrity" "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=" "resolved" "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz" @@ -9266,6 +9344,26 @@ "resolved" "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz" "version" "2.1.2" +"sc-istanbul@^0.4.5": + "integrity" "sha512-qJFF/8tW/zJsbyfh/iT/ZM5QNHE3CXxtLJbZsL+CzdJLBsPD7SedJZoUA4d8iAcN2IoMp/Dx80shOOd2x96X/g==" + "resolved" "https://registry.npmjs.org/sc-istanbul/-/sc-istanbul-0.4.6.tgz" + "version" "0.4.6" + dependencies: + "abbrev" "1.0.x" + "async" "1.x" + "escodegen" "1.8.x" + "esprima" "2.7.x" + "glob" "^5.0.15" + "handlebars" "^4.0.1" + "js-yaml" "3.x" + "mkdirp" "0.5.x" + "nopt" "3.x" + "once" "1.x" + "resolve" "1.1.x" + "supports-color" "^3.1.0" + "which" "^1.1.1" + "wordwrap" "^1.0.0" + "schema-utils@^1.0.0": "integrity" "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==" "resolved" "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz" @@ -9453,13 +9551,6 @@ "inherits" "^2.0.1" "safe-buffer" "^5.0.1" -"sha3@^1.2.2": - "integrity" "sha512-KgLGmJGrmNB4JWVsAV11Yk6KbvsAiygWJc7t5IebWva/0NukNrjJqhtKhzy3Eiv2AKuGvhZZt7dt1mDo7HkoiQ==" - "resolved" "https://registry.npmjs.org/sha3/-/sha3-1.2.6.tgz" - "version" "1.2.6" - dependencies: - "nan" "2.13.2" - "sha3@^2.1.1": "integrity" "sha512-S8cNxbyb0UGUM2VhRD4Poe5N58gJnJsLJ5vC7FYWGUmGhcsj4++WaIOBFVDxlG0W3To6xBuiRh+i0Qp2oNCOtg==" "resolved" "https://registry.npmjs.org/sha3/-/sha3-2.1.4.tgz" @@ -9479,10 +9570,10 @@ "resolved" "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz" "version" "1.0.0" -"shelljs@^0.7.4": - "integrity" "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=" - "resolved" "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz" - "version" "0.7.8" +"shelljs@^0.8.3": + "integrity" "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==" + "resolved" "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz" + "version" "0.8.4" dependencies: "glob" "^7.0.0" "interpret" "^1.0.0" @@ -9575,11 +9666,6 @@ "source-map-resolve" "^0.5.0" "use" "^3.1.0" -"sol-explore@^1.6.2": - "integrity" "sha1-Q66MQZ/TrAVqBfip0fsQIs1B7MI=" - "resolved" "https://registry.npmjs.org/sol-explore/-/sol-explore-1.6.2.tgz" - "version" "1.6.2" - "solc@^0.4.20": "integrity" "sha512-o+c6FpkiHd+HPjmjEVpQgH7fqZ14tJpXhho+/bQXlXbliLIS/xjXb42Vxh+qQY1WCSTMQ0+a5vR9vi0MfhU6mA==" "resolved" "https://registry.npmjs.org/solc/-/solc-0.4.26.tgz" @@ -9605,13 +9691,13 @@ "semver" "^5.5.0" "tmp" "0.0.33" -"solc@^0.7.0": - "integrity" "sha512-WsR/W7CXwh2VnmZapB4JrsDeLlshoKBz5Pz/zYNulB6LBsOEHI2Zj/GeKLMFcvv57OHiXHvxq5ZOQB+EdqxlxQ==" - "resolved" "https://registry.npmjs.org/solc/-/solc-0.7.6.tgz" - "version" "0.7.6" +"solc@^0.8.10": + "integrity" "sha512-I/Mcn6J5bEtJqveNLplQm9IRrhemm6v+qkw5S2+wM4x9HItJ1sYdrqVTN3j4DMhFDM3ZbvM0QywVzpPx666PHw==" + "resolved" "https://registry.npmjs.org/solc/-/solc-0.8.10.tgz" + "version" "0.8.10" dependencies: "command-exists" "^1.2.8" - "commander" "3.0.2" + "commander" "^8.1.0" "follow-redirects" "^1.12.1" "fs-extra" "^0.30.0" "js-sha3" "0.8.0" @@ -9635,30 +9721,30 @@ "semver" "^5.5.0" "tmp" "0.0.33" -"solidity-coverage@0.5.11": - "integrity" "sha512-qikdsSi6+9XbfvwA0aI7HUVpF9fIFNqRWTw23M89GMDY+b6Gj0wWU9IngJS0fimoZIAdEp3bfChxvpfVcrUesg==" - "resolved" "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.5.11.tgz" - "version" "0.5.11" +"solidity-coverage@0.7.17": + "integrity" "sha512-Erw2hd2xdACAvDX8jUdYkmgJlIIazGznwDJA5dhRaw4def2SisXN9jUjneeyOZnl/E7j6D3XJYug4Zg9iwodsg==" + "resolved" "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.7.17.tgz" + "version" "0.7.17" dependencies: + "@solidity-parser/parser" "^0.13.2" + "@truffle/provider" "^0.2.24" + "chalk" "^2.4.2" "death" "^1.1.0" - "ethereumjs-testrpc-sc" "6.1.6" - "istanbul" "^0.4.5" - "keccakjs" "^0.2.1" - "req-cwd" "^1.0.1" - "shelljs" "^0.7.4" - "sol-explore" "^1.6.2" - "solidity-parser-sc" "0.4.11" - "tree-kill" "^1.2.0" - "web3" "^0.18.4" - -"solidity-parser-sc@0.4.11": - "integrity" "sha512-1kV5iC7m3CtMDfmHaVNwz2saSGQVIuF16rIxU417Al38MVCWHMQQ5vT6cmLsNwDe60S74auobWij9vNawSeOyw==" - "resolved" "https://registry.npmjs.org/solidity-parser-sc/-/solidity-parser-sc-0.4.11.tgz" - "version" "0.4.11" - dependencies: - "mocha" "^4.1.0" - "pegjs" "^0.10.0" - "yargs" "^4.6.0" + "detect-port" "^1.3.0" + "fs-extra" "^8.1.0" + "ganache-cli" "^6.12.2" + "ghost-testrpc" "^0.0.2" + "global-modules" "^2.0.0" + "globby" "^10.0.1" + "jsonschema" "^1.2.4" + "lodash" "^4.17.15" + "node-emoji" "^1.10.0" + "pify" "^4.0.1" + "recursive-readdir" "^2.2.2" + "sc-istanbul" "^0.4.5" + "semver" "^7.3.4" + "shelljs" "^0.8.3" + "web3-utils" "^1.3.0" "source-list-map@^2.0.0": "integrity" "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==" @@ -9681,7 +9767,7 @@ dependencies: "source-map" "^0.5.6" -"source-map-support@^0.5.13", "source-map-support@^0.5.3", "source-map-support@~0.5.12": +"source-map-support@^0.5.13", "source-map-support@~0.5.12": "integrity" "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==" "resolved" "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz" "version" "0.5.19" @@ -10009,13 +10095,6 @@ dependencies: "has-flag" "^4.0.0" -"supports-color@4.4.0": - "integrity" "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==" - "resolved" "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz" - "version" "4.4.0" - dependencies: - "has-flag" "^2.0.0" - "supports-color@6.0.0": "integrity" "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==" "resolved" "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz" @@ -10260,11 +10339,6 @@ "psl" "^1.1.28" "punycode" "^2.1.1" -"tree-kill@^1.2.0": - "integrity" "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==" - "resolved" "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz" - "version" "1.2.2" - "trim-right@^1.0.1": "version" "1.0.1" @@ -10424,7 +10498,7 @@ "ts-essentials" "^6.0.3" "ts-generator" "^0.1.1" -"typechain@^6.0.0": +"typechain@^6.0.0", "typechain@^6.0.4", "typechain@^6.0.5": "integrity" "sha512-Kr2rATu2Y7Y0wOC/I0zKuyLU8EEUpnuPGkiloZ65ACm4sSLFVF8Tnxn8LEUJSN93dX3RMu2DLF5fwRBOjNB+Gw==" "resolved" "https://registry.npmjs.org/typechain/-/typechain-6.0.5.tgz" "version" "6.0.5" @@ -10452,7 +10526,7 @@ "resolved" "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz" "version" "0.0.6" -"typescript@^4.3.4", "typescript@^4.5.2", "typescript@>=2.7", "typescript@>=3.7.0", "typescript@>=4.1.0": +"typescript@^4.3.4", "typescript@^4.5.2", "typescript@>=2.7", "typescript@>=3.7.0", "typescript@>=4.0.0", "typescript@>=4.1.0": "integrity" "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==" "resolved" "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz" "version" "4.5.2" @@ -10660,11 +10734,6 @@ dependencies: "node-gyp-build" "^4.2.0" -"utf8@^2.1.1": - "integrity" "sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY=" - "resolved" "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz" - "version" "2.1.2" - "utf8@^3.0.0", "utf8@3.0.0": "integrity" "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" "resolved" "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz" @@ -10744,6 +10813,11 @@ "resolved" "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz" "version" "3.4.0" +"uuid@^8.3.2": + "integrity" "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + "resolved" "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz" + "version" "8.3.2" + "uuid@2.0.1": "integrity" "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" "resolved" "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz" @@ -10868,10 +10942,10 @@ "got" "9.6.0" "swarm-js" "^0.1.40" -"web3-bzz@1.6.0": - "integrity" "sha512-ugYV6BsinwhIi0CsLWINBz4mqN9wR9vNG0WmyEbdECjxcPyr6vkaWt4qi0zqlUxEnYAwGj4EJXNrbjPILntQTQ==" - "resolved" "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.6.0.tgz" - "version" "1.6.0" +"web3-bzz@1.6.1": + "integrity" "sha512-JbnFNbRlwwHJZPtVuCxo7rC4U4OTg+mPsyhjgPQJJhS0a6Y54OgVWYk9UA/95HqbmTJwTtX329gJoSsseEfrng==" + "resolved" "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.6.1.tgz" + "version" "1.6.1" dependencies: "@types/node" "^12.12.6" "got" "9.6.0" @@ -10892,13 +10966,13 @@ "web3-eth-iban" "1.5.3" "web3-utils" "1.5.3" -"web3-core-helpers@1.6.0": - "integrity" "sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg==" - "resolved" "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz" - "version" "1.6.0" +"web3-core-helpers@1.6.1": + "integrity" "sha512-om2PZvK1uoWcgMq6JfcSx3241LEIVF6qi2JuHz2SLKiKEW5UsBUaVx0mNCmcZaiuYQCyOsLS3r33q5AdM+v8ng==" + "resolved" "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.6.1.tgz" + "version" "1.6.1" dependencies: - "web3-eth-iban" "1.6.0" - "web3-utils" "1.6.0" + "web3-eth-iban" "1.6.1" + "web3-utils" "1.6.1" "web3-core-method@1.2.11": "version" "1.2.11" @@ -10922,17 +10996,16 @@ "web3-core-subscriptions" "1.5.3" "web3-utils" "1.5.3" -"web3-core-method@1.6.0": - "integrity" "sha512-cHekyEil4mtcCOk6Q1Zh4y+2o5pTwsLIxP6Bpt4BRtZgdsyPiadYJpkLAVT/quch5xN7Qs5ZwG5AvRCS3VwD2g==" - "resolved" "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.6.0.tgz" - "version" "1.6.0" +"web3-core-method@1.6.1": + "integrity" "sha512-szH5KyIWIaULQDBdDvevQUCHV9lsExJ/oV0ePqK+w015D2SdMPMuhii0WB+HCePaksWO+rr/GAypvV9g2T3N+w==" + "resolved" "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.6.1.tgz" + "version" "1.6.1" dependencies: - "@ethereumjs/common" "^2.4.0" "@ethersproject/transactions" "^5.0.0-beta.135" - "web3-core-helpers" "1.6.0" - "web3-core-promievent" "1.6.0" - "web3-core-subscriptions" "1.6.0" - "web3-utils" "1.6.0" + "web3-core-helpers" "1.6.1" + "web3-core-promievent" "1.6.1" + "web3-core-subscriptions" "1.6.1" + "web3-utils" "1.6.1" "web3-core-promievent@1.2.11": "version" "1.2.11" @@ -10946,10 +11019,10 @@ dependencies: "eventemitter3" "4.0.4" -"web3-core-promievent@1.6.0": - "integrity" "sha512-ZzsevjMXWkhqW9dnVfTfb1OUcK7jKcKPvPIbQ4boJccNgvNZPZKlo8xB4pkAX38n4c59O5mC7Lt/z2QL/M5CeQ==" - "resolved" "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.6.0.tgz" - "version" "1.6.0" +"web3-core-promievent@1.6.1": + "integrity" "sha512-byJ5s2MQxrWdXd27pWFmujfzsTZK4ik8rDgIV1RFDFc+rHZ2nZhq+VWk7t/Nkrj7EaVXncEgTdPEHc18nx+ocQ==" + "resolved" "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.6.1.tgz" + "version" "1.6.1" dependencies: "eventemitter3" "4.0.4" @@ -10973,16 +11046,16 @@ "web3-providers-ipc" "1.5.3" "web3-providers-ws" "1.5.3" -"web3-core-requestmanager@1.6.0": - "integrity" "sha512-CY5paPdiDXKTXPWaEUZekDfUXSuoE2vPxolwqzsvKwFWH5+H1NaXgrc+D5HpufgSvTXawTw0fy7IAicg8+PWqA==" - "resolved" "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.6.0.tgz" - "version" "1.6.0" +"web3-core-requestmanager@1.6.1": + "integrity" "sha512-4y7etYEUtkfflyYVBfN1oJtCbVFNhNX1omlEYzezhTnPj3/dT7n+dhUXcqvIhx9iKA13unGfpFge80XNFfcB8A==" + "resolved" "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.6.1.tgz" + "version" "1.6.1" dependencies: "util" "^0.12.0" - "web3-core-helpers" "1.6.0" - "web3-providers-http" "1.6.0" - "web3-providers-ipc" "1.6.0" - "web3-providers-ws" "1.6.0" + "web3-core-helpers" "1.6.1" + "web3-providers-http" "1.6.1" + "web3-providers-ipc" "1.6.1" + "web3-providers-ws" "1.6.1" "web3-core-subscriptions@1.2.11": "version" "1.2.11" @@ -10999,13 +11072,13 @@ "eventemitter3" "4.0.4" "web3-core-helpers" "1.5.3" -"web3-core-subscriptions@1.6.0": - "integrity" "sha512-kY9WZUY/m1URSOv3uTLshoZD9ZDiFKReIzHuPUkxFpD5oYNmr1/aPQNPCrrMxKODR7UVX/D90FxWwCYqHhLaxQ==" - "resolved" "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.6.0.tgz" - "version" "1.6.0" +"web3-core-subscriptions@1.6.1": + "integrity" "sha512-WZwxsYttIojyGQ5RqxuQcKg0IJdDCFpUe4EncS3QKZwxPqWzGmgyLwE0rm7tP+Ux1waJn5CUaaoSCBxWGSun1g==" + "resolved" "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.6.1.tgz" + "version" "1.6.1" dependencies: "eventemitter3" "4.0.4" - "web3-core-helpers" "1.6.0" + "web3-core-helpers" "1.6.1" "web3-core@1.2.11": "version" "1.2.11" @@ -11031,18 +11104,18 @@ "web3-core-requestmanager" "1.5.3" "web3-utils" "1.5.3" -"web3-core@1.6.0": - "integrity" "sha512-o0WsLrJ2yD+HAAc29lGMWJef/MutTyuzpJC0UzLJtIAQJqtpDalzWINEu4j8XYXGk34N/V6vudtzRPo23QEE6g==" - "resolved" "https://registry.npmjs.org/web3-core/-/web3-core-1.6.0.tgz" - "version" "1.6.0" +"web3-core@1.6.1": + "integrity" "sha512-m+b7UfYvU5cQUAh6NRfxRzH/5B3to1AdEQi1HIQt570cDWlObOOmoO9tY6iJnI5w4acxIO19LqjDMqEJGBYyRQ==" + "resolved" "https://registry.npmjs.org/web3-core/-/web3-core-1.6.1.tgz" + "version" "1.6.1" dependencies: "@types/bn.js" "^4.11.5" "@types/node" "^12.12.6" "bignumber.js" "^9.0.0" - "web3-core-helpers" "1.6.0" - "web3-core-method" "1.6.0" - "web3-core-requestmanager" "1.6.0" - "web3-utils" "1.6.0" + "web3-core-helpers" "1.6.1" + "web3-core-method" "1.6.1" + "web3-core-requestmanager" "1.6.1" + "web3-utils" "1.6.1" "web3-eth-abi@1.2.11": "version" "1.2.11" @@ -11059,13 +11132,13 @@ "@ethersproject/abi" "5.0.7" "web3-utils" "1.5.3" -"web3-eth-abi@1.6.0": - "integrity" "sha512-fImomGE9McuTMJLwK8Tp0lTUzXqCkWeMm00qPVIwpJ/h7lCw9UFYV9+4m29wSqW6FF+FIZKwc6UBEf9dlx3orA==" - "resolved" "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.0.tgz" - "version" "1.6.0" +"web3-eth-abi@1.6.1": + "integrity" "sha512-svhYrAlXP9XQtV7poWKydwDJq2CaNLMtmKydNXoOBLcQec6yGMP+v20pgrxF2H6wyTK+Qy0E3/5ciPOqC/VuoQ==" + "resolved" "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.6.1.tgz" + "version" "1.6.1" dependencies: "@ethersproject/abi" "5.0.7" - "web3-utils" "1.6.0" + "web3-utils" "1.6.1" "web3-eth-accounts@1.2.11": "version" "1.2.11" @@ -11099,22 +11172,22 @@ "web3-core-method" "1.5.3" "web3-utils" "1.5.3" -"web3-eth-accounts@1.6.0": - "integrity" "sha512-2f6HS4KIH4laAsNCOfbNX3dRiQosqSY2TRK86C8jtAA/QKGdx+5qlPfYzbI2RjG81iayb2+mVbHIaEaBGZ8sGw==" - "resolved" "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.6.0.tgz" - "version" "1.6.0" +"web3-eth-accounts@1.6.1": + "integrity" "sha512-rGn3jwnuOKwaQRu4SiShz0YAQ87aVDBKs4HO43+XTCI1q1Y1jn3NOsG3BW9ZHaOckev4+zEyxze/Bsh2oEk24w==" + "resolved" "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.6.1.tgz" + "version" "1.6.1" dependencies: - "@ethereumjs/common" "^2.3.0" - "@ethereumjs/tx" "^3.2.1" + "@ethereumjs/common" "^2.5.0" + "@ethereumjs/tx" "^3.3.2" "crypto-browserify" "3.12.0" "eth-lib" "0.2.8" "ethereumjs-util" "^7.0.10" "scrypt-js" "^3.0.1" "uuid" "3.3.2" - "web3-core" "1.6.0" - "web3-core-helpers" "1.6.0" - "web3-core-method" "1.6.0" - "web3-utils" "1.6.0" + "web3-core" "1.6.1" + "web3-core-helpers" "1.6.1" + "web3-core-method" "1.6.1" + "web3-utils" "1.6.1" "web3-eth-contract@1.2.11": "version" "1.2.11" @@ -11143,19 +11216,19 @@ "web3-eth-abi" "1.5.3" "web3-utils" "1.5.3" -"web3-eth-contract@1.6.0": - "integrity" "sha512-ZUtO77zFnxuFtrc+D+iJ3AzNgFXAVcKnhEYN7f1PNz/mFjbtE6dJ+ujO0mvMbxIZF02t9IZv0CIXRpK0rDvZAw==" - "resolved" "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.6.0.tgz" - "version" "1.6.0" +"web3-eth-contract@1.6.1": + "integrity" "sha512-GXqTe3mF6kpbOAakiNc7wtJ120/gpuKMTZjuGFKeeY8aobRLfbfgKzM9IpyqVZV2v5RLuGXDuurVN2KPgtu3hQ==" + "resolved" "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.6.1.tgz" + "version" "1.6.1" dependencies: "@types/bn.js" "^4.11.5" - "web3-core" "1.6.0" - "web3-core-helpers" "1.6.0" - "web3-core-method" "1.6.0" - "web3-core-promievent" "1.6.0" - "web3-core-subscriptions" "1.6.0" - "web3-eth-abi" "1.6.0" - "web3-utils" "1.6.0" + "web3-core" "1.6.1" + "web3-core-helpers" "1.6.1" + "web3-core-method" "1.6.1" + "web3-core-promievent" "1.6.1" + "web3-core-subscriptions" "1.6.1" + "web3-eth-abi" "1.6.1" + "web3-utils" "1.6.1" "web3-eth-ens@1.2.11": "version" "1.2.11" @@ -11184,19 +11257,19 @@ "web3-eth-contract" "1.5.3" "web3-utils" "1.5.3" -"web3-eth-ens@1.6.0": - "integrity" "sha512-AG24PNv9qbYHSpjHcU2pViOII0jvIR7TeojJ2bxXSDqfcgHuRp3NZGKv6xFvT4uNI4LEQHUhSC7bzHoNF5t8CA==" - "resolved" "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.6.0.tgz" - "version" "1.6.0" +"web3-eth-ens@1.6.1": + "integrity" "sha512-ngprtbnoRgxg8s1wXt9nXpD3h1P+p7XnKXrp/8GdFI9uDmrbSQPRfzBw86jdZgOmy78hAnWmrHI6pBInmgi2qQ==" + "resolved" "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.6.1.tgz" + "version" "1.6.1" dependencies: "content-hash" "^2.5.2" "eth-ens-namehash" "2.0.8" - "web3-core" "1.6.0" - "web3-core-helpers" "1.6.0" - "web3-core-promievent" "1.6.0" - "web3-eth-abi" "1.6.0" - "web3-eth-contract" "1.6.0" - "web3-utils" "1.6.0" + "web3-core" "1.6.1" + "web3-core-helpers" "1.6.1" + "web3-core-promievent" "1.6.1" + "web3-eth-abi" "1.6.1" + "web3-eth-contract" "1.6.1" + "web3-utils" "1.6.1" "web3-eth-iban@1.2.11": "version" "1.2.11" @@ -11212,13 +11285,13 @@ "bn.js" "^4.11.9" "web3-utils" "1.5.3" -"web3-eth-iban@1.6.0": - "integrity" "sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw==" - "resolved" "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz" - "version" "1.6.0" +"web3-eth-iban@1.6.1": + "integrity" "sha512-91H0jXZnWlOoXmc13O9NuQzcjThnWyAHyDn5Yf7u6mmKOhpJSGF/OHlkbpXt1Y4v2eJdEPaVFa+6i8aRyagE7Q==" + "resolved" "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.6.1.tgz" + "version" "1.6.1" dependencies: "bn.js" "^4.11.9" - "web3-utils" "1.6.0" + "web3-utils" "1.6.1" "web3-eth-personal@1.2.11": "version" "1.2.11" @@ -11242,17 +11315,17 @@ "web3-net" "1.5.3" "web3-utils" "1.5.3" -"web3-eth-personal@1.6.0": - "integrity" "sha512-8ohf4qAwbShf4RwES2tLHVqa+pHZnS5Q6tV80sU//bivmlZeyO1W4UWyNn59vu9KPpEYvLseOOC6Muxuvr8mFQ==" - "resolved" "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.6.0.tgz" - "version" "1.6.0" +"web3-eth-personal@1.6.1": + "integrity" "sha512-ItsC89Ln02+irzJjK6ALcLrMZfbVUCqVbmb/ieDKJ+eLW3pNkBNwoUzaydh92d5NzxNZgNxuQWVdlFyYX2hkEw==" + "resolved" "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.6.1.tgz" + "version" "1.6.1" dependencies: "@types/node" "^12.12.6" - "web3-core" "1.6.0" - "web3-core-helpers" "1.6.0" - "web3-core-method" "1.6.0" - "web3-net" "1.6.0" - "web3-utils" "1.6.0" + "web3-core" "1.6.1" + "web3-core-helpers" "1.6.1" + "web3-core-method" "1.6.1" + "web3-net" "1.6.1" + "web3-utils" "1.6.1" "web3-eth@1.2.11": "version" "1.2.11" @@ -11289,23 +11362,23 @@ "web3-net" "1.5.3" "web3-utils" "1.5.3" -"web3-eth@1.6.0": - "integrity" "sha512-qJMvai//r0be6I9ghU24/152f0zgJfYC23TMszN3Y6jse1JtjCBP2TlTibFcvkUN1RRdIUY5giqO7ZqAYAmp7w==" - "resolved" "https://registry.npmjs.org/web3-eth/-/web3-eth-1.6.0.tgz" - "version" "1.6.0" +"web3-eth@1.6.1": + "integrity" "sha512-kOV1ZgCKypSo5BQyltRArS7ZC3bRpIKAxSgzl7pUFinUb/MxfbM9KGeNxUXoCfTSErcCQJaDjcS6bSre5EMKuQ==" + "resolved" "https://registry.npmjs.org/web3-eth/-/web3-eth-1.6.1.tgz" + "version" "1.6.1" dependencies: - "web3-core" "1.6.0" - "web3-core-helpers" "1.6.0" - "web3-core-method" "1.6.0" - "web3-core-subscriptions" "1.6.0" - "web3-eth-abi" "1.6.0" - "web3-eth-accounts" "1.6.0" - "web3-eth-contract" "1.6.0" - "web3-eth-ens" "1.6.0" - "web3-eth-iban" "1.6.0" - "web3-eth-personal" "1.6.0" - "web3-net" "1.6.0" - "web3-utils" "1.6.0" + "web3-core" "1.6.1" + "web3-core-helpers" "1.6.1" + "web3-core-method" "1.6.1" + "web3-core-subscriptions" "1.6.1" + "web3-eth-abi" "1.6.1" + "web3-eth-accounts" "1.6.1" + "web3-eth-contract" "1.6.1" + "web3-eth-ens" "1.6.1" + "web3-eth-iban" "1.6.1" + "web3-eth-personal" "1.6.1" + "web3-net" "1.6.1" + "web3-utils" "1.6.1" "web3-net@1.2.11": "version" "1.2.11" @@ -11323,14 +11396,14 @@ "web3-core-method" "1.5.3" "web3-utils" "1.5.3" -"web3-net@1.6.0": - "integrity" "sha512-LFfG95ovTT2sNHkO1TEfsaKpYcxOSUtbuwHQ0K3G0e5nevKDJkPEFIqIcob40yiwcWoqEjENJP9Bjk8CRrZ99Q==" - "resolved" "https://registry.npmjs.org/web3-net/-/web3-net-1.6.0.tgz" - "version" "1.6.0" +"web3-net@1.6.1": + "integrity" "sha512-gpnqKEIwfUHh5ik7wsQFlCje1DfcmGv+Sk7LCh1hCqn++HEDQxJ/mZCrMo11ZZpZHCH7c87imdxTg96GJnRxDw==" + "resolved" "https://registry.npmjs.org/web3-net/-/web3-net-1.6.1.tgz" + "version" "1.6.1" dependencies: - "web3-core" "1.6.0" - "web3-core-method" "1.6.0" - "web3-utils" "1.6.0" + "web3-core" "1.6.1" + "web3-core-method" "1.6.1" + "web3-utils" "1.6.1" "web3-provider-engine@14.2.1": "version" "14.2.1" @@ -11370,12 +11443,12 @@ "web3-core-helpers" "1.5.3" "xhr2-cookies" "1.1.0" -"web3-providers-http@1.6.0": - "integrity" "sha512-sNxHFNv3lnxpmULt34AS6M36IYB/Hzm2Et4yPNzdP1XE644D8sQBZQZaJQdTaza5HfrlwoqU6AOK935armqGuA==" - "resolved" "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.6.0.tgz" - "version" "1.6.0" +"web3-providers-http@1.6.1": + "integrity" "sha512-xBoKOJxu10+kO3ikamXmBfrWZ/xpQOGy0ocdp7Y81B17En5TXELwlmMXt1UlIgWiyYDhjq4OwlH/VODYqHXy3A==" + "resolved" "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.6.1.tgz" + "version" "1.6.1" dependencies: - "web3-core-helpers" "1.6.0" + "web3-core-helpers" "1.6.1" "xhr2-cookies" "1.1.0" "web3-providers-ipc@1.2.11": @@ -11393,13 +11466,13 @@ "oboe" "2.1.5" "web3-core-helpers" "1.5.3" -"web3-providers-ipc@1.6.0": - "integrity" "sha512-ETYdfhpGiGoWpmmSJnONvnPfd3TPivHEGjXyuX+L5FUsbMOVZj9MFLNIS19Cx/YGL8UWJ/8alLJoTcWSIdz/aA==" - "resolved" "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.6.0.tgz" - "version" "1.6.0" +"web3-providers-ipc@1.6.1": + "integrity" "sha512-anyoIZlpMzwEQI4lwylTzDrHsVp20v0QUtSTp2B5jInBinmQtyCE7vnbX20jEQ4j5uPwfJabKNtoJsk6a3O4WQ==" + "resolved" "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.6.1.tgz" + "version" "1.6.1" dependencies: "oboe" "2.1.5" - "web3-core-helpers" "1.6.0" + "web3-core-helpers" "1.6.1" "web3-providers-ws@1.2.11": "version" "1.2.11" @@ -11418,13 +11491,13 @@ "web3-core-helpers" "1.5.3" "websocket" "^1.0.32" -"web3-providers-ws@1.6.0": - "integrity" "sha512-eNRmlhOPCpuVYwBrKBBQRLGPFb4U1Uo44r9EWV69Cpo4gP6XeBTl6nkawhLz6DS0fq79apyPfItJVuSfAy77pA==" - "resolved" "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.6.0.tgz" - "version" "1.6.0" +"web3-providers-ws@1.6.1": + "integrity" "sha512-FWMEFYb4rYFYRgSFBf/O1Ex4p/YKSlN+JydCtdlJwRimd89qm95CTfs4xGjCskwvXMjV2sarH+f1NPwJXicYpg==" + "resolved" "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.6.1.tgz" + "version" "1.6.1" dependencies: "eventemitter3" "4.0.4" - "web3-core-helpers" "1.6.0" + "web3-core-helpers" "1.6.1" "websocket" "^1.0.32" "web3-shh@1.2.11": @@ -11445,20 +11518,20 @@ "web3-core-subscriptions" "1.5.3" "web3-net" "1.5.3" -"web3-shh@1.6.0": - "integrity" "sha512-ymN0OFL81WtEeSyb+PFpuUv39fR3frGwsZnIg5EVPZvrOIdaDSFcGSLDmafUt0vKSubvLMVYIBOCskRD6YdtEQ==" - "resolved" "https://registry.npmjs.org/web3-shh/-/web3-shh-1.6.0.tgz" - "version" "1.6.0" +"web3-shh@1.6.1": + "integrity" "sha512-oP00HbAtybLCGlLOZUYXOdeB9xq88k2l0TtStvKBtmFqRt+zVk5TxEeuOnVPRxNhcA2Un8RUw6FtvgZlWStu9A==" + "resolved" "https://registry.npmjs.org/web3-shh/-/web3-shh-1.6.1.tgz" + "version" "1.6.1" dependencies: - "web3-core" "1.6.0" - "web3-core-method" "1.6.0" - "web3-core-subscriptions" "1.6.0" - "web3-net" "1.6.0" + "web3-core" "1.6.1" + "web3-core-method" "1.6.1" + "web3-core-subscriptions" "1.6.1" + "web3-net" "1.6.1" -"web3-utils@^1.0.0-beta.31", "web3-utils@^1.2.5", "web3-utils@1.6.0": - "integrity" "sha512-bgCAWAeQnJF035YTFxrcHJ5mGEfTi/McsjqldZiXRwlHK7L1PyOqvXiQLE053dlzvy1kdAxWl/sSSfLMyNUAXg==" - "resolved" "https://registry.npmjs.org/web3-utils/-/web3-utils-1.6.0.tgz" - "version" "1.6.0" +"web3-utils@^1.0.0-beta.31", "web3-utils@^1.2.5", "web3-utils@^1.3.0", "web3-utils@1.6.1": + "integrity" "sha512-RidGKv5kOkcerI6jQqDFDoTllQQqV+rPhTzZHhmbqtFObbYpU93uc+yG1LHivRTQhA6llIx67iudc/vzisgO+w==" + "resolved" "https://registry.npmjs.org/web3-utils/-/web3-utils-1.6.1.tgz" + "version" "1.6.1" dependencies: "bn.js" "^4.11.9" "ethereum-bloom-filters" "^1.0.6" @@ -11493,29 +11566,18 @@ "randombytes" "^2.1.0" "utf8" "3.0.0" -"web3@^0.18.4": - "integrity" "sha1-gewXhBRUkfLqqJVbMcBgSeB8Xn0=" - "resolved" "https://registry.npmjs.org/web3/-/web3-0.18.4.tgz" - "version" "0.18.4" +"web3@^1.0.0-beta.36", "web3@^1.2.5", "web3@^1.6.1": + "integrity" "sha512-c299lLiyb2/WOcxh7TinwvbATaMmrgNIeAzbLbmOKHI0LcwyfsB1eu2ReOIrfrCYDYRW2KAjYr7J7gHawqDNPQ==" + "resolved" "https://registry.npmjs.org/web3/-/web3-1.6.1.tgz" + "version" "1.6.1" dependencies: - "bignumber.js" "git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2" - "crypto-js" "^3.1.4" - "utf8" "^2.1.1" - "xhr2" "*" - "xmlhttprequest" "*" - -"web3@^1.0.0-beta.36", "web3@^1.2.5", "web3@^1.5.2": - "integrity" "sha512-rWpXnO88MiVX5yTRqMBCVKASxc7QDkXZZUl1D48sKlbX4dt3BAV+nVMVUKCBKiluZ5Bp8pDrVCUdPx/jIYai5Q==" - "resolved" "https://registry.npmjs.org/web3/-/web3-1.6.0.tgz" - "version" "1.6.0" - dependencies: - "web3-bzz" "1.6.0" - "web3-core" "1.6.0" - "web3-eth" "1.6.0" - "web3-eth-personal" "1.6.0" - "web3-net" "1.6.0" - "web3-shh" "1.6.0" - "web3-utils" "1.6.0" + "web3-bzz" "1.6.1" + "web3-core" "1.6.1" + "web3-eth" "1.6.1" + "web3-eth-personal" "1.6.1" + "web3-net" "1.6.1" + "web3-shh" "1.6.1" + "web3-utils" "1.6.1" "web3@1.2.11": "version" "1.2.11" @@ -11669,7 +11731,7 @@ "has-tostringtag" "^1.0.0" "is-typed-array" "^1.1.7" -"which@^1.1.1", "which@^1.2.9", "which@1.3.1": +"which@^1.1.1", "which@^1.2.9", "which@^1.3.1", "which@1.3.1": "integrity" "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==" "resolved" "https://registry.npmjs.org/which/-/which-1.3.1.tgz" "version" "1.3.1" @@ -11793,12 +11855,7 @@ dependencies: "cookiejar" "^2.1.1" -"xhr2@*": - "integrity" "sha512-sID0rrVCqkVNUn8t6xuv9+6FViXjUVXq8H5rWOH2rz9fDNQEd4g0EA2XlcEdJXRz5BMEn4O1pJFdT+z4YHhoWw==" - "resolved" "https://registry.npmjs.org/xhr2/-/xhr2-0.2.1.tgz" - "version" "0.2.1" - -"xmlhttprequest@*", "xmlhttprequest@1.8.0": +"xmlhttprequest@1.8.0": "integrity" "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" "resolved" "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz" "version" "1.8.0" @@ -11899,26 +11956,6 @@ "y18n" "^4.0.0" "yargs-parser" "^13.1.2" -"yargs@^4.6.0": - "integrity" "sha1-wMQpJMpKqmsObaFznfshZDn53cA=" - "resolved" "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz" - "version" "4.8.1" - dependencies: - "cliui" "^3.2.0" - "decamelize" "^1.1.1" - "get-caller-file" "^1.0.1" - "lodash.assign" "^4.0.3" - "os-locale" "^1.4.0" - "read-pkg-up" "^1.0.1" - "require-directory" "^2.1.1" - "require-main-filename" "^1.0.1" - "set-blocking" "^2.0.0" - "string-width" "^1.0.1" - "which-module" "^1.0.0" - "window-size" "^0.2.0" - "y18n" "^3.2.1" - "yargs-parser" "^2.4.1" - "yargs@^4.7.1": "integrity" "sha1-wMQpJMpKqmsObaFznfshZDn53cA=" "resolved" "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz" From c2dfae64387c8fb4ab249fb34a5b021b0e7f1000 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Mon, 6 Dec 2021 01:34:41 +0530 Subject: [PATCH 13/39] refactored scripts/* --- scripts/tests/buildDSAv2.ts | 14 ++++++++-- scripts/tests/deployAndEnableConnector.ts | 13 ++++++++-- scripts/tests/getMasterSigner.ts | 12 +++++++-- scripts/tests/mainnet/addresses.ts | 11 ++++++++ scripts/tests/mainnet/constant.ts | 6 +++++ scripts/tests/mainnet/tokens.ts | 23 ++++++++++++++++ .../addresses.ts => addressesPolygon.ts} | 2 +- scripts/tests/polygon/buildDSAv2.ts | 19 -------------- .../tests/polygon/{constant => }/constant.ts | 0 .../tests/polygon/deployAndEnableConnector.ts | 26 ------------------- scripts/tests/polygon/encodeSpells.ts | 17 ------------ scripts/tests/polygon/getMasterSigner.ts | 24 ----------------- .../tests/polygon/{constant => }/tokens.ts | 0 13 files changed, 74 insertions(+), 93 deletions(-) create mode 100644 scripts/tests/mainnet/addresses.ts create mode 100644 scripts/tests/mainnet/constant.ts create mode 100644 scripts/tests/mainnet/tokens.ts rename scripts/tests/polygon/{constant/addresses.ts => addressesPolygon.ts} (89%) delete mode 100644 scripts/tests/polygon/buildDSAv2.ts rename scripts/tests/polygon/{constant => }/constant.ts (100%) delete mode 100644 scripts/tests/polygon/deployAndEnableConnector.ts delete mode 100644 scripts/tests/polygon/encodeSpells.ts delete mode 100644 scripts/tests/polygon/getMasterSigner.ts rename scripts/tests/polygon/{constant => }/tokens.ts (100%) diff --git a/scripts/tests/buildDSAv2.ts b/scripts/tests/buildDSAv2.ts index 0820b14e..aa97a026 100644 --- a/scripts/tests/buildDSAv2.ts +++ b/scripts/tests/buildDSAv2.ts @@ -1,13 +1,23 @@ import { ethers } from "hardhat"; -import { addresses } from "../constant/addresses"; +const network = String(process.env.networkType); + +import { addressesPolygon } from "./polygon/addressesPolygon"; +import { addresses } from "./mainnet/addresses"; import { abis } from "../constant/abis"; import { abi } from "../../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json"; +function getAddress(network: string | undefined) { + if (network === "polygon") return addressesPolygon.core.instaIndex; + // else if (network === "arbitrum") return addressesPolygon.core.instaIndex; + // else if (network === "avalanche") return addressesPolygon.core.instaIndex; + else return addresses.core.instaIndex; +} + export async function buildDSAv2(owner: any) { const instaIndex = await ethers.getContractAt( abis.core.instaIndex, - addresses.core.instaIndex + getAddress(String(process.env.networkType)) ); const tx = await instaIndex.build(owner, 2, owner); diff --git a/scripts/tests/deployAndEnableConnector.ts b/scripts/tests/deployAndEnableConnector.ts index 362277f2..3c60a814 100644 --- a/scripts/tests/deployAndEnableConnector.ts +++ b/scripts/tests/deployAndEnableConnector.ts @@ -1,4 +1,5 @@ -import { addresses } from "../constant/addresses"; +import { addressesPolygon } from "./polygon/addressesPolygon"; +import { addresses } from "./mainnet/addresses"; import { abis } from "../constant/abis"; // const { deployContract } = waffle; @@ -6,6 +7,13 @@ import { abis } from "../constant/abis"; // import { promises as fs } from "fs"; // import { deployContract } from "ethereum-waffle"; +function getAddress(network: string | undefined) { + if (network === "polygon") return addressesPolygon; + // else if (network === "arbitrum") return addressesPolygon; + // else if (network === "avalanche") return addressesPolygon; + else return addresses; +} + export async function deployAndEnableConnector({ connectorName, contractArtifact, @@ -19,7 +27,8 @@ export async function deployAndEnableConnector({ .connect(signer) .addConnectors([connectorName], [connectorInstanace.address]); - addresses.connectors[connectorName] = connectorInstanace.address; + getAddress(String(process.env.networkType)).connectors[connectorName] = + connectorInstanace.address; abis.connectors[connectorName] = contractArtifact.abi; return connectorInstanace; diff --git a/scripts/tests/getMasterSigner.ts b/scripts/tests/getMasterSigner.ts index 59f59afb..b6f2bef7 100644 --- a/scripts/tests/getMasterSigner.ts +++ b/scripts/tests/getMasterSigner.ts @@ -1,11 +1,19 @@ import { ethers, network } from "hardhat"; -import { addresses } from "../constant/addresses"; +import { addressesPolygon } from "./polygon/addressesPolygon"; +import { addresses } from "./mainnet/addresses"; import { abis } from "../constant/abis"; +function getAddress(network: string | undefined) { + if (network === "polygon") return addressesPolygon.core.instaIndex; + // else if (network === "arbitrum") return addressesPolygon.core.instaIndex; + // else if (network === "avalanche") return addressesPolygon.core.instaIndex; + else return addresses.core.instaIndex; +} + export async function getMasterSigner() { const [_, __, ___, wallet3] = await ethers.getSigners(); const instaIndex = new ethers.Contract( - addresses.core.instaIndex, + getAddress(String(process.env.networkType)), abis.core.instaIndex, wallet3 ); diff --git a/scripts/tests/mainnet/addresses.ts b/scripts/tests/mainnet/addresses.ts new file mode 100644 index 00000000..28b6afec --- /dev/null +++ b/scripts/tests/mainnet/addresses.ts @@ -0,0 +1,11 @@ +export const addresses = { + connectors: { + basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6", + auth: "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9", + "INSTAPOOL-A": "0x5806af7ab22e2916fa582ff05731bf7c682387b2", + }, + core: { + connectorsV2: "0x97b0B3A8bDeFE8cB9563a3c610019Ad10DB8aD11", + instaIndex: "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723", + }, +}; diff --git a/scripts/tests/mainnet/constant.ts b/scripts/tests/mainnet/constant.ts new file mode 100644 index 00000000..9e659d77 --- /dev/null +++ b/scripts/tests/mainnet/constant.ts @@ -0,0 +1,6 @@ +export const constants = { + address_zero: "0x0000000000000000000000000000000000000000", + native_address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", + max_value: + "115792089237316195423570985008687907853269984665640564039457584007913129639935", +}; diff --git a/scripts/tests/mainnet/tokens.ts b/scripts/tests/mainnet/tokens.ts new file mode 100644 index 00000000..d3c95180 --- /dev/null +++ b/scripts/tests/mainnet/tokens.ts @@ -0,0 +1,23 @@ +export const tokens = { + eth: { + type: "token", + symbol: "ETH", + name: "Ethereum", + address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + decimals: 18, + }, + dai: { + type: "token", + symbol: "DAI", + name: "DAI Stable", + address: "0x6B175474E89094C44Da98b954EedeAC495271d0F", + decimals: 18, + }, + usdc: { + type: "token", + symbol: "USDC", + name: "USD Coin", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + decimals: 6, + }, +}; diff --git a/scripts/tests/polygon/constant/addresses.ts b/scripts/tests/polygon/addressesPolygon.ts similarity index 89% rename from scripts/tests/polygon/constant/addresses.ts rename to scripts/tests/polygon/addressesPolygon.ts index d60133c0..2ad864c3 100644 --- a/scripts/tests/polygon/constant/addresses.ts +++ b/scripts/tests/polygon/addressesPolygon.ts @@ -1,4 +1,4 @@ -export const addresses = { +export const addressesPolygon = { connectors: { basic: "0x1cAF5EC802ca602E98139AD96A8f2B7BC524264E", auth: "0xf6474aD0dA75A0dE15D2c915e601D9f754B9e6fe", diff --git a/scripts/tests/polygon/buildDSAv2.ts b/scripts/tests/polygon/buildDSAv2.ts deleted file mode 100644 index 3c7b81f7..00000000 --- a/scripts/tests/polygon/buildDSAv2.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { ethers } from "hardhat"; - -import { addresses } from "./constant/addresses"; -import { abis } from "../../constant/abis"; -import { abi } from "../../../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json"; - -module.exports = async function(owner: any) { - const instaIndex = await ethers.getContractAt( - abis.core.instaIndex, - addresses.core.instaIndex - ); - - const tx = await instaIndex.build(owner, 2, owner); - const receipt = await tx.wait(); - const event = receipt.events.find( - (a: { event: string }) => a.event === "LogAccountCreated" - ); - return await ethers.getContractAt(abi, event.args.account); -}; diff --git a/scripts/tests/polygon/constant/constant.ts b/scripts/tests/polygon/constant.ts similarity index 100% rename from scripts/tests/polygon/constant/constant.ts rename to scripts/tests/polygon/constant.ts diff --git a/scripts/tests/polygon/deployAndEnableConnector.ts b/scripts/tests/polygon/deployAndEnableConnector.ts deleted file mode 100644 index 355da3ac..00000000 --- a/scripts/tests/polygon/deployAndEnableConnector.ts +++ /dev/null @@ -1,26 +0,0 @@ -import "@nomiclabs/hardhat-waffle"; - -import { addresses } from "./constant/addresses"; -import { abis } from "../../constant/abis"; - -import * as hre from "hardhat"; -const { ethers, waffle } = hre; -const { deployContract } = waffle; - -module.exports = async function({ - connectorName, - contractArtifact, - signer, - connectors, -}) { - const connectorInstanace = await deployContract(signer, contractArtifact, []); - - await connectors - .connect(signer) - .addConnectors([connectorName], [connectorInstanace.address]); - - addresses.connectors[connectorName] = connectorInstanace.address; - abis.connectors[connectorName] = contractArtifact.abi; - - return connectorInstanace; -}; diff --git a/scripts/tests/polygon/encodeSpells.ts b/scripts/tests/polygon/encodeSpells.ts deleted file mode 100644 index d35b4277..00000000 --- a/scripts/tests/polygon/encodeSpells.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { abis } from "../../constant/abis"; -import { web3 } from "hardhat"; - -export function encodeSpells(spells: any[]) { - const targets = spells.map((a) => a.connector); - const calldatas = spells.map((a) => { - const functionName = a.method; - // console.log(functionName) - const abi = abis.connectors[a.connector].find((b: { name: any }) => { - return b.name === functionName; - }); - // console.log(functionName) - if (!abi) throw new Error("Couldn't find function"); - return web3.eth.abi.encodeFunctionCall(abi, a.args); - }); - return [targets, calldatas]; -} diff --git a/scripts/tests/polygon/getMasterSigner.ts b/scripts/tests/polygon/getMasterSigner.ts deleted file mode 100644 index 43cf5e12..00000000 --- a/scripts/tests/polygon/getMasterSigner.ts +++ /dev/null @@ -1,24 +0,0 @@ -const { ethers, network } = "hardhat"; -import { addresses } from "./constant/addresses"; -import { abis } from "../../constant/abis"; - -module.exports = async function() { - const [_, __, ___, wallet3] = await ethers.getSigners(); - const instaIndex = new ethers.Contract( - addresses.core.instaIndex, - abis.core.instaIndex, - wallet3 - ); - - const masterAddress = await instaIndex.master(); // TODO: make it constant? - await network.provider.request({ - method: "hardhat_impersonateAccount", - params: [masterAddress], - }); - await wallet3.sendTransaction({ - to: masterAddress, - value: ethers.utils.parseEther("10"), - }); - - return await ethers.getSigner(masterAddress); -}; diff --git a/scripts/tests/polygon/constant/tokens.ts b/scripts/tests/polygon/tokens.ts similarity index 100% rename from scripts/tests/polygon/constant/tokens.ts rename to scripts/tests/polygon/tokens.ts From 343a58604583e12a3f60287b1d0749c226546b44 Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Mon, 6 Dec 2021 01:41:21 +0530 Subject: [PATCH 14/39] minor change --- scripts/tests/getMasterSigner.ts | 2 +- scripts/tests/polygon/{addressesPolygon.ts => addresses.ts} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename scripts/tests/polygon/{addressesPolygon.ts => addresses.ts} (89%) diff --git a/scripts/tests/getMasterSigner.ts b/scripts/tests/getMasterSigner.ts index b6f2bef7..794bb4be 100644 --- a/scripts/tests/getMasterSigner.ts +++ b/scripts/tests/getMasterSigner.ts @@ -1,6 +1,6 @@ import { ethers, network } from "hardhat"; -import { addressesPolygon } from "./polygon/addressesPolygon"; import { addresses } from "./mainnet/addresses"; +import { addresses as addressesPolygon } from "./polygon/addresses"; import { abis } from "../constant/abis"; function getAddress(network: string | undefined) { diff --git a/scripts/tests/polygon/addressesPolygon.ts b/scripts/tests/polygon/addresses.ts similarity index 89% rename from scripts/tests/polygon/addressesPolygon.ts rename to scripts/tests/polygon/addresses.ts index 2ad864c3..d60133c0 100644 --- a/scripts/tests/polygon/addressesPolygon.ts +++ b/scripts/tests/polygon/addresses.ts @@ -1,4 +1,4 @@ -export const addressesPolygon = { +export const addresses = { connectors: { basic: "0x1cAF5EC802ca602E98139AD96A8f2B7BC524264E", auth: "0xf6474aD0dA75A0dE15D2c915e601D9f754B9e6fe", From a4c6b685c7e3a41f7826870c95d6718aba45289d Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Mon, 6 Dec 2021 01:45:02 +0530 Subject: [PATCH 15/39] update --- scripts/tests/buildDSAv2.ts | 2 +- scripts/tests/deployAndEnableConnector.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/tests/buildDSAv2.ts b/scripts/tests/buildDSAv2.ts index aa97a026..79c74ebb 100644 --- a/scripts/tests/buildDSAv2.ts +++ b/scripts/tests/buildDSAv2.ts @@ -2,7 +2,7 @@ import { ethers } from "hardhat"; const network = String(process.env.networkType); -import { addressesPolygon } from "./polygon/addressesPolygon"; +import { addresses as addressesPolygon } from "./polygon/addresses"; import { addresses } from "./mainnet/addresses"; import { abis } from "../constant/abis"; import { abi } from "../../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json"; diff --git a/scripts/tests/deployAndEnableConnector.ts b/scripts/tests/deployAndEnableConnector.ts index 3c60a814..856164d6 100644 --- a/scripts/tests/deployAndEnableConnector.ts +++ b/scripts/tests/deployAndEnableConnector.ts @@ -1,4 +1,4 @@ -import { addressesPolygon } from "./polygon/addressesPolygon"; +import { addresses as addressesPolygon } from "./polygon/addresses"; import { addresses } from "./mainnet/addresses"; import { abis } from "../constant/abis"; From 4d6fc66c686a9db4ed0391e3eae4eca2f83d747d Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Mon, 6 Dec 2021 02:14:26 +0530 Subject: [PATCH 16/39] minor fix --- scripts/deployment/deploy.ts | 4 ++-- tsconfig.json | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/deployment/deploy.ts b/scripts/deployment/deploy.ts index 209f908a..3c772bee 100644 --- a/scripts/deployment/deploy.ts +++ b/scripts/deployment/deploy.ts @@ -5,7 +5,7 @@ async function main() { const accounts = await ethers.getSigners(); const wallet = accounts[0]; - const connectMapping = { + const connectMapping: Record = { "1INCH-A": "ConnectV2OneInch", "1INCH-B": "ConnectV2OneProto", "AAVE-V1-A": "ConnectV2AaveV1", @@ -21,7 +21,7 @@ async function main() { "UNISWAP-A": "ConnectV2UniswapV2", }; - const addressMapping = {}; + const addressMapping: Record = {}; for (const key in connectMapping) { addressMapping[key] = await deployConnector(connectMapping[key]); diff --git a/tsconfig.json b/tsconfig.json index 98421cca..af311260 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,6 @@ "lib": ["es5", "es6"], "module": "commonjs", "moduleResolution": "node", - "noImplicitAny": true, "outDir": "dist", "resolveJsonModule": true, "sourceMap": true, From 65f3d3f9ac5818e2a9edb1123710f1f4fa731a78 Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Mon, 6 Dec 2021 02:54:36 +0530 Subject: [PATCH 17/39] fixed ts types --- scripts/constant/abis.ts | 2 +- scripts/tests/deployAndEnableConnector.ts | 38 ++++++++++++++++------- scripts/tests/mainnet/addresses.ts | 14 ++++----- scripts/tests/polygon/addresses.ts | 2 +- test/mainnet/compound/compound.test.ts | 16 ++++++---- 5 files changed, 45 insertions(+), 27 deletions(-) diff --git a/scripts/constant/abis.ts b/scripts/constant/abis.ts index ed8c8faf..43097ba5 100644 --- a/scripts/constant/abis.ts +++ b/scripts/constant/abis.ts @@ -1,4 +1,4 @@ -export const abis = { +export const abis: Record = { core: { connectorsV2: require("./abi/core/connectorsV2.json"), instaIndex: require("./abi/core/instaIndex.json"), diff --git a/scripts/tests/deployAndEnableConnector.ts b/scripts/tests/deployAndEnableConnector.ts index 856164d6..f41ae881 100644 --- a/scripts/tests/deployAndEnableConnector.ts +++ b/scripts/tests/deployAndEnableConnector.ts @@ -2,10 +2,23 @@ import { addresses as addressesPolygon } from "./polygon/addresses"; import { addresses } from "./mainnet/addresses"; import { abis } from "../constant/abis"; -// const { deployContract } = waffle; -// import { ethers } from "hardhat"; -// import { promises as fs } from "fs"; -// import { deployContract } from "ethereum-waffle"; +import hre from "hardhat"; +import type { Signer, Contract } from "ethers"; +import type { ContractJSON } from "ethereum-waffle/dist/esm/ContractJSON"; + + +const { ethers, waffle } = hre; +const { deployContract } = waffle; + + + +interface DeployInterface { + connectorName: string; + contractArtifact: ContractJSON; + signer: Signer; + connectors: Contract; +} + function getAddress(network: string | undefined) { if (network === "polygon") return addressesPolygon; @@ -14,14 +27,15 @@ function getAddress(network: string | undefined) { else return addresses; } -export async function deployAndEnableConnector({ - connectorName, - contractArtifact, - signer, - connectors, -}) { - const deployer = new contractArtifact(signer); - const connectorInstanace = await deployer.deploy(); +export async function deployAndEnableConnector( + { + connectorName, + contractArtifact, + signer, + connectors + } : DeployInterface +) { + const connectorInstanace: Contract = await deployContract(signer, contractArtifact); await connectors .connect(signer) diff --git a/scripts/tests/mainnet/addresses.ts b/scripts/tests/mainnet/addresses.ts index 28b6afec..9a6012ba 100644 --- a/scripts/tests/mainnet/addresses.ts +++ b/scripts/tests/mainnet/addresses.ts @@ -1,11 +1,11 @@ -export const addresses = { - connectors: { - basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6", - auth: "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9", +export const addresses: Record = { + "connectors": { + "basic": "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6", + "auth": "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9", "INSTAPOOL-A": "0x5806af7ab22e2916fa582ff05731bf7c682387b2", }, - core: { - connectorsV2: "0x97b0B3A8bDeFE8cB9563a3c610019Ad10DB8aD11", - instaIndex: "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723", + "core": { + "connectorsV2": "0x97b0B3A8bDeFE8cB9563a3c610019Ad10DB8aD11", + "instaIndex": "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723", }, }; diff --git a/scripts/tests/polygon/addresses.ts b/scripts/tests/polygon/addresses.ts index d60133c0..cb4af74b 100644 --- a/scripts/tests/polygon/addresses.ts +++ b/scripts/tests/polygon/addresses.ts @@ -1,4 +1,4 @@ -export const addresses = { +export const addresses: Record = { connectors: { basic: "0x1cAF5EC802ca602E98139AD96A8f2B7BC524264E", auth: "0xf6474aD0dA75A0dE15D2c915e601D9f754B9e6fe", diff --git a/test/mainnet/compound/compound.test.ts b/test/mainnet/compound/compound.test.ts index f08c2415..bb7d13d5 100644 --- a/test/mainnet/compound/compound.test.ts +++ b/test/mainnet/compound/compound.test.ts @@ -1,7 +1,10 @@ import { expect } from "chai"; import hre from "hardhat"; -import { web3, deployments, waffle, ethers } = hre; -import { provider, deployContract } = waffle +const { web3, deployments, waffle, ethers } = hre; +const { provider, deployContract} = waffle + +import type { Signer, Contract } from "ethers"; +import type { ContractJSON } from "ethereum-waffle/dist/esm/ContractJSON"; import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" @@ -13,14 +16,14 @@ import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { tokens } from "../../../scripts/constant/tokens"; -import connectV2CompoundArtifacts from "../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json" +import connectV2CompoundArtifacts from "../../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json" describe("Compound", function () { const connectorName = "COMPOUND-TEST-A" - let dsaWallet0: any; - let masterSigner: any; - let instaConnectorsV2: any; + let dsaWallet0: Signer; + let masterSigner: Signer; + let instaConnectorsV2: Contract; let connector: any; const wallets = provider.getWallets() @@ -31,6 +34,7 @@ describe("Compound", function () { params: [ { forking: { + //@ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 13300000, }, From 6f14a93e8ac43a38919a30186890e3fe5ccff614 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Mon, 6 Dec 2021 03:31:27 +0530 Subject: [PATCH 18/39] removed errors --- scripts/constant/addresses.ts | 2 +- scripts/deployment/deploy.ts | 1 - scripts/deployment/deployConnectorsFromCmd.ts | 12 +++---- scripts/deployment/deploySingle.ts | 26 -------------- scripts/tests/addLiquidity.ts | 2 +- scripts/tests/buildDSAv2.ts | 2 -- scripts/tests/deployAndEnableConnector.ts | 4 --- scripts/tests/encodeFlashcastData.ts | 2 +- status-checks/index.ts | 2 +- test/mainnet/aave/v2.test.ts | 34 ++++++++++--------- test/mainnet/compound/compound.test.ts | 20 +++++------ 11 files changed, 36 insertions(+), 71 deletions(-) delete mode 100644 scripts/deployment/deploySingle.ts diff --git a/scripts/constant/addresses.ts b/scripts/constant/addresses.ts index 28b6afec..d8d6a83b 100644 --- a/scripts/constant/addresses.ts +++ b/scripts/constant/addresses.ts @@ -1,4 +1,4 @@ -export const addresses = { +export const addresses: Record = { connectors: { basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6", auth: "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9", diff --git a/scripts/deployment/deploy.ts b/scripts/deployment/deploy.ts index 3c772bee..381fe091 100644 --- a/scripts/deployment/deploy.ts +++ b/scripts/deployment/deploy.ts @@ -3,7 +3,6 @@ import { deployConnector } from "./deployConnector"; async function main() { const accounts = await ethers.getSigners(); - const wallet = accounts[0]; const connectMapping: Record = { "1INCH-A": "ConnectV2OneInch", diff --git a/scripts/deployment/deployConnectorsFromCmd.ts b/scripts/deployment/deployConnectorsFromCmd.ts index 3fa462e6..39c55bdc 100644 --- a/scripts/deployment/deployConnectorsFromCmd.ts +++ b/scripts/deployment/deployConnectorsFromCmd.ts @@ -1,9 +1,10 @@ import * as fs from "fs"; -import { ethers, network, config } from "hardhat"; +import * as hre from "hardhat" +const { ethers, network, config } = hre; let args = process.argv; args = args.splice(2, args.length); -let params = {}; +let params: Record = {}; for (let i = 0; i < args.length; i += 2) { if (args[i][0] !== "-" || args[i][1] !== "-") { @@ -38,17 +39,16 @@ let wallet = new ethers.Wallet(privateKey, provider); network.name = params["networkName"]; network.config = config.networks[params["networkName"]]; network.provider = provider; -let contracts = []; +let contracts: (string | string[])[] = []; const parseFile = async (filePath: fs.PathOrFileDescriptor) => { const data = fs.readFileSync(filePath, "utf-8"); let parsedData = data.split("contract "); parsedData = parsedData[parsedData.length - 1].split(" "); - parsedData = parsedData[0]; - return parsedData; + return parsedData[0]; }; -const parseDir = async (root, basePath, addPath) => { +const parseDir = async (root: string | any[], basePath: string, addPath: string) => { for (let i = 0; i < root.length; i++) { addPath = "/" + root[i]; const dir = fs.readdirSync(basePath + addPath); diff --git a/scripts/deployment/deploySingle.ts b/scripts/deployment/deploySingle.ts deleted file mode 100644 index 51a0eb47..00000000 --- a/scripts/deployment/deploySingle.ts +++ /dev/null @@ -1,26 +0,0 @@ -import * as hre from "hardhat"; -const { ethers } = hre; -import { deployConnector } from "./deployConnector"; - -async function main() { - const address = await deployConnector("ConnectOne"); // Example - - const connectorsAbi = [ - "function addConnectors(string[] _connectorNames, address[] _connectors)", - ]; - - const connectorsContract = new ethers.Contract( - "0x84b457c6D31025d56449D5A01F0c34bF78636f67", - connectorsAbi, - ethers.provider - ); - - await connectorsContract.addConnectors(["1inch"], [address]); -} - -main() - .then(() => process.exit(0)) - .catch((error) => { - console.error(error); - process.exit(1); - }); diff --git a/scripts/tests/addLiquidity.ts b/scripts/tests/addLiquidity.ts index a2290a65..f29d6374 100644 --- a/scripts/tests/addLiquidity.ts +++ b/scripts/tests/addLiquidity.ts @@ -7,7 +7,7 @@ const mineTx = async (tx: any) => { await (await tx).wait(); }; -const tokenMapping = { +const tokenMapping: Record = { usdc: { impersonateSigner: "0xfcb19e6a322b27c06842a71e8c725399f049ae3a", address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", diff --git a/scripts/tests/buildDSAv2.ts b/scripts/tests/buildDSAv2.ts index 79c74ebb..383d9ef1 100644 --- a/scripts/tests/buildDSAv2.ts +++ b/scripts/tests/buildDSAv2.ts @@ -1,7 +1,5 @@ import { ethers } from "hardhat"; -const network = String(process.env.networkType); - import { addresses as addressesPolygon } from "./polygon/addresses"; import { addresses } from "./mainnet/addresses"; import { abis } from "../constant/abis"; diff --git a/scripts/tests/deployAndEnableConnector.ts b/scripts/tests/deployAndEnableConnector.ts index f41ae881..8e1f5d4b 100644 --- a/scripts/tests/deployAndEnableConnector.ts +++ b/scripts/tests/deployAndEnableConnector.ts @@ -6,12 +6,9 @@ import hre from "hardhat"; import type { Signer, Contract } from "ethers"; import type { ContractJSON } from "ethereum-waffle/dist/esm/ContractJSON"; - const { ethers, waffle } = hre; const { deployContract } = waffle; - - interface DeployInterface { connectorName: string; contractArtifact: ContractJSON; @@ -19,7 +16,6 @@ interface DeployInterface { connectors: Contract; } - function getAddress(network: string | undefined) { if (network === "polygon") return addressesPolygon; // else if (network === "arbitrum") return addressesPolygon; diff --git a/scripts/tests/encodeFlashcastData.ts b/scripts/tests/encodeFlashcastData.ts index d7051737..f9a88803 100644 --- a/scripts/tests/encodeFlashcastData.ts +++ b/scripts/tests/encodeFlashcastData.ts @@ -1,4 +1,4 @@ -import * as hre from "hardhat"; +import hre from "hardhat"; const { web3 } = hre; import { encodeSpells } from "./encodeSpells.js"; diff --git a/status-checks/index.ts b/status-checks/index.ts index 738beed3..984161d5 100644 --- a/status-checks/index.ts +++ b/status-checks/index.ts @@ -38,7 +38,7 @@ async function setStatus(context, state, description) { // Run in parallel await Promise.all( - checks.map(async (check) => { + checks.map(async (check: { name: any; callback: any }) => { const { name, callback } = check; await setStatus(name, "pending", "Running check.."); diff --git a/test/mainnet/aave/v2.test.ts b/test/mainnet/aave/v2.test.ts index f8b28ad2..1ac4b662 100644 --- a/test/mainnet/aave/v2.test.ts +++ b/test/mainnet/aave/v2.test.ts @@ -12,27 +12,29 @@ import { tokens } from "../../../scripts/constant/tokens"; import { constants } from "../../../scripts/constant/constant"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; const { ethers } = hre; +import type { Signer, Contract } from "ethers"; describe("Aave V2", function () { const connectorName = "AAVEV2-TEST-A"; - let connector: ConnectV2AaveV2; + let connector: any; - let wallet0: any, wallet1: { address: any; }; + let wallet0: any, wallet1:any; let dsaWallet0: any; - let instaConnectorsV2: { address: any; }; - let masterSigner: { address: any; }; + let instaConnectorsV2: Contract; + let masterSigner: Signer; before(async () => { - // await hre.network.provider.request({ - // method: "hardhat_reset", - // params: [ - // { - // forking: { - // jsonRpcUrl: hre.config.networks.hardhat.forking.url, - // blockNumber: 12796965, - // }, - // }, - // ], - // }); + await hre.network.provider.request({ + method: "hardhat_reset", + params: [ + { + forking: { + // @ts-ignore + jsonRpcUrl: hre.config.networks.hardhat.forking.url, + blockNumber: 12796965, + }, + }, + ], + }); [wallet0, wallet1] = await ethers.getSigners(); masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( @@ -51,7 +53,7 @@ describe("Aave V2", function () { it("should have contracts deployed", async () => { expect(!!instaConnectorsV2.address).to.be.true; expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; }); describe("DSA wallet setup", function () { diff --git a/test/mainnet/compound/compound.test.ts b/test/mainnet/compound/compound.test.ts index bb7d13d5..042e3e93 100644 --- a/test/mainnet/compound/compound.test.ts +++ b/test/mainnet/compound/compound.test.ts @@ -1,27 +1,23 @@ import { expect } from "chai"; import hre from "hardhat"; -const { web3, deployments, waffle, ethers } = hre; +const { waffle, ethers } = hre; const { provider, deployContract} = waffle import type { Signer, Contract } from "ethers"; -import type { ContractJSON } from "ethereum-waffle/dist/esm/ContractJSON"; -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" - import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; -import { tokens } from "../../../scripts/constant/tokens"; - -import connectV2CompoundArtifacts from "../../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json" +import { ConnectV2Compound__factory } from "../../../typechain"; describe("Compound", function () { const connectorName = "COMPOUND-TEST-A" - let dsaWallet0: Signer; + let dsaWallet0: any; let masterSigner: Signer; let instaConnectorsV2: Contract; let connector: any; @@ -41,11 +37,11 @@ describe("Compound", function () { }, ], }); - masterSigner = await getMasterSigner(wallet3) + masterSigner = await getMasterSigner() instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, - contractArtifact: connectV2CompoundArtifacts, + contractArtifact: ConnectV2Compound__factory, signer: masterSigner, connectors: instaConnectorsV2 }) @@ -55,7 +51,7 @@ describe("Compound", function () { it("Should have contracts deployed.", async function () { expect(!!instaConnectorsV2.address).to.be.true; expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; }); describe("DSA wallet setup", function () { From e4d39cbb31ca3d70f1347a049561e0171191e42c Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Mon, 6 Dec 2021 03:48:23 +0530 Subject: [PATCH 19/39] update --- status-checks/check.ts | 2 +- status-checks/index.ts | 1 - test/mainnet/aave/v1.test.ts | 19 +++++++++---------- test/mainnet/b.protocol/b.compound.test.ts | 17 ++++++++--------- test/mainnet/b.protocol/b.liquity.test.ts | 12 +++++------- 5 files changed, 23 insertions(+), 28 deletions(-) diff --git a/status-checks/check.ts b/status-checks/check.ts index 9c0b442d..371c3825 100644 --- a/status-checks/check.ts +++ b/status-checks/check.ts @@ -3,7 +3,7 @@ import * as path from "path"; const forbiddenStrings: any = ["selfdestruct"]; -const getConnectorsList = async (connectorsRootsDirs: string | any[]) => { +const getConnectorsList= async (connectorsRootsDirs: string | any[]): Promise> => { try { const connectors = []; for (let index = 0; index < connectorsRootsDirs.length; index++) { diff --git a/status-checks/index.ts b/status-checks/index.ts index 984161d5..e740debf 100644 --- a/status-checks/index.ts +++ b/status-checks/index.ts @@ -35,7 +35,6 @@ async function setStatus(context, state, description) { (async () => { console.log(`Starting status checks for commit ${sha}`); - // Run in parallel await Promise.all( checks.map(async (check: { name: any; callback: any }) => { diff --git a/test/mainnet/aave/v1.test.ts b/test/mainnet/aave/v1.test.ts index 52e1607c..563a3410 100644 --- a/test/mainnet/aave/v1.test.ts +++ b/test/mainnet/aave/v1.test.ts @@ -1,29 +1,27 @@ +import hre from "hardhat"; import { expect } from "chai"; -import "hardhat"; import { abis } from "../../../scripts/constant/abis"; import { addresses } from "../../../scripts/constant/addresses"; import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; - -import ConnectV2AaveV1 from "../../artifacts/contracts/mainnet/connectors/aave/v1/main.sol/ConnectV2AaveV1.json"; +import { ConnectV2AaveV1, ConnectV2AaveV1__factory } from "../../../typechain"; import { parseEther } from "@ethersproject/units"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { tokens } from "../../../scripts/constant/tokens"; import { constants } from "../../../scripts/constant/constant"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; -// const { ethers } = hre; - -const ALCHEMY_ID = process.env.ALCHEMY_ID; +const { ethers } = hre; +import type { Signer, Contract } from "ethers"; describe("Aave V1", function () { const connectorName = "AAVEV1-TEST-A"; let wallet0: any, wallet1: any; let dsaWallet0: any; - let instaConnectorsV2: any; + let instaConnectorsV2: Contract; let connector: any; - let masterSigner: any; + let masterSigner: Signer; before(async () => { try { @@ -32,6 +30,7 @@ describe("Aave V1", function () { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 12796965, }, @@ -46,7 +45,7 @@ describe("Aave V1", function () { ); connector = await deployAndEnableConnector({ connectorName, - contractArtifact: ConnectV2AaveV1, + contractArtifact: ConnectV2AaveV1__factory, signer: masterSigner, connectors: instaConnectorsV2, }); @@ -59,7 +58,7 @@ describe("Aave V1", function () { it("should have contracts deployed", async () => { expect(!!instaConnectorsV2.address).to.be.true; expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; }); describe("DSA wallet setup", function () { diff --git a/test/mainnet/b.protocol/b.compound.test.ts b/test/mainnet/b.protocol/b.compound.test.ts index 1f0f20fa..8c885a2b 100644 --- a/test/mainnet/b.protocol/b.compound.test.ts +++ b/test/mainnet/b.protocol/b.compound.test.ts @@ -7,20 +7,18 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" - import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; -import { tokens } from "../../../scripts/constant/tokens"; - -import connectV2CompoundArtifacts from "../../artifacts/contracts/mainnet/connectors/b.protocol/compound/main.sol/ConnectV2BCompound.json" +import { ConnectV2Compound__factory } from "../../../typechain"; +import type { Signer, Contract } from "ethers"; describe("B.Compound", function () { const connectorName = "B.COMPOUND-TEST-A" let dsaWallet0: any; - let masterSigner: any; - let instaConnectorsV2: any; + let masterSigner: Signer; + let instaConnectorsV2: Contract; let connector: any; const wallets = provider.getWallets() @@ -31,17 +29,18 @@ describe("B.Compound", function () { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 13300000, }, }, ], }); - masterSigner = await getMasterSigner(wallet3) + masterSigner = await getMasterSigner() instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, - contractArtifact: connectV2CompoundArtifacts, + contractArtifact: ConnectV2Compound__factory, signer: masterSigner, connectors: instaConnectorsV2 }) @@ -51,7 +50,7 @@ describe("B.Compound", function () { it("Should have contracts deployed.", async function () { expect(!!instaConnectorsV2.address).to.be.true; expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; expect(await connector.name()).to.be.equal("B.Compound-v1.0"); }); diff --git a/test/mainnet/b.protocol/b.liquity.test.ts b/test/mainnet/b.protocol/b.liquity.test.ts index dd4e74ba..75ac42bf 100644 --- a/test/mainnet/b.protocol/b.liquity.test.ts +++ b/test/mainnet/b.protocol/b.liquity.test.ts @@ -9,13 +9,10 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; -import { constants } from "../../../scripts/constant/constant"; -import { tokens } from "../../../scripts/constant/tokens"; - -import connectorLiquityArtifacts from ("../../artifacts/contracts/mainnet/connectors/b.protocol/liquity/main.sol/ConnectV2BLiquity.json") +import { ConnectV2BLiquity__factory } from "../../../typechain"; +import type { Signer, Contract } from "ethers"; const LUSD_WHALE = "0x66017D22b0f8556afDd19FC67041899Eb65a21bb" // stability pool - const BAMM_ADDRESS = "0x0d3AbAA7E088C2c82f54B2f47613DA438ea8C598" describe("B.Liquity", function () { @@ -23,8 +20,8 @@ describe("B.Liquity", function () { let dsaWallet0: any; let dsaWallet1: any - let masterSigner: any; - let instaConnectorsV2: any; + let masterSigner: Signer; + let instaConnectorsV2: Contract; let connector: any; let manager: any; let vat: any; @@ -40,6 +37,7 @@ describe("B.Liquity", function () { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 12996875, }, From 6e0dde3dcdb1787ab683c89a9c8e4548a3df4044 Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Mon, 6 Dec 2021 04:04:43 +0530 Subject: [PATCH 20/39] minor fix --- status-checks/checks.ts | 2 +- status-checks/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/status-checks/checks.ts b/status-checks/checks.ts index be76ccdf..8eb8fa71 100644 --- a/status-checks/checks.ts +++ b/status-checks/checks.ts @@ -1,6 +1,6 @@ import checkMain from "./check"; -module.exports = [ +export default [ { name: "Solidity check", callback: async () => { diff --git a/status-checks/index.ts b/status-checks/index.ts index e740debf..10db317a 100644 --- a/status-checks/index.ts +++ b/status-checks/index.ts @@ -1,7 +1,7 @@ import * as cp from "child_process"; import fetch from "node-fetch"; -import checkMain from "./check"; +import checks from "./checks"; const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/"); From 5c275f3ad8e9574b00a8be970f1173d1b077cbe1 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Mon, 6 Dec 2021 05:07:37 +0530 Subject: [PATCH 21/39] updated tests and scripts --- scripts/tests/encodeFlashcastData.ts | 2 +- status-checks/index.ts | 2 +- test/mainnet/b.protocol/b.liquity.test.ts | 12 ++--- test/mainnet/b.protocol/b.maker.test.ts | 31 ++++++------ .../mainnet/basic-ERC1155/ERC1155-transfer.ts | 28 +++++------ test/mainnet/basic-ERC721/ERC721-transfer.ts | 29 +++++------ test/mainnet/instapool/instapool.test.ts | 20 ++++---- test/mainnet/liquity/liquity.helpers.ts | 49 +++++++++---------- 8 files changed, 80 insertions(+), 93 deletions(-) diff --git a/scripts/tests/encodeFlashcastData.ts b/scripts/tests/encodeFlashcastData.ts index f9a88803..934b58e6 100644 --- a/scripts/tests/encodeFlashcastData.ts +++ b/scripts/tests/encodeFlashcastData.ts @@ -3,7 +3,7 @@ const { web3 } = hre; import { encodeSpells } from "./encodeSpells.js"; -module.exports = function(spells: any) { +export default function encodeFlashcastData(spells: any) { const encodeSpellsData = encodeSpells(spells); const targetType = "string[]"; let argTypes = [targetType, "bytes[]"]; diff --git a/status-checks/index.ts b/status-checks/index.ts index 10db317a..e3c91c00 100644 --- a/status-checks/index.ts +++ b/status-checks/index.ts @@ -15,7 +15,7 @@ function getCurrentCommitSha() { // We need to get the current commit sha ourself. const sha = getCurrentCommitSha(); -async function setStatus(context, state, description) { +async function setStatus(context: any, state: string, description: string) { return fetch( `https://api.github.com/repos/${owner}/${repo}/statuses/${sha}`, { diff --git a/test/mainnet/b.protocol/b.liquity.test.ts b/test/mainnet/b.protocol/b.liquity.test.ts index 75ac42bf..cefd7601 100644 --- a/test/mainnet/b.protocol/b.liquity.test.ts +++ b/test/mainnet/b.protocol/b.liquity.test.ts @@ -44,11 +44,11 @@ describe("B.Liquity", function () { }, ], }); - masterSigner = await getMasterSigner(wallet3) + masterSigner = await getMasterSigner() instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, - contractArtifact: connectorLiquityArtifacts, + contractArtifact: ConnectV2BLiquity__factory, signer: masterSigner, connectors: instaConnectorsV2 }) @@ -70,7 +70,7 @@ describe("B.Liquity", function () { it("Should have contracts deployed.", async function () { expect(!!instaConnectorsV2.address).to.be.true; expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; expect(await connector.name()).to.be.equal("B.Liquity-v1"); }); @@ -175,12 +175,12 @@ describe("B.Liquity", function () { }) }) -function veryClose(n1, n2) { +function veryClose(n1: any, n2: any) { n1 = web3.utils.toBN(n1) n2 = web3.utils.toBN(n2) - _10000 = web3.utils.toBN(10000) - _9999 = web3.utils.toBN(9999) + let _10000 = web3.utils.toBN(10000) + let _9999 = web3.utils.toBN(9999) if (n1.mul(_10000).lt(n2.mul(_9999))) return false if (n2.mul(_10000).lt(n1.mul(_9999))) return false diff --git a/test/mainnet/b.protocol/b.maker.test.ts b/test/mainnet/b.protocol/b.maker.test.ts index 35f42390..d87da72e 100644 --- a/test/mainnet/b.protocol/b.maker.test.ts +++ b/test/mainnet/b.protocol/b.maker.test.ts @@ -3,25 +3,23 @@ import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle - import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; -import { constants } from "../../../scripts/constant/constant"; import { tokens } from "../../../scripts/constant/tokens"; - -import connectorMakerArtifacts from ("../../artifacts/contracts/mainnet/connectors/b.protocol/makerdao/main.sol/ConnectV2BMakerDAO.json") +import { ConnectV2BMakerDAO__factory } from "../../../typechain"; +import type { Signer, Contract } from "ethers"; describe("B.Maker", function () { const connectorName = "B.MAKER-TEST-A" let dsaWallet0: any; let dsaWallet1: any; - let masterSigner: any; - let instaConnectorsV2: any; + let masterSigner: Signer; + let instaConnectorsV2: Contract; let connector: any; let manager: any; let vat: any; @@ -35,17 +33,18 @@ describe("B.Maker", function () { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 12696000, }, }, ], }); - masterSigner = await getMasterSigner(wallet3) + masterSigner = await getMasterSigner() instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, - contractArtifact: connectorMakerArtifacts, + contractArtifact: ConnectV2BMakerDAO__factory, signer: masterSigner, connectors: instaConnectorsV2 }) @@ -67,7 +66,7 @@ describe("B.Maker", function () { it("Should have contracts deployed.", async function () { expect(!!instaConnectorsV2.address).to.be.true; expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; expect(await connector.name()).to.be.equal("B.MakerDAO-v1.0"); }); @@ -96,9 +95,9 @@ describe("B.Maker", function () { }); describe("Main", function () { - let vault - let ilk - let urn + let vault: any; + let ilk: any; + let urn: any; it("Should open ETH-A vault Maker", async function () { vault = Number(await manager.cdpi()) + 1 @@ -314,7 +313,7 @@ describe("B.Maker", function () { }) }) -async function daiToArt(vat, ilk, dai) { +async function daiToArt(vat: any, ilk: any, dai: any) { const ilks = await vat.ilks(ilk) const rate = ilks[1] // second parameter const _1e27 = ethers.utils.parseEther("1000000000") // 1e9 * 1e18 @@ -323,12 +322,12 @@ async function daiToArt(vat, ilk, dai) { return art.add(1) } -function veryClose(n1, n2) { +function veryClose(n1: any, n2: any) { n1 = web3.utils.toBN(n1) n2 = web3.utils.toBN(n2) - _10000 = web3.utils.toBN(10000) - _9999 = web3.utils.toBN(9999) + let _10000 = web3.utils.toBN(10000) + let _9999 = web3.utils.toBN(9999) if (n1.mul(_10000).lt(n2.mul(_9999))) return false if (n2.mul(_10000).lt(n1.mul(_9999))) return false diff --git a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts index ea7c3bd6..2d16e1d3 100644 --- a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts +++ b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts @@ -2,20 +2,17 @@ import { expect } from "chai" import hre from "hardhat" const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -import { abi: implementationsABI } from "../../../scripts/constant/abi/core/InstaImplementations.json" +import { abi } from "../../../scripts/constant/abi/core/InstaImplementations.json" import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" - import { addresses } from "../../../scripts/constant/addresses" import { abis } from "../../../scripts/constant/abis" -import { constants } from "../../../scripts/constant/constant" -import { tokens } from "../../../scripts/constant/tokens" +import type { Signer, Contract } from "ethers"; -import connectV2BasicERC1155Artifacts from "../../artifacts/contracts/mainnet/connectors/basic-ERC1155/main.sol/ConnectV2BasicERC1155.json" -import erc1155Artifacts from "../../artifacts/@openzeppelin/contracts/token/ERC1155/IERC1155.sol/IERC1155.json" +import { ConnectV2BasicERC1155__factory, IERC1155__factory } from "../../../typechain"; const TOKEN_CONTRACT_ADDR = "0x1ca3262009b21F944e6b92a2a88D039D06F1acFa"; const TOKEN_OWNER_ADDR = "0x1ca3262009b21F944e6b92a2a88D039D06F1acFa"; @@ -27,8 +24,8 @@ describe("BASIC-ERC1155", function () { const connectorName = "BASIC-ERC1155-A" let dsaWallet0: any; - let masterSigner: any; - let instaConnectorsV2: any; + let masterSigner: Signer; + let instaConnectorsV2: Contract; let connector: any; let nftContract: any; let tokenOwner: any; @@ -45,6 +42,7 @@ describe("BASIC-ERC1155", function () { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 13300000, }, @@ -56,7 +54,7 @@ describe("BASIC-ERC1155", function () { params: [TOKEN_OWNER_ADDR], }); - await network.provider.send("hardhat_setBalance", [ + await hre.network.provider.send("hardhat_setBalance", [ TOKEN_OWNER_ADDR, "0x1000000000000000", ]); @@ -65,17 +63,17 @@ describe("BASIC-ERC1155", function () { tokenOwner = await ethers.getSigner( TOKEN_OWNER_ADDR ); - nftContract = await ethers.getContractAt(erc1155Artifacts.abi, TOKEN_CONTRACT_ADDR) - masterSigner = await getMasterSigner(wallet3) + nftContract = await ethers.getContractAt(IERC1155__factory.abi, TOKEN_CONTRACT_ADDR) + masterSigner = await getMasterSigner() instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); - instaImplementationsMapping = await ethers.getContractAt(implementationsABI, implementationsMappingAddr); + instaImplementationsMapping = await ethers.getContractAt(abi, implementationsMappingAddr); InstaAccountV2DefaultImpl = await ethers.getContractFactory("InstaDefaultImplementation") instaAccountV2DefaultImpl = await InstaAccountV2DefaultImpl.deploy(addresses.core.instaIndex); await instaAccountV2DefaultImpl.deployed() connector = await deployAndEnableConnector({ connectorName, - contractArtifact: connectV2BasicERC1155Artifacts, + contractArtifact: ConnectV2BasicERC1155__factory, signer: masterSigner, connectors: instaConnectorsV2 }) @@ -85,17 +83,15 @@ describe("BASIC-ERC1155", function () { it("Should have contracts deployed.", async function () { expect(!!instaConnectorsV2.address).to.be.true; expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; }); describe("Implementations", function () { - it("Should add default implementation to mapping.", async function () { const tx = await instaImplementationsMapping.connect(masterSigner).setDefaultImplementation(instaAccountV2DefaultImpl.address); await tx.wait() expect(await instaImplementationsMapping.defaultImplementation()).to.be.equal(instaAccountV2DefaultImpl.address); }); - }); describe("DSA wallet setup", function () { diff --git a/test/mainnet/basic-ERC721/ERC721-transfer.ts b/test/mainnet/basic-ERC721/ERC721-transfer.ts index bdc1ab80..43dbb50e 100644 --- a/test/mainnet/basic-ERC721/ERC721-transfer.ts +++ b/test/mainnet/basic-ERC721/ERC721-transfer.ts @@ -1,23 +1,18 @@ import { expect } from "chai"; -import hre from "hardhat"; +import hre, { network } from "hardhat"; const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -import { abi : implementationsABI } from "../../../scripts/constant/abi/core/InstaImplementations.json" - +import { abi } from "../../../scripts/constant/abi/core/InstaImplementations.json" import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" - - import { addresses } from "../../../scripts/constant/addresses" import { abis } from "../../../scripts/constant/abis" -import { constants } from "../../../scripts/constant/constant" -import { tokens } from "../../../scripts/constant/tokens" +import type { Signer, Contract } from "ethers"; -import connectV2BasicERC721Artifacts from "../../artifacts/contracts/mainnet/connectors/basic-ERC721/main.sol/ConnectV2BasicERC721.json" -import erc721Artifacts from "../../artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.json" +import { ConnectV2BasicERC721__factory, IERC721__factory } from "../../../typechain"; const TOKEN_CONTRACT_ADDR = "0x4d695c615a7aacf2d7b9c481b66045bb2457dfde"; const TOKEN_OWNER_ADDR = "0x8c6b10d42ff08e56133fca0dac75e1931b1fcc23"; @@ -29,8 +24,8 @@ describe("BASIC-ERC721", function () { const connectorName = "BASIC-ERC721-A" let dsaWallet0: any; - let masterSigner: any; - let instaConnectorsV2: any; + let masterSigner: Signer; + let instaConnectorsV2: Contract; let connector: any; let nftContract: any; let tokenOwner: any; @@ -46,6 +41,7 @@ describe("BASIC-ERC721", function () { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 13300000, }, @@ -66,17 +62,17 @@ describe("BASIC-ERC721", function () { tokenOwner = await ethers.getSigner( TOKEN_OWNER_ADDR ); - nftContract = await ethers.getContractAt(erc721Artifacts.abi, TOKEN_CONTRACT_ADDR) - masterSigner = await getMasterSigner(wallet3) + nftContract = await ethers.getContractAt(IERC721__factory.abi, TOKEN_CONTRACT_ADDR) + masterSigner = await getMasterSigner() instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); - instaImplementationsMapping = await ethers.getContractAt(implementationsABI, implementationsMappingAddr); + instaImplementationsMapping = await ethers.getContractAt(abi, implementationsMappingAddr); InstaAccountV2DefaultImpl = await ethers.getContractFactory("InstaDefaultImplementation") instaAccountV2DefaultImpl = await InstaAccountV2DefaultImpl.deploy(addresses.core.instaIndex); await instaAccountV2DefaultImpl.deployed() connector = await deployAndEnableConnector({ connectorName, - contractArtifact: connectV2BasicERC721Artifacts, + contractArtifact: ConnectV2BasicERC721__factory, signer: masterSigner, connectors: instaConnectorsV2 }) @@ -86,11 +82,10 @@ describe("BASIC-ERC721", function () { it("Should have contracts deployed.", async function () { expect(!!instaConnectorsV2.address).to.be.true; expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; }); describe("Implementations", function () { - it("Should add default implementation to mapping.", async function () { const tx = await instaImplementationsMapping.connect(masterSigner).setDefaultImplementation(instaAccountV2DefaultImpl.address); await tx.wait() diff --git a/test/mainnet/instapool/instapool.test.ts b/test/mainnet/instapool/instapool.test.ts index 4904c652..1a309416 100644 --- a/test/mainnet/instapool/instapool.test.ts +++ b/test/mainnet/instapool/instapool.test.ts @@ -6,23 +6,20 @@ const { provider, deployContract } = waffle import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" -import { encodeFlashcastData } from "../../../scripts/tests/encodeFlashcastData.js" +import encodeFlashcastData from "../../../scripts/tests/encodeFlashcastData.js" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; -import { constants } from "../../../scripts/constant/constant"; -import { tokens } from "../../../scripts/constant/tokens"; - - -import connectV2CompoundArtifacts from "../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json" +import type { Signer, Contract } from "ethers"; +import { ConnectV2Compound__factory } from "../../../typechain"; describe("Instapool", function () { const connectorName = "COMPOUND-TEST-A" let dsaWallet0: any; - let masterSigner: any; - let instaConnectorsV2: any; + let masterSigner: Signer; + let instaConnectorsV2: Contract; let connector: any; const wallets = provider.getWallets() @@ -33,17 +30,18 @@ describe("Instapool", function () { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 13300000, }, }, ], }); - masterSigner = await getMasterSigner(wallet3) + masterSigner = await getMasterSigner() instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, - contractArtifact: connectV2CompoundArtifacts, + contractArtifact: ConnectV2Compound__factory, signer: masterSigner, connectors: instaConnectorsV2 }) @@ -53,7 +51,7 @@ describe("Instapool", function () { it("Should have contracts deployed.", async function () { expect(!!instaConnectorsV2.address).to.be.true; expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; }); describe("DSA wallet setup", function () { diff --git a/test/mainnet/liquity/liquity.helpers.ts b/test/mainnet/liquity/liquity.helpers.ts index 5e1dd77f..bab90124 100644 --- a/test/mainnet/liquity/liquity.helpers.ts +++ b/test/mainnet/liquity/liquity.helpers.ts @@ -1,4 +1,5 @@ import hre from "hardhat"; +import { ethers } from "hardhat"; import hardhatConfig from "../../../hardhat.config"; // Instadapp deployment and testing helpers @@ -12,34 +13,31 @@ import { instadappAddresses } from "../../../scripts/important/addresses"; import { instadappAbi } from "../../../scripts/constant/abis"; // Instadapp Liquity Connector artifacts -import connectV2LiquityArtifacts from "../../artifacts/contracts/mainnet/connectors/liquity/main.sol/ConnectV2Liquity.json"; -import connectV2BasicV1Artifacts from "../../artifacts/contracts/mainnet/connectors/basic/main.sol/ConnectV2Basic.json"; -import { ethers } from "hardhat"; +import { ConnectV2Liquity__factory, ConnectV2Basic__factory } from "../../../typechain"; // Instadapp uses a fake address to represent native ETH -import { eth_addr: ETH_ADDRESS } from "../../../scripts/constant/constant"; +import { constants } from "../../../scripts/constant/constant.js"; +import type { Signer, Contract } from "ethers"; + const LIQUITY_CONNECTOR = "LIQUITY-v1-TEST"; const LUSD_GAS_COMPENSATION = hre.ethers.utils.parseUnits("200", 18); // 200 LUSD gas compensation repaid after loan repayment const LIQUIDATABLE_TROVES_BLOCK_NUMBER = 12478159; // Deterministic block number for tests to run against, if you change this, tests will break. const JUSTIN_SUN_ADDRESS = "0x903d12bf2c57a29f32365917c706ce0e1a84cce3"; // LQTY whale address const LIQUIDATABLE_TROVE_ADDRESS = "0xafbeb4cb97f3b08ec2fe07ef0dac15d37013a347"; // Trove which is liquidatable at blockNumber: LIQUIDATABLE_TROVES_BLOCK_NUMBER -const MAX_GAS = hardhatConfig.networks.hardhat.blockGasLimit; // Maximum gas limit (12000000) +// const MAX_GAS = hardhatConfig.networks.hardhat.blockGasLimit; // Maximum gas limit (12000000) const INSTADAPP_BASIC_V1_CONNECTOR = "Basic-v1"; const openTroveSpell = async ( - dsa, - signer: any, + dsa: any, + signer: Signer, depositAmount: any, borrowAmount: any, upperHint: any, lowerHint: any, maxFeePercentage: any ) => { - let address = signer.address; - if (signer.address === undefined) { - address = await signer.getAddress(); - } + let address = await signer.getAddress(); const openTroveSpell = { connector: LIQUITY_CONNECTOR, @@ -63,9 +61,9 @@ const openTroveSpell = async ( }; const createDsaTrove = async ( - dsa, - signer, - liquity, + dsa: any, + signer: any, + liquity: any, depositAmount = hre.ethers.utils.parseEther("5"), borrowAmount = hre.ethers.utils.parseUnits("2000", 18) ) => { @@ -86,32 +84,33 @@ const createDsaTrove = async ( ); }; -const sendToken = async (token, amount, from, to) => { +const sendToken = async (token: any, amount: any, from: any, to: any) => { await hre.network.provider.request({ method: "hardhat_impersonateAccount", params: [from], }); - const signer = await hre.ethers.provider.getSigner(from); + const signer = hre.ethers.provider.getSigner(from); return await token.connect(signer).transfer(to, amount, { gasPrice: 0, }); }; -const resetInitialState = async (walletAddress, contracts, isDebug = false) => { +const resetInitialState = async (walletAddress: any, contracts: any, isDebug = false) => { const liquity = await deployAndConnect(contracts, isDebug); const dsa = await buildDSAv2(walletAddress); return [liquity, dsa]; }; -const resetHardhatBlockNumber = async (blockNumber) => { +const resetHardhatBlockNumber = async (blockNumber: number) => { return await hre.network.provider.request({ method: "hardhat_reset", params: [ { forking: { - jsonRpcUrl: hardhatConfig.networks.hardhat.forking.url, + // @ts-ignore + jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber, }, }, @@ -119,11 +118,11 @@ const resetHardhatBlockNumber = async (blockNumber) => { }); }; -const deployAndConnect = async (contracts, isDebug = false) => { +const deployAndConnect = async (contracts: any, isDebug = false) => { // Pin Liquity tests to a particular block number to create deterministic state (Ether price etc.) await resetHardhatBlockNumber(LIQUIDATABLE_TROVES_BLOCK_NUMBER); - const liquity = { - troveManager: null, + let liquity = { + troveManager: Contract, borrowerOperations: null, stabilityPool: null, lusdToken: null, @@ -143,7 +142,7 @@ const deployAndConnect = async (contracts, isDebug = false) => { ); const connector = await deployAndEnableConnector({ connectorName: LIQUITY_CONNECTOR, - contractArtifact: connectV2LiquityArtifacts, + contractArtifact: ConnectV2Liquity__factory, signer: masterSigner, connectors: instaConnectorsV2, }); @@ -152,7 +151,7 @@ const deployAndConnect = async (contracts, isDebug = false) => { const basicConnector = await deployAndEnableConnector({ connectorName: "Basic-v1", - contractArtifact: connectV2BasicV1Artifacts, + contractArtifact: ConnectV2Basic__factory, signer: masterSigner, connectors: instaConnectorsV2, }); @@ -226,7 +225,7 @@ const deployAndConnect = async (contracts, isDebug = false) => { return liquity; }; -const getTroveInsertionHints = async (depositAmount, borrowAmount, liquity) => { +const getTroveInsertionHints = async (depositAmount, borrowAmount, liquity: any) => { const nominalCR = await liquity.hintHelpers.computeNominalCR( depositAmount, borrowAmount From 2d594b0ad717cc97ad3c9005629ccdee91f8cbb8 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Mon, 6 Dec 2021 05:44:38 +0530 Subject: [PATCH 22/39] updated test cases + scripts + fixes --- package-lock.json | 19 + package.json | 1 + test/mainnet/b.protocol/b.compound.test.ts | 4 +- test/mainnet/b.protocol/b.liquity.test.ts | 4 +- test/mainnet/b.protocol/b.maker.test.ts | 4 +- .../mainnet/basic-ERC1155/ERC1155-transfer.ts | 4 +- test/mainnet/basic-ERC721/ERC721-transfer.ts | 4 +- test/mainnet/instapool/instapool.test.ts | 6 +- test/mainnet/mappings/mappings.test.ts | 6 +- .../pooltogether-polygon/pooltogether.test.ts | 933 ++++---- .../mainnet/pooltogether/pooltogether.test.ts | 1976 ++++++++++------- .../uniswap-sell-beta/uniswap-sell-beta.ts | 15 +- test/mainnet/uniswap/uniswap.test.ts | 109 +- .../mainnet/uniswapStake/uniswapStake.test.ts | 34 +- test/mainnet/yearn/yearn.test.ts | 293 +-- yarn.lock | 7 + 16 files changed, 2015 insertions(+), 1404 deletions(-) diff --git a/package-lock.json b/package-lock.json index 25dce20f..5c5dd07b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,6 +30,7 @@ "@studydefi/money-legos": "^2.4.2", "@tenderly/hardhat-tenderly": "^1.0.13", "@types/chai": "^4.2.22", + "@types/chai-as-promised": "^7.1.4", "@types/mocha": "^9.0.0", "@types/node": "^16.11.11", "chai": "^4.3.4", @@ -4138,6 +4139,15 @@ "integrity": "sha512-tFfcE+DSTzWAgifkjik9AySNqIyNoYwmR+uecPwwD/XRNfvOjmC/FjCxpiUGDkDVDphPfCUecSQVFw+lN3M3kQ==", "dev": true }, + "node_modules/@types/chai-as-promised": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/@types/chai-as-promised/-/chai-as-promised-7.1.4.tgz", + "integrity": "sha512-1y3L1cHePcIm5vXkh1DSGf/zQq5n5xDKG1fpCvf18+uOkpce0Z1ozNFPkyWsVswK7ntN1sZBw3oU6gmN+pDUcA==", + "dev": true, + "dependencies": { + "@types/chai": "*" + } + }, "node_modules/@types/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", @@ -33045,6 +33055,15 @@ "integrity": "sha512-tFfcE+DSTzWAgifkjik9AySNqIyNoYwmR+uecPwwD/XRNfvOjmC/FjCxpiUGDkDVDphPfCUecSQVFw+lN3M3kQ==", "dev": true }, + "@types/chai-as-promised": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/@types/chai-as-promised/-/chai-as-promised-7.1.4.tgz", + "integrity": "sha512-1y3L1cHePcIm5vXkh1DSGf/zQq5n5xDKG1fpCvf18+uOkpce0Z1ozNFPkyWsVswK7ntN1sZBw3oU6gmN+pDUcA==", + "dev": true, + "requires": { + "@types/chai": "*" + } + }, "@types/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", diff --git a/package.json b/package.json index cd3d62d9..6c3139d9 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@studydefi/money-legos": "^2.4.2", "@tenderly/hardhat-tenderly": "^1.0.13", "@types/chai": "^4.2.22", + "@types/chai-as-promised": "^7.1.4", "@types/mocha": "^9.0.0", "@types/node": "^16.11.11", "chai": "^4.3.4", diff --git a/test/mainnet/b.protocol/b.compound.test.ts b/test/mainnet/b.protocol/b.compound.test.ts index 8c885a2b..fbda13f9 100644 --- a/test/mainnet/b.protocol/b.compound.test.ts +++ b/test/mainnet/b.protocol/b.compound.test.ts @@ -3,9 +3,9 @@ import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; //check const { provider, deployContract } = waffle -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector" import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; diff --git a/test/mainnet/b.protocol/b.liquity.test.ts b/test/mainnet/b.protocol/b.liquity.test.ts index cefd7601..65d3996c 100644 --- a/test/mainnet/b.protocol/b.liquity.test.ts +++ b/test/mainnet/b.protocol/b.liquity.test.ts @@ -3,9 +3,9 @@ import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; //check const { provider, deployContract } = waffle -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector" import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; diff --git a/test/mainnet/b.protocol/b.maker.test.ts b/test/mainnet/b.protocol/b.maker.test.ts index d87da72e..31f2c26a 100644 --- a/test/mainnet/b.protocol/b.maker.test.ts +++ b/test/mainnet/b.protocol/b.maker.test.ts @@ -3,9 +3,9 @@ import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector" import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; diff --git a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts index 2d16e1d3..5c85581a 100644 --- a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts +++ b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts @@ -4,9 +4,9 @@ const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle import { abi } from "../../../scripts/constant/abi/core/InstaImplementations.json" -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector" import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses" import { abis } from "../../../scripts/constant/abis" diff --git a/test/mainnet/basic-ERC721/ERC721-transfer.ts b/test/mainnet/basic-ERC721/ERC721-transfer.ts index 43dbb50e..db4acb9e 100644 --- a/test/mainnet/basic-ERC721/ERC721-transfer.ts +++ b/test/mainnet/basic-ERC721/ERC721-transfer.ts @@ -4,9 +4,9 @@ const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle import { abi } from "../../../scripts/constant/abi/core/InstaImplementations.json" -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector" import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses" import { abis } from "../../../scripts/constant/abis" diff --git a/test/mainnet/instapool/instapool.test.ts b/test/mainnet/instapool/instapool.test.ts index 1a309416..3abb59c0 100644 --- a/test/mainnet/instapool/instapool.test.ts +++ b/test/mainnet/instapool/instapool.test.ts @@ -3,10 +3,10 @@ import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector" import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" -import encodeFlashcastData from "../../../scripts/tests/encodeFlashcastData.js" +import { encodeSpells } from "../../../scripts/tests/encodeSpells" +import encodeFlashcastData from "../../../scripts/tests/encodeFlashcastData" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; diff --git a/test/mainnet/mappings/mappings.test.ts b/test/mainnet/mappings/mappings.test.ts index bea79b0d..dfc60644 100644 --- a/test/mainnet/mappings/mappings.test.ts +++ b/test/mainnet/mappings/mappings.test.ts @@ -1,14 +1,15 @@ -import { ethers, network } from "hardhat"; +import hre, { ethers, network } from "hardhat"; import chai from "chai"; import chaiPromise from "chai-as-promised"; import { solidity } from "ethereum-waffle"; +import type { Signer, Contract } from "ethers"; chai.use(chaiPromise); chai.use(solidity); const { expect } = chai; -const getMapping = (address, signer) => { +const getMapping = (address: string, signer: Signer) => { return ethers.getContractAt("InstaMappingController", address, signer); }; @@ -25,6 +26,7 @@ describe("Test InstaMapping contract", () => { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 12796965, }, diff --git a/test/mainnet/pooltogether-polygon/pooltogether.test.ts b/test/mainnet/pooltogether-polygon/pooltogether.test.ts index 462d7d4b..31b645f2 100644 --- a/test/mainnet/pooltogether-polygon/pooltogether.test.ts +++ b/test/mainnet/pooltogether-polygon/pooltogether.test.ts @@ -1,422 +1,561 @@ import { expect } from "chai"; import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; -const { provider, deployContract } = waffle +const { provider, deployContract } = waffle; const ALCHEMY_ID = process.env.ALCHEMY_ID; -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" -import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; +import { encodeSpells } from "../../../scripts/tests/encodeSpells"; +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; +import { addresses } from "../../../scripts/constant/addresses"; +import { abis } from "../../../scripts/constant/abis"; +import { tokens } from "../../../scripts/constant/tokens"; +import type { Signer, Contract } from "ethers"; -import { addresses } from "../../../scripts/constant/addresses" -import { abis } from "../../../scripts/constant/abis" -import { constants } from "../../../scripts/constant/constant" -import { tokens } from "../../../scripts/constant/tokens" +import { ConnectV2AaveV2Polygon__factory, ConnectV2PoolTogetherPolygon__factory } from "../../../typechain"; - -import connectV2AaveV2Artifacts from "../../artifacts/contracts/polygon/connectors/aave/v2/main.sol/ConnectV2AaveV2Polygon.json" -import connectV2PoolTogetherArtifacts from "../../artifacts/contracts/polygon/connectors/pooltogether/main.sol/ConnectV2PoolTogetherPolygon.json" - -const DAI_TOKEN_ADDR = tokens.dai.address // DAI Token +const DAI_TOKEN_ADDR = tokens.dai.address; // DAI Token // PoolTogether Address: https://docs.pooltogether.com/resources/networks/matic -const USDC_PRIZE_POOL_ADDR = "0xEE06AbE9e2Af61cabcb13170e01266Af2DEFa946" // USDC Prize Pool -const PT_USDC_TICKET_ADDR = "0x473E484c722EF9ec6f63B509b07Bb9cfB258820b" // PT USDC Ticket -const PT_USDC_SPONGSOR_TICKET_ADDR = "0x19c0e557ee5a9b456f613ba3d025a4dc45b52c35" // PT USDC Sponsor Ticket -const USDC_POOL_FAUCET_ADDR = "0x6cbc003fE015D753180f072d904bA841b2415498" // USDC POOL Faucet -const POOL_TOKEN_ADDRESS = "0x25788a1a171ec66Da6502f9975a15B609fF54CF6" // POOL Tocken -const TOKEN_FAUCET_PROXY_FACTORY_ADDR = "0xeaa636304a7C8853324B6b603dCdE55F92dfbab1" // TokenFaucetProxyFactory for claimAll +const USDC_PRIZE_POOL_ADDR = "0xEE06AbE9e2Af61cabcb13170e01266Af2DEFa946"; // USDC Prize Pool +const PT_USDC_TICKET_ADDR = "0x473E484c722EF9ec6f63B509b07Bb9cfB258820b"; // PT USDC Ticket +const PT_USDC_SPONGSOR_TICKET_ADDR = + "0x19c0e557ee5a9b456f613ba3d025a4dc45b52c35"; // PT USDC Sponsor Ticket +const USDC_POOL_FAUCET_ADDR = "0x6cbc003fE015D753180f072d904bA841b2415498"; // USDC POOL Faucet +const POOL_TOKEN_ADDRESS = "0x25788a1a171ec66Da6502f9975a15B609fF54CF6"; // POOL Tocken +const TOKEN_FAUCET_PROXY_FACTORY_ADDR = + "0xeaa636304a7C8853324B6b603dCdE55F92dfbab1"; // TokenFaucetProxyFactory for claimAll // Community WETH Prize Pool (Rari): https://reference-app.pooltogether.com/pools/mainnet/0xa88ca010b32a54d446fc38091ddbca55750cbfc3/manage#stats -const WETH_PRIZE_POOL_ADDR = "0xa88ca010b32a54d446fc38091ddbca55750cbfc3" // Community WETH Prize Pool (Rari) -const WETH_POOL_TICKET_ADDR = "0x9b5c30aeb9ce2a6a121cea9a85bc0d662f6d9b40" // Community WETH Prize Pool Ticket (Rari) +const WETH_PRIZE_POOL_ADDR = "0xa88ca010b32a54d446fc38091ddbca55750cbfc3"; // Community WETH Prize Pool (Rari) +const WETH_POOL_TICKET_ADDR = "0x9b5c30aeb9ce2a6a121cea9a85bc0d662f6d9b40"; // Community WETH Prize Pool Ticket (Rari) const prizePoolABI = [ - "function calculateEarlyExitFee( address from, address controlledToken, uint256 amount) external returns ( uint256 exitFee, uint256 burnedCredit)", - "function creditPlanOf( address controlledToken) external view returns ( uint128 creditLimitMantissa, uint128 creditRateMantissa)" -] + "function calculateEarlyExitFee( address from, address controlledToken, uint256 amount) external returns ( uint256 exitFee, uint256 burnedCredit)", + "function creditPlanOf( address controlledToken) external view returns ( uint128 creditLimitMantissa, uint128 creditRateMantissa)", +]; const connectorsABI = [ - "function isConnectors(string[] calldata connectorNames) external view returns (bool, address[] memory)" -] + "function isConnectors(string[] calldata connectorNames) external view returns (bool, address[] memory)", +]; -describe("PoolTogether", function () { - const connectorName = "AAVEV2-TEST-A" - const ptConnectorName = "POOLTOGETHER-TEST-A" +describe("PoolTogether", function() { + const connectorName = "AAVEV2-TEST-A"; + const ptConnectorName = "POOLTOGETHER-TEST-A"; - let dsaWallet0 - let masterSigner; - let instaConnectorsV2; - let connector; - let ptConnector; + let dsaWallet0: any; + let masterSigner: Signer; + let instaConnectorsV2: Contract; + let connector: any; + let ptConnector: Contract; - const wallets = provider.getWallets() - const [wallet0, wallet1, wallet2, wallet3] = wallets - before(async () => { - await hre.network.provider.request({ - method: "hardhat_reset", - params: [ - { - forking: { - jsonRpcUrl: `https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_ID}`, - blockNumber: 18717337, - }, - }, - ], - }); - - masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); - - // Deploy and enable Compound Connector - connector = await deployAndEnableConnector({ - connectorName, - contractArtifact: connectV2AaveV2Artifacts, - signer: masterSigner, - connectors: instaConnectorsV2 - }) - - // Deploy and enable Pool Together Connector - ptConnector = await deployAndEnableConnector({ - connectorName: ptConnectorName, - contractArtifact: connectV2PoolTogetherArtifacts, - signer: masterSigner, - connectors: instaConnectorsV2 - }) - }) - - it("Should have contracts deployed.", async function () { - expect(!!instaConnectorsV2.address).to.be.true; - expect(!!connector.address).to.be.true; - expect(!!ptConnector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + const wallets = provider.getWallets(); + const [wallet0, wallet1, wallet2, wallet3] = wallets; + before(async () => { + await hre.network.provider.request({ + method: "hardhat_reset", + params: [ + { + forking: { + jsonRpcUrl: `https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_ID}`, + blockNumber: 18717337, + }, + }, + ], }); - describe("DSA wallet setup", function () { - it("Should build DSA v2", async function () { - dsaWallet0 = await buildDSAv2(wallet0.address) - expect(!!dsaWallet0.address).to.be.true; - }); + masterSigner = await getMasterSigner(); + instaConnectorsV2 = await ethers.getContractAt( + abis.core.connectorsV2, + addresses.core.connectorsV2 + ); - it("Deposit 1000 MATIC into DSA wallet", async function () { - await wallet0.sendTransaction({ - to: dsaWallet0.address, - value: ethers.utils.parseEther("1000") - }); - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("1000")); - }); + // Deploy and enable Compound Connector + connector = await deployAndEnableConnector({ + connectorName, + contractArtifact: ConnectV2AaveV2Polygon__factory, + signer: masterSigner, + connectors: instaConnectorsV2, }); - describe("Main - USDC Prize Pool Test", function () { - - it("Should deposit 100 MATIC in AAVE V2", async function () { - const amount = ethers.utils.parseEther("100") // 100 MATIC - const spells = [ - { - connector: connectorName, - method: "deposit", - args: [tokens.matic.address, amount, 0, 0] - } - ] - - const tx = await dsaWallet0.cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("900")); - }); - - it("Should borrow 10 USDC from AAVE V2 and deposit USDC into USDC Prize Pool", async function () { - const amount = ethers.utils.parseUnits("10", 6) // 10 USDC - const setId = "83478237" - const spells = [ - { - connector: connectorName, - method: "borrow", - args: [tokens.usdc.address, amount, 2, 0, setId] - }, - { - connector: ptConnectorName, - method: "depositTo", - args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_SPONGSOR_TICKET_ADDR, setId, 0] - } - ] - // Before Spell - let usdcToken = await ethers.getContractAt(abis.basic.erc20, tokens.usdc.address) - let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - expect(usdcBalance, `USDC balance is 0`).to.be.eq(ethers.utils.parseUnits("0", 6)); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_USDC_SPONGSOR_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance, `PoolTogether USDC Ticket balance is 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - expect(usdcBalance, `Expect USDC balance to still equal 0 since it was deposited into Prize Pool`).to.be.eq(0); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether USDC Ticket balance equals 10`).to.be.eq(ethers.utils.parseUnits("10", 6)); - - // ETH used for transaction - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("900")); - }); - - it("Should wait 11 days, withdraw all PrizePool, get back 10 USDC, and claim POOL", async function () { - const amount = ethers.utils.parseUnits("10", 6) // 10 USDC - - let prizePoolContract = new ethers.Contract(USDC_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); - // const { creditLimitMantissa, creditRateMantissa } = await prizePoolContract.creditPlanOf(PT_USDC_TICKET_ADDR); - // console.log("CreditLimitMantiss: ", creditLimitMantissa.toString()); - // console.log("CreditRateMantiss: ", creditRateMantissa.toString()); - let earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_USDC_SPONGSOR_TICKET_ADDR, amount); - expect(earlyExitFee.exitFee, "Exit Fee equal to 0 USDC because 0% fee for sponsorship ticket").to.be.eq(ethers.utils.parseUnits("0", 6)); - - const spells = [ - { - connector: ptConnectorName, - method: "claim", - args: [USDC_POOL_FAUCET_ADDR, 0] - }, - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_SPONGSOR_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] - } - - ] - - // Before spell - let usdcToken = await ethers.getContractAt(abis.basic.erc20, tokens.usdc.address) - let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - expect(usdcBalance, `USDC balance equals 0`).to.be.eq(ethers.utils.parseEther("0")); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_USDC_SPONGSOR_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance, `PoolTogether USDC Ticket is 10`).to.be.eq(ethers.utils.parseUnits("10", 6)); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token equals 0`).to.be.eq(ethers.utils.parseEther("0")); - - // Increase time by 11 days so we get back all USDC without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [15 * 24 * 60 * 60]); - await ethers.provider.send("evm_mine"); - - earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_USDC_SPONGSOR_TICKET_ADDR, amount); - expect(earlyExitFee.exitFee, "Exit Fee equal to 0 DAI because past 14 days").to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - console.log("USDC BALANCE: ", usdcBalance.toString()); - console.log("USDC BALANCE: ", ethers.utils.parseUnits("10", 6).toString()); - expect(usdcBalance, - `USDC balance to be equal to 10, because of no early withdrawal fee` - ).to.be.eq(ethers.utils.parseUnits("10", 6)); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether USDC Ticket to equal 0`).to.be.eq(0); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - console.log("POOL BALANCE AFTER:", poolBalanceAfter.toString()); - expect(poolBalanceAfter, `POOL Token Balance to be greater than 0`).to.be.gt(ethers.utils.parseEther("0")); - }); - - it("Should deposit and withdraw all PrizePool, get back less than 10 USDC", async function () { - const amount = ethers.utils.parseUnits("10", 6) // 10 USDC - const exitFee = ethers.utils.parseUnits(".1", 6) // 1 USDC is 1% of 100 USDC - const spells = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_TICKET_ADDR, 0, 0] - }, - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_TICKET_ADDR, exitFee, 0, 0] - } - ] - - // Before spell - let usdcToken = await ethers.getContractAt(abis.basic.erc20, tokens.usdc.address) - let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - expect(usdcBalance, `USDC Balance equals 100`).to.be.eq(ethers.utils.parseUnits("10", 6)); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_USDC_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance, `PoolTogether USDC Ticket equals 0`).to.be.eq(0); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `PoolTogether Token greater than 0`).to.be.gt(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - expect(usdcBalance, - `USDC balance to be less than 10, because of early withdrawal fee` - ).to.be.lt(ethers.utils.parseUnits("10", 6)); - - console.log("USDC BALANCE AFTER:", usdcBalance.toString()); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether USDC Ticket to equal 0`).to.be.eq(0); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `POOL Token Balance to greater than 0`).to.be.gt(ethers.utils.parseEther("0")); - - }); - - it("Should deposit, wait 11 days, and withdraw all PrizePool, get 10 USDC, and claim all POOL using claimAll", async function () { - const amount = ethers.utils.parseUnits("9.9", 6) // 9 USDC - const depositSpells = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_SPONGSOR_TICKET_ADDR, 0, 0] - } - ] - - // Before spell - let usdcToken = await ethers.getContractAt(abis.basic.erc20, tokens.usdc.address) - let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - expect(usdcBalance, `USDC balance less than 10`).to.be.lt(ethers.utils.parseUnits("10", 6)); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_USDC_SPONGSOR_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance, `PoolTogether USDC Ticket equal 0`).to.be.eq(0); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token is greater than 0`).to.be.gt(ethers.utils.parseEther("0")); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(depositSpells), wallet1.address) - const receipt = await tx.wait() - - const prizePoolContract = new ethers.Contract(USDC_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); - let earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_USDC_SPONGSOR_TICKET_ADDR, amount); - expect(earlyExitFee.exitFee, "Exit Fee equal to 0 USDC because fee 0%").to.be.eq(0); - - // Increase time by 11 days so we get back all DAI without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); - await ethers.provider.send("evm_mine"); - - const withdrawSpells = [ - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_SPONGSOR_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] - }, - { - connector: ptConnectorName, - method: "claimAll", - args: [TOKEN_FAUCET_PROXY_FACTORY_ADDR, [USDC_POOL_FAUCET_ADDR]] - } - ] - - // Run spell transaction - const tx2 = await dsaWallet0.connect(wallet0).cast(...encodeSpells(withdrawSpells), wallet1.address) - const receipt2 = await tx2.wait() - - // After spell - usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); - expect(usdcBalance, `USDC balance equals 9.9`).to.be.eq(ethers.utils.parseUnits("9.9", 6)); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether USDC Ticket equal 0`).to.be.eq(0); - - // Expect - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - console.log("POOL BALANCE AFTER:", poolBalanceAfter.toString()); - expect(poolBalanceAfter, `Pool Token to be greater than before`).to.be.gt(poolBalance); - }); - // }) - - // NO WMATIC POOLS: https://reference-app.pooltogether.com/pools/polygon - // describe("Main - WETH Prize Pool Test", function () { - // it("Deposit 1 ETH into WETH Prize Pool and withdraw immediately", async function () { - // const amount = ethers.utils.parseEther("1") // 1 ETH - // const setId = "83478237" - // const spells = [ - // { - // connector: ptConnectorName, - // method: "depositTo", - // args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, setId] - // }, - // { - // connector: ptConnectorName, - // method: "withdrawInstantlyFrom", - // args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, amount, setId, 0] - // }, - // ] - // // Before Spell - // const ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); - - // // Run spell transaction - // const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - // const receipt = await tx.wait() - - // // After spell - // const ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - - // // ETH used for transaction - // expect(ethBalanceAfter, `ETH Balance less than before spell because of early withdrawal fee`).to.be.lte(ethBalanceBefore); - // }); - - // it("Deposit 1 ETH into WETH Prize Pool, wait 14 days, then withdraw", async function () { - // const amount = ethers.utils.parseEther("1") // 1 ETH - // const depositSpell = [ - // { - // connector: ptConnectorName, - // method: "depositTo", - // args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, 0] - // } - // ] - - // const withdrawSpell = [ - // { - // connector: ptConnectorName, - // method: "withdrawInstantlyFrom", - // args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, amount, 0, 0] - // } - // ] - - // // Before Deposit Spell - // let ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); - - // // Run deposit spell transaction - // const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(depositSpell), wallet1.address) - // const receipt = await tx.wait() - - // // After Deposit spell - // let ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - - // expect(ethBalanceAfter, `ETH Balance less than before spell`).to.be.lte(ethBalanceBefore); - - // // Increase time by 11 days so we get back all ETH without early withdrawal fee - // await ethers.provider.send("evm_increaseTime", [14*24*60*60]); - // await ethers.provider.send("evm_mine"); - - // // Run withdraw spell transaction - // const tx2 = await dsaWallet0.connect(wallet0).cast(...encodeSpells(withdrawSpell), wallet1.address) - // const receipt2 = await tx.wait() - - // // After Deposit spell - // ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - - // expect(ethBalanceAfter, `ETH Balance equal to before spell because no early exit fee`).to.be.eq(ethBalanceBefore); - // }); + // Deploy and enable Pool Together Connector + ptConnector = await deployAndEnableConnector({ + connectorName: ptConnectorName, + contractArtifact: ConnectV2PoolTogetherPolygon__factory, + signer: masterSigner, + connectors: instaConnectorsV2, }); -}) \ No newline at end of file + }); + + it("Should have contracts deployed.", async function() { + expect(!!instaConnectorsV2.address).to.be.true; + expect(!!connector.address).to.be.true; + expect(!!ptConnector.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; + }); + + describe("DSA wallet setup", function() { + it("Should build DSA v2", async function() { + dsaWallet0 = await buildDSAv2(wallet0.address); + expect(!!dsaWallet0.address).to.be.true; + }); + + it("Deposit 1000 MATIC into DSA wallet", async function() { + await wallet0.sendTransaction({ + to: dsaWallet0.address, + value: ethers.utils.parseEther("1000"), + }); + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte( + ethers.utils.parseEther("1000") + ); + }); + }); + + describe("Main - USDC Prize Pool Test", function() { + it("Should deposit 100 MATIC in AAVE V2", async function() { + const amount = ethers.utils.parseEther("100"); // 100 MATIC + const spells = [ + { + connector: connectorName, + method: "deposit", + args: [tokens.eth.address, amount, 0, 0], + }, + ]; + + const tx = await dsaWallet0.cast( + ...encodeSpells(spells), + wallet1.address + ); + const receipt = await tx.wait(); + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( + ethers.utils.parseEther("900") + ); + }); + + it("Should borrow 10 USDC from AAVE V2 and deposit USDC into USDC Prize Pool", async function() { + const amount = ethers.utils.parseUnits("10", 6); // 10 USDC + const setId = "83478237"; + const spells = [ + { + connector: connectorName, + method: "borrow", + args: [tokens.usdc.address, amount, 2, 0, setId], + }, + { + connector: ptConnectorName, + method: "depositTo", + args: [ + USDC_PRIZE_POOL_ADDR, + amount, + PT_USDC_SPONGSOR_TICKET_ADDR, + setId, + 0, + ], + }, + ]; + // Before Spell + let usdcToken = await ethers.getContractAt( + abis.basic.erc20, + tokens.usdc.address + ); + let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + expect(usdcBalance, `USDC balance is 0`).to.be.eq( + ethers.utils.parseUnits("0", 6) + ); + + let cToken = await ethers.getContractAt( + abis.basic.erc20, + PT_USDC_SPONGSOR_TICKET_ADDR + ); + const balance = await cToken.balanceOf(dsaWallet0.address); + expect(balance, `PoolTogether USDC Ticket balance is 0`).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + expect( + usdcBalance, + `Expect USDC balance to still equal 0 since it was deposited into Prize Pool` + ).to.be.eq(0); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address); + expect( + balanceAfter, + `PoolTogether USDC Ticket balance equals 10` + ).to.be.eq(ethers.utils.parseUnits("10", 6)); + + // ETH used for transaction + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( + ethers.utils.parseEther("900") + ); + }); + + it("Should wait 11 days, withdraw all PrizePool, get back 10 USDC, and claim POOL", async function() { + const amount = ethers.utils.parseUnits("10", 6); // 10 USDC + + let prizePoolContract = new ethers.Contract( + USDC_PRIZE_POOL_ADDR, + prizePoolABI, + ethers.provider + ); + // const { creditLimitMantissa, creditRateMantissa } = await prizePoolContract.creditPlanOf(PT_USDC_TICKET_ADDR); + // console.log("CreditLimitMantiss: ", creditLimitMantissa.toString()); + // console.log("CreditRateMantiss: ", creditRateMantissa.toString()); + let earlyExitFee = await prizePoolContract.callStatic[ + "calculateEarlyExitFee" + ](dsaWallet0.address, PT_USDC_SPONGSOR_TICKET_ADDR, amount); + expect( + earlyExitFee.exitFee, + "Exit Fee equal to 0 USDC because 0% fee for sponsorship ticket" + ).to.be.eq(ethers.utils.parseUnits("0", 6)); + + const spells = [ + { + connector: ptConnectorName, + method: "claim", + args: [USDC_POOL_FAUCET_ADDR, 0], + }, + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + USDC_PRIZE_POOL_ADDR, + amount, + PT_USDC_SPONGSOR_TICKET_ADDR, + earlyExitFee.exitFee, + 0, + 0, + ], + }, + ]; + + // Before spell + let usdcToken = await ethers.getContractAt( + abis.basic.erc20, + tokens.usdc.address + ); + let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + expect(usdcBalance, `USDC balance equals 0`).to.be.eq( + ethers.utils.parseEther("0") + ); + + let cToken = await ethers.getContractAt( + abis.basic.erc20, + PT_USDC_SPONGSOR_TICKET_ADDR + ); + const balance = await cToken.balanceOf(dsaWallet0.address); + expect(balance, `PoolTogether USDC Ticket is 10`).to.be.eq( + ethers.utils.parseUnits("10", 6) + ); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token equals 0`).to.be.eq( + ethers.utils.parseEther("0") + ); + + // Increase time by 11 days so we get back all USDC without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [15 * 24 * 60 * 60]); + + earlyExitFee = await prizePoolContract.callStatic[ + "calculateEarlyExitFee" + ](dsaWallet0.address, PT_USDC_SPONGSOR_TICKET_ADDR, amount); + expect( + earlyExitFee.exitFee, + "Exit Fee equal to 0 DAI because past 14 days" + ).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + console.log("USDC BALANCE: ", usdcBalance.toString()); + console.log( + "USDC BALANCE: ", + ethers.utils.parseUnits("10", 6).toString() + ); + expect( + usdcBalance, + `USDC balance to be equal to 10, because of no early withdrawal fee` + ).to.be.eq(ethers.utils.parseUnits("10", 6)); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address); + expect(balanceAfter, `PoolTogether USDC Ticket to equal 0`).to.be.eq(0); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + console.log("POOL BALANCE AFTER:", poolBalanceAfter.toString()); + expect( + poolBalanceAfter, + `POOL Token Balance to be greater than 0` + ).to.be.gt(ethers.utils.parseEther("0")); + }); + + it("Should deposit and withdraw all PrizePool, get back less than 10 USDC", async function() { + const amount = ethers.utils.parseUnits("10", 6); // 10 USDC + const exitFee = ethers.utils.parseUnits(".1", 6); // 1 USDC is 1% of 100 USDC + const spells = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [USDC_PRIZE_POOL_ADDR, amount, PT_USDC_TICKET_ADDR, 0, 0], + }, + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + USDC_PRIZE_POOL_ADDR, + amount, + PT_USDC_TICKET_ADDR, + exitFee, + 0, + 0, + ], + }, + ]; + + // Before spell + let usdcToken = await ethers.getContractAt( + abis.basic.erc20, + tokens.usdc.address + ); + let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + expect(usdcBalance, `USDC Balance equals 100`).to.be.eq( + ethers.utils.parseUnits("10", 6) + ); + + let cToken = await ethers.getContractAt( + abis.basic.erc20, + PT_USDC_TICKET_ADDR + ); + const balance = await cToken.balanceOf(dsaWallet0.address); + expect(balance, `PoolTogether USDC Ticket equals 0`).to.be.eq(0); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `PoolTogether Token greater than 0`).to.be.gt(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + expect( + usdcBalance, + `USDC balance to be less than 10, because of early withdrawal fee` + ).to.be.lt(ethers.utils.parseUnits("10", 6)); + + console.log("USDC BALANCE AFTER:", usdcBalance.toString()); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address); + expect(balanceAfter, `PoolTogether USDC Ticket to equal 0`).to.be.eq(0); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalanceAfter, `POOL Token Balance to greater than 0`).to.be.gt( + ethers.utils.parseEther("0") + ); + }); + + it("Should deposit, wait 11 days, and withdraw all PrizePool, get 10 USDC, and claim all POOL using claimAll", async function() { + const amount = ethers.utils.parseUnits("9.9", 6); // 9 USDC + const depositSpells = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [ + USDC_PRIZE_POOL_ADDR, + amount, + PT_USDC_SPONGSOR_TICKET_ADDR, + 0, + 0, + ], + }, + ]; + + // Before spell + let usdcToken = await ethers.getContractAt( + abis.basic.erc20, + tokens.usdc.address + ); + let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + expect(usdcBalance, `USDC balance less than 10`).to.be.lt( + ethers.utils.parseUnits("10", 6) + ); + + let cToken = await ethers.getContractAt( + abis.basic.erc20, + PT_USDC_SPONGSOR_TICKET_ADDR + ); + const balance = await cToken.balanceOf(dsaWallet0.address); + expect(balance, `PoolTogether USDC Ticket equal 0`).to.be.eq(0); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token is greater than 0`).to.be.gt( + ethers.utils.parseEther("0") + ); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(depositSpells), wallet1.address); + const receipt = await tx.wait(); + + const prizePoolContract = new ethers.Contract( + USDC_PRIZE_POOL_ADDR, + prizePoolABI, + ethers.provider + ); + let earlyExitFee = await prizePoolContract.callStatic[ + "calculateEarlyExitFee" + ](dsaWallet0.address, PT_USDC_SPONGSOR_TICKET_ADDR, amount); + expect( + earlyExitFee.exitFee, + "Exit Fee equal to 0 USDC because fee 0%" + ).to.be.eq(0); + + // Increase time by 11 days so we get back all DAI without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); + + const withdrawSpells = [ + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + USDC_PRIZE_POOL_ADDR, + amount, + PT_USDC_SPONGSOR_TICKET_ADDR, + earlyExitFee.exitFee, + 0, + 0, + ], + }, + { + connector: ptConnectorName, + method: "claimAll", + args: [TOKEN_FAUCET_PROXY_FACTORY_ADDR, [USDC_POOL_FAUCET_ADDR]], + }, + ]; + + // Run spell transaction + const tx2 = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(withdrawSpells), wallet1.address); + const receipt2 = await tx2.wait(); + + // After spell + usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); + expect(usdcBalance, `USDC balance equals 9.9`).to.be.eq( + ethers.utils.parseUnits("9.9", 6) + ); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address); + expect(balanceAfter, `PoolTogether USDC Ticket equal 0`).to.be.eq(0); + + // Expect + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + console.log("POOL BALANCE AFTER:", poolBalanceAfter.toString()); + expect(poolBalanceAfter, `Pool Token to be greater than before`).to.be.gt( + poolBalance + ); + }); + // }) + + // NO WMATIC POOLS: https://reference-app.pooltogether.com/pools/polygon + // describe("Main - WETH Prize Pool Test", function () { + // it("Deposit 1 ETH into WETH Prize Pool and withdraw immediately", async function () { + // const amount = ethers.utils.parseEther("1") // 1 ETH + // const setId = "83478237" + // const spells = [ + // { + // connector: ptConnectorName, + // method: "depositTo", + // args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, setId] + // }, + // { + // connector: ptConnectorName, + // method: "withdrawInstantlyFrom", + // args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, amount, setId, 0] + // }, + // ] + // // Before Spell + // const ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); + + // // Run spell transaction + // const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) + // const receipt = await tx.wait() + + // // After spell + // const ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); + + // // ETH used for transaction + // expect(ethBalanceAfter, `ETH Balance less than before spell because of early withdrawal fee`).to.be.lte(ethBalanceBefore); + // }); + + // it("Deposit 1 ETH into WETH Prize Pool, wait 14 days, then withdraw", async function () { + // const amount = ethers.utils.parseEther("1") // 1 ETH + // const depositSpell = [ + // { + // connector: ptConnectorName, + // method: "depositTo", + // args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, 0] + // } + // ] + + // const withdrawSpell = [ + // { + // connector: ptConnectorName, + // method: "withdrawInstantlyFrom", + // args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, amount, 0, 0] + // } + // ] + + // // Before Deposit Spell + // let ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); + + // // Run deposit spell transaction + // const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(depositSpell), wallet1.address) + // const receipt = await tx.wait() + + // // After Deposit spell + // let ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); + + // expect(ethBalanceAfter, `ETH Balance less than before spell`).to.be.lte(ethBalanceBefore); + + // // Increase time by 11 days so we get back all ETH without early withdrawal fee + // await ethers.provider.send("evm_increaseTime", [14*24*60*60]); + // await ethers.provider.send("evm_mine"); + + // // Run withdraw spell transaction + // const tx2 = await dsaWallet0.connect(wallet0).cast(...encodeSpells(withdrawSpell), wallet1.address) + // const receipt2 = await tx.wait() + + // // After Deposit spell + // ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); + + // expect(ethBalanceAfter, `ETH Balance equal to before spell because no early exit fee`).to.be.eq(ethBalanceBefore); + // }); + }); +}); diff --git a/test/mainnet/pooltogether/pooltogether.test.ts b/test/mainnet/pooltogether/pooltogether.test.ts index 2aadfa8e..610a3bbe 100644 --- a/test/mainnet/pooltogether/pooltogether.test.ts +++ b/test/mainnet/pooltogether/pooltogether.test.ts @@ -1,811 +1,1225 @@ import { expect } from "chai"; import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; -const { provider, deployContract } = waffle +const { provider, deployContract } = waffle; -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" -import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; +import { encodeSpells } from "../../../scripts/tests/encodeSpells"; +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; -import { addresses } from "../../../scripts/constant/addresses" -import { abis } from "../../../scripts/constant/abis" -import { constants } from "../../../scripts/constant/constant" -import { tokens } from "../../../scripts/constant/tokens" +import { addresses } from "../../../scripts/constant/addresses"; +import { abis } from "../../../scripts/constant/abis"; +import { constants } from "../../../scripts/constant/constant"; +import { tokens } from "../../../scripts/constant/tokens"; +import type { Signer, Contract } from "ethers"; -import connectV2CompoundArtifacts from "../../artifacts/contracts/mainnet/connectors/compound/main.sol/ConnectV2Compound.json" -import connectV2PoolTogetherArtifacts from "../../artifacts/contracts/mainnet/connectors/pooltogether/main.sol/ConnectV2PoolTogether.json" -import connectV2UniswapArtifacts from "../../artifacts/contracts/mainnet/connectors/uniswap/main.sol/ConnectV2UniswapV2.json" +import { + ConnectV2Compound__factory, + ConnectV2PoolTogether__factory, + ConnectV2UniswapV2__factory, +} from "../../../typechain"; -const DAI_TOKEN_ADDR = tokens.dai.address // DAI Token +const DAI_TOKEN_ADDR = tokens.dai.address; // DAI Token // PoolTogether Address: https://docs.pooltogether.com/resources/networks/ethereum -const DAI_PRIZE_POOL_ADDR = "0xEBfb47A7ad0FD6e57323C8A42B2E5A6a4F68fc1a" // DAI Prize Pool -const PT_DAI_TICKET_ADDR = "0x334cBb5858417Aee161B53Ee0D5349cCF54514CF" // PT DAI Ticket -const DAI_POOL_FAUCET_ADDR = "0xF362ce295F2A4eaE4348fFC8cDBCe8d729ccb8Eb" // DAI POOL Faucet -const POOL_TOKEN_ADDRESS = "0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e" // POOL Tocken -const TOKEN_FAUCET_PROXY_FACTORY_ADDR = "0xE4E9cDB3E139D7E8a41172C20b6Ed17b6750f117" // TokenFaucetProxyFactory for claimAll -const DAI_POD_ADDR = "0x2f994e2E4F3395649eeE8A89092e63Ca526dA829" // DAI Pod -const UNISWAP_POOLETHLP_PRIZE_POOL_ADDR = "0x3AF7072D29Adde20FC7e173a7CB9e45307d2FB0A" // Uniswap Pool/ETH LP PrizePool -const UNISWAP_POOLETHLP_FAUCET_ADDR = "0x9A29401EF1856b669f55Ae5b24505b3B6fAEb370" // Uniswap Pool/ETH LP Faucet -const UNISWAP_POOLETHLP_TOKEN_ADDR = "0x85cb0bab616fe88a89a35080516a8928f38b518b" // Uniswap Pool/ETH Token -const PT_UNISWAP_POOLETHLP_TICKET_ADDR = "0xeb8928ee92efb06c44d072a24c2bcb993b61e543" // Pool Together Uniswap Pool/ETH LP Ticket -const POOL_PRIZE_POOL_ADDR = "0x396b4489da692788e327e2e4b2b0459a5ef26791" // POOL Prize Pool -const PT_POOL_TICKET_ADDR = "0x27d22a7648e955e510a40bdb058333e9190d12d4" // Pool Together POOL Ticket -const WETH_ADDR = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" // WETH -const DAI_POD_TOKEN_DROP = "0xc5209623E3dFdf9C0cCbe497c8012883C4147731" +const DAI_PRIZE_POOL_ADDR = "0xEBfb47A7ad0FD6e57323C8A42B2E5A6a4F68fc1a"; // DAI Prize Pool +const PT_DAI_TICKET_ADDR = "0x334cBb5858417Aee161B53Ee0D5349cCF54514CF"; // PT DAI Ticket +const DAI_POOL_FAUCET_ADDR = "0xF362ce295F2A4eaE4348fFC8cDBCe8d729ccb8Eb"; // DAI POOL Faucet +const POOL_TOKEN_ADDRESS = "0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e"; // POOL Tocken +const TOKEN_FAUCET_PROXY_FACTORY_ADDR = + "0xE4E9cDB3E139D7E8a41172C20b6Ed17b6750f117"; // TokenFaucetProxyFactory for claimAll +const DAI_POD_ADDR = "0x2f994e2E4F3395649eeE8A89092e63Ca526dA829"; // DAI Pod +const UNISWAP_POOLETHLP_PRIZE_POOL_ADDR = + "0x3AF7072D29Adde20FC7e173a7CB9e45307d2FB0A"; // Uniswap Pool/ETH LP PrizePool +const UNISWAP_POOLETHLP_FAUCET_ADDR = + "0x9A29401EF1856b669f55Ae5b24505b3B6fAEb370"; // Uniswap Pool/ETH LP Faucet +const UNISWAP_POOLETHLP_TOKEN_ADDR = + "0x85cb0bab616fe88a89a35080516a8928f38b518b"; // Uniswap Pool/ETH Token +const PT_UNISWAP_POOLETHLP_TICKET_ADDR = + "0xeb8928ee92efb06c44d072a24c2bcb993b61e543"; // Pool Together Uniswap Pool/ETH LP Ticket +const POOL_PRIZE_POOL_ADDR = "0x396b4489da692788e327e2e4b2b0459a5ef26791"; // POOL Prize Pool +const PT_POOL_TICKET_ADDR = "0x27d22a7648e955e510a40bdb058333e9190d12d4"; // Pool Together POOL Ticket +const WETH_ADDR = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; // WETH +const DAI_POD_TOKEN_DROP = "0xc5209623E3dFdf9C0cCbe497c8012883C4147731"; // Community WETH Prize Pool (Rari): https://reference-app.pooltogether.com/pools/mainnet/0xa88ca010b32a54d446fc38091ddbca55750cbfc3/manage#stats -const WETH_PRIZE_POOL_ADDR = "0xa88ca010b32a54d446fc38091ddbca55750cbfc3" // Community WETH Prize Pool (Rari) -const WETH_POOL_TICKET_ADDR = "0x9b5c30aeb9ce2a6a121cea9a85bc0d662f6d9b40" // Community WETH Prize Pool Ticket (Rari) +const WETH_PRIZE_POOL_ADDR = "0xa88ca010b32a54d446fc38091ddbca55750cbfc3"; // Community WETH Prize Pool (Rari) +const WETH_POOL_TICKET_ADDR = "0x9b5c30aeb9ce2a6a121cea9a85bc0d662f6d9b40"; // Community WETH Prize Pool Ticket (Rari) const prizePoolABI = [ - "function calculateEarlyExitFee( address from, address controlledToken, uint256 amount) external returns ( uint256 exitFee, uint256 burnedCredit)" -] + "function calculateEarlyExitFee( address from, address controlledToken, uint256 amount) external returns ( uint256 exitFee, uint256 burnedCredit)", +]; const podABI = [ - "function getEarlyExitFee(uint256 amount) external returns (uint256)", - "function balanceOfUnderlying(address user) external view returns (uint256 amount)", - "function drop() public returns (uint256)", - "function balanceOf(address account) external view returns (uint256)" -] + "function getEarlyExitFee(uint256 amount) external returns (uint256)", + "function balanceOfUnderlying(address user) external view returns (uint256 amount)", + "function drop() public returns (uint256)", + "function balanceOf(address account) external view returns (uint256)", +]; -const POD_FACTORY_ADDRESS = "0x4e3a9f9fbafb2ec49727cffa2a411f7a0c1c4ce1" +const POD_FACTORY_ADDRESS = "0x4e3a9f9fbafb2ec49727cffa2a411f7a0c1c4ce1"; const podFactoryABI = [ - "function create( address _prizePool, address _ticket, address _faucet, address _manager, uint8 _decimals) external returns (address pod)" -] + "function create( address _prizePool, address _ticket, address _faucet, address _manager, uint8 _decimals) external returns (address pod)", +]; const tokenDropABI = [ - "function claim(address user) external returns (uint256)", -] + "function claim(address user) external returns (uint256)", +]; -describe("PoolTogether", function () { - const connectorName = "COMPOUND-TEST-A" - const uniswapConnectorName = "UNISWAP-TEST-A" - const ptConnectorName = "POOLTOGETHER-TEST-A" +describe("PoolTogether", function() { + const connectorName = "COMPOUND-TEST-A"; + const uniswapConnectorName = "UNISWAP-TEST-A"; + const ptConnectorName = "POOLTOGETHER-TEST-A"; - let dsaWallet0: any - let masterSigner: any; - let instaConnectorsV2: any; - let connector: any; - let ptConnector: any; - let uniswapConnector: any; + let dsaWallet0: any; + let masterSigner: Signer; + let instaConnectorsV2: Contract; + let connector: any; + let ptConnector: any; + let uniswapConnector: any; - const wallets = provider.getWallets() - const [wallet0, wallet1, wallet2, wallet3] = wallets - before(async () => { - masterSigner = await getMasterSigner(wallet3) - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); + const wallets = provider.getWallets(); + const [wallet0, wallet1, wallet2, wallet3] = wallets; + before(async () => { + masterSigner = await getMasterSigner(); + instaConnectorsV2 = await ethers.getContractAt( + abis.core.connectorsV2, + addresses.core.connectorsV2 + ); - // Deploy and enable Compound Connector - connector = await deployAndEnableConnector({ - connectorName, - contractArtifact: connectV2CompoundArtifacts, - signer: masterSigner, - connectors: instaConnectorsV2 - }) - - // Deploy and enable Pool Together Connector - ptConnector = await deployAndEnableConnector({ - connectorName: ptConnectorName, - contractArtifact: connectV2PoolTogetherArtifacts, - signer: masterSigner, - connectors: instaConnectorsV2 - }) - - // Deploy and enable Uniswap Connector - uniswapConnector = await deployAndEnableConnector({ - connectorName: uniswapConnectorName, - contractArtifact: connectV2UniswapArtifacts, - signer: masterSigner, - connectors: instaConnectorsV2 - }) - }) - - it("Should have contracts deployed.", async function () { - expect(!!instaConnectorsV2.address).to.be.true; - expect(!!connector.address).to.be.true; - expect(!!ptConnector.address).to.be.true; - expect(!!uniswapConnector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + // Deploy and enable Compound Connector + connector = await deployAndEnableConnector({ + connectorName, + contractArtifact: ConnectV2Compound__factory, + signer: masterSigner, + connectors: instaConnectorsV2, }); - describe("DSA wallet setup", function () { - it("Should build DSA v2", async function () { - dsaWallet0 = await buildDSAv2(wallet0.address) - expect(!!dsaWallet0.address).to.be.true; - }); - - it("Deposit 10 ETH into DSA wallet", async function () { - await wallet0.sendTransaction({ - to: dsaWallet0.address, - value: ethers.utils.parseEther("10") - }); - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("10")); - }); + // Deploy and enable Pool Together Connector + ptConnector = await deployAndEnableConnector({ + connectorName: ptConnectorName, + contractArtifact: ConnectV2PoolTogether__factory, + signer: masterSigner, + connectors: instaConnectorsV2, }); - describe("Main - DAI Prize Pool Test", function () { - - it("Should deposit 1 ETH in Compound", async function () { - const amount = ethers.utils.parseEther("1") // 1 ETH - const spells = [ - { - connector: connectorName, - method: "deposit", - args: ["ETH-A", amount, 0, 0] - } - ] - - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("9")); - }); - - it("Should borrow 100 DAI from Compound and deposit DAI into DAI Prize Pool", async function () { - const amount = ethers.utils.parseEther("100") // 100 DAI - const setId = "83478237" - const spells = [ - { - connector: connectorName, - method: "borrow", - args: ["DAI-A", amount, 0, setId] - }, - { - connector: ptConnectorName, - method: "depositTo", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, setId, 0] - } - ] - // Before Spell - let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance is 0`).to.be.eq(ethers.utils.parseEther("0")); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_DAI_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance, `PoolTogether DAI Ticket balance is 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `Expect DAI balance to still equal 0 since it was deposited into Prize Pool`).to.be.eq(0); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether DAI Ticket balance equals 100`).to.be.eq(ethers.utils.parseEther("100")); - - // ETH used for transaction - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte(ethers.utils.parseEther("9")); - }); - - it("Should wait 11 days, withdraw all PrizePool, get back 100 DAI, and claim POOL", async function () { - const amount = ethers.utils.parseEther("100") // 100 DAI - - let prizePoolContract = new ethers.Contract(DAI_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); - let earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); - expect(earlyExitFee.exitFee, "Exit Fee equal to 1 DAI because starts at 10%").to.be.eq(ethers.utils.parseEther("1")); - - const spells = [ - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] - }, - { - connector: ptConnectorName, - method: "claim", - args: [DAI_POOL_FAUCET_ADDR, 0] - } - ] - - // Before spell - let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance equals 0`).to.be.eq(ethers.utils.parseEther("0")); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_DAI_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance, `PoolTogether Dai Ticket is 100`).to.be.eq(ethers.utils.parseEther("100")); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token equals 0`).to.be.eq(ethers.utils.parseEther("0")); - - // Increase time by 11 days so we get back all DAI without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); - await ethers.provider.send("evm_mine"); - - earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); - expect(earlyExitFee.exitFee, "Exit Fee equal to 0 DAI because past 10 days").to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, - `DAI balance to be equal to 100, because of no early withdrawal fee` - ).to.be.eq(ethers.utils.parseEther("100")); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `POOL Token Balance to be greater than 0`).to.be.gt(ethers.utils.parseEther("0")); - }); - - it("Should deposit and withdraw all PrizePool, get back less than 100 DAI", async function () { - const amount = ethers.utils.parseEther("100") // 100 DAI - const exitFee = ethers.utils.parseEther("1") // 1 DAI is 10% of 100 DAI - const spells = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0] - }, - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, exitFee, 0, 0] - } - ] - - // Before spell - let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI Balance equals 0`).to.be.eq(ethers.utils.parseEther("100")); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_DAI_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance, `PoolTogether DAI Ticket equals 0`).to.be.eq(0); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `PoolTogether Token greater than 0`).to.be.gt(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, - `DAI balance to be less than 100, because of early withdrawal fee` - ).to.be.lt(ethers.utils.parseEther("100")); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `POOL Token Balance to greater than 0`).to.be.gt(ethers.utils.parseEther("0")); - - }); - - it("Should deposit, wait 11 days, and withdraw all PrizePool, get 99 DAI, and claim all POOL using claimAll", async function () { - const amount = ethers.utils.parseEther("99") // 99 DAI - const depositSpells = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0] - } - ] - - // Before spell - let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance less than 100`).to.be.lt(ethers.utils.parseEther("100")); - - let cToken = await ethers.getContractAt(abis.basic.erc20, PT_DAI_TICKET_ADDR) - const balance = await cToken.balanceOf(dsaWallet0.address) - expect(balance, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token is greater than 0`).to.be.gt(ethers.utils.parseEther("0")); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(depositSpells), wallet1.address) - const receipt = await tx.wait() - - const prizePoolContract = new ethers.Contract(DAI_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); - let earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); - expect(earlyExitFee.exitFee, "Exit Fee equal to .99 DAI because starts at 10%").to.be.eq(ethers.utils.parseEther(".99")); - - - // Increase time by 11 days so we get back all DAI without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); - await ethers.provider.send("evm_mine"); - - earlyExitFee = await prizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); - expect(earlyExitFee.exitFee, "Exit Fee equal to 0 DAI because past 10 days").to.be.eq(0); - - const withdrawSpells = [ - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] - }, - { - connector: ptConnectorName, - method: "claimAll", - args: [TOKEN_FAUCET_PROXY_FACTORY_ADDR, [DAI_POOL_FAUCET_ADDR]] - } - ] - - // Run spell transaction - const tx2 = await dsaWallet0.connect(wallet0).cast(...encodeSpells(withdrawSpells), wallet1.address) - const receipt2 = await tx2.wait() - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance equals 99`).to.be.eq(ethers.utils.parseEther("99")); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address) - expect(balanceAfter, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); - - // Expect - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `Pool Token to be greateir than 0`).to.be.gt(ethers.utils.parseEther("0")); - }); - }) - - describe("Main - DAI Pod Test", function () { - it("Should deposit 99 DAI in DAI Pod", async function () { - const amount = ethers.utils.parseEther("99") // 99 DAI - const spells = [ - { - connector: ptConnectorName, - method: "depositToPod", - args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0] - } - ] - - // Before spell - let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance equals 99`).to.be.eq(ethers.utils.parseEther("99")); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR) - const podBalance = await podToken.balanceOf(dsaWallet0.address) - expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI equals 0`).to.be.eq(0); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `POOL Token greater than 0`).to.be.gt(0); - - const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address) - expect(podBalanceAfter, `Pod DAI token greater than 0`).to.be.eq(ethers.utils.parseEther("99")); - }); - - it("Should claim rewards from pod token drop", async function () { - const spells = [ - { - connector: ptConnectorName, - method: "claimPodTokenDrop", - args: [DAI_POD_TOKEN_DROP, 0] - } - ] - - const tokenDropContract = new ethers.Contract(DAI_POD_TOKEN_DROP, tokenDropABI, ethers.provider); - const podContract = new ethers.Contract(DAI_POD_ADDR, podABI, masterSigner); - - // drop(): Claim TokenDrop asset for PrizePool Pod and transfers token(s) to external Pod TokenDrop - // dropt() also calls batch which, Deposit Pod float into PrizePool. Deposits the current float - // amount into the PrizePool and claims current POOL rewards. - const dropTx = await podContract.drop(); - await dropTx.wait(); - - // POOL Rewards able to claim from Pod Token Drop - let claimAmount = await tokenDropContract.callStatic["claim"](dsaWallet0.address); - - // Before spell - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - const total = claimAmount.add(poolBalance); - expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq(total); - }); - - it("Should wait 11 days, withdraw all podTokens, get back 99 DAI", async function () { - const amount = ethers.utils.parseEther("99") // 99 DAI - - const podContract = new ethers.Contract(DAI_POD_ADDR, podABI, ethers.provider); - let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); - // maxFee depends on if token has been deposited to PrizePool yet - // since we called drop in previous test case, the tokens were deposited to PrizePool - expect(maxFee, "Exit Fee equal to .99 DAI because token still in float").to.be.eq(ethers.utils.parseEther(".99")); - - const spells = [ - { - connector: ptConnectorName, - method: "withdrawFromPod", - args: [DAI_POD_ADDR, amount, maxFee, 0, 0] - } - ] - - // Before spell - let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI Balance equals 0`).to.be.eq(0); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token balance greater than 0`).to.be.gt(0); - - let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR) - const podBalance = await podToken.balanceOf(dsaWallet0.address) - expect(podBalance, `Pod DAI Token equals 99`).to.be.eq(ethers.utils.parseEther("99")); - - // Increase time by 11 days so we get back all DAI without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); - await ethers.provider.send("evm_mine"); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, - `DAI balance equals 99, because of no early withdrawal fee` - ).to.be.eq(ethers.utils.parseEther("99")); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `POOL Token to be greater than 0`).to.be.gt(0); - - const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address) - expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq(0); - }); - - - - - it("Should deposit and withdraw from pod, get back same amount of 99 DAI", async function () { - const amount = ethers.utils.parseEther("99") - const maxFee = 0; // maxFee 0 since it doesn't give chance for Pod to actually deposit into PrizePool - - const spells = [ - { - connector: ptConnectorName, - method: "depositToPod", - args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0] - }, - { - connector: ptConnectorName, - method: "withdrawFromPod", - args: [DAI_POD_ADDR, amount, maxFee, 0, 0] - } - ] - - // Before spell - let daiToken = await ethers.getContractAt(abis.basic.erc20, DAI_TOKEN_ADDR) - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI equals 99`).to.be.eq(ethers.utils.parseEther("99")); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - // PodToken is 0 - let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR) - const podBalance = await podToken.balanceOf(dsaWallet0.address) - expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, - `DAI balance to be equal to 99, because funds still in 'float` - ).to.be.eq(ethers.utils.parseEther("99")); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq(poolBalance); - - // Expect Pod Token Balance to equal 0 - const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address) - expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq(ethers.utils.parseEther("0")); - }); - }) - - describe("Main - UNISWAP POOL/ETH Prize Pool Test", function () { - it("Should use uniswap to swap ETH for POOL, deposit to POOL/ETH LP, deposit POOL/ETH LP to PrizePool", async function () { - const amount = ethers.utils.parseEther("100") // 100 POOL - const slippage = ethers.utils.parseEther("0.03"); - const setId = "83478237" - - const UniswapV2Router02ABI = [ - "function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts)" - ]; - - // Get amount of ETH for 100 POOL from Uniswap - const UniswapV2Router02 = await ethers.getContractAt(UniswapV2Router02ABI, "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"); - const amounts = await UniswapV2Router02.getAmountsOut(amount, [POOL_TOKEN_ADDRESS, WETH_ADDR]); - const unitAmount = ethers.utils.parseEther(((amounts[1] * 1.03) / amounts[0]).toString()); - - const spells = [ - { - connector: uniswapConnectorName, - method: "buy", - args: [POOL_TOKEN_ADDRESS, tokens.eth.address, amount, unitAmount, 0, setId] - }, - { - connector: uniswapConnectorName, - method: "deposit", - args: [POOL_TOKEN_ADDRESS, tokens.eth.address, amount, unitAmount, slippage, 0, setId] - }, - { - connector: ptConnectorName, - method: "depositTo", - args: [UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, 0, PT_UNISWAP_POOLETHLP_TICKET_ADDR, setId, 0] - } - ] - - // Before Spell - let ethBalance = await ethers.provider.getBalance(dsaWallet0.address); - expect(ethBalance, `ETH Balance equals 9`).to.be.eq(ethers.utils.parseEther("9")); - - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - let uniswapLPToken = await ethers.getContractAt(abis.basic.erc20, UNISWAP_POOLETHLP_TOKEN_ADDR) - const uniswapPoolEthBalance = await uniswapLPToken.balanceOf(dsaWallet0.address) - expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); - - let ptUniswapPoolEthToken = await ethers.getContractAt(abis.basic.erc20, PT_UNISWAP_POOLETHLP_TICKET_ADDR) - const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf(dsaWallet0.address) - expect(ptUniswapPoolEthBalance, `PoolTogether Uniswap POOL?ETH LP equals 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - ethBalance = await ethers.provider.getBalance(dsaWallet0.address); - expect(ethBalance, `ETH Balance less than 9`).to.be.lt(ethers.utils.parseEther("9")); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `POOL Token to be same after spell`).to.be.eq(poolBalance); - - const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf(dsaWallet0.address) - expect(uniswapPoolEthBalanceAfter, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); - - const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf(dsaWallet0.address) - expect(ptUniswapPoolEthBalanceAfter, `PT Uniswap POOL/ETH LP to greater than 0`).to.be.gt(0); - }); - - it("Should withdraw all PrizePool, get back Uniswap LP, claim POOL, deposit claimed POOL into Pool PrizePool", async function () { - let ptUniswapPoolEthToken = await ethers.getContractAt(abis.basic.erc20, PT_UNISWAP_POOLETHLP_TICKET_ADDR) - const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf(dsaWallet0.address) - const setId = "83478237" - - let uniswapPrizePoolContract = new ethers.Contract(UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, prizePoolABI, ethers.provider); - let earlyExitFee = await uniswapPrizePoolContract.callStatic["calculateEarlyExitFee"](dsaWallet0.address, PT_UNISWAP_POOLETHLP_TICKET_ADDR, ptUniswapPoolEthBalance); - expect(earlyExitFee.exitFee, "Exit Fee equals 0 because no early exit fee for this prize pool").to.be.eq(0); - - const spells = [ - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, ptUniswapPoolEthBalance, PT_UNISWAP_POOLETHLP_TICKET_ADDR, earlyExitFee.exitFee, 0, 0] - }, - { - connector: ptConnectorName, - method: "claim", - args: [UNISWAP_POOLETHLP_FAUCET_ADDR, setId] - }, - { - connector: ptConnectorName, - method: "depositTo", - args: [POOL_PRIZE_POOL_ADDR, 0, PT_POOL_TICKET_ADDR, setId, 0] - } - ] - - // Before spell - let poolToken = await ethers.getContractAt(abis.basic.erc20, POOL_TOKEN_ADDRESS) - const poolBalance = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - // Uniswap POOL/ETH LP is 0 - let uniswapLPToken = await ethers.getContractAt(abis.basic.erc20, UNISWAP_POOLETHLP_TOKEN_ADDR) - const uniswapPoolEthBalance = await uniswapLPToken.balanceOf(dsaWallet0.address) - expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); - - expect(ptUniswapPoolEthBalance, `PT Uniswap POOL/ETH LP greater than 0`).to.be.gt(0); - - let poolPoolTicket = await ethers.getContractAt(abis.basic.erc20, PT_POOL_TICKET_ADDR) - const poolPoolTicketBalance = await poolPoolTicket.balanceOf(dsaWallet0.address) - expect(poolPoolTicketBalance, `PoolTogether POOL Ticket equals 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address) - expect(poolBalanceAfter, `Pool Token Balance equal to balance before spell`).to.be.eq(poolBalance); - - const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf(dsaWallet0.address) - expect(uniswapPoolEthBalanceAfter, `Uniswap POOL/ETH LP to greater than 0`).to.be.gt(0); - - const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf(dsaWallet0.address) - expect(ptUniswapPoolEthBalanceAfter, `PT Uniswap POOL/ETH LP equal 0`).to.be.eq(0); - - const poolPoolTicketBalanceAfter = await poolPoolTicket.balanceOf(dsaWallet0.address) - expect(poolPoolTicketBalanceAfter, `PoolTogether POOL Ticket greater than 0`).to.be.gt(0); - }); - }) - - describe("Main - WETH Prize Pool Test", function () { - it("Deposit 1 ETH into WETH Prize Pool and withdraw immediately", async function () { - const amount = ethers.utils.parseEther("1") // 1 ETH - const setId = "83478237" - const spells = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, setId] - }, - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, amount, setId, 0] - }, - ] - // Before Spell - const ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After spell - const ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - - // ETH used for transaction - expect(ethBalanceAfter, `ETH Balance less than before spell because of early withdrawal fee`).to.be.lte(ethBalanceBefore); - }); - - it("Deposit 1 ETH into WETH Prize Pool, wait 14 days, then withdraw", async function () { - const amount = ethers.utils.parseEther("1") // 1 ETH - const depositSpell = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, 0] - } - ] - - const withdrawSpell = [ - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, amount, 0, 0] - } - ] - - // Before Deposit Spell - let ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); - - // Run deposit spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(depositSpell), wallet1.address) - const receipt = await tx.wait() - - // After Deposit spell - let ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - - expect(ethBalanceAfter, `ETH Balance less than before spell`).to.be.lte(ethBalanceBefore); - - // Increase time by 11 days so we get back all ETH without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [14 * 24 * 60 * 60]); - await ethers.provider.send("evm_mine"); - - // Run withdraw spell transaction - const tx2 = await dsaWallet0.connect(wallet0).cast(...encodeSpells(withdrawSpell), wallet1.address) - const receipt2 = await tx.wait() - - // After Deposit spell - ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - - expect(ethBalanceAfter, `ETH Balance equal to before spell because no early exit fee`).to.be.eq(ethBalanceBefore); - }); + // Deploy and enable Uniswap Connector + uniswapConnector = await deployAndEnableConnector({ + connectorName: uniswapConnectorName, + contractArtifact: ConnectV2UniswapV2__factory, + signer: masterSigner, + connectors: instaConnectorsV2, + }); + }); + + it("Should have contracts deployed.", async function() { + expect(!!instaConnectorsV2.address).to.be.true; + expect(!!connector.address).to.be.true; + expect(!!ptConnector.address).to.be.true; + expect(!!uniswapConnector.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; + }); + + describe("DSA wallet setup", function() { + it("Should build DSA v2", async function() { + dsaWallet0 = await buildDSAv2(wallet0.address); + expect(!!dsaWallet0.address).to.be.true; }); - describe("Main - WETH Pod Test", function () { - let podAddress - it("Should deposit 1 ETH in WETH Pod and get Pod Ticket", async function () { - const amount = ethers.utils.parseEther("1") - - // Create Pod for WETH Prize Pool (Rari) - const podFactoryContract = new ethers.Contract(POD_FACTORY_ADDRESS, podFactoryABI, masterSigner) - podAddress = await podFactoryContract.callStatic.create(WETH_PRIZE_POOL_ADDR, WETH_POOL_TICKET_ADDR, constants.address_zero, wallet0.address, 18) - await podFactoryContract.create(WETH_PRIZE_POOL_ADDR, WETH_POOL_TICKET_ADDR, constants.address_zero, wallet0.address, 18) - - const spells = [ - { - connector: ptConnectorName, - method: "depositToPod", - args: [WETH_ADDR, podAddress, amount, 0, 0] - } - ] - - // Before Deposit Spell - const podContract = new ethers.Contract(podAddress, podABI, ethers.provider); - let podBalanceBefore = await podContract.balanceOfUnderlying(dsaWallet0.address) - expect(podBalanceBefore, `Pod balance equal to 0`).to.be.eq(0); - - let ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After Deposit spell - let ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - expect(ethBalanceAfter, `ETH balance less than before`).to.be.lt(ethBalanceBefore); - - podBalanceAfter = await podContract.balanceOfUnderlying(dsaWallet0.address) - expect(podBalanceAfter, `Pod balance equal to 1`).to.be.eq(ethers.utils.parseEther("1")); - }); - - it("Should withdraw 1 Ticket from WETH Pod and get back ETH", async function () { - const amount = ethers.utils.parseEther("1") - - const podContract = new ethers.Contract(podAddress, podABI, ethers.provider); - let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); - expect(maxFee, "Exit Fee equal to 0 DAI because token still in float").to.be.eq(0); - // maxFee depends on if token has been deposited to PrizePool yet - - const spells = [ - { - connector: ptConnectorName, - method: "withdrawFromPod", - args: [podAddress, amount, maxFee, 0, 0] - } - ] - - // Before Deposit Spell - let podBalanceBefore = await podContract.balanceOfUnderlying(dsaWallet0.address) - expect(podBalanceBefore, `Pod balance equal to 1`).to.be.eq(ethers.utils.parseEther("1")); - - let ethBalanceBefore = await ethers.provider.getBalance(dsaWallet0.address); - - // Run spell transaction - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet1.address) - const receipt = await tx.wait() - - // After Deposit spell - let ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - expect(ethBalanceAfter, `ETH balance greater than before`).to.be.gt(ethBalanceBefore); - - podBalanceAfter = await podContract.balanceOfUnderlying(dsaWallet0.address) - expect(podBalanceAfter, `Pod balance equal to 0`).to.be.eq(ethers.utils.parseEther("0")); - }); + it("Deposit 10 ETH into DSA wallet", async function() { + await wallet0.sendTransaction({ + to: dsaWallet0.address, + value: ethers.utils.parseEther("10"), + }); + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte( + ethers.utils.parseEther("10") + ); }); -}) \ No newline at end of file + }); + + describe("Main - DAI Prize Pool Test", function() { + it("Should deposit 1 ETH in Compound", async function() { + const amount = ethers.utils.parseEther("1"); // 1 ETH + const spells = [ + { + connector: connectorName, + method: "deposit", + args: ["ETH-A", amount, 0, 0], + }, + ]; + + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( + ethers.utils.parseEther("9") + ); + }); + + it("Should borrow 100 DAI from Compound and deposit DAI into DAI Prize Pool", async function() { + const amount = ethers.utils.parseEther("100"); // 100 DAI + const setId = "83478237"; + const spells = [ + { + connector: connectorName, + method: "borrow", + args: ["DAI-A", amount, 0, setId], + }, + { + connector: ptConnectorName, + method: "depositTo", + args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, setId, 0], + }, + ]; + // Before Spell + let daiToken = await ethers.getContractAt( + abis.basic.erc20, + DAI_TOKEN_ADDR + ); + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance is 0`).to.be.eq( + ethers.utils.parseEther("0") + ); + + let cToken = await ethers.getContractAt( + abis.basic.erc20, + PT_DAI_TICKET_ADDR + ); + const balance = await cToken.balanceOf(dsaWallet0.address); + expect(balance, `PoolTogether DAI Ticket balance is 0`).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect( + daiBalance, + `Expect DAI balance to still equal 0 since it was deposited into Prize Pool` + ).to.be.eq(0); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address); + expect( + balanceAfter, + `PoolTogether DAI Ticket balance equals 100` + ).to.be.eq(ethers.utils.parseEther("100")); + + // ETH used for transaction + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( + ethers.utils.parseEther("9") + ); + }); + + it("Should wait 11 days, withdraw all PrizePool, get back 100 DAI, and claim POOL", async function() { + const amount = ethers.utils.parseEther("100"); // 100 DAI + + let prizePoolContract = new ethers.Contract( + DAI_PRIZE_POOL_ADDR, + prizePoolABI, + ethers.provider + ); + let earlyExitFee = await prizePoolContract.callStatic[ + "calculateEarlyExitFee" + ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); + expect( + earlyExitFee.exitFee, + "Exit Fee equal to 1 DAI because starts at 10%" + ).to.be.eq(ethers.utils.parseEther("1")); + + const spells = [ + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + DAI_PRIZE_POOL_ADDR, + amount, + PT_DAI_TICKET_ADDR, + earlyExitFee.exitFee, + 0, + 0, + ], + }, + { + connector: ptConnectorName, + method: "claim", + args: [DAI_POOL_FAUCET_ADDR, 0], + }, + ]; + + // Before spell + let daiToken = await ethers.getContractAt( + abis.basic.erc20, + DAI_TOKEN_ADDR + ); + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance equals 0`).to.be.eq( + ethers.utils.parseEther("0") + ); + + let cToken = await ethers.getContractAt( + abis.basic.erc20, + PT_DAI_TICKET_ADDR + ); + const balance = await cToken.balanceOf(dsaWallet0.address); + expect(balance, `PoolTogether Dai Ticket is 100`).to.be.eq( + ethers.utils.parseEther("100") + ); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token equals 0`).to.be.eq( + ethers.utils.parseEther("0") + ); + + // Increase time by 11 days so we get back all DAI without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); + + earlyExitFee = await prizePoolContract.callStatic[ + "calculateEarlyExitFee" + ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); + expect( + earlyExitFee.exitFee, + "Exit Fee equal to 0 DAI because past 10 days" + ).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect( + daiBalance, + `DAI balance to be equal to 100, because of no early withdrawal fee` + ).to.be.eq(ethers.utils.parseEther("100")); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address); + expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect( + poolBalanceAfter, + `POOL Token Balance to be greater than 0` + ).to.be.gt(ethers.utils.parseEther("0")); + }); + + it("Should deposit and withdraw all PrizePool, get back less than 100 DAI", async function() { + const amount = ethers.utils.parseEther("100"); // 100 DAI + const exitFee = ethers.utils.parseEther("1"); // 1 DAI is 10% of 100 DAI + const spells = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0], + }, + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + DAI_PRIZE_POOL_ADDR, + amount, + PT_DAI_TICKET_ADDR, + exitFee, + 0, + 0, + ], + }, + ]; + + // Before spell + let daiToken = await ethers.getContractAt( + abis.basic.erc20, + DAI_TOKEN_ADDR + ); + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI Balance equals 0`).to.be.eq( + ethers.utils.parseEther("100") + ); + + let cToken = await ethers.getContractAt( + abis.basic.erc20, + PT_DAI_TICKET_ADDR + ); + const balance = await cToken.balanceOf(dsaWallet0.address); + expect(balance, `PoolTogether DAI Ticket equals 0`).to.be.eq(0); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `PoolTogether Token greater than 0`).to.be.gt(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect( + daiBalance, + `DAI balance to be less than 100, because of early withdrawal fee` + ).to.be.lt(ethers.utils.parseEther("100")); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address); + expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalanceAfter, `POOL Token Balance to greater than 0`).to.be.gt( + ethers.utils.parseEther("0") + ); + }); + + it("Should deposit, wait 11 days, and withdraw all PrizePool, get 99 DAI, and claim all POOL using claimAll", async function() { + const amount = ethers.utils.parseEther("99"); // 99 DAI + const depositSpells = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0], + }, + ]; + + // Before spell + let daiToken = await ethers.getContractAt( + abis.basic.erc20, + DAI_TOKEN_ADDR + ); + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance less than 100`).to.be.lt( + ethers.utils.parseEther("100") + ); + + let cToken = await ethers.getContractAt( + abis.basic.erc20, + PT_DAI_TICKET_ADDR + ); + const balance = await cToken.balanceOf(dsaWallet0.address); + expect(balance, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token is greater than 0`).to.be.gt( + ethers.utils.parseEther("0") + ); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(depositSpells), wallet1.address); + const receipt = await tx.wait(); + + const prizePoolContract = new ethers.Contract( + DAI_PRIZE_POOL_ADDR, + prizePoolABI, + ethers.provider + ); + let earlyExitFee = await prizePoolContract.callStatic[ + "calculateEarlyExitFee" + ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); + expect( + earlyExitFee.exitFee, + "Exit Fee equal to .99 DAI because starts at 10%" + ).to.be.eq(ethers.utils.parseEther(".99")); + + // Increase time by 11 days so we get back all DAI without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); + + earlyExitFee = await prizePoolContract.callStatic[ + "calculateEarlyExitFee" + ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); + expect( + earlyExitFee.exitFee, + "Exit Fee equal to 0 DAI because past 10 days" + ).to.be.eq(0); + + const withdrawSpells = [ + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + DAI_PRIZE_POOL_ADDR, + amount, + PT_DAI_TICKET_ADDR, + earlyExitFee.exitFee, + 0, + 0, + ], + }, + { + connector: ptConnectorName, + method: "claimAll", + args: [TOKEN_FAUCET_PROXY_FACTORY_ADDR, [DAI_POOL_FAUCET_ADDR]], + }, + ]; + + // Run spell transaction + const tx2 = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(withdrawSpells), wallet1.address); + const receipt2 = await tx2.wait(); + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance equals 99`).to.be.eq( + ethers.utils.parseEther("99") + ); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address); + expect(balanceAfter, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); + + // Expect + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalanceAfter, `Pool Token to be greateir than 0`).to.be.gt( + ethers.utils.parseEther("0") + ); + }); + }); + + describe("Main - DAI Pod Test", function() { + it("Should deposit 99 DAI in DAI Pod", async function() { + const amount = ethers.utils.parseEther("99"); // 99 DAI + const spells = [ + { + connector: ptConnectorName, + method: "depositToPod", + args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0], + }, + ]; + + // Before spell + let daiToken = await ethers.getContractAt( + abis.basic.erc20, + DAI_TOKEN_ADDR + ); + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance equals 99`).to.be.eq( + ethers.utils.parseEther("99") + ); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + + let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); + const podBalance = await podToken.balanceOf(dsaWallet0.address); + expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI equals 0`).to.be.eq(0); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalanceAfter, `POOL Token greater than 0`).to.be.gt(0); + + const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); + expect(podBalanceAfter, `Pod DAI token greater than 0`).to.be.eq( + ethers.utils.parseEther("99") + ); + }); + + it("Should claim rewards from pod token drop", async function() { + const spells = [ + { + connector: ptConnectorName, + method: "claimPodTokenDrop", + args: [DAI_POD_TOKEN_DROP, 0], + }, + ]; + + const tokenDropContract = new ethers.Contract( + DAI_POD_TOKEN_DROP, + tokenDropABI, + ethers.provider + ); + const podContract = new ethers.Contract( + DAI_POD_ADDR, + podABI, + masterSigner + ); + + // drop(): Claim TokenDrop asset for PrizePool Pod and transfers token(s) to external Pod TokenDrop + // dropt() also calls batch which, Deposit Pod float into PrizePool. Deposits the current float + // amount into the PrizePool and claims current POOL rewards. + const dropTx = await podContract.drop(); + await dropTx.wait(); + + // POOL Rewards able to claim from Pod Token Drop + let claimAmount = await tokenDropContract.callStatic["claim"]( + dsaWallet0.address + ); + + // Before spell + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + const total = claimAmount.add(poolBalance); + expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq( + total + ); + }); + + it("Should wait 11 days, withdraw all podTokens, get back 99 DAI", async function() { + const amount = ethers.utils.parseEther("99"); // 99 DAI + + const podContract = new ethers.Contract( + DAI_POD_ADDR, + podABI, + ethers.provider + ); + let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); + // maxFee depends on if token has been deposited to PrizePool yet + // since we called drop in previous test case, the tokens were deposited to PrizePool + expect( + maxFee, + "Exit Fee equal to .99 DAI because token still in float" + ).to.be.eq(ethers.utils.parseEther(".99")); + + const spells = [ + { + connector: ptConnectorName, + method: "withdrawFromPod", + args: [DAI_POD_ADDR, amount, maxFee, 0, 0], + }, + ]; + + // Before spell + let daiToken = await ethers.getContractAt( + abis.basic.erc20, + DAI_TOKEN_ADDR + ); + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI Balance equals 0`).to.be.eq(0); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token balance greater than 0`).to.be.gt(0); + + let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); + const podBalance = await podToken.balanceOf(dsaWallet0.address); + expect(podBalance, `Pod DAI Token equals 99`).to.be.eq( + ethers.utils.parseEther("99") + ); + + // Increase time by 11 days so we get back all DAI without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect( + daiBalance, + `DAI balance equals 99, because of no early withdrawal fee` + ).to.be.eq(ethers.utils.parseEther("99")); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalanceAfter, `POOL Token to be greater than 0`).to.be.gt(0); + + const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); + expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq(0); + }); + + it("Should deposit and withdraw from pod, get back same amount of 99 DAI", async function() { + const amount = ethers.utils.parseEther("99"); + const maxFee = 0; // maxFee 0 since it doesn't give chance for Pod to actually deposit into PrizePool + + const spells = [ + { + connector: ptConnectorName, + method: "depositToPod", + args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0], + }, + { + connector: ptConnectorName, + method: "withdrawFromPod", + args: [DAI_POD_ADDR, amount, maxFee, 0, 0], + }, + ]; + + // Before spell + let daiToken = await ethers.getContractAt( + abis.basic.erc20, + DAI_TOKEN_ADDR + ); + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI equals 99`).to.be.eq( + ethers.utils.parseEther("99") + ); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + + // PodToken is 0 + let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); + const podBalance = await podToken.balanceOf(dsaWallet0.address); + expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect( + daiBalance, + `DAI balance to be equal to 99, because funds still in 'float` + ).to.be.eq(ethers.utils.parseEther("99")); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq( + poolBalance + ); + + // Expect Pod Token Balance to equal 0 + const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); + expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq( + ethers.utils.parseEther("0") + ); + }); + }); + + describe("Main - UNISWAP POOL/ETH Prize Pool Test", function() { + it("Should use uniswap to swap ETH for POOL, deposit to POOL/ETH LP, deposit POOL/ETH LP to PrizePool", async function() { + const amount = ethers.utils.parseEther("100"); // 100 POOL + const slippage = ethers.utils.parseEther("0.03"); + const setId = "83478237"; + + const UniswapV2Router02ABI = [ + "function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts)", + ]; + + // Get amount of ETH for 100 POOL from Uniswap + const UniswapV2Router02 = await ethers.getContractAt( + UniswapV2Router02ABI, + "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D" + ); + const amounts = await UniswapV2Router02.getAmountsOut(amount, [ + POOL_TOKEN_ADDRESS, + WETH_ADDR, + ]); + const unitAmount = ethers.utils.parseEther( + ((amounts[1] * 1.03) / amounts[0]).toString() + ); + + const spells = [ + { + connector: uniswapConnectorName, + method: "buy", + args: [ + POOL_TOKEN_ADDRESS, + tokens.eth.address, + amount, + unitAmount, + 0, + setId, + ], + }, + { + connector: uniswapConnectorName, + method: "deposit", + args: [ + POOL_TOKEN_ADDRESS, + tokens.eth.address, + amount, + unitAmount, + slippage, + 0, + setId, + ], + }, + { + connector: ptConnectorName, + method: "depositTo", + args: [ + UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, + 0, + PT_UNISWAP_POOLETHLP_TICKET_ADDR, + setId, + 0, + ], + }, + ]; + + // Before Spell + let ethBalance = await ethers.provider.getBalance(dsaWallet0.address); + expect(ethBalance, `ETH Balance equals 9`).to.be.eq( + ethers.utils.parseEther("9") + ); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + + let uniswapLPToken = await ethers.getContractAt( + abis.basic.erc20, + UNISWAP_POOLETHLP_TOKEN_ADDR + ); + const uniswapPoolEthBalance = await uniswapLPToken.balanceOf( + dsaWallet0.address + ); + expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); + + let ptUniswapPoolEthToken = await ethers.getContractAt( + abis.basic.erc20, + PT_UNISWAP_POOLETHLP_TICKET_ADDR + ); + const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf( + dsaWallet0.address + ); + expect( + ptUniswapPoolEthBalance, + `PoolTogether Uniswap POOL?ETH LP equals 0` + ).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + ethBalance = await ethers.provider.getBalance(dsaWallet0.address); + expect(ethBalance, `ETH Balance less than 9`).to.be.lt( + ethers.utils.parseEther("9") + ); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalanceAfter, `POOL Token to be same after spell`).to.be.eq( + poolBalance + ); + + const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf( + dsaWallet0.address + ); + expect( + uniswapPoolEthBalanceAfter, + `Uniswap POOL/ETH LP equals 0` + ).to.be.eq(0); + + const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf( + dsaWallet0.address + ); + expect( + ptUniswapPoolEthBalanceAfter, + `PT Uniswap POOL/ETH LP to greater than 0` + ).to.be.gt(0); + }); + + it("Should withdraw all PrizePool, get back Uniswap LP, claim POOL, deposit claimed POOL into Pool PrizePool", async function() { + let ptUniswapPoolEthToken = await ethers.getContractAt( + abis.basic.erc20, + PT_UNISWAP_POOLETHLP_TICKET_ADDR + ); + const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf( + dsaWallet0.address + ); + const setId = "83478237"; + + let uniswapPrizePoolContract = new ethers.Contract( + UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, + prizePoolABI, + ethers.provider + ); + let earlyExitFee = await uniswapPrizePoolContract.callStatic[ + "calculateEarlyExitFee" + ]( + dsaWallet0.address, + PT_UNISWAP_POOLETHLP_TICKET_ADDR, + ptUniswapPoolEthBalance + ); + expect( + earlyExitFee.exitFee, + "Exit Fee equals 0 because no early exit fee for this prize pool" + ).to.be.eq(0); + + const spells = [ + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, + ptUniswapPoolEthBalance, + PT_UNISWAP_POOLETHLP_TICKET_ADDR, + earlyExitFee.exitFee, + 0, + 0, + ], + }, + { + connector: ptConnectorName, + method: "claim", + args: [UNISWAP_POOLETHLP_FAUCET_ADDR, setId], + }, + { + connector: ptConnectorName, + method: "depositTo", + args: [POOL_PRIZE_POOL_ADDR, 0, PT_POOL_TICKET_ADDR, setId, 0], + }, + ]; + + // Before spell + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + + // Uniswap POOL/ETH LP is 0 + let uniswapLPToken = await ethers.getContractAt( + abis.basic.erc20, + UNISWAP_POOLETHLP_TOKEN_ADDR + ); + const uniswapPoolEthBalance = await uniswapLPToken.balanceOf( + dsaWallet0.address + ); + expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); + + expect( + ptUniswapPoolEthBalance, + `PT Uniswap POOL/ETH LP greater than 0` + ).to.be.gt(0); + + let poolPoolTicket = await ethers.getContractAt( + abis.basic.erc20, + PT_POOL_TICKET_ADDR + ); + const poolPoolTicketBalance = await poolPoolTicket.balanceOf( + dsaWallet0.address + ); + expect( + poolPoolTicketBalance, + `PoolTogether POOL Ticket equals 0` + ).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect( + poolBalanceAfter, + `Pool Token Balance equal to balance before spell` + ).to.be.eq(poolBalance); + + const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf( + dsaWallet0.address + ); + expect( + uniswapPoolEthBalanceAfter, + `Uniswap POOL/ETH LP to greater than 0` + ).to.be.gt(0); + + const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf( + dsaWallet0.address + ); + expect( + ptUniswapPoolEthBalanceAfter, + `PT Uniswap POOL/ETH LP equal 0` + ).to.be.eq(0); + + const poolPoolTicketBalanceAfter = await poolPoolTicket.balanceOf( + dsaWallet0.address + ); + expect( + poolPoolTicketBalanceAfter, + `PoolTogether POOL Ticket greater than 0` + ).to.be.gt(0); + }); + }); + + describe("Main - WETH Prize Pool Test", function() { + it("Deposit 1 ETH into WETH Prize Pool and withdraw immediately", async function() { + const amount = ethers.utils.parseEther("1"); // 1 ETH + const setId = "83478237"; + const spells = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, setId], + }, + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + WETH_PRIZE_POOL_ADDR, + amount, + WETH_POOL_TICKET_ADDR, + amount, + setId, + 0, + ], + }, + ]; + // Before Spell + const ethBalanceBefore = await ethers.provider.getBalance( + dsaWallet0.address + ); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + const ethBalanceAfter = await ethers.provider.getBalance( + dsaWallet0.address + ); + + // ETH used for transaction + expect( + ethBalanceAfter, + `ETH Balance less than before spell because of early withdrawal fee` + ).to.be.lte(ethBalanceBefore); + }); + + it("Deposit 1 ETH into WETH Prize Pool, wait 14 days, then withdraw", async function() { + const amount = ethers.utils.parseEther("1"); // 1 ETH + const depositSpell = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, 0], + }, + ]; + + const withdrawSpell = [ + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + WETH_PRIZE_POOL_ADDR, + amount, + WETH_POOL_TICKET_ADDR, + amount, + 0, + 0, + ], + }, + ]; + + // Before Deposit Spell + let ethBalanceBefore = await ethers.provider.getBalance( + dsaWallet0.address + ); + + // Run deposit spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(depositSpell), wallet1.address); + const receipt = await tx.wait(); + + // After Deposit spell + let ethBalanceAfter = await ethers.provider.getBalance( + dsaWallet0.address + ); + + expect(ethBalanceAfter, `ETH Balance less than before spell`).to.be.lte( + ethBalanceBefore + ); + + // Increase time by 11 days so we get back all ETH without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [14 * 24 * 60 * 60]); + + // Run withdraw spell transaction + const tx2 = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(withdrawSpell), wallet1.address); + const receipt2 = await tx.wait(); + + // After Deposit spell + ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); + + expect( + ethBalanceAfter, + `ETH Balance equal to before spell because no early exit fee` + ).to.be.eq(ethBalanceBefore); + }); + }); + + describe("Main - WETH Pod Test", function() { + let podAddress: string; + it("Should deposit 1 ETH in WETH Pod and get Pod Ticket", async function() { + const amount = ethers.utils.parseEther("1"); + + // Create Pod for WETH Prize Pool (Rari) + const podFactoryContract = new ethers.Contract( + POD_FACTORY_ADDRESS, + podFactoryABI, + masterSigner + ); + podAddress = await podFactoryContract.callStatic.create( + WETH_PRIZE_POOL_ADDR, + WETH_POOL_TICKET_ADDR, + constants.address_zero, + wallet0.address, + 18 + ); + await podFactoryContract.create( + WETH_PRIZE_POOL_ADDR, + WETH_POOL_TICKET_ADDR, + constants.address_zero, + wallet0.address, + 18 + ); + + const spells = [ + { + connector: ptConnectorName, + method: "depositToPod", + args: [WETH_ADDR, podAddress, amount, 0, 0], + }, + ]; + + // Before Deposit Spell + const podContract = new ethers.Contract( + podAddress, + podABI, + ethers.provider + ); + let podBalanceBefore = await podContract.balanceOfUnderlying( + dsaWallet0.address + ); + expect(podBalanceBefore, `Pod balance equal to 0`).to.be.eq(0); + + let ethBalanceBefore = await ethers.provider.getBalance( + dsaWallet0.address + ); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After Deposit spell + let ethBalanceAfter = await ethers.provider.getBalance( + dsaWallet0.address + ); + expect(ethBalanceAfter, `ETH balance less than before`).to.be.lt( + ethBalanceBefore + ); + + let podBalanceAfter = await podContract.balanceOfUnderlying( + dsaWallet0.address + ); + expect(podBalanceAfter, `Pod balance equal to 1`).to.be.eq( + ethers.utils.parseEther("1") + ); + }); + + it("Should withdraw 1 Ticket from WETH Pod and get back ETH", async function() { + const amount = ethers.utils.parseEther("1"); + + const podContract = new ethers.Contract( + podAddress, + podABI, + ethers.provider + ); + let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); + expect( + maxFee, + "Exit Fee equal to 0 DAI because token still in float" + ).to.be.eq(0); + // maxFee depends on if token has been deposited to PrizePool yet + + const spells = [ + { + connector: ptConnectorName, + method: "withdrawFromPod", + args: [podAddress, amount, maxFee, 0, 0], + }, + ]; + + // Before Deposit Spell + let podBalanceBefore = await podContract.balanceOfUnderlying( + dsaWallet0.address + ); + expect(podBalanceBefore, `Pod balance equal to 1`).to.be.eq( + ethers.utils.parseEther("1") + ); + + let ethBalanceBefore = await ethers.provider.getBalance( + dsaWallet0.address + ); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After Deposit spell + let ethBalanceAfter = await ethers.provider.getBalance( + dsaWallet0.address + ); + expect(ethBalanceAfter, `ETH balance greater than before`).to.be.gt( + ethBalanceBefore + ); + + let podBalanceAfter = await podContract.balanceOfUnderlying( + dsaWallet0.address + ); + expect(podBalanceAfter, `Pod balance equal to 0`).to.be.eq( + ethers.utils.parseEther("0") + ); + }); + }); +}); diff --git a/test/mainnet/uniswap-sell-beta/uniswap-sell-beta.ts b/test/mainnet/uniswap-sell-beta/uniswap-sell-beta.ts index b607a822..73b9df8b 100644 --- a/test/mainnet/uniswap-sell-beta/uniswap-sell-beta.ts +++ b/test/mainnet/uniswap-sell-beta/uniswap-sell-beta.ts @@ -1,22 +1,23 @@ +import { BigNumberish } from "@ethersproject/bignumber"; +import { Contract } from "@ethersproject/contracts"; import { expect } from "chai"; -import hre from "hardhat"; -const { web3, deployments, waffle, ethers } = hre; -const { provider, deployContract } = waffle +import hre, { artifacts } from "hardhat"; +const { ethers } = hre; const USDC_ADDR = "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"; const WETH_ADDR = "0x82af49447d8a07e3bd95bd0d56f35241523fbab1"; describe("Uniswap-sell-beta", function () { - let UniswapSellBeta, uniswapSellBeta; + let UniswapSellBeta, uniswapSellBeta: Contract; - async function setBalance(address) { - await network.provider.send("hardhat_setBalance", [ + async function setBalance(address: any) { + await hre.network.provider.send("hardhat_setBalance", [ address, ethers.utils.parseEther("10.0").toHexString(), ]); } - async function impersonate(owner, account, token0, decimals) { + async function impersonate(owner: string, account: any, token0: string, decimals: BigNumberish | undefined) { const tokenArtifact = await artifacts.readArtifact( "@openzeppelin/contracts/token/ERC20/IERC20.sol:IERC20" ); diff --git a/test/mainnet/uniswap/uniswap.test.ts b/test/mainnet/uniswap/uniswap.test.ts index cb1dc61e..0a5deea3 100644 --- a/test/mainnet/uniswap/uniswap.test.ts +++ b/test/mainnet/uniswap/uniswap.test.ts @@ -1,27 +1,19 @@ import { expect } from "chai"; import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; -const { provider, deployContract } = waffle +const { provider, deployContract } = waffle; -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js"; +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js"; -import { encodeFlashcastData } from "../../../scripts/tests/encodeFlashcastData.js"; +import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; - import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; -import { constants } from "../../../scripts/constant/constant"; -import { tokens } from "../../../scripts/constant/tokens"; +import type { Signer, Contract } from "ethers"; -import { - abi: nftManagerAbi, -} from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json"; - -import connectV2UniswapV3Artifacts from "../../artifacts/contracts/mainnet/connectors/uniswap/v3/main.sol/ConnectV2UniswapV3.json" -import { eth } from "../../../scripts/constant/tokens" -import { BigNumber } from "ethers" +import { abi } from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json"; +import { ConnectV2UniswapV3__factory } from "../../../typechain"; const FeeAmount = { LOW: 500, @@ -29,7 +21,7 @@ const FeeAmount = { HIGH: 10000, }; -const TICK_SPACINGS = { +const TICK_SPACINGS: Record = { 500: 10, 3000: 60, 10000: 200, @@ -38,18 +30,18 @@ const TICK_SPACINGS = { const USDT_ADDR = "0xdac17f958d2ee523a2206206994597c13d831ec7"; const DAI_ADDR = "0x6b175474e89094c44da98b954eedeac495271d0f"; -let tokenIds = []; -let liquidities = []; +let tokenIds: any[] = []; +let liquidities: any[] = []; const abiCoder = ethers.utils.defaultAbiCoder; -describe("UniswapV3", function () { +describe("UniswapV3", function() { const connectorName = "UniswapV3-v1"; - let dsaWallet0; - let masterSigner; - let instaConnectorsV2; - let connector; - let nftManager; + let dsaWallet0: any; + let masterSigner: Signer; + let instaConnectorsV2: Contract; + let connector: Contract; + let nftManager: Contract; const wallets = provider.getWallets(); const [wallet0, wallet1, wallet2, wallet3] = wallets; @@ -59,43 +51,44 @@ describe("UniswapV3", function () { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 13005785, }, }, ], }); - masterSigner = await getMasterSigner(wallet3); + masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, addresses.core.connectorsV2 ); nftManager = await ethers.getContractAt( - nftManagerAbi, + abi, "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" ); connector = await deployAndEnableConnector({ connectorName, - contractArtifact: connectV2UniswapV3Artifacts, + contractArtifact: ConnectV2UniswapV3__factory, signer: masterSigner, connectors: instaConnectorsV2, }); console.log("Connector address", connector.address); }); - it("Should have contracts deployed.", async function () { + it("Should have contracts deployed.", async function() { expect(!!instaConnectorsV2.address).to.be.true; expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; }); - describe("DSA wallet setup", function () { - it("Should build DSA v2", async function () { + describe("DSA wallet setup", function() { + it("Should build DSA v2", async function() { dsaWallet0 = await buildDSAv2(wallet0.address); expect(!!dsaWallet0.address).to.be.true; }); - it("Deposit ETH & DAI into DSA wallet", async function () { + it("Deposit ETH & DAI into DSA wallet", async function() { await wallet0.sendTransaction({ to: dsaWallet0.address, value: ethers.utils.parseEther("10"), @@ -111,7 +104,7 @@ describe("UniswapV3", function () { ); }); - it("Deposit ETH & USDT into DSA wallet", async function () { + it("Deposit ETH & USDT into DSA wallet", async function() { await wallet0.sendTransaction({ to: dsaWallet0.address, value: ethers.utils.parseEther("10"), @@ -128,11 +121,11 @@ describe("UniswapV3", function () { }); }); - describe("Main", function () { - it("Should mint successfully", async function () { + describe("Main", function() { + it("Should mint successfully", async function() { const ethAmount = ethers.utils.parseEther("0.1"); // 1 ETH const daiAmount = ethers.utils.parseEther("400"); // 1 ETH - const usdtAmount = ethers.utils.parseEther("400") / Math.pow(10, 12); // 1 ETH + const usdtAmount = Number(ethers.utils.parseEther("400")) / Math.pow(10, 12); // 1 ETH const ethAddress = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; const getIds = ["0", "0"]; @@ -197,14 +190,14 @@ describe("UniswapV3", function () { dsaWallet0.on( "LogCast", ( - origin, - sender, - value, - targetNames, - targets, - eventNames, - eventParams, - event + origin: any, + sender: any, + value: any, + targetNames: any, + targets: any, + eventNames: any, + eventParams: any, + event: any ) => { const params = abiCoder.decode( ["uint256", "uint256", "uint256", "uint256", "int24", "int24"], @@ -237,11 +230,9 @@ describe("UniswapV3", function () { expect(data.liquidity).to.be.equals(liquidities[0]); }).timeout(10000000000); - it("Should deposit successfully", async function () { + it("Should deposit successfully", async function() { const daiAmount = ethers.utils.parseEther("400"); // 1 ETH const ethAmount = ethers.utils.parseEther("0.1"); // 1 ETH - const usdtAmount = ethers.utils.parseEther("400") / Math.pow(10, 12); // 1 ETH - const ethAddress = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; const getIds = ["0", "0"]; const setId = "0"; @@ -270,14 +261,14 @@ describe("UniswapV3", function () { dsaWallet0.on( "LogCast", ( - origin, - sender, - value, - targetNames, - targets, - eventNames, - eventParams, - event + origin: any, + sender: any, + value: any, + targetNames: any, + targets: any, + eventNames: any, + eventParams: any, + event: any ) => { const params = abiCoder.decode( ["uint256", "uint256", "uint256", "uint256"], @@ -303,7 +294,7 @@ describe("UniswapV3", function () { expect(data.liquidity).to.be.equals(liquidities[0]); }); - it("Should withdraw successfully", async function () { + it("Should withdraw successfully", async function() { const getId = "0"; const setIds = ["0", "0"]; @@ -332,7 +323,7 @@ describe("UniswapV3", function () { expect(data1.liquidity.toNumber()).to.be.equals(0); }); - it("Should collect successfully", async function () { + it("Should collect successfully", async function() { const ethAmount = ethers.utils.parseEther("0.2"); // 1 ETH const daiAmount = ethers.utils.parseEther("800"); // 1 ETH const getIds = ["0", "0"]; @@ -352,7 +343,7 @@ describe("UniswapV3", function () { const receipt = await tx.wait(); }); - it("Should burn successfully", async function () { + it("Should burn successfully", async function() { const spells = [ { connector: connectorName, @@ -369,7 +360,7 @@ describe("UniswapV3", function () { }); }); -const getMinTick = (tickSpacing) => +const getMinTick = (tickSpacing: number) => Math.ceil(-887272 / tickSpacing) * tickSpacing; -const getMaxTick = (tickSpacing) => +const getMaxTick = (tickSpacing: number) => Math.floor(887272 / tickSpacing) * tickSpacing; diff --git a/test/mainnet/uniswapStake/uniswapStake.test.ts b/test/mainnet/uniswapStake/uniswapStake.test.ts index 7051acec..bc2cf3e0 100644 --- a/test/mainnet/uniswapStake/uniswapStake.test.ts +++ b/test/mainnet/uniswapStake/uniswapStake.test.ts @@ -3,18 +3,18 @@ import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; const { provider, deployContract } = waffle -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js"; +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js"; +import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; -import { abi: nftManagerAbi } from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json" +import { abi } from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json" +import type { Signer, Contract } from "ethers"; -import connectV2UniswapStakerArtifacts from "../../artifacts/contracts/mainnet/connectors/uniswap/v3_staker/main.sol/ConnectV2UniswapV3Staker.json"; -import connectV2UniswapV3Artifacts from "../../artifacts/contracts/mainnet/connectors/uniswap/v3/main.sol/ConnectV2UniswapV3.json"; +import { ConnectV2UniswapV3Staker__factory, ConnectV2UniswapV3__factory } from "../../../typechain"; const FeeAmount = { LOW: 500, @@ -22,7 +22,7 @@ const FeeAmount = { HIGH: 10000, } -const TICK_SPACINGS = { +const TICK_SPACINGS: Record = { 500: 10, 3000: 60, 10000: 200 @@ -32,7 +32,7 @@ const DAI_ADDR = "0x6b175474e89094c44da98b954eedeac495271d0f" const ethAddress = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" const INST_ADDR = "0x6f40d4a6237c257fff2db00fa0510deeecd303eb" -let tokenIds = [] +let tokenIds: any[] = [] const abiCoder = ethers.utils.defaultAbiCoder describe("UniswapV3", function () { @@ -44,6 +44,7 @@ describe("UniswapV3", function () { let instaConnectorsV2: any; let connector: any; let startTime: any, endTime: any; + let nftManager: Contract; const wallets = provider.getWallets() const [wallet0, wallet1, wallet2, wallet3] = wallets @@ -53,18 +54,19 @@ describe("UniswapV3", function () { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 13300000, }, }, ], }); - masterSigner = await getMasterSigner(wallet3) + masterSigner = await getMasterSigner() instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); - let nftManager = await ethers.getContractAt(nftManagerAbi, "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"); + nftManager = await ethers.getContractAt(abi, "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"); connector = await deployAndEnableConnector({ connectorName: connectorStaker, - contractArtifact: connectV2UniswapStakerArtifacts, + contractArtifact: ConnectV2UniswapV3Staker__factory, signer: masterSigner, connectors: instaConnectorsV2 }) @@ -72,7 +74,7 @@ describe("UniswapV3", function () { let uniswapConnector = await deployAndEnableConnector({ connectorName: connectorUniswap, - contractArtifact: connectV2UniswapV3Artifacts, + contractArtifact: ConnectV2UniswapV3__factory, signer: masterSigner, connectors: instaConnectorsV2 }); @@ -161,7 +163,7 @@ describe("UniswapV3", function () { let receipt = await tx.wait() let castEvent = new Promise((resolve, reject) => { - dsaWallet0.on('LogCast', (origin, sender, value, targetNames, targets, eventNames, eventParams, event) => { + dsaWallet0.on('LogCast', (origin: any, sender: any, value: any, targetNames: any, targets: any, eventNames: any, eventParams: any, event: any) => { const params = abiCoder.decode(["uint256", "uint256", "uint256", "uint256", "int24", "int24"], eventParams[0]); const params1 = abiCoder.decode(["uint256", "uint256", "uint256", "uint256", "int24", "int24"], eventParams[1]); tokenIds.push(params[0]); @@ -213,7 +215,7 @@ describe("UniswapV3", function () { let receipt = await tx.wait() let castEvent = new Promise((resolve, reject) => { - dsaWallet0.on('LogCast', (origin, sender, value, targetNames, targets, eventNames, eventParams, event) => { + dsaWallet0.on('LogCast', (origin: any, sender: any, value: any, targetNames: any, targets: any, eventNames: any, eventParams: any, event: any) => { const params = abiCoder.decode(["bytes32", "address", "address", "uint256", "uint256", "uint256"], eventParams[0]); const params1 = abiCoder.decode(["bytes32", "address", "address", "uint256", "uint256", "uint256"], eventParams[1]); event.removeListener(); @@ -226,7 +228,7 @@ describe("UniswapV3", function () { }, 60000) }); - let event = await castEvent + let event: any = await castEvent startTime = event.start; endTime = event.end; }); @@ -351,5 +353,5 @@ describe("UniswapV3", function () { }) }) -const getMinTick = (tickSpacing) => Math.ceil(-887272 / tickSpacing) * tickSpacing -const getMaxTick = (tickSpacing) => Math.floor(887272 / tickSpacing) * tickSpacing +const getMinTick = (tickSpacing: number) => Math.ceil(-887272 / tickSpacing) * tickSpacing +const getMaxTick = (tickSpacing: number) => Math.floor(887272 / tickSpacing) * tickSpacing diff --git a/test/mainnet/yearn/yearn.test.ts b/test/mainnet/yearn/yearn.test.ts index c3e9028c..68757674 100644 --- a/test/mainnet/yearn/yearn.test.ts +++ b/test/mainnet/yearn/yearn.test.ts @@ -1,154 +1,189 @@ import { expect } from "chai"; import hre from "hardhat"; const { web3, deployments, waffle, ethers } = hre; -const { provider, deployContract } = waffle +const { provider, deployContract } = waffle; -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" -import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; +import { encodeSpells } from "../../../scripts/tests/encodeSpells"; +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { tokens } from "../../../scripts/constant/tokens"; +import { Signer, Contract, BigNumber } from "ethers"; -import connectV2YearnArtifacts from "../../artifacts/contracts/mainnet/connectors/yearn_v2/main.sol/ConnectV2YearnV2.json" +import { ConnectV2YearnV2__factory } from "../../../typechain"; -const toBytes32 = (bn) => { - return ethers.utils.hexlify(ethers.utils.zeroPad(bn.toHexString(), 32)); -}; -const setStorageAt = async (address, index, value) => { - await ethers.provider.send("hardhat_setStorageAt", [address, index, value]); - await ethers.provider.send("evm_mine", []); // Just mines to the next block +const toBytes32 = (bn: BigNumber) => { + return ethers.utils.hexlify(ethers.utils.zeroPad(bn.toHexString(), 32)); }; -describe("Yearn", function () { - const connectorName = "YEARN-TEST-A" +const setStorageAt = async (address: string, index: string, value: string) => { + await ethers.provider.send("hardhat_setStorageAt", [address, index, value]); + await ethers.provider.send("evm_mine", []); // Just mines to the next block +}; - let dsaWallet0 - let masterSigner; - let instaConnectorsV2; - let connector; +describe("Yearn", function() { + const connectorName = "YEARN-TEST-A"; - const wallets = provider.getWallets() - const [wallet0, wallet1, wallet2, wallet3] = wallets - before(async () => { - await hre.network.provider.request({ - method: "hardhat_reset", - params: [ - { - forking: { - jsonRpcUrl: hre.config.networks.hardhat.forking.url, - blockNumber: 12996975, - }, - }, - ], - }); - masterSigner = await getMasterSigner(wallet3) - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); - connector = await deployAndEnableConnector({ - connectorName, - contractArtifact: connectV2YearnArtifacts, - signer: masterSigner, - connectors: instaConnectorsV2 - }) - console.log("Connector address", connector.address) - }) + let dsaWallet0: any; + let masterSigner: Signer; + let instaConnectorsV2: Contract; + let connector: Contract; - it("Should have contracts deployed.", async function () { - expect(!!instaConnectorsV2.address).to.be.true; - expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + const wallets = provider.getWallets(); + const [wallet0, wallet1, wallet2, wallet3] = wallets; + before(async () => { + await hre.network.provider.request({ + method: "hardhat_reset", + params: [ + { + forking: { + // @ts-ignore + jsonRpcUrl: hre.config.networks.hardhat.forking.url, + blockNumber: 12996975, + }, + }, + ], + }); + masterSigner = await getMasterSigner(); + instaConnectorsV2 = await ethers.getContractAt( + abis.core.connectorsV2, + addresses.core.connectorsV2 + ); + connector = await deployAndEnableConnector({ + connectorName, + contractArtifact: ConnectV2YearnV2__factory, + signer: masterSigner, + connectors: instaConnectorsV2, + }); + console.log("Connector address", connector.address); + }); + + it("Should have contracts deployed.", async function() { + expect(!!instaConnectorsV2.address).to.be.true; + expect(!!connector.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; + }); + + describe("DSA wallet setup", function() { + it("Should build DSA v2", async function() { + dsaWallet0 = await buildDSAv2(wallet0.address); + expect(!!dsaWallet0.address).to.be.true; }); - describe("DSA wallet setup", function () { - it("Should build DSA v2", async function () { - dsaWallet0 = await buildDSAv2(wallet0.address) - expect(!!dsaWallet0.address).to.be.true; - }); + it("Deposit ETH into DSA wallet", async function() { + await wallet0.sendTransaction({ + to: dsaWallet0.address, + value: ethers.utils.parseEther("10"), + }); + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte( + ethers.utils.parseEther("10") + ); + }); + }); - it("Deposit ETH into DSA wallet", async function () { - await wallet0.sendTransaction({ - to: dsaWallet0.address, - value: ethers.utils.parseEther("10") - }); - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte(ethers.utils.parseEther("10")); - }); + describe("Main", function() { + it("Should increase the DAI balance to 100 DAI", async function() { + const DAI = new ethers.Contract( + tokens.dai.address, + abis.basic.erc20, + ethers.provider + ); + const DAI_SLOT = 2; + const locallyManipulatedBalance = ethers.utils.parseEther("100"); + + // Get storage slot index + const index = ethers.utils.solidityKeccak256( + ["uint256", "uint256"], + [dsaWallet0.address, DAI_SLOT] + ); + // Manipulate local balance (needs to be bytes32 string) + await setStorageAt( + tokens.dai.address, + index.toString(), + toBytes32(locallyManipulatedBalance).toString() + ); + + // Get DAI balance + const balance = await DAI.balanceOf(dsaWallet0.address); + expect( + await ethers.BigNumber.from(balance).eq(ethers.utils.parseEther("100")) + ); }); - describe("Main", function () { + it("Should deposit and withdraw 50 DAI in/out the Yearn Vault", async function() { + const DAI = new ethers.Contract( + tokens.dai.address, + abis.basic.erc20, + ethers.provider + ); + const DAI_VAULT = "0xdA816459F1AB5631232FE5e97a05BBBb94970c95"; + const amount = ethers.utils.parseEther("50"); // 50 DAI + const setId = "132456"; + const spells = [ + { + connector: connectorName, + method: "deposit", + args: [DAI_VAULT, amount, 0, setId], + }, + { + connector: connectorName, + method: "withdraw", + args: [DAI_VAULT, amount, setId, 0], + }, + ]; - it("Should increase the DAI balance to 100 DAI", async function () { - const DAI = new ethers.Contract(tokens.dai.address, abis.basic.erc20, ethers.provider); - const DAI_SLOT = 2; - const locallyManipulatedBalance = ethers.utils.parseEther("100"); + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet0.address); + await tx.wait(); - // Get storage slot index - const index = ethers.utils.solidityKeccak256( - ["uint256", "uint256"], - [dsaWallet0.address, DAI_SLOT] - ); - // Manipulate local balance (needs to be bytes32 string) - await setStorageAt( - tokens.dai.address, - index.toString(), - toBytes32(locallyManipulatedBalance).toString() - ); + // Get DAI balance + const balance = await DAI.balanceOf(dsaWallet0.address); + expect( + await ethers.BigNumber.from(balance).eq(ethers.utils.parseEther("100")) + ); + }); - // Get DAI balance - const balance = await DAI.balanceOf(dsaWallet0.address); - expect(await ethers.BigNumber.from(balance).eq(ethers.utils.parseEther("100"))); - }); + it("Should deposit 70 DAI in the Yearn Vault", async function() { + const DAI_VAULT = "0xdA816459F1AB5631232FE5e97a05BBBb94970c95"; + const DAI = new ethers.Contract( + tokens.dai.address, + abis.basic.erc20, + ethers.provider + ); + const YVDAI = new ethers.Contract( + DAI_VAULT, + abis.basic.erc20, + ethers.provider + ); + const amount = ethers.utils.parseEther("70"); // 70 DAI + const setId = "568445"; + const spells = [ + { + connector: connectorName, + method: "deposit", + args: [DAI_VAULT, amount, 0, setId], + }, + ]; - it("Should deposit and withdraw 50 DAI in/out the Yearn Vault", async function () { - const DAI = new ethers.Contract(tokens.dai.address, abis.basic.erc20, ethers.provider); - const DAI_VAULT = '0xdA816459F1AB5631232FE5e97a05BBBb94970c95'; - const amount = ethers.utils.parseEther("50") // 50 DAI - const setId = "132456"; - const spells = [ - { - connector: connectorName, - method: "deposit", - args: [DAI_VAULT, amount, 0, setId] - }, - { - connector: connectorName, - method: "withdraw", - args: [DAI_VAULT, amount, setId, 0] - } - ] + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet0.address); + await tx.wait(); - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet0.address); - await tx.wait(); - - // Get DAI balance - const balance = await DAI.balanceOf(dsaWallet0.address); - expect(await ethers.BigNumber.from(balance).eq(ethers.utils.parseEther("100"))); - }); - - it("Should deposit 70 DAI in the Yearn Vault", async function () { - const DAI_VAULT = '0xdA816459F1AB5631232FE5e97a05BBBb94970c95'; - const DAI = new ethers.Contract(tokens.dai.address, abis.basic.erc20, ethers.provider); - const YVDAI = new ethers.Contract(DAI_VAULT, abis.basic.erc20, ethers.provider); - const amount = ethers.utils.parseEther("70") // 70 DAI - const setId = "568445"; - const spells = [ - { - connector: connectorName, - method: "deposit", - args: [DAI_VAULT, amount, 0, setId] - } - ] - - const tx = await dsaWallet0.connect(wallet0).cast(...encodeSpells(spells), wallet0.address); - await tx.wait(); - - // Get DAI balance - const yvDAIBalance = await YVDAI.balanceOf(dsaWallet0.address); - const daiBalance = await DAI.balanceOf(dsaWallet0.address); - const correctDaiBalance = await ethers.BigNumber.from(daiBalance).eq(ethers.utils.parseEther("30")); - const correctYVDaiBalance = await ethers.BigNumber.from(yvDAIBalance).lte(ethers.utils.parseEther("70")); - expect(correctDaiBalance && correctYVDaiBalance); - }); - }) -}) + // Get DAI balance + const yvDAIBalance = await YVDAI.balanceOf(dsaWallet0.address); + const daiBalance = await DAI.balanceOf(dsaWallet0.address); + const correctDaiBalance = ethers.BigNumber.from(daiBalance).eq( + ethers.utils.parseEther("30") + ); + const correctYVDaiBalance = ethers.BigNumber.from(yvDAIBalance).lte( + ethers.utils.parseEther("70") + ); + expect(correctDaiBalance && correctYVDaiBalance); + }); + }); +}); diff --git a/yarn.lock b/yarn.lock index 51e7f458..7d4de696 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1271,6 +1271,13 @@ dependencies: "@types/node" "*" +"@types/chai-as-promised@^7.1.4": + "integrity" "sha512-1y3L1cHePcIm5vXkh1DSGf/zQq5n5xDKG1fpCvf18+uOkpce0Z1ozNFPkyWsVswK7ntN1sZBw3oU6gmN+pDUcA==" + "resolved" "https://registry.npmjs.org/@types/chai-as-promised/-/chai-as-promised-7.1.4.tgz" + "version" "7.1.4" + dependencies: + "@types/chai" "*" + "@types/chai@*", "@types/chai@^4.2.22": "integrity" "sha512-tFfcE+DSTzWAgifkjik9AySNqIyNoYwmR+uecPwwD/XRNfvOjmC/FjCxpiUGDkDVDphPfCUecSQVFw+lN3M3kQ==" "resolved" "https://registry.npmjs.org/@types/chai/-/chai-4.2.22.tgz" From c2ccad9668b0a81b3fa8bb120b89fabfae1b4031 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Mon, 6 Dec 2021 16:17:14 +0530 Subject: [PATCH 23/39] added test runner scripts + test cases fix --- package-lock.json | 878 ++- package.json | 7 +- scripts/tests/command.ts | 33 + scripts/tests/encodeFlashcastData.ts | 2 +- scripts/tests/global-test.ts | 44 + scripts/tests/run-tests.ts | 58 + .../uniswap-sell-beta/uniswap-sell-beta.ts | 4 +- test/mainnet/b.protocol/b.compound.test.ts | 6 +- .../mainnet/basic-ERC1155/ERC1155-transfer.ts | 3 +- test/mainnet/basic-ERC721/ERC721-transfer.ts | 2 +- test/mainnet/liquity/liquity.contracts.ts | 168 +- test/mainnet/liquity/liquity.helpers.ts | 604 +- test/mainnet/liquity/liquity.test.ts | 5438 ++++++++--------- .../mainnet/pooltogether/pooltogether.test.ts | 2450 ++++---- .../mainnet/uniswapStake/uniswapStake.test.ts | 10 +- .../pooltogether}/pooltogether.test.ts | 0 yarn.lock | 248 +- 17 files changed, 5569 insertions(+), 4386 deletions(-) create mode 100644 scripts/tests/command.ts create mode 100644 scripts/tests/global-test.ts create mode 100644 scripts/tests/run-tests.ts rename test/{mainnet => arbitrum}/uniswap-sell-beta/uniswap-sell-beta.ts (96%) rename test/{mainnet/pooltogether-polygon => polygon/pooltogether}/pooltogether.test.ts (100%) diff --git a/package-lock.json b/package-lock.json index 5c5dd07b..8479fd20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "chalk": "^5.0.0", "dotenv": "^10.0.0", "hardhat-docgen": "^1.2.0", + "inquirer": "^8.2.0", "minimist": "^1.2.5", "solc": "^0.8.10", "typechain": "^6.0.5" @@ -31,6 +32,7 @@ "@tenderly/hardhat-tenderly": "^1.0.13", "@types/chai": "^4.2.22", "@types/chai-as-promised": "^7.1.4", + "@types/inquirer": "^8.1.3", "@types/mocha": "^9.0.0", "@types/node": "^16.11.11", "chai": "^4.3.4", @@ -4158,6 +4160,31 @@ "@types/node": "*" } }, + "node_modules/@types/inquirer": { + "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-8.1.3.tgz", + "integrity": "sha512-AayK4ZL5ssPzR1OtnOLGAwpT0Dda3Xi/h1G0l1oJDNrowp7T1423q4Zb8/emr7tzRlCy4ssEri0LWVexAqHyKQ==", + "dev": true, + "dependencies": { + "@types/through": "*", + "rxjs": "^7.2.0" + } + }, + "node_modules/@types/inquirer/node_modules/rxjs": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.4.0.tgz", + "integrity": "sha512-7SQDi7xeTMCJpqViXh8gL/lebcwlp3d831F05+9B44A4B0WfsEwUQHR64gsH1kvJ+Ep/J9K2+n1hVl1CsGN23w==", + "dev": true, + "dependencies": { + "tslib": "~2.1.0" + } + }, + "node_modules/@types/inquirer/node_modules/tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==", + "dev": true + }, "node_modules/@types/level-errors": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/level-errors/-/level-errors-3.0.0.tgz", @@ -4283,6 +4310,15 @@ "@types/sinon": "*" } }, + "node_modules/@types/through": { + "version": "0.0.30", + "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.30.tgz", + "integrity": "sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/underscore": { "version": "1.11.2", "resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.11.2.tgz", @@ -5230,6 +5266,29 @@ "file-uri-to-path": "1.0.0" } }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bl/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/blakejs": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.0.tgz", @@ -5762,6 +5821,11 @@ "upper-case-first": "^1.1.0" } }, + "node_modules/chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" + }, "node_modules/check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -6013,6 +6077,36 @@ "node": ">= 4.0" } }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-spinners": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", + "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-width": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", + "engines": { + "node": ">= 10" + } + }, "node_modules/cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", @@ -6055,6 +6149,14 @@ "node": ">=6" } }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "engines": { + "node": ">=0.8" + } + }, "node_modules/clone-response": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", @@ -6649,6 +6751,14 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, + "node_modules/defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "dependencies": { + "clone": "^1.0.2" + } + }, "node_modules/defer-to-connect": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", @@ -8466,6 +8576,19 @@ "node": ">=0.10.0" } }, + "node_modules/external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dependencies": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/extglob": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", @@ -8604,6 +8727,20 @@ "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==" }, + "node_modules/figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", @@ -21803,6 +21940,152 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, + "node_modules/inquirer": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.0.tgz", + "integrity": "sha512-0crLweprevJ02tTuA6ThpoAERAGyVILC4sS74uib58Xf/zSr1/ZWtmm7D5CI+bSQEaA04f0K7idaHpQbSWgiVQ==", + "dependencies": { + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.1", + "cli-cursor": "^3.1.0", + "cli-width": "^3.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.21", + "mute-stream": "0.0.8", + "ora": "^5.4.1", + "run-async": "^2.4.0", + "rxjs": "^7.2.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/inquirer/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/inquirer/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/inquirer/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/inquirer/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/inquirer/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/inquirer/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/rxjs": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.4.0.tgz", + "integrity": "sha512-7SQDi7xeTMCJpqViXh8gL/lebcwlp3d831F05+9B44A4B0WfsEwUQHR64gsH1kvJ+Ep/J9K2+n1hVl1CsGN23w==", + "dependencies": { + "tslib": "~2.1.0" + } + }, + "node_modules/inquirer/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==" + }, "node_modules/internal-slot": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", @@ -22090,6 +22373,14 @@ "npm": ">=3" } }, + "node_modules/is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "engines": { + "node": ">=8" + } + }, "node_modules/is-lower-case": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/is-lower-case/-/is-lower-case-1.1.3.tgz", @@ -22252,6 +22543,17 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-upper-case": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/is-upper-case/-/is-upper-case-1.1.2.tgz", @@ -23673,6 +23975,11 @@ "imul": "^1.0.0" } }, + "node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + }, "node_modules/nan": { "version": "2.13.2", "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", @@ -24247,6 +24554,28 @@ "wrappy": "1" } }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/onetime/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "engines": { + "node": ">=6" + } + }, "node_modules/open": { "version": "7.4.2", "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", @@ -24292,6 +24621,126 @@ "node": ">= 0.8.0" } }, + "node_modules/ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "dependencies": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ora/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/ora/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ora/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/ora/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/ora/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ora/node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ora/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/os-browserify": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", @@ -25519,6 +25968,18 @@ "lowercase-keys": "^1.0.0" } }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", @@ -25589,6 +26050,14 @@ "rlp": "bin/rlp" } }, + "node_modules/run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -25992,8 +26461,7 @@ "node_modules/signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" }, "node_modules/simple-concat": { "version": "1.0.1", @@ -26966,19 +27434,6 @@ "tar-stream": "^2.1.4" } }, - "node_modules/tar-fs/node_modules/bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, "node_modules/tar-fs/node_modules/readable-stream": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", @@ -27086,6 +27541,11 @@ "deprecated": "testrpc has been renamed to ganache-cli, please use this package from now on.", "dev": true }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, "node_modules/through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", @@ -28221,6 +28681,14 @@ "node": ">=0.10.0" } }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "dependencies": { + "defaults": "^1.0.3" + } + }, "node_modules/web3": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/web3/-/web3-1.6.1.tgz", @@ -33074,6 +33542,33 @@ "@types/node": "*" } }, + "@types/inquirer": { + "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-8.1.3.tgz", + "integrity": "sha512-AayK4ZL5ssPzR1OtnOLGAwpT0Dda3Xi/h1G0l1oJDNrowp7T1423q4Zb8/emr7tzRlCy4ssEri0LWVexAqHyKQ==", + "dev": true, + "requires": { + "@types/through": "*", + "rxjs": "^7.2.0" + }, + "dependencies": { + "rxjs": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.4.0.tgz", + "integrity": "sha512-7SQDi7xeTMCJpqViXh8gL/lebcwlp3d831F05+9B44A4B0WfsEwUQHR64gsH1kvJ+Ep/J9K2+n1hVl1CsGN23w==", + "dev": true, + "requires": { + "tslib": "~2.1.0" + } + }, + "tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==", + "dev": true + } + } + }, "@types/level-errors": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/level-errors/-/level-errors-3.0.0.tgz", @@ -33198,6 +33693,15 @@ "@types/sinon": "*" } }, + "@types/through": { + "version": "0.0.30", + "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.30.tgz", + "integrity": "sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/underscore": { "version": "1.11.2", "resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.11.2.tgz", @@ -33990,6 +34494,28 @@ "file-uri-to-path": "1.0.0" } }, + "bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "blakejs": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.0.tgz", @@ -34451,6 +34977,11 @@ "upper-case-first": "^1.1.0" } }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" + }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -34656,6 +35187,24 @@ "source-map": "~0.6.0" } }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-spinners": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", + "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==" + }, + "cli-width": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==" + }, "cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", @@ -34691,6 +35240,11 @@ } } }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=" + }, "clone-response": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", @@ -35170,6 +35724,14 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "requires": { + "clone": "^1.0.2" + } + }, "defer-to-connect": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", @@ -36679,6 +37241,16 @@ "is-extendable": "^1.0.1" } }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, "extglob": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", @@ -36793,6 +37365,14 @@ "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==" }, + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, "file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", @@ -47139,6 +47719,118 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, + "inquirer": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.0.tgz", + "integrity": "sha512-0crLweprevJ02tTuA6ThpoAERAGyVILC4sS74uib58Xf/zSr1/ZWtmm7D5CI+bSQEaA04f0K7idaHpQbSWgiVQ==", + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.1", + "cli-cursor": "^3.1.0", + "cli-width": "^3.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.21", + "mute-stream": "0.0.8", + "ora": "^5.4.1", + "run-async": "^2.4.0", + "rxjs": "^7.2.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "rxjs": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.4.0.tgz", + "integrity": "sha512-7SQDi7xeTMCJpqViXh8gL/lebcwlp3d831F05+9B44A4B0WfsEwUQHR64gsH1kvJ+Ep/J9K2+n1hVl1CsGN23w==", + "requires": { + "tslib": "~2.1.0" + } + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==" + } + } + }, "internal-slot": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", @@ -47324,6 +48016,11 @@ "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" }, + "is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==" + }, "is-lower-case": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/is-lower-case/-/is-lower-case-1.1.3.tgz", @@ -47429,6 +48126,11 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==" + }, "is-upper-case": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/is-upper-case/-/is-upper-case-1.1.2.tgz", @@ -48606,6 +49308,11 @@ "imul": "^1.0.0" } }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + }, "nan": { "version": "2.13.2", "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", @@ -49090,6 +49797,21 @@ "wrappy": "1" } }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + }, + "dependencies": { + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + } + } + }, "open": { "version": "7.4.2", "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", @@ -49125,6 +49847,89 @@ "word-wrap": "~1.2.3" } }, + "ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "requires": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "requires": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "os-browserify": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", @@ -50089,6 +50894,15 @@ "lowercase-keys": "^1.0.0" } }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", @@ -50140,6 +50954,11 @@ "bn.js": "^4.11.1" } }, + "run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==" + }, "run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -50458,8 +51277,7 @@ "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" }, "simple-concat": { "version": "1.0.1", @@ -51268,19 +52086,6 @@ "tar-stream": "^2.1.4" }, "dependencies": { - "bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, "readable-stream": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", @@ -51369,6 +52174,11 @@ "integrity": "sha512-afH1hO+SQ/VPlmaLUFj2636QMeDvPCeQMc/9RBMW0IfjNe9gFD9Ra3ShqYkB7py0do1ZcCna/9acHyzTJ+GcNA==", "dev": true }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, "through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", @@ -52286,6 +53096,14 @@ } } }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "requires": { + "defaults": "^1.0.3" + } + }, "web3": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/web3/-/web3-1.6.1.tgz", diff --git a/package.json b/package.json index 6c3139d9..6dfdd041 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,12 @@ "description": "", "directories": {}, "scripts": { - "test": "hardhat test", + "test": "hardhat run scripts/tests/global-test.ts", "coverage": "./node_modules/.bin/solidity-coverage", "check": "node status-checks/huskyCheck.js", "check-husky": "node status-checks/huskyCheck.js", - "deploy": "node scripts/deployConnectorsFromCmd.js" + "deploy": "node scripts/deployConnectorsFromCmd.js", + "test:runner": "hardhat run scripts/tests/run-tests.ts" }, "repository": { "type": "git", @@ -29,6 +30,7 @@ "chalk": "^5.0.0", "dotenv": "^10.0.0", "hardhat-docgen": "^1.2.0", + "inquirer": "^8.2.0", "minimist": "^1.2.5", "solc": "^0.8.10", "typechain": "^6.0.5" @@ -43,6 +45,7 @@ "@tenderly/hardhat-tenderly": "^1.0.13", "@types/chai": "^4.2.22", "@types/chai-as-promised": "^7.1.4", + "@types/inquirer": "^8.1.3", "@types/mocha": "^9.0.0", "@types/node": "^16.11.11", "chai": "^4.3.4", diff --git a/scripts/tests/command.ts b/scripts/tests/command.ts new file mode 100644 index 00000000..51a07234 --- /dev/null +++ b/scripts/tests/command.ts @@ -0,0 +1,33 @@ +import { execFile, spawn } from "child_process"; + +interface ICommand { + readonly cmd: string; + readonly args: string[]; + readonly env: { + [param: string]: string; + }; +} + +export async function execScript(input: ICommand): Promise { + return new Promise((resolve, reject) => { + let cmdEnv = Object.create(process.env); + for (let param in input.env) { + cmdEnv[param] = input.env[param]; + } + + const proc = spawn(input.cmd, [...input.args], { + env: cmdEnv, + shell: true, + stdio: "inherit", + }); + + proc.on("exit", (code) => { + if (code !== 0) { + reject(code); + return; + } + + resolve(code); + }); + }); +} diff --git a/scripts/tests/encodeFlashcastData.ts b/scripts/tests/encodeFlashcastData.ts index 934b58e6..8e4b9d9f 100644 --- a/scripts/tests/encodeFlashcastData.ts +++ b/scripts/tests/encodeFlashcastData.ts @@ -1,7 +1,7 @@ import hre from "hardhat"; const { web3 } = hre; -import { encodeSpells } from "./encodeSpells.js"; +import { encodeSpells } from "./encodeSpells"; export default function encodeFlashcastData(spells: any) { const encodeSpellsData = encodeSpells(spells); diff --git a/scripts/tests/global-test.ts b/scripts/tests/global-test.ts new file mode 100644 index 00000000..7a00510f --- /dev/null +++ b/scripts/tests/global-test.ts @@ -0,0 +1,44 @@ +import { promises as fs } from "fs"; + +import { join } from "path"; +import { execScript } from "./command"; + +let start: number, end: number; + +async function testRunner() { + const chain = ["avalanche", "mainnet", "polygon"]; + start = Date.now(); + + for (let ch of chain) { + console.log(`📗Running test for %c${ch}: `, "blue"); + let path: string; + const testsPath = join(__dirname, "../../test", ch); + await fs.access(testsPath); + const availableTests = await fs.readdir(testsPath); + + if (availableTests.length !== 0) { + for (let test of availableTests) { + path = join(testsPath, test); + path += "/*"; + await execScript({ + cmd: "npx", + args: ["hardhat", "test", path], + env: { + networkType: ch, + }, + }); + } + } + } + + end = Date.now(); +} + +testRunner() + .then(() => + console.log( + `🙌 finished running the test, total time taken ${(end - start) / + 1000} sec` + ) + ) + .catch((err) => console.error("❌ failed due to error: ", err)); diff --git a/scripts/tests/run-tests.ts b/scripts/tests/run-tests.ts new file mode 100644 index 00000000..de48de95 --- /dev/null +++ b/scripts/tests/run-tests.ts @@ -0,0 +1,58 @@ +import inquirer from "inquirer"; +import { promises as fs } from "fs"; + +import { join } from "path"; +import { execScript } from "./command"; + +let start: number, end: number; + +async function testRunner() { + const { chain } = await inquirer.prompt([ + { + name: "chain", + message: "What chain do you want to run tests on?", + type: "list", + choices: ["mainnet", "polygon", "avalanche", "arbitrum"], + }, + ]); + const testsPath = join(__dirname, "../../test", chain); + await fs.access(testsPath); + const availableTests = await fs.readdir(testsPath); + if (availableTests.length === 0) { + throw new Error(`No tests available for ${chain}`); + } + + const { testName } = await inquirer.prompt([ + { + name: "testName", + message: "For which resolver you want to run the tests?", + type: "list", + choices: ["all", ...availableTests], + }, + ]); + start = Date.now(); + let path: string; + if (testName === "all") { + path = availableTests.map((file) => join(testsPath, file)).join(" "); + } else { + path = join(testsPath, testName); + } + path += "/*"; + + await execScript({ + cmd: "npx", + args: ["hardhat", "test", path], + env: { + networkType: chain, + }, + }); + end = Date.now(); +} + +testRunner() + .then(() => + console.log( + `🙌 finished the test runner, time taken ${(end - start) / 1000} sec` + ) + ) + .catch((err) => console.error("❌ failed due to error: ", err)); diff --git a/test/mainnet/uniswap-sell-beta/uniswap-sell-beta.ts b/test/arbitrum/uniswap-sell-beta/uniswap-sell-beta.ts similarity index 96% rename from test/mainnet/uniswap-sell-beta/uniswap-sell-beta.ts rename to test/arbitrum/uniswap-sell-beta/uniswap-sell-beta.ts index 73b9df8b..dc3ad518 100644 --- a/test/mainnet/uniswap-sell-beta/uniswap-sell-beta.ts +++ b/test/arbitrum/uniswap-sell-beta/uniswap-sell-beta.ts @@ -51,8 +51,8 @@ describe("Uniswap-sell-beta", function () { } beforeEach(async () => { - const account0 = "0x36cc7B13029B5DEe4034745FB4F24034f3F2ffc6"; - const account1 = "0xce2cc46682e9c6d5f174af598fb4931a9c0be68e"; + const account0 = "0xa067668661c84476afcdc6fa5d758c4c01c34352"; + const account1 = "0x0db3fe3b770c95a0b99d1ed6f2627933466c0dd8"; const [owner, add1, add2] = await ethers.getSigners(); await impersonate(owner.address, account1, USDC_ADDR, 6); diff --git a/test/mainnet/b.protocol/b.compound.test.ts b/test/mainnet/b.protocol/b.compound.test.ts index fbda13f9..4ef6c0ba 100644 --- a/test/mainnet/b.protocol/b.compound.test.ts +++ b/test/mainnet/b.protocol/b.compound.test.ts @@ -10,7 +10,7 @@ import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; -import { ConnectV2Compound__factory } from "../../../typechain"; +import { ConnectV2BCompound__factory } from "../../../typechain"; import type { Signer, Contract } from "ethers"; describe("B.Compound", function () { @@ -19,7 +19,7 @@ describe("B.Compound", function () { let dsaWallet0: any; let masterSigner: Signer; let instaConnectorsV2: Contract; - let connector: any; + let connector: Contract; const wallets = provider.getWallets() const [wallet0, wallet1, wallet2, wallet3] = wallets @@ -40,7 +40,7 @@ describe("B.Compound", function () { instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, - contractArtifact: ConnectV2Compound__factory, + contractArtifact: ConnectV2BCompound__factory, signer: masterSigner, connectors: instaConnectorsV2 }) diff --git a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts index 5c85581a..88fc918b 100644 --- a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts +++ b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts @@ -56,9 +56,8 @@ describe("BASIC-ERC1155", function () { await hre.network.provider.send("hardhat_setBalance", [ TOKEN_OWNER_ADDR, - "0x1000000000000000", + "0x10000000000000000", ]); - // get tokenOwner tokenOwner = await ethers.getSigner( TOKEN_OWNER_ADDR diff --git a/test/mainnet/basic-ERC721/ERC721-transfer.ts b/test/mainnet/basic-ERC721/ERC721-transfer.ts index db4acb9e..2fb3c24d 100644 --- a/test/mainnet/basic-ERC721/ERC721-transfer.ts +++ b/test/mainnet/basic-ERC721/ERC721-transfer.ts @@ -55,7 +55,7 @@ describe("BASIC-ERC721", function () { await network.provider.send("hardhat_setBalance", [ TOKEN_OWNER_ADDR, - "0x1000000000000000", + "0x10000000000000000", ]); // get tokenOwner diff --git a/test/mainnet/liquity/liquity.contracts.ts b/test/mainnet/liquity/liquity.contracts.ts index f6a6df74..44fa6534 100644 --- a/test/mainnet/liquity/liquity.contracts.ts +++ b/test/mainnet/liquity/liquity.contracts.ts @@ -1,95 +1,95 @@ -const TROVE_MANAGER_ADDRESS = "0xA39739EF8b0231DbFA0DcdA07d7e29faAbCf4bb2"; -const TROVE_MANAGER_ABI = [ - "function getTroveColl(address _borrower) external view returns (uint)", - "function getTroveDebt(address _borrower) external view returns (uint)", - "function getTroveStatus(address _borrower) external view returns (uint)", - "function redeemCollateral(uint _LUSDAmount, address _firstRedemptionHint, address _upperPartialRedemptionHint, address _lowerPartialRedemptionHint, uint _partialRedemptionHintNICR, uint _maxIterations, uint _maxFee) external returns (uint)", - "function getNominalICR(address _borrower) external view returns (uint)", - "function liquidate(address _borrower) external", - "function liquidateTroves(uint _n) external", -]; +// const TROVE_MANAGER_ADDRESS = "0xA39739EF8b0231DbFA0DcdA07d7e29faAbCf4bb2"; +// const TROVE_MANAGER_ABI = [ +// "function getTroveColl(address _borrower) external view returns (uint)", +// "function getTroveDebt(address _borrower) external view returns (uint)", +// "function getTroveStatus(address _borrower) external view returns (uint)", +// "function redeemCollateral(uint _LUSDAmount, address _firstRedemptionHint, address _upperPartialRedemptionHint, address _lowerPartialRedemptionHint, uint _partialRedemptionHintNICR, uint _maxIterations, uint _maxFee) external returns (uint)", +// "function getNominalICR(address _borrower) external view returns (uint)", +// "function liquidate(address _borrower) external", +// "function liquidateTroves(uint _n) external", +// ]; -const BORROWER_OPERATIONS_ADDRESS = - "0x24179CD81c9e782A4096035f7eC97fB8B783e007"; -const BORROWER_OPERATIONS_ABI = [ - "function openTrove(uint256 _maxFee, uint256 _LUSDAmount, address _upperHint, address _lowerHint) external payable", - "function closeTrove() external", -]; +// const BORROWER_OPERATIONS_ADDRESS = +// "0x24179CD81c9e782A4096035f7eC97fB8B783e007"; +// const BORROWER_OPERATIONS_ABI = [ +// "function openTrove(uint256 _maxFee, uint256 _LUSDAmount, address _upperHint, address _lowerHint) external payable", +// "function closeTrove() external", +// ]; -const LUSD_TOKEN_ADDRESS = "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0"; -const LUSD_TOKEN_ABI = [ - "function transfer(address _to, uint256 _value) public returns (bool success)", - "function balanceOf(address account) external view returns (uint256)", - "function approve(address spender, uint256 amount) external returns (bool)", -]; +// const LUSD_TOKEN_ADDRESS = "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0"; +// const LUSD_TOKEN_ABI = [ +// "function transfer(address _to, uint256 _value) public returns (bool success)", +// "function balanceOf(address account) external view returns (uint256)", +// "function approve(address spender, uint256 amount) external returns (bool)", +// ]; -const ACTIVE_POOL_ADDRESS = "0xDf9Eb223bAFBE5c5271415C75aeCD68C21fE3D7F"; -const ACTIVE_POOL_ABI = ["function getLUSDDebt() external view returns (uint)"]; +// const ACTIVE_POOL_ADDRESS = "0xDf9Eb223bAFBE5c5271415C75aeCD68C21fE3D7F"; +// const ACTIVE_POOL_ABI = ["function getLUSDDebt() external view returns (uint)"]; -const PRICE_FEED_ADDRESS = "0x4c517D4e2C851CA76d7eC94B805269Df0f2201De"; -const PRICE_FEED_ABI = ["function fetchPrice() external returns (uint)"]; +// const PRICE_FEED_ADDRESS = "0x4c517D4e2C851CA76d7eC94B805269Df0f2201De"; +// const PRICE_FEED_ABI = ["function fetchPrice() external returns (uint)"]; -const HINT_HELPERS_ADDRESS = "0xE84251b93D9524E0d2e621Ba7dc7cb3579F997C0"; -const HINT_HELPERS_ABI = [ - "function getRedemptionHints(uint _LUSDamount, uint _price, uint _maxIterations) external view returns (address firstRedemptionHint, uint partialRedemptionHintNICR, uint truncatedLUSDamount)", - "function getApproxHint(uint _CR, uint _numTrials, uint _inputRandomSeed) view returns (address hintAddress, uint diff, uint latestRandomSeed)", - "function computeNominalCR(uint _coll, uint _debt) external pure returns (uint)", -]; +// const HINT_HELPERS_ADDRESS = "0xE84251b93D9524E0d2e621Ba7dc7cb3579F997C0"; +// const HINT_HELPERS_ABI = [ +// "function getRedemptionHints(uint _LUSDamount, uint _price, uint _maxIterations) external view returns (address firstRedemptionHint, uint partialRedemptionHintNICR, uint truncatedLUSDamount)", +// "function getApproxHint(uint _CR, uint _numTrials, uint _inputRandomSeed) view returns (address hintAddress, uint diff, uint latestRandomSeed)", +// "function computeNominalCR(uint _coll, uint _debt) external pure returns (uint)", +// ]; -const SORTED_TROVES_ADDRESS = "0x8FdD3fbFEb32b28fb73555518f8b361bCeA741A6"; -const SORTED_TROVES_ABI = [ - "function findInsertPosition(uint256 _ICR, address _prevId, address _nextId) external view returns (address, address)", - "function getLast() external view returns (address)", -]; +// const SORTED_TROVES_ADDRESS = "0x8FdD3fbFEb32b28fb73555518f8b361bCeA741A6"; +// const SORTED_TROVES_ABI = [ +// "function findInsertPosition(uint256 _ICR, address _prevId, address _nextId) external view returns (address, address)", +// "function getLast() external view returns (address)", +// ]; -const STABILITY_POOL_ADDRESS = "0x66017D22b0f8556afDd19FC67041899Eb65a21bb"; -const STABILITY_POOL_ABI = [ - "function getCompoundedLUSDDeposit(address _depositor) external view returns (uint)", - "function getDepositorETHGain(address _depositor) external view returns (uint)", - "function getDepositorLQTYGain(address _depositor) external view returns (uint)", -]; +// const STABILITY_POOL_ADDRESS = "0x66017D22b0f8556afDd19FC67041899Eb65a21bb"; +// const STABILITY_POOL_ABI = [ +// "function getCompoundedLUSDDeposit(address _depositor) external view returns (uint)", +// "function getDepositorETHGain(address _depositor) external view returns (uint)", +// "function getDepositorLQTYGain(address _depositor) external view returns (uint)", +// ]; -const STAKING_ADDRESS = "0x4f9Fbb3f1E99B56e0Fe2892e623Ed36A76Fc605d"; -const STAKING_ABI = [ - "function stake(uint _LQTYamount) external", - "function unstake(uint _LQTYamount) external", - "function getPendingETHGain(address _user) external view returns (uint)", - "function getPendingLUSDGain(address _user) external view returns (uint)", -]; +// const STAKING_ADDRESS = "0x4f9Fbb3f1E99B56e0Fe2892e623Ed36A76Fc605d"; +// const STAKING_ABI = [ +// "function stake(uint _LQTYamount) external", +// "function unstake(uint _LQTYamount) external", +// "function getPendingETHGain(address _user) external view returns (uint)", +// "function getPendingLUSDGain(address _user) external view returns (uint)", +// ]; -const LQTY_TOKEN_ADDRESS = "0x6DEA81C8171D0bA574754EF6F8b412F2Ed88c54D"; -const LQTY_TOKEN_ABI = [ - "function balanceOf(address account) external view returns (uint256)", - "function transfer(address _to, uint256 _value) public returns (bool success)", - "function approve(address spender, uint256 amount) external returns (bool)", -]; +// const LQTY_TOKEN_ADDRESS = "0x6DEA81C8171D0bA574754EF6F8b412F2Ed88c54D"; +// const LQTY_TOKEN_ABI = [ +// "function balanceOf(address account) external view returns (uint256)", +// "function transfer(address _to, uint256 _value) public returns (bool success)", +// "function approve(address spender, uint256 amount) external returns (bool)", +// ]; -const COLL_SURPLUS_ADDRESS = "0x3D32e8b97Ed5881324241Cf03b2DA5E2EBcE5521"; -const COLL_SURPLUS_ABI = [ - "function getCollateral(address _account) external view returns (uint)", -]; +// const COLL_SURPLUS_ADDRESS = "0x3D32e8b97Ed5881324241Cf03b2DA5E2EBcE5521"; +// const COLL_SURPLUS_ABI = [ +// "function getCollateral(address _account) external view returns (uint)", +// ]; -module.exports = { - TROVE_MANAGER_ADDRESS, - TROVE_MANAGER_ABI, - BORROWER_OPERATIONS_ADDRESS, - BORROWER_OPERATIONS_ABI, - LUSD_TOKEN_ADDRESS, - LUSD_TOKEN_ABI, - STABILITY_POOL_ADDRESS, - STABILITY_POOL_ABI, - ACTIVE_POOL_ADDRESS, - ACTIVE_POOL_ABI, - PRICE_FEED_ADDRESS, - PRICE_FEED_ABI, - HINT_HELPERS_ADDRESS, - HINT_HELPERS_ABI, - SORTED_TROVES_ADDRESS, - SORTED_TROVES_ABI, - STAKING_ADDRESS, - STAKING_ABI, - LQTY_TOKEN_ADDRESS, - LQTY_TOKEN_ABI, - COLL_SURPLUS_ADDRESS, - COLL_SURPLUS_ABI, -}; +// module.exports = { +// TROVE_MANAGER_ADDRESS, +// TROVE_MANAGER_ABI, +// BORROWER_OPERATIONS_ADDRESS, +// BORROWER_OPERATIONS_ABI, +// LUSD_TOKEN_ADDRESS, +// LUSD_TOKEN_ABI, +// STABILITY_POOL_ADDRESS, +// STABILITY_POOL_ABI, +// ACTIVE_POOL_ADDRESS, +// ACTIVE_POOL_ABI, +// PRICE_FEED_ADDRESS, +// PRICE_FEED_ABI, +// HINT_HELPERS_ADDRESS, +// HINT_HELPERS_ABI, +// SORTED_TROVES_ADDRESS, +// SORTED_TROVES_ABI, +// STAKING_ADDRESS, +// STAKING_ABI, +// LQTY_TOKEN_ADDRESS, +// LQTY_TOKEN_ABI, +// COLL_SURPLUS_ADDRESS, +// COLL_SURPLUS_ABI, +// }; diff --git a/test/mainnet/liquity/liquity.helpers.ts b/test/mainnet/liquity/liquity.helpers.ts index bab90124..26ff0851 100644 --- a/test/mainnet/liquity/liquity.helpers.ts +++ b/test/mainnet/liquity/liquity.helpers.ts @@ -1,343 +1,343 @@ -import hre from "hardhat"; -import { ethers } from "hardhat"; -import hardhatConfig from "../../../hardhat.config"; +// import hre from "hardhat"; +// import { ethers } from "hardhat"; +// import hardhatConfig from "../../../hardhat.config"; -// Instadapp deployment and testing helpers -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" -import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" -import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" +// // Instadapp deployment and testing helpers +// import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +// import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" +// import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +// import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -// Instadapp instadappAddresses/ABIs -import { instadappAddresses } from "../../../scripts/important/addresses"; -import { instadappAbi } from "../../../scripts/constant/abis"; +// // Instadapp instadappAddresses/ABIs +// import { instadappAddresses } from "../../../scripts/important/addresses"; +// import { instadappAbi } from "../../../scripts/constant/abis"; -// Instadapp Liquity Connector artifacts -import { ConnectV2Liquity__factory, ConnectV2Basic__factory } from "../../../typechain"; +// // Instadapp Liquity Connector artifacts +// import { ConnectV2Liquity__factory, ConnectV2Basic__factory } from "../../../typechain"; -// Instadapp uses a fake address to represent native ETH -import { constants } from "../../../scripts/constant/constant.js"; -import type { Signer, Contract } from "ethers"; +// // Instadapp uses a fake address to represent native ETH +// import { constants } from "../../../scripts/constant/constant.js"; +// import type { Signer, Contract } from "ethers"; -const LIQUITY_CONNECTOR = "LIQUITY-v1-TEST"; -const LUSD_GAS_COMPENSATION = hre.ethers.utils.parseUnits("200", 18); // 200 LUSD gas compensation repaid after loan repayment -const LIQUIDATABLE_TROVES_BLOCK_NUMBER = 12478159; // Deterministic block number for tests to run against, if you change this, tests will break. -const JUSTIN_SUN_ADDRESS = "0x903d12bf2c57a29f32365917c706ce0e1a84cce3"; // LQTY whale address -const LIQUIDATABLE_TROVE_ADDRESS = "0xafbeb4cb97f3b08ec2fe07ef0dac15d37013a347"; // Trove which is liquidatable at blockNumber: LIQUIDATABLE_TROVES_BLOCK_NUMBER -// const MAX_GAS = hardhatConfig.networks.hardhat.blockGasLimit; // Maximum gas limit (12000000) -const INSTADAPP_BASIC_V1_CONNECTOR = "Basic-v1"; +// const LIQUITY_CONNECTOR = "LIQUITY-v1-TEST"; +// const LUSD_GAS_COMPENSATION = hre.ethers.utils.parseUnits("200", 18); // 200 LUSD gas compensation repaid after loan repayment +// const LIQUIDATABLE_TROVES_BLOCK_NUMBER = 12478159; // Deterministic block number for tests to run against, if you change this, tests will break. +// const JUSTIN_SUN_ADDRESS = "0x903d12bf2c57a29f32365917c706ce0e1a84cce3"; // LQTY whale address +// const LIQUIDATABLE_TROVE_ADDRESS = "0xafbeb4cb97f3b08ec2fe07ef0dac15d37013a347"; // Trove which is liquidatable at blockNumber: LIQUIDATABLE_TROVES_BLOCK_NUMBER +// // const MAX_GAS = hardhatConfig.networks.hardhat.blockGasLimit; // Maximum gas limit (12000000) +// const INSTADAPP_BASIC_V1_CONNECTOR = "Basic-v1"; -const openTroveSpell = async ( - dsa: any, - signer: Signer, - depositAmount: any, - borrowAmount: any, - upperHint: any, - lowerHint: any, - maxFeePercentage: any -) => { - let address = await signer.getAddress(); +// const openTroveSpell = async ( +// dsa: any, +// signer: Signer, +// depositAmount: any, +// borrowAmount: any, +// upperHint: any, +// lowerHint: any, +// maxFeePercentage: any +// ) => { +// let address = await signer.getAddress(); - const openTroveSpell = { - connector: LIQUITY_CONNECTOR, - method: "open", - args: [ - depositAmount, - maxFeePercentage, - borrowAmount, - upperHint, - lowerHint, - [0, 0], - [0, 0], - ], - }; +// const openTroveSpell = { +// connector: LIQUITY_CONNECTOR, +// method: "open", +// args: [ +// depositAmount, +// maxFeePercentage, +// borrowAmount, +// upperHint, +// lowerHint, +// [0, 0], +// [0, 0], +// ], +// }; - return await dsa - .connect(signer) - .cast(...encodeSpells([openTroveSpell]), address, { - value: depositAmount, - }); -}; +// return await dsa +// .connect(signer) +// .cast(...encodeSpells([openTroveSpell]), address, { +// value: depositAmount, +// }); +// }; -const createDsaTrove = async ( - dsa: any, - signer: any, - liquity: any, - depositAmount = hre.ethers.utils.parseEther("5"), - borrowAmount = hre.ethers.utils.parseUnits("2000", 18) -) => { - const maxFeePercentage = hre.ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - const { upperHint, lowerHint } = await getTroveInsertionHints( - depositAmount, - borrowAmount, - liquity - ); - return await openTroveSpell( - dsa, - signer, - depositAmount, - borrowAmount, - upperHint, - lowerHint, - maxFeePercentage - ); -}; +// const createDsaTrove = async ( +// dsa: any, +// signer: any, +// liquity: any, +// depositAmount = hre.ethers.utils.parseEther("5"), +// borrowAmount = hre.ethers.utils.parseUnits("2000", 18) +// ) => { +// const maxFeePercentage = hre.ethers.utils.parseUnits("0.5", 18); // 0.5% max fee +// const { upperHint, lowerHint } = await getTroveInsertionHints( +// depositAmount, +// borrowAmount, +// liquity +// ); +// return await openTroveSpell( +// dsa, +// signer, +// depositAmount, +// borrowAmount, +// upperHint, +// lowerHint, +// maxFeePercentage +// ); +// }; -const sendToken = async (token: any, amount: any, from: any, to: any) => { - await hre.network.provider.request({ - method: "hardhat_impersonateAccount", - params: [from], - }); - const signer = hre.ethers.provider.getSigner(from); +// const sendToken = async (token: any, amount: any, from: any, to: any) => { +// await hre.network.provider.request({ +// method: "hardhat_impersonateAccount", +// params: [from], +// }); +// const signer = hre.ethers.provider.getSigner(from); - return await token.connect(signer).transfer(to, amount, { - gasPrice: 0, - }); -}; +// return await token.connect(signer).transfer(to, amount, { +// gasPrice: 0, +// }); +// }; -const resetInitialState = async (walletAddress: any, contracts: any, isDebug = false) => { - const liquity = await deployAndConnect(contracts, isDebug); - const dsa = await buildDSAv2(walletAddress); +// const resetInitialState = async (walletAddress: any, contracts: any, isDebug = false) => { +// const liquity = await deployAndConnect(contracts, isDebug); +// const dsa = await buildDSAv2(walletAddress); - return [liquity, dsa]; -}; +// return [liquity, dsa]; +// }; -const resetHardhatBlockNumber = async (blockNumber: number) => { - return await hre.network.provider.request({ - method: "hardhat_reset", - params: [ - { - forking: { - // @ts-ignore - jsonRpcUrl: hre.config.networks.hardhat.forking.url, - blockNumber, - }, - }, - ], - }); -}; +// const resetHardhatBlockNumber = async (blockNumber: number) => { +// return await hre.network.provider.request({ +// method: "hardhat_reset", +// params: [ +// { +// forking: { +// // @ts-ignore +// jsonRpcUrl: hre.config.networks.hardhat.forking.url, +// blockNumber, +// }, +// }, +// ], +// }); +// }; -const deployAndConnect = async (contracts: any, isDebug = false) => { - // Pin Liquity tests to a particular block number to create deterministic state (Ether price etc.) - await resetHardhatBlockNumber(LIQUIDATABLE_TROVES_BLOCK_NUMBER); - let liquity = { - troveManager: Contract, - borrowerOperations: null, - stabilityPool: null, - lusdToken: null, - lqtyToken: null, - activePool: null, - priceFeed: null, - hintHelpers: null, - sortedTroves: null, - staking: null, - collSurplus: null, - }; +// const deployAndConnect = async (contracts: any, isDebug = false) => { +// // Pin Liquity tests to a particular block number to create deterministic state (Ether price etc.) +// await resetHardhatBlockNumber(LIQUIDATABLE_TROVES_BLOCK_NUMBER); +// let liquity = { +// troveManager: Contract, +// borrowerOperations: null, +// stabilityPool: null, +// lusdToken: null, +// lqtyToken: null, +// activePool: null, +// priceFeed: null, +// hintHelpers: null, +// sortedTroves: null, +// staking: null, +// collSurplus: null, +// }; - const masterSigner = await getMasterSigner(); - const instaConnectorsV2 = await ethers.getContractAt( - instadappAbi.core.connectorsV2, - instadappAddresses.core.connectorsV2 - ); - const connector = await deployAndEnableConnector({ - connectorName: LIQUITY_CONNECTOR, - contractArtifact: ConnectV2Liquity__factory, - signer: masterSigner, - connectors: instaConnectorsV2, - }); - isDebug && - console.log(`${LIQUITY_CONNECTOR} Connector address`, connector.address); +// const masterSigner = await getMasterSigner(); +// const instaConnectorsV2 = await ethers.getContractAt( +// instadappAbi.core.connectorsV2, +// instadappAddresses.core.connectorsV2 +// ); +// const connector = await deployAndEnableConnector({ +// connectorName: LIQUITY_CONNECTOR, +// contractArtifact: ConnectV2Liquity__factory, +// signer: masterSigner, +// connectors: instaConnectorsV2, +// }); +// isDebug && +// console.log(`${LIQUITY_CONNECTOR} Connector address`, connector.address); - const basicConnector = await deployAndEnableConnector({ - connectorName: "Basic-v1", - contractArtifact: ConnectV2Basic__factory, - signer: masterSigner, - connectors: instaConnectorsV2, - }); - isDebug && console.log("Basic-v1 Connector address", basicConnector.address); +// const basicConnector = await deployAndEnableConnector({ +// connectorName: "Basic-v1", +// contractArtifact: ConnectV2Basic__factory, +// signer: masterSigner, +// connectors: instaConnectorsV2, +// }); +// isDebug && console.log("Basic-v1 Connector address", basicConnector.address); - liquity.troveManager = new ethers.Contract( - contracts.TROVE_MANAGER_ADDRESS, - contracts.TROVE_MANAGER_ABI, - ethers.provider - ); +// liquity.troveManager = new ethers.Contract( +// contracts.TROVE_MANAGER_ADDRESS, +// contracts.TROVE_MANAGER_ABI, +// ethers.provider +// ); - liquity.borrowerOperations = new ethers.Contract( - contracts.BORROWER_OPERATIONS_ADDRESS, - contracts.BORROWER_OPERATIONS_ABI, - ethers.provider - ); +// liquity.borrowerOperations = new ethers.Contract( +// contracts.BORROWER_OPERATIONS_ADDRESS, +// contracts.BORROWER_OPERATIONS_ABI, +// ethers.provider +// ); - liquity.stabilityPool = new ethers.Contract( - contracts.STABILITY_POOL_ADDRESS, - contracts.STABILITY_POOL_ABI, - ethers.provider - ); +// liquity.stabilityPool = new ethers.Contract( +// contracts.STABILITY_POOL_ADDRESS, +// contracts.STABILITY_POOL_ABI, +// ethers.provider +// ); - liquity.lusdToken = new ethers.Contract( - contracts.LUSD_TOKEN_ADDRESS, - contracts.LUSD_TOKEN_ABI, - ethers.provider - ); +// liquity.lusdToken = new ethers.Contract( +// contracts.LUSD_TOKEN_ADDRESS, +// contracts.LUSD_TOKEN_ABI, +// ethers.provider +// ); - liquity.lqtyToken = new ethers.Contract( - contracts.LQTY_TOKEN_ADDRESS, - contracts.LQTY_TOKEN_ABI, - ethers.provider - ); +// liquity.lqtyToken = new ethers.Contract( +// contracts.LQTY_TOKEN_ADDRESS, +// contracts.LQTY_TOKEN_ABI, +// ethers.provider +// ); - liquity.activePool = new ethers.Contract( - contracts.ACTIVE_POOL_ADDRESS, - contracts.ACTIVE_POOL_ABI, - ethers.provider - ); +// liquity.activePool = new ethers.Contract( +// contracts.ACTIVE_POOL_ADDRESS, +// contracts.ACTIVE_POOL_ABI, +// ethers.provider +// ); - liquity.priceFeed = new ethers.Contract( - contracts.PRICE_FEED_ADDRESS, - contracts.PRICE_FEED_ABI, - ethers.provider - ); +// liquity.priceFeed = new ethers.Contract( +// contracts.PRICE_FEED_ADDRESS, +// contracts.PRICE_FEED_ABI, +// ethers.provider +// ); - liquity.hintHelpers = new ethers.Contract( - contracts.HINT_HELPERS_ADDRESS, - contracts.HINT_HELPERS_ABI, - ethers.provider - ); +// liquity.hintHelpers = new ethers.Contract( +// contracts.HINT_HELPERS_ADDRESS, +// contracts.HINT_HELPERS_ABI, +// ethers.provider +// ); - liquity.sortedTroves = new ethers.Contract( - contracts.SORTED_TROVES_ADDRESS, - contracts.SORTED_TROVES_ABI, - ethers.provider - ); +// liquity.sortedTroves = new ethers.Contract( +// contracts.SORTED_TROVES_ADDRESS, +// contracts.SORTED_TROVES_ABI, +// ethers.provider +// ); - liquity.staking = new ethers.Contract( - contracts.STAKING_ADDRESS, - contracts.STAKING_ABI, - ethers.provider - ); - liquity.collSurplus = new ethers.Contract( - contracts.COLL_SURPLUS_ADDRESS, - contracts.COLL_SURPLUS_ABI, - ethers.provider - ); +// liquity.staking = new ethers.Contract( +// contracts.STAKING_ADDRESS, +// contracts.STAKING_ABI, +// ethers.provider +// ); +// liquity.collSurplus = new ethers.Contract( +// contracts.COLL_SURPLUS_ADDRESS, +// contracts.COLL_SURPLUS_ABI, +// ethers.provider +// ); - return liquity; -}; +// return liquity; +// }; -const getTroveInsertionHints = async (depositAmount, borrowAmount, liquity: any) => { - const nominalCR = await liquity.hintHelpers.computeNominalCR( - depositAmount, - borrowAmount - ); +// const getTroveInsertionHints = async (depositAmount, borrowAmount, liquity: any) => { +// const nominalCR = await liquity.hintHelpers.computeNominalCR( +// depositAmount, +// borrowAmount +// ); - const { - hintAddress, - latestRandomSeed, - } = await liquity.hintHelpers.getApproxHint(nominalCR, 50, 1298379, { - gasLimit: MAX_GAS, - }); - randomSeed = latestRandomSeed; +// const { +// hintAddress, +// latestRandomSeed, +// } = await liquity.hintHelpers.getApproxHint(nominalCR, 50, 1298379, { +// gasLimit: MAX_GAS, +// }); +// randomSeed = latestRandomSeed; - const { - 0: upperHint, - 1: lowerHint, - } = await liquity.sortedTroves.findInsertPosition( - nominalCR, - hintAddress, - hintAddress, - { - gasLimit: MAX_GAS, - } - ); +// const { +// 0: upperHint, +// 1: lowerHint, +// } = await liquity.sortedTroves.findInsertPosition( +// nominalCR, +// hintAddress, +// hintAddress, +// { +// gasLimit: MAX_GAS, +// } +// ); - return { - upperHint, - lowerHint, - }; -}; +// return { +// upperHint, +// lowerHint, +// }; +// }; -let randomSeed = 4223; +// let randomSeed = 4223; -const getRedemptionHints = async (amount, liquity) => { - const ethPrice = await liquity.priceFeed.callStatic.fetchPrice(); - const [ - firstRedemptionHint, - partialRedemptionHintNicr, - ] = await liquity.hintHelpers.getRedemptionHints(amount, ethPrice, 0); +// const getRedemptionHints = async (amount, liquity) => { +// const ethPrice = await liquity.priceFeed.callStatic.fetchPrice(); +// const [ +// firstRedemptionHint, +// partialRedemptionHintNicr, +// ] = await liquity.hintHelpers.getRedemptionHints(amount, ethPrice, 0); - const { - hintAddress, - latestRandomSeed, - } = await liquity.hintHelpers.getApproxHint( - partialRedemptionHintNicr, - 50, - randomSeed, - { - gasLimit: MAX_GAS, - } - ); - randomSeed = latestRandomSeed; +// const { +// hintAddress, +// latestRandomSeed, +// } = await liquity.hintHelpers.getApproxHint( +// partialRedemptionHintNicr, +// 50, +// randomSeed, +// { +// gasLimit: MAX_GAS, +// } +// ); +// randomSeed = latestRandomSeed; - const { - 0: upperHint, - 1: lowerHint, - } = await liquity.sortedTroves.findInsertPosition( - partialRedemptionHintNicr, - hintAddress, - hintAddress, - { - gasLimit: MAX_GAS, - } - ); +// const { +// 0: upperHint, +// 1: lowerHint, +// } = await liquity.sortedTroves.findInsertPosition( +// partialRedemptionHintNicr, +// hintAddress, +// hintAddress, +// { +// gasLimit: MAX_GAS, +// } +// ); - return { - partialRedemptionHintNicr, - firstRedemptionHint, - upperHint, - lowerHint, - }; -}; +// return { +// partialRedemptionHintNicr, +// firstRedemptionHint, +// upperHint, +// lowerHint, +// }; +// }; -const redeem = async (amount, from, wallet, liquity) => { - await sendToken(liquity.lusdToken, amount, from, wallet.address); - const { - partialRedemptionHintNicr, - firstRedemptionHint, - upperHint, - lowerHint, - } = await getRedemptionHints(amount, liquity); - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee +// const redeem = async (amount, from, wallet, liquity) => { +// await sendToken(liquity.lusdToken, amount, from, wallet.address); +// const { +// partialRedemptionHintNicr, +// firstRedemptionHint, +// upperHint, +// lowerHint, +// } = await getRedemptionHints(amount, liquity); +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - return await liquity.troveManager - .connect(wallet) - .redeemCollateral( - amount, - firstRedemptionHint, - upperHint, - lowerHint, - partialRedemptionHintNicr, - 0, - maxFeePercentage, - { - gasLimit: MAX_GAS, // permit max gas - } - ); -}; +// return await liquity.troveManager +// .connect(wallet) +// .redeemCollateral( +// amount, +// firstRedemptionHint, +// upperHint, +// lowerHint, +// partialRedemptionHintNicr, +// 0, +// maxFeePercentage, +// { +// gasLimit: MAX_GAS, // permit max gas +// } +// ); +// }; -module.exports = { - deployAndConnect, - resetInitialState, - createDsaTrove, - sendToken, - getTroveInsertionHints, - getRedemptionHints, - redeem, - LIQUITY_CONNECTOR, - LUSD_GAS_COMPENSATION, - JUSTIN_SUN_ADDRESS, - LIQUIDATABLE_TROVE_ADDRESS, - MAX_GAS, - INSTADAPP_BASIC_V1_CONNECTOR, - ETH_ADDRESS, -}; +// module.exports = { +// deployAndConnect, +// resetInitialState, +// createDsaTrove, +// sendToken, +// getTroveInsertionHints, +// getRedemptionHints, +// redeem, +// LIQUITY_CONNECTOR, +// LUSD_GAS_COMPENSATION, +// JUSTIN_SUN_ADDRESS, +// LIQUIDATABLE_TROVE_ADDRESS, +// MAX_GAS, +// INSTADAPP_BASIC_V1_CONNECTOR, +// ETH_ADDRESS, +// }; diff --git a/test/mainnet/liquity/liquity.test.ts b/test/mainnet/liquity/liquity.test.ts index fd5ccd69..151c1881 100644 --- a/test/mainnet/liquity/liquity.test.ts +++ b/test/mainnet/liquity/liquity.test.ts @@ -1,2719 +1,2719 @@ -import hre from "hardhat"; -import { expect } from "chai"; - -// Instadapp deployment and testing helpers -import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js"; - -// Liquity smart contracts -import contracts from "./liquity.contracts"; - -// Liquity helpers -import helpers from "./liquity.helpers"; - -describe("Liquity", () => { - const { waffle, ethers } = hre; - const { provider } = waffle; - - // Waffle test account 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 (holds 1000 ETH) - const userWallet = provider.getWallets()[0]; - let dsa = null; - let liquity = null; - - before(async () => { - await hre.network.provider.request({ - method: "hardhat_reset", - params: [ - { - forking: { - jsonRpcUrl: hre.config.networks.hardhat.forking.url, - blockNumber: 13300000, - }, - }, - ], - }); - liquity = await helpers.deployAndConnect(contracts, true); - expect(liquity.troveManager.address).to.exist; - expect(liquity.borrowerOperations.address).to.exist; - expect(liquity.stabilityPool.address).to.exist; - expect(liquity.lusdToken.address).to.exist; - expect(liquity.lqtyToken.address).to.exist; - expect(liquity.activePool.address).to.exist; - expect(liquity.priceFeed.address).to.exist; - expect(liquity.hintHelpers.address).to.exist; - expect(liquity.sortedTroves.address).to.exist; - expect(liquity.staking.address).to.exist; - }); - - beforeEach(async () => { - // Build a new DSA before each test so we start each test from the same default state - dsa = await buildDSAv2(userWallet.address); - expect(dsa.address).to.exist; - }); - - describe("Main (Connector)", () => { - describe("Trove", () => { - describe("open()", () => { - it("opens a Trove", async () => { - const depositAmount = ethers.utils.parseEther("5"); // 5 ETH - const borrowAmount = ethers.utils.parseUnits("2000", 18); // 2000 LUSD - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const originalUserBalance = await ethers.provider.getBalance( - userWallet.address - ); - const originalDsaBalance = await ethers.provider.getBalance( - dsa.address - ); - - const openTroveSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "open", - args: [ - depositAmount, - maxFeePercentage, - borrowAmount, - upperHint, - lowerHint, - [0, 0], - [0, 0], - ], - }; - - await dsa - .connect(userWallet) - .cast(...encodeSpells([openTroveSpell]), userWallet.address, { - value: depositAmount, - gasPrice: 0, - }); - - const userBalance = await ethers.provider.getBalance( - userWallet.address - ); - const dsaEthBalance = await ethers.provider.getBalance(dsa.address); - const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); - const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address - ); - - expect(userBalance).eq( - originalUserBalance.sub(depositAmount), - "User's Ether balance should decrease by the amount they deposited" - ); - - expect(dsaEthBalance).to.eq( - originalDsaBalance, - "User's DSA account Ether should not change after borrowing" - ); - - expect( - dsaLusdBalance, - "DSA account should now hold the amount the user borrowed" - ).to.eq(borrowAmount); - - expect(troveDebt).to.gt( - borrowAmount, - "Trove debt should equal the borrowed amount plus fee" - ); - - expect(troveCollateral).to.eq( - depositAmount, - "Trove collateral should equal the deposited amount" - ); - }); - - it("opens a Trove using ETH collected from a previous spell", async () => { - const depositAmount = ethers.utils.parseEther("5"); // 5 ETH - const borrowAmount = ethers.utils.parseUnits("2000", 18); // 2000 LUSD - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const originalUserBalance = await ethers.provider.getBalance( - userWallet.address - ); - const originalDsaBalance = await ethers.provider.getBalance( - dsa.address - ); - const depositId = 1; // Choose an ID to store and retrieve the deposited ETH - - const depositEthSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "deposit", - args: [helpers.ETH_ADDRESS, depositAmount, 0, depositId], - }; - - const openTroveSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "open", - args: [ - 0, // When pulling ETH from a previous spell it doesn't matter what deposit value we put in this param - maxFeePercentage, - borrowAmount, - upperHint, - lowerHint, - [depositId, 0], - [0, 0], - ], - }; - - const spells = [depositEthSpell, openTroveSpell]; - await dsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address, { - value: depositAmount, - gasPrice: 0, - }); - - const userBalance = await ethers.provider.getBalance( - userWallet.address - ); - const dsaEthBalance = await ethers.provider.getBalance(dsa.address); - const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); - const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address - ); - - expect(userBalance).eq( - originalUserBalance.sub(depositAmount), - "User's Ether balance should decrease by the amount they deposited" - ); - - expect(dsaEthBalance).to.eq( - originalDsaBalance, - "DSA balance should not change" - ); - - expect( - dsaLusdBalance, - "DSA account should now hold the amount the user borrowed" - ).to.eq(borrowAmount); - - expect(troveDebt).to.gt( - borrowAmount, - "Trove debt should equal the borrowed amount plus fee" - ); - - expect(troveCollateral).to.eq( - depositAmount, - "Trove collateral should equal the deposited amount" - ); - }); - - it("opens a Trove and stores the debt for other spells to use", async () => { - const depositAmount = ethers.utils.parseEther("5"); // 5 ETH - const borrowAmount = ethers.utils.parseUnits("2000", 18); // 2000 LUSD - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const originalUserBalance = await ethers.provider.getBalance( - userWallet.address - ); - const originalDsaBalance = await ethers.provider.getBalance( - dsa.address - ); - const borrowId = 1; - - const openTroveSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "open", - args: [ - depositAmount, - maxFeePercentage, - borrowAmount, - upperHint, - lowerHint, - [0, 0], - [borrowId, 0], - ], - }; - - const withdrawLusdSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "withdraw", - args: [ - contracts.LUSD_TOKEN_ADDRESS, - 0, // Amount comes from the previous spell's setId - dsa.address, - borrowId, - 0, - ], - }; - - const spells = [openTroveSpell, withdrawLusdSpell]; - await dsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address, { - value: depositAmount, - gasPrice: 0, - }); - - const userBalance = await ethers.provider.getBalance( - userWallet.address - ); - const dsaEthBalance = await ethers.provider.getBalance(dsa.address); - const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); - const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address - ); - - expect(userBalance).eq( - originalUserBalance.sub(depositAmount), - "User's Ether balance should decrease by the amount they deposited" - ); - - expect(dsaEthBalance).to.eq( - originalDsaBalance, - "User's DSA account Ether should not change after borrowing" - ); - - expect( - dsaLusdBalance, - "DSA account should now hold the amount the user borrowed" - ).to.eq(borrowAmount); - - expect(troveDebt).to.gt( - borrowAmount, - "Trove debt should equal the borrowed amount plus fee" - ); - - expect(troveCollateral).to.eq( - depositAmount, - "Trove collateral should equal the deposited amount" - ); - }); - - it("returns Instadapp event name and data", async () => { - const depositAmount = ethers.utils.parseEther("5"); - const borrowAmount = ethers.utils.parseUnits("2000", 18); - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - - const openTroveSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "open", - args: [ - depositAmount, - maxFeePercentage, - borrowAmount, - upperHint, - lowerHint, - [0, 0], - [0, 0], - ], - }; - - const openTx = await dsa.cast( - ...encodeSpells([openTroveSpell]), - userWallet.address, - { - value: depositAmount, - } - ); - const receipt = await openTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; - expect(castLogEvent.eventNames[0]).eq( - "LogOpen(address,uint256,uint256,uint256,uint256[],uint256[])" - ); - const expectedEventParams = ethers.utils.defaultAbiCoder.encode( - [ - "address", - "uint256", - "uint256", - "uint256", - "uint256[]", - "uint256[]", - ], - [ - dsa.address, - maxFeePercentage, - depositAmount, - borrowAmount, - [0, 0], - [0, 0], - ] - ); - expect(castLogEvent.eventParams[0]).eq(expectedEventParams); - }); - }); - - describe("close()", () => { - it("closes a Trove", async () => { - const depositAmount = ethers.utils.parseEther("5"); - const borrowAmount = ethers.utils.parseUnits("2000", 18); - // Create a dummy Trove - await helpers.createDsaTrove( - dsa, - userWallet, - liquity, - depositAmount, - borrowAmount - ); - - const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address - ); - - const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address - ); - - // Send DSA account enough LUSD (from Stability Pool) to close their Trove - const extraLusdRequiredToCloseTrove = troveDebtBefore.sub( - borrowAmount - ); - - await helpers.sendToken( - liquity.lusdToken, - extraLusdRequiredToCloseTrove, - contracts.STABILITY_POOL_ADDRESS, - dsa.address - ); - - const originalDsaLusdBalance = await liquity.lusdToken.balanceOf( - dsa.address - ); - - expect( - originalDsaLusdBalance, - "DSA account should now hold the LUSD amount required to pay off the Trove debt" - ).to.eq(troveDebtBefore); - - const closeTroveSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "close", - args: [0], - }; - - await dsa - .connect(userWallet) - .cast(...encodeSpells([closeTroveSpell]), userWallet.address); - - const dsaEthBalance = await ethers.provider.getBalance(dsa.address); - const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); - const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address - ); - - expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); - - expect( - troveCollateral, - "Trove collateral should equal 0 after close" - ).to.eq(0); - - expect( - dsaEthBalance, - "DSA account should now hold the Trove's ETH collateral" - ).to.eq(troveCollateralBefore); - - expect( - dsaLusdBalance, - "DSA account should now hold the gas compensation amount of LUSD as it paid off the Trove debt" - ).to.eq(helpers.LUSD_GAS_COMPENSATION); - }); - - it("closes a Trove using LUSD obtained from a previous spell", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address - ); - - // Send user enough LUSD to repay the loan, we'll use a deposit and withdraw spell to obtain it - await helpers.sendToken( - liquity.lusdToken, - troveDebtBefore, - contracts.STABILITY_POOL_ADDRESS, - userWallet.address - ); - - // Allow DSA to spend user's LUSD - await liquity.lusdToken - .connect(userWallet) - .approve(dsa.address, troveDebtBefore); - - // Simulate a spell which would have pulled LUSD from somewhere (e.g. Uniswap) into InstaMemory - // In this case we're simply running a deposit spell from the user's EOA - const depositLusdSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "deposit", - args: [contracts.LUSD_TOKEN_ADDRESS, troveDebtBefore, 0, 0], - }; - - const closeTroveSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "close", - args: [0], - }; - const spells = [depositLusdSpell, closeTroveSpell]; - - await dsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address); - - const dsaEthBalance = await ethers.provider.getBalance(dsa.address); - const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address - ); - - expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); - - expect( - troveCollateral, - "Trove collateral should equal 0 after close" - ).to.eq(0); - - expect( - dsaEthBalance, - "DSA account should now hold the Trove's ETH collateral" - ).to.eq(troveCollateralBefore); - }); - - it("closes a Trove and stores the released collateral for other spells to use", async () => { - const depositAmount = ethers.utils.parseEther("5"); - const borrowAmount = ethers.utils.parseUnits("2000", 18); - // Create a dummy Trove - await helpers.createDsaTrove( - dsa, - userWallet, - liquity, - depositAmount, - borrowAmount - ); - - const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address - ); - - // Send DSA account enough LUSD (from Stability Pool) to close their Trove - const extraLusdRequiredToCloseTrove = troveDebtBefore.sub( - borrowAmount - ); - await helpers.sendToken( - liquity.lusdToken, - extraLusdRequiredToCloseTrove, - contracts.STABILITY_POOL_ADDRESS, - dsa.address - ); - const originalDsaLusdBalance = await liquity.lusdToken.balanceOf( - dsa.address - ); - - expect( - originalDsaLusdBalance, - "DSA account should now hold the LUSD amount required to pay off the Trove debt" - ).to.eq(troveDebtBefore); - - const collateralWithdrawId = 1; - - const closeTroveSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "close", - args: [collateralWithdrawId], - }; - - const withdrawEthSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "withdraw", - args: [ - helpers.ETH_ADDRESS, - 0, // amount comes from the previous spell's setId - dsa.address, - collateralWithdrawId, - 0, - ], - }; - - await dsa - .connect(userWallet) - .cast( - ...encodeSpells([closeTroveSpell, withdrawEthSpell]), - userWallet.address - ); - - const dsaEthBalance = await ethers.provider.getBalance(dsa.address); - const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); - const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address - ); - - expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); - - expect( - troveCollateral, - "Trove collateral should equal 0 after close" - ).to.eq(0); - - expect( - dsaEthBalance, - "DSA account should now hold the Trove's ETH collateral" - ).to.eq(troveCollateralBefore); - - expect( - dsaLusdBalance, - "DSA account should now hold the gas compensation amount of LUSD as it paid off the Trove debt" - ).to.eq(helpers.LUSD_GAS_COMPENSATION); - }); - - it("returns Instadapp event name and data", async () => { - const depositAmount = ethers.utils.parseEther("5"); - const borrowAmount = ethers.utils.parseUnits("2000", 18); - // Create a dummy Trove - await helpers.createDsaTrove( - dsa, - userWallet, - liquity, - depositAmount, - borrowAmount - ); - await helpers.sendToken( - liquity.lusdToken, - ethers.utils.parseUnits("2500", 18), - contracts.STABILITY_POOL_ADDRESS, - dsa.address - ); - - const closeTroveSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "close", - args: [0], - }; - - const closeTx = await dsa - .connect(userWallet) - .cast(...encodeSpells([closeTroveSpell]), userWallet.address); - - const receipt = await closeTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; - const expectedEventParams = ethers.utils.defaultAbiCoder.encode( - ["address", "uint256"], - [dsa.address, 0] - ); - expect(castLogEvent.eventNames[0]).eq("LogClose(address,uint256)"); - expect(castLogEvent.eventParams[0]).eq(expectedEventParams); - }); - }); - - describe("deposit()", () => { - it("deposits ETH into a Trove", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address - ); - - const topupAmount = ethers.utils.parseEther("1"); - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const depositEthSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "deposit", - args: [topupAmount, upperHint, lowerHint, 0, 0], - }; - - await dsa - .connect(userWallet) - .cast(...encodeSpells([depositEthSpell]), userWallet.address, { - value: topupAmount, - }); - - const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address - ); - - const expectedTroveCollateral = troveCollateralBefore.add( - topupAmount - ); - - expect( - troveCollateral, - `Trove collateral should have increased by ${topupAmount} ETH` - ).to.eq(expectedTroveCollateral); - }); - - it("deposits using ETH gained from a previous spell", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address - ); - - const topupAmount = ethers.utils.parseEther("1"); - const depositId = 1; - const depositEthSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "deposit", - args: [helpers.ETH_ADDRESS, topupAmount, 0, depositId], - }; - - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const depositEthToTroveSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "deposit", - args: [0, upperHint, lowerHint, depositId, 0], - }; - const spells = [depositEthSpell, depositEthToTroveSpell]; - - await dsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address, { - value: topupAmount, - }); - - const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address - ); - - const expectedTroveCollateral = troveCollateralBefore.add( - topupAmount - ); - - expect( - troveCollateral, - `Trove collateral should have increased by ${topupAmount} ETH` - ).to.eq(expectedTroveCollateral); - }); - - it("returns Instadapp event name and data", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - const topupAmount = ethers.utils.parseEther("1"); - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const depositEthSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "deposit", - args: [topupAmount, upperHint, lowerHint, 0, 0], - }; - - const depositTx = await dsa - .connect(userWallet) - .cast(...encodeSpells([depositEthSpell]), userWallet.address, { - value: topupAmount, - }); - - const receipt = await depositTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; - const expectedEventParams = ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "uint256"], - [dsa.address, topupAmount, 0, 0] - ); - expect(castLogEvent.eventNames[0]).eq( - "LogDeposit(address,uint256,uint256,uint256)" - ); - expect(castLogEvent.eventParams[0]).eq(expectedEventParams); - }); - }); - - describe("withdraw()", () => { - it("withdraws ETH from a Trove", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address - ); - const withdrawAmount = ethers.utils.parseEther("1"); - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const withdrawEthSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "withdraw", - args: [withdrawAmount, upperHint, lowerHint, 0, 0], - }; - - await dsa - .connect(userWallet) - .cast(...encodeSpells([withdrawEthSpell]), userWallet.address); - - const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address - ); - const expectedTroveCollateral = troveCollateralBefore.sub( - withdrawAmount - ); - - expect( - troveCollateral, - `Trove collateral should have decreased by ${withdrawAmount} ETH` - ).to.eq(expectedTroveCollateral); - }); - - it("withdraws ETH from a Trove and stores the ETH for other spells to use", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address - ); - const originalUserEthBalance = await ethers.provider.getBalance( - userWallet.address - ); - - const withdrawAmount = ethers.utils.parseEther("1"); - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const withdrawId = 1; - const withdrawEthFromTroveSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "withdraw", - args: [withdrawAmount, upperHint, lowerHint, 0, withdrawId], - }; - - const withdrawEthSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "withdraw", - args: [helpers.ETH_ADDRESS, 0, userWallet.address, withdrawId, 0], - }; - const spells = [withdrawEthFromTroveSpell, withdrawEthSpell]; - await dsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address, { - gasPrice: 0, // Remove gas costs so we can check balances have changed correctly - }); - - const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address - ); - const expectedTroveCollateral = troveCollateralBefore.sub( - withdrawAmount - ); - const userEthBalance = await ethers.provider.getBalance( - userWallet.address - ); - - expect( - troveCollateral, - `Trove collateral should have decreased by ${withdrawAmount} ETH` - ).to.eq(expectedTroveCollateral); - - expect( - userEthBalance, - `User ETH balance should have increased by ${withdrawAmount} ETH` - ).to.eq(originalUserEthBalance.add(withdrawAmount)); - }); - - it("returns Instadapp event name and data", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - const withdrawAmount = ethers.utils.parseEther("1"); - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const withdrawEthSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "withdraw", - args: [withdrawAmount, upperHint, lowerHint, 0, 0], - }; - - const withdrawTx = await dsa - .connect(userWallet) - .cast(...encodeSpells([withdrawEthSpell]), userWallet.address); - - const receipt = await withdrawTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; - const expectedEventParams = ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "uint256"], - [dsa.address, withdrawAmount, 0, 0] - ); - expect(castLogEvent.eventNames[0]).eq( - "LogWithdraw(address,uint256,uint256,uint256)" - ); - expect(castLogEvent.eventParams[0]).eq(expectedEventParams); - }); - }); - - describe("borrow()", () => { - it("borrows LUSD from a Trove", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address - ); - - const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - const borrowSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "borrow", - args: [maxFeePercentage, borrowAmount, upperHint, lowerHint, 0, 0], - }; - - // Borrow more LUSD from the Trove - await dsa - .connect(userWallet) - .cast(...encodeSpells([borrowSpell]), userWallet.address); - - const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const expectedTroveDebt = troveDebtBefore.add(borrowAmount); - - expect( - troveDebt, - `Trove debt should have increased by at least ${borrowAmount} ETH` - ).to.gte(expectedTroveDebt); - }); - - it("borrows LUSD from a Trove and stores the LUSD for other spells to use", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address - ); - - const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - const borrowId = 1; - const borrowSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "borrow", - args: [ - maxFeePercentage, - borrowAmount, - upperHint, - lowerHint, - 0, - borrowId, - ], - }; - const withdrawSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "withdraw", - args: [ - liquity.lusdToken.address, - 0, - userWallet.address, - borrowId, - 0, - ], - }; - const spells = [borrowSpell, withdrawSpell]; - - // Borrow more LUSD from the Trove - await dsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address); - - const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const expectedTroveDebt = troveDebtBefore.add(borrowAmount); - const userLusdBalance = await liquity.lusdToken.balanceOf( - userWallet.address - ); - - expect( - troveDebt, - `Trove debt should have increased by at least ${borrowAmount} ETH` - ).to.gte(expectedTroveDebt); - - expect( - userLusdBalance, - `User LUSD balance should equal the borrowed LUSD due to the second withdraw spell` - ).eq(borrowAmount); - }); - - it("returns Instadapp event name and data", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - const borrowSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "borrow", - args: [maxFeePercentage, borrowAmount, upperHint, lowerHint, 0, 0], - }; - - const borrowTx = await dsa - .connect(userWallet) - .cast(...encodeSpells([borrowSpell]), userWallet.address); - - const receipt = await borrowTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; - const expectedEventParams = ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "uint256"], - [dsa.address, borrowAmount, 0, 0] - ); - expect(castLogEvent.eventNames[0]).eq( - "LogBorrow(address,uint256,uint256,uint256)" - ); - expect(castLogEvent.eventParams[0]).eq(expectedEventParams); - }); - }); - - describe("repay()", () => { - it("repays LUSD to a Trove", async () => { - const depositAmount = ethers.utils.parseEther("5"); - const borrowAmount = ethers.utils.parseUnits("2500", 18); - - // Create a dummy Trove - await helpers.createDsaTrove( - dsa, - userWallet, - liquity, - depositAmount, - borrowAmount - ); - - const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address - ); - // DSA account is holding 2500 LUSD from opening a Trove, so we use some of that to repay - const repayAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD - - const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( - depositAmount, - borrowAmount, - liquity - ); - const repaySpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "repay", - args: [repayAmount, upperHint, lowerHint, 0, 0], - }; - - await dsa - .connect(userWallet) - .cast(...encodeSpells([repaySpell]), userWallet.address); - - const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const expectedTroveDebt = troveDebtBefore.sub(repayAmount); - - expect( - troveDebt, - `Trove debt should have decreased by ${repayAmount} ETH` - ).to.eq(expectedTroveDebt); - }); - - it("repays LUSD to a Trove using LUSD collected from a previous spell", async () => { - const depositAmount = ethers.utils.parseEther("5"); - const borrowAmount = ethers.utils.parseUnits("2500", 18); - - // Create a dummy Trove - await helpers.createDsaTrove( - dsa, - userWallet, - liquity, - depositAmount, - borrowAmount - ); - - const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address - ); - - const repayAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD - const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( - depositAmount, - borrowAmount, - liquity - ); - - // Drain the DSA's LUSD balance so that we ensure we are repaying using LUSD from a previous spell - await helpers.sendToken( - liquity.lusdToken, - borrowAmount, - dsa.address, - userWallet.address - ); - - // Allow DSA to spend user's LUSD - await liquity.lusdToken - .connect(userWallet) - .approve(dsa.address, repayAmount); - - const lusdDepositId = 1; - const depositSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "deposit", - args: [liquity.lusdToken.address, repayAmount, 0, lusdDepositId], - }; - const borrowSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "repay", - args: [0, upperHint, lowerHint, lusdDepositId, 0], - }; - - const spells = [depositSpell, borrowSpell]; - - await dsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address); - - const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const expectedTroveDebt = troveDebtBefore.sub(repayAmount); - - expect( - troveDebt, - `Trove debt should have decreased by ${repayAmount} ETH` - ).to.eq(expectedTroveDebt); - }); - - it("returns Instadapp event name and data", async () => { - // Create a dummy Trove - const depositAmount = ethers.utils.parseEther("5"); - const borrowAmount = ethers.utils.parseUnits("2500", 18); - await helpers.createDsaTrove( - dsa, - userWallet, - liquity, - depositAmount, - borrowAmount - ); - - const repayAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD - const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( - depositAmount, - borrowAmount, - liquity - ); - - const borrowSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "repay", - args: [repayAmount, upperHint, lowerHint, 0, 0], - }; - - const repayTx = await dsa - .connect(userWallet) - .cast(...encodeSpells([borrowSpell]), userWallet.address, { - value: repayAmount, - }); - - const receipt = await repayTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; - const expectedEventParams = ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "uint256"], - [dsa.address, repayAmount, 0, 0] - ); - expect(castLogEvent.eventNames[0]).eq( - "LogRepay(address,uint256,uint256,uint256)" - ); - expect(castLogEvent.eventParams[0]).eq(expectedEventParams); - }); - }); - - describe("adjust()", () => { - it("adjusts a Trove: deposit ETH and borrow LUSD", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address - ); - const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const depositAmount = ethers.utils.parseEther("1"); // 1 ETH - const borrowAmount = ethers.utils.parseUnits("500", 18); // 500 LUSD - const withdrawAmount = 0; - const repayAmount = 0; - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - - const adjustSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "adjust", - args: [ - maxFeePercentage, - depositAmount, - withdrawAmount, - borrowAmount, - repayAmount, - upperHint, - lowerHint, - [0, 0, 0, 0], - [0, 0, 0, 0], - ], - }; - - // Adjust Trove by depositing ETH and borrowing LUSD - await dsa - .connect(userWallet) - .cast(...encodeSpells([adjustSpell]), userWallet.address, { - value: depositAmount, - gasLimit: helpers.MAX_GAS, - }); - - const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address - ); - const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const expectedTroveColl = troveCollateralBefore.add(depositAmount); - const expectedTroveDebt = troveDebtBefore.add(borrowAmount); - - expect( - troveCollateral, - `Trove collateral should have increased by ${depositAmount} ETH` - ).to.eq(expectedTroveColl); - - expect( - troveDebt, - `Trove debt should have increased by at least ${borrowAmount} ETH` - ).to.gte(expectedTroveDebt); - }); - - it("adjusts a Trove: withdraw ETH and repay LUSD", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address - ); - const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const depositAmount = 0; - const borrowAmount = 0; - const withdrawAmount = ethers.utils.parseEther("1"); // 1 ETH; - const repayAmount = ethers.utils.parseUnits("10", 18); // 10 LUSD; - const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( - troveCollateralBefore.sub(withdrawAmount), - troveDebtBefore.sub(repayAmount), - liquity - ); - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - - const adjustSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "adjust", - args: [ - maxFeePercentage, - depositAmount, - withdrawAmount, - borrowAmount, - repayAmount, - upperHint, - lowerHint, - [0, 0, 0, 0], - [0, 0, 0, 0], - ], - }; - - // Adjust Trove by withdrawing ETH and repaying LUSD - await dsa - .connect(userWallet) - .cast(...encodeSpells([adjustSpell]), userWallet.address, { - value: depositAmount, - gasLimit: helpers.MAX_GAS, - }); - - const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address - ); - const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const expectedTroveColl = troveCollateralBefore.sub(withdrawAmount); - const expectedTroveDebt = troveDebtBefore.sub(repayAmount); - - expect( - troveCollateral, - `Trove collateral should have increased by ${depositAmount} ETH` - ).to.eq(expectedTroveColl); - - expect( - troveDebt, - `Trove debt should have decreased by at least ${repayAmount} LUSD` - ).to.gte(expectedTroveDebt); - }); - - it("adjusts a Trove: deposit ETH and repay LUSD using previous spells", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address - ); - const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const depositAmount = ethers.utils.parseEther("1"); // 1 ETH - const borrowAmount = 0; - const withdrawAmount = 0; - const repayAmount = ethers.utils.parseUnits("10", 18); // 10 lUSD - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - - const ethDepositId = 1; - const lusdRepayId = 2; - - const depositEthSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "deposit", - args: [helpers.ETH_ADDRESS, depositAmount, 0, ethDepositId], - }; - - const depositLusdSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "deposit", - args: [liquity.lusdToken.address, repayAmount, 0, lusdRepayId], - }; - - const adjustSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "adjust", - args: [ - maxFeePercentage, - 0, // Deposit amount comes from a previous spell's storage slot - withdrawAmount, - borrowAmount, - 0, // Repay amount comes from a previous spell's storage slot - upperHint, - lowerHint, - [ethDepositId, 0, 0, lusdRepayId], - [0, 0, 0, 0], - ], - }; - const spells = [depositEthSpell, depositLusdSpell, adjustSpell]; - - // Send user some LUSD so they can repay - await helpers.sendToken( - liquity.lusdToken, - repayAmount, - helpers.JUSTIN_SUN_ADDRESS, - userWallet.address - ); - - // Allow DSA to spend user's LUSD - await liquity.lusdToken - .connect(userWallet) - .approve(dsa.address, repayAmount); - - // Adjust Trove by depositing ETH and repaying LUSD - await dsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address, { - value: depositAmount, - gasLimit: helpers.MAX_GAS, - }); - - const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address - ); - const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address - ); - const expectedTroveColl = troveCollateralBefore.add(depositAmount); - const expectedTroveDebt = troveDebtBefore.sub(repayAmount); - - expect( - troveCollateral, - `Trove collateral should have increased by ${depositAmount} ETH` - ).to.eq(expectedTroveColl); - - expect( - troveDebt, - `Trove debt (${troveDebtBefore}) should have decreased by at least ${repayAmount} LUSD` - ).to.eq(expectedTroveDebt); - }); - - it("adjusts a Trove: withdraw ETH, borrow LUSD, and store the amounts for other spells", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - const userEthBalanceBefore = await ethers.provider.getBalance( - userWallet.address - ); - const userLusdBalanceBefore = await liquity.lusdToken.balanceOf( - userWallet.address - ); - - const depositAmount = 0; - const borrowAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD - const withdrawAmount = ethers.utils.parseEther("1"); // 1 ETH - const repayAmount = 0; - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - - const ethWithdrawId = 1; - const lusdBorrowId = 2; - - const adjustSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "adjust", - args: [ - maxFeePercentage, - depositAmount, - withdrawAmount, - borrowAmount, - repayAmount, - upperHint, - lowerHint, - [0, 0, 0, 0], - [0, ethWithdrawId, lusdBorrowId, 0], - ], - }; - - const withdrawEthSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "withdraw", - args: [ - helpers.ETH_ADDRESS, - 0, - userWallet.address, - ethWithdrawId, - 0, - ], - }; - - const withdrawLusdSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "withdraw", - args: [ - liquity.lusdToken.address, - 0, - userWallet.address, - lusdBorrowId, - 0, - ], - }; - - const spells = [adjustSpell, withdrawEthSpell, withdrawLusdSpell]; - - // Adjust Trove by withdrawing ETH and borrowing LUSD - await dsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address, { - gasLimit: helpers.MAX_GAS, - gasPrice: 0, - }); - - const userEthBalanceAfter = await ethers.provider.getBalance( - userWallet.address - ); - const userLusdBalanceAfter = await liquity.lusdToken.balanceOf( - userWallet.address - ); - expect(userEthBalanceAfter).eq( - userEthBalanceBefore.add(withdrawAmount) - ); - expect(userLusdBalanceAfter).eq( - userLusdBalanceBefore.add(borrowAmount) - ); - }); - - it("returns Instadapp event name and data", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - const depositAmount = ethers.utils.parseEther("1"); // 1 ETH - const borrowAmount = ethers.utils.parseUnits("500", 18); // 500 LUSD - const withdrawAmount = 0; - const repayAmount = 0; - const upperHint = ethers.constants.AddressZero; - const lowerHint = ethers.constants.AddressZero; - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - - const adjustSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "adjust", - args: [ - maxFeePercentage, - depositAmount, - withdrawAmount, - borrowAmount, - repayAmount, - upperHint, - lowerHint, - [0, 0, 0, 0], - [0, 0, 0, 0], - ], - }; - - const adjustTx = await dsa - .connect(userWallet) - .cast(...encodeSpells([adjustSpell]), userWallet.address, { - value: depositAmount, - gasLimit: helpers.MAX_GAS, - }); - - const receipt = await adjustTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; - const expectedEventParams = ethers.utils.defaultAbiCoder.encode( - [ - "address", - "uint256", - "uint256", - "uint256", - "uint256", - "uint256", - "uint256[]", - "uint256[]", - ], - [ - dsa.address, - maxFeePercentage, - depositAmount, - withdrawAmount, - borrowAmount, - repayAmount, - [0, 0, 0, 0], - [0, 0, 0, 0], - ] - ); - expect(castLogEvent.eventNames[0]).eq( - "LogAdjust(address,uint256,uint256,uint256,uint256,uint256,uint256[],uint256[])" - ); - expect(castLogEvent.eventParams[0]).eq(expectedEventParams); - }); - }); - - describe("claimCollateralFromRedemption()", () => { - it("claims collateral from a redeemed Trove", async () => { - // Create a low collateralized Trove - const depositAmount = ethers.utils.parseEther("1.5"); - const borrowAmount = ethers.utils.parseUnits("2500", 18); - - await helpers.createDsaTrove( - dsa, - userWallet, - liquity, - depositAmount, - borrowAmount - ); - - // Redeem lots of LUSD to cause the Trove to become redeemed - const redeemAmount = ethers.utils.parseUnits("10000000", 18); - await helpers.sendToken( - liquity.lusdToken, - redeemAmount, - contracts.STABILITY_POOL_ADDRESS, - userWallet.address - ); - const { - partialRedemptionHintNicr, - firstRedemptionHint, - upperHint, - lowerHint, - } = await helpers.getRedemptionHints(redeemAmount, liquity); - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - - await liquity.troveManager - .connect(userWallet) - .redeemCollateral( - redeemAmount, - firstRedemptionHint, - upperHint, - lowerHint, - partialRedemptionHintNicr, - 0, - maxFeePercentage, - { - gasLimit: helpers.MAX_GAS, // permit max gas - } - ); - - const remainingEthCollateral = await liquity.collSurplus.getCollateral( - dsa.address - ); - - // Claim the remaining collateral from the redeemed Trove - const claimCollateralFromRedemptionSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "claimCollateralFromRedemption", - args: [0], - }; - - await dsa - .connect(userWallet) - .cast( - ...encodeSpells([claimCollateralFromRedemptionSpell]), - userWallet.address - ); - - const ethBalance = await ethers.provider.getBalance(dsa.address); - - expect(ethBalance).to.eq(remainingEthCollateral); - }); - - it("returns Instadapp event name and data", async () => { - // Create a low collateralized Trove - const depositAmount = ethers.utils.parseEther("1.5"); - const borrowAmount = ethers.utils.parseUnits("2500", 18); - - await helpers.createDsaTrove( - dsa, - userWallet, - liquity, - depositAmount, - borrowAmount - ); - - // Redeem lots of LUSD to cause the Trove to become redeemed - const redeemAmount = ethers.utils.parseUnits("10000000", 18); - const setId = 0; - await helpers.sendToken( - liquity.lusdToken, - redeemAmount, - contracts.STABILITY_POOL_ADDRESS, - userWallet.address - ); - const { - partialRedemptionHintNicr, - firstRedemptionHint, - upperHint, - lowerHint, - } = await helpers.getRedemptionHints(redeemAmount, liquity); - const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - - await liquity.troveManager - .connect(userWallet) - .redeemCollateral( - redeemAmount, - firstRedemptionHint, - upperHint, - lowerHint, - partialRedemptionHintNicr, - 0, - maxFeePercentage, - { - gasLimit: helpers.MAX_GAS, // permit max gas - } - ); - const claimAmount = await liquity.collSurplus.getCollateral( - dsa.address - ); - - const claimCollateralFromRedemptionSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "claimCollateralFromRedemption", - args: [setId], - }; - - const claimTx = await dsa - .connect(userWallet) - .cast( - ...encodeSpells([claimCollateralFromRedemptionSpell]), - userWallet.address - ); - - const receipt = await claimTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; - const expectedEventParams = ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256"], - [dsa.address, claimAmount, setId] - ); - expect(castLogEvent.eventNames[0]).eq( - "LogClaimCollateralFromRedemption(address,uint256,uint256)" - ); - expect(castLogEvent.eventParams[0]).eq(expectedEventParams); - }); - }); - }); - - describe("Stability Pool", () => { - describe("stabilityDeposit()", () => { - it("deposits into Stability Pool", async () => { - const amount = ethers.utils.parseUnits("100", 18); - const frontendTag = ethers.constants.AddressZero; - - await helpers.sendToken( - liquity.lusdToken, - amount, - contracts.STABILITY_POOL_ADDRESS, - dsa.address - ); - - const stabilityDepositSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stabilityDeposit", - args: [amount, frontendTag, 0, 0, 0, 0], - }; - - await dsa - .connect(userWallet) - .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - - const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( - dsa.address - ); - expect(depositedAmount).to.eq(amount); - }); - - it("deposits into Stability Pool using LUSD collected from a previous spell", async () => { - const amount = ethers.utils.parseUnits("100", 18); - const frontendTag = ethers.constants.AddressZero; - - await helpers.sendToken( - liquity.lusdToken, - amount, - contracts.STABILITY_POOL_ADDRESS, - userWallet.address - ); - const lusdDepositId = 1; - - const depositLusdSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "deposit", - args: [liquity.lusdToken.address, amount, 0, lusdDepositId], - }; - const stabilityDepositSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stabilityDeposit", - args: [0, frontendTag, lusdDepositId, 0, 0, 0], - }; - const spells = [depositLusdSpell, stabilityDepositSpell]; - - // Allow DSA to spend user's LUSD - await liquity.lusdToken - .connect(userWallet) - .approve(dsa.address, amount); - - await dsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address); - - const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( - dsa.address - ); - expect(depositedAmount).to.eq(amount); - }); - - it("returns Instadapp event name and data", async () => { - const amount = ethers.utils.parseUnits("100", 18); - const halfAmount = amount.div(2); - const frontendTag = ethers.constants.AddressZero; - const getDepositId = 0; - const setDepositId = 0; - const setEthGainId = 0; - const setLqtyGainId = 0; - - await helpers.sendToken( - liquity.lusdToken, - amount, - contracts.STABILITY_POOL_ADDRESS, - dsa.address - ); - - const stabilityDepositSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stabilityDeposit", - args: [ - halfAmount, - frontendTag, - getDepositId, - setDepositId, - setEthGainId, - setLqtyGainId, - ], - }; - - // Create a Stability deposit for this DSA - await dsa - .connect(userWallet) - .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - - // Liquidate a Trove to cause an ETH gain - await liquity.troveManager.connect(userWallet).liquidateTroves(1, { - gasLimit: helpers.MAX_GAS, - }); - - // Fast forward in time so we have an LQTY gain - await provider.send("evm_increaseTime", [600]); - await provider.send("evm_mine"); - - // Create a Stability Pool deposit with a differen DSA so that LQTY gains can be calculated - // See: https://github.com/liquity/dev/#lqty-reward-events-and-payouts - const tempDsa = await buildDSAv2(userWallet.address); - await helpers.sendToken( - liquity.lusdToken, - amount, - contracts.STABILITY_POOL_ADDRESS, - tempDsa.address - ); - await tempDsa - .connect(userWallet) - .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - - const ethGain = await liquity.stabilityPool.getDepositorETHGain( - dsa.address - ); - const lqtyGain = await liquity.stabilityPool.getDepositorLQTYGain( - dsa.address - ); - - // Top up the user's deposit so that we can track their ETH and LQTY gain - const depositAgainTx = await dsa - .connect(userWallet) - .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - - const receipt = await depositAgainTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; - const expectedEventParams = ethers.utils.defaultAbiCoder.encode( - [ - "address", - "uint256", - "uint256", - "uint256", - "address", - "uint256", - "uint256", - "uint256", - "uint256", - ], - [ - dsa.address, - halfAmount, - ethGain, - lqtyGain, - frontendTag, - getDepositId, - setDepositId, - setEthGainId, - setLqtyGainId, - ] - ); - expect(castLogEvent.eventNames[0]).eq( - "LogStabilityDeposit(address,uint256,uint256,uint256,address,uint256,uint256,uint256,uint256)" - ); - expect(castLogEvent.eventParams[0]).eq(expectedEventParams); - }); - }); - - describe("stabilityWithdraw()", () => { - it("withdraws from Stability Pool", async () => { - // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool - [liquity, dsa] = await helpers.resetInitialState( - userWallet.address, - contracts - ); - - // The current block number has liquidatable Troves. - // Remove them otherwise Stability Pool withdrawals are disabled - await liquity.troveManager.connect(userWallet).liquidateTroves(90, { - gasLimit: helpers.MAX_GAS, - }); - - const amount = ethers.utils.parseUnits("100", 18); - const frontendTag = ethers.constants.AddressZero; - - await helpers.sendToken( - liquity.lusdToken, - amount, - contracts.STABILITY_POOL_ADDRESS, - dsa.address - ); - - const stabilityDepositSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stabilityDeposit", - args: [amount, frontendTag, 0, 0, 0, 0], - }; - - // Withdraw half of the deposit - const stabilityWithdrawSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stabilityWithdraw", - args: [amount.div(2), 0, 0, 0, 0], - }; - const spells = [stabilityDepositSpell, stabilityWithdrawSpell]; - - await dsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address); - - const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( - dsa.address - ); - const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); - - expect(depositedAmount).to.eq(amount.div(2)); - expect(dsaLusdBalance).to.eq(amount.div(2)); - }); - - it("withdraws from Stability Pool and stores the LUSD for other spells", async () => { - // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool - [liquity, dsa] = await helpers.resetInitialState( - userWallet.address, - contracts - ); - - // The current block number has liquidatable Troves. - // Remove them otherwise Stability Pool withdrawals are disabled - await liquity.troveManager.connect(userWallet).liquidateTroves(90, { - gasLimit: helpers.MAX_GAS, - }); - const amount = ethers.utils.parseUnits("100", 18); - const frontendTag = ethers.constants.AddressZero; - const withdrawId = 1; - - await helpers.sendToken( - liquity.lusdToken, - amount, - contracts.STABILITY_POOL_ADDRESS, - dsa.address - ); - - const stabilityDepositSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stabilityDeposit", - args: [amount, frontendTag, 0, 0, 0, 0], - }; - - // Withdraw half of the deposit - const stabilityWithdrawSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stabilityWithdraw", - args: [amount.div(2), 0, 0, 0, withdrawId], - }; - - const withdrawLusdSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "withdraw", - args: [ - liquity.lusdToken.address, - 0, - userWallet.address, - withdrawId, - 0, - ], - }; - - const spells = [ - stabilityDepositSpell, - stabilityWithdrawSpell, - withdrawLusdSpell, - ]; - - await dsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address); - - const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( - dsa.address - ); - const walletLusdBalance = await liquity.lusdToken.balanceOf( - dsa.address - ); - - expect(depositedAmount).to.eq(amount.div(2)); - expect(walletLusdBalance).to.eq(amount.div(2)); - }); - - it("returns Instadapp event name and data", async () => { - // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool - [liquity, dsa] = await helpers.resetInitialState( - userWallet.address, - contracts - ); - - const amount = ethers.utils.parseUnits("100", 18); - const frontendTag = ethers.constants.AddressZero; - - await helpers.sendToken( - liquity.lusdToken, - amount, - contracts.STABILITY_POOL_ADDRESS, - dsa.address - ); - - const stabilityDepositSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stabilityDeposit", - args: [amount, frontendTag, 0, 0, 0, 0], - }; - - // Withdraw half of the deposit - const withdrawAmount = amount.div(2); - const getWithdrawId = 0; - const setWithdrawId = 0; - const setEthGainId = 0; - const setLqtyGainId = 0; - - // Create a Stability Pool deposit - await dsa - .connect(userWallet) - .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - - // The current block number has liquidatable Troves. - // Remove them otherwise Stability Pool withdrawals are disabled - await liquity.troveManager.connect(userWallet).liquidateTroves(90, { - gasLimit: helpers.MAX_GAS, - }); - - // Fast forward in time so we have an LQTY gain - await provider.send("evm_increaseTime", [600]); - await provider.send("evm_mine"); - - // Create another Stability Pool deposit so that LQTY gains are realized - // See: https://github.com/liquity/dev/#lqty-reward-events-and-payouts - const tempDsa = await buildDSAv2(userWallet.address); - await helpers.sendToken( - liquity.lusdToken, - amount, - contracts.STABILITY_POOL_ADDRESS, - tempDsa.address - ); - await tempDsa - .connect(userWallet) - .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - - const ethGain = await liquity.stabilityPool.getDepositorETHGain( - dsa.address - ); - const lqtyGain = await liquity.stabilityPool.getDepositorLQTYGain( - dsa.address - ); - - const stabilityWithdrawSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stabilityWithdraw", - args: [ - withdrawAmount, - getWithdrawId, - setWithdrawId, - setEthGainId, - setLqtyGainId, - ], - }; - - const withdrawTx = await dsa - .connect(userWallet) - .cast( - ...encodeSpells([stabilityWithdrawSpell]), - userWallet.address - ); - - const receipt = await withdrawTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; - const expectedEventParams = ethers.utils.defaultAbiCoder.encode( - [ - "address", - "uint256", - "uint256", - "uint256", - "uint256", - "uint256", - "uint256", - "uint256", - ], - [ - dsa.address, - withdrawAmount, - ethGain, - lqtyGain, - getWithdrawId, - setWithdrawId, - setEthGainId, - setLqtyGainId, - ] - ); - expect(castLogEvent.eventNames[0]).eq( - "LogStabilityWithdraw(address,uint256,uint256,uint256,uint256,uint256,uint256,uint256)" - ); - expect(castLogEvent.eventParams[0]).eq(expectedEventParams); - }); - }); - - describe("stabilityMoveEthGainToTrove()", () => { - beforeEach(async () => { - // Start these test from fresh so that we definitely have a liquidatable Trove within this block - [liquity, dsa] = await helpers.resetInitialState( - userWallet.address, - contracts - ); - }); - - it("moves ETH gain from Stability Pool to Trove", async () => { - // Create a DSA owned Trove to capture ETH liquidation gains - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address - ); - - // Create a Stability Deposit using the Trove's borrowed LUSD - const amount = ethers.utils.parseUnits("100", 18); - const frontendTag = ethers.constants.AddressZero; - const stabilityDepositSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stabilityDeposit", - args: [amount, frontendTag, 0, 0, 0, 0], - }; - - await dsa - .connect(userWallet) - .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - - // Liquidate a Trove to create an ETH gain for the new DSA Trove - await liquity.troveManager - .connect(userWallet) - .liquidate(helpers.LIQUIDATABLE_TROVE_ADDRESS, { - gasLimit: helpers.MAX_GAS, // permit max gas - }); - - const ethGainFromLiquidation = await liquity.stabilityPool.getDepositorETHGain( - dsa.address - ); - - // Move ETH gain to Trove - const moveEthGainSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stabilityMoveEthGainToTrove", - args: [ethers.constants.AddressZero, ethers.constants.AddressZero], - }; - - await dsa - .connect(userWallet) - .cast(...encodeSpells([moveEthGainSpell]), userWallet.address); - - const ethGainAfterMove = await liquity.stabilityPool.getDepositorETHGain( - dsa.address - ); - const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address - ); - const expectedTroveCollateral = troveCollateralBefore.add( - ethGainFromLiquidation - ); - expect(ethGainAfterMove).to.eq(0); - expect(troveCollateral).to.eq(expectedTroveCollateral); - }); - - it("returns Instadapp event name and data", async () => { - // Create a DSA owned Trove to capture ETH liquidation gains - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); - - // Create a Stability Deposit using the Trove's borrowed LUSD - const amount = ethers.utils.parseUnits("100", 18); - const frontendTag = ethers.constants.AddressZero; - const stabilityDepositSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stabilityDeposit", - args: [amount, frontendTag, 0, 0, 0, 0], - }; - - await dsa - .connect(userWallet) - .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - - // Liquidate a Trove to create an ETH gain for the new DSA Trove - await liquity.troveManager - .connect(userWallet) - .liquidate(helpers.LIQUIDATABLE_TROVE_ADDRESS, { - gasLimit: helpers.MAX_GAS, // permit max gas - }); - - const ethGainFromLiquidation = await liquity.stabilityPool.getDepositorETHGain( - dsa.address - ); - - // Move ETH gain to Trove - const moveEthGainSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stabilityMoveEthGainToTrove", - args: [ethers.constants.AddressZero, ethers.constants.AddressZero], - }; - - const moveEthGainTx = await dsa - .connect(userWallet) - .cast(...encodeSpells([moveEthGainSpell]), userWallet.address); - - const receipt = await moveEthGainTx.wait(); - - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; - const expectedEventParams = ethers.utils.defaultAbiCoder.encode( - ["address", "uint256"], - [dsa.address, ethGainFromLiquidation] - ); - expect(castLogEvent.eventNames[0]).eq( - "LogStabilityMoveEthGainToTrove(address,uint256)" - ); - expect(castLogEvent.eventParams[0]).eq(expectedEventParams); - }); - }); - }); - - describe("Staking", () => { - describe("stake()", () => { - it("stakes LQTY", async () => { - const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( - contracts.STAKING_ADDRESS - ); - - const amount = ethers.utils.parseUnits("1", 18); - await helpers.sendToken( - liquity.lqtyToken, - amount, - helpers.JUSTIN_SUN_ADDRESS, - dsa.address - ); - - const stakeSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stake", - args: [amount, 0, 0, 0, 0], - }; - - await dsa - .connect(userWallet) - .cast(...encodeSpells([stakeSpell]), userWallet.address); - - const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); - expect(lqtyBalance).to.eq(0); - - const totalStakingBalance = await liquity.lqtyToken.balanceOf( - contracts.STAKING_ADDRESS - ); - expect(totalStakingBalance).to.eq( - totalStakingBalanceBefore.add(amount) - ); - }); - - it("stakes LQTY using LQTY obtained from a previous spell", async () => { - const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( - contracts.STAKING_ADDRESS - ); - - const amount = ethers.utils.parseUnits("1", 18); - await helpers.sendToken( - liquity.lqtyToken, - amount, - helpers.JUSTIN_SUN_ADDRESS, - userWallet.address - ); - - const lqtyDepositId = 1; - const depositSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "deposit", - args: [liquity.lqtyToken.address, amount, 0, lqtyDepositId], - }; - const stakeSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stake", - args: [0, lqtyDepositId, 0, 0, 0], - }; - const spells = [depositSpell, stakeSpell]; - - // Allow DSA to spend user's LQTY - await liquity.lqtyToken - .connect(userWallet) - .approve(dsa.address, amount); - - await dsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address); - - const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); - expect(lqtyBalance).to.eq(0); - - const totalStakingBalance = await liquity.lqtyToken.balanceOf( - contracts.STAKING_ADDRESS - ); - expect(totalStakingBalance).to.eq( - totalStakingBalanceBefore.add(amount) - ); - }); - - it("returns Instadapp event name and data", async () => { - const amount = ethers.utils.parseUnits("1", 18); - await helpers.sendToken( - liquity.lqtyToken, - amount, - helpers.JUSTIN_SUN_ADDRESS, - dsa.address - ); - - const getStakeId = 0; - const setStakeId = 0; - const setEthGainId = 0; - const setLusdGainId = 0; - const stakeSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stake", - args: [amount, getStakeId, setStakeId, setEthGainId, setLusdGainId], - }; - - const stakeTx = await dsa - .connect(userWallet) - .cast(...encodeSpells([stakeSpell]), userWallet.address); - - const receipt = await stakeTx.wait(); - - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; - const expectedEventParams = ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "uint256", "uint256", "uint256"], - [ - dsa.address, - amount, - getStakeId, - setStakeId, - setEthGainId, - setLusdGainId, - ] - ); - expect(castLogEvent.eventNames[0]).eq( - "LogStake(address,uint256,uint256,uint256,uint256,uint256)" - ); - expect(castLogEvent.eventParams[0]).eq(expectedEventParams); - }); - }); - - describe("unstake()", () => { - it("unstakes LQTY", async () => { - const amount = ethers.utils.parseUnits("1", 18); - await helpers.sendToken( - liquity.lqtyToken, - amount, - helpers.JUSTIN_SUN_ADDRESS, - dsa.address - ); - - const stakeSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stake", - args: [amount, 0, 0, 0, 0], - }; - - await dsa - .connect(userWallet) - .cast(...encodeSpells([stakeSpell]), userWallet.address); - - const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( - contracts.STAKING_ADDRESS - ); - const unstakeSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "unstake", - args: [amount, 0, 0, 0, 0], - }; - - await dsa - .connect(userWallet) - .cast(...encodeSpells([unstakeSpell]), userWallet.address); - - const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); - expect(lqtyBalance).to.eq(amount); - - const totalStakingBalance = await liquity.lqtyToken.balanceOf( - contracts.STAKING_ADDRESS - ); - expect(totalStakingBalance).to.eq( - totalStakingBalanceBefore.sub(amount) - ); - }); - - it("unstakes LQTY and stores the LQTY for other spells", async () => { - const amount = ethers.utils.parseUnits("1", 18); - await helpers.sendToken( - liquity.lqtyToken, - amount, - helpers.JUSTIN_SUN_ADDRESS, - dsa.address - ); - - const stakeSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stake", - args: [amount, 0, 0, 0, 0], - }; - - await dsa - .connect(userWallet) - .cast(...encodeSpells([stakeSpell]), userWallet.address); - - const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( - contracts.STAKING_ADDRESS - ); - const withdrawId = 1; - const unstakeSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "unstake", - args: [amount, 0, withdrawId, 0, 0], - }; - - const withdrawLqtySpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "withdraw", - args: [ - liquity.lqtyToken.address, - 0, - userWallet.address, - withdrawId, - 0, - ], - }; - const spells = [unstakeSpell, withdrawLqtySpell]; - await dsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address); - - const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); - const totalStakingBalance = await liquity.lqtyToken.balanceOf( - contracts.STAKING_ADDRESS - ); - const userLqtyBalance = await liquity.lqtyToken.balanceOf( - userWallet.address - ); - expect(lqtyBalance).to.eq(0); - expect(totalStakingBalance).to.eq( - totalStakingBalanceBefore.sub(amount) - ); - expect(userLqtyBalance).to.eq(amount); - }); - - it("returns Instadapp event name and data", async () => { - const amount = ethers.utils.parseUnits("1", 18); - await helpers.sendToken( - liquity.lqtyToken, - amount, - helpers.JUSTIN_SUN_ADDRESS, - dsa.address - ); - - const stakeSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stake", - args: [amount, 0, 0, 0, 0], - }; - - await dsa - .connect(userWallet) - .cast(...encodeSpells([stakeSpell]), userWallet.address); - - const getUnstakeId = 0; - const setUnstakeId = 0; - const setEthGainId = 0; - const setLusdGainId = 0; - const unstakeSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "unstake", - args: [ - amount, - getUnstakeId, - setUnstakeId, - setEthGainId, - setLusdGainId, - ], - }; - - const unstakeTx = await dsa - .connect(userWallet) - .cast(...encodeSpells([unstakeSpell]), userWallet.address); - - const receipt = await unstakeTx.wait(); - - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; - const expectedEventParams = ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "uint256", "uint256", "uint256"], - [ - dsa.address, - amount, - getUnstakeId, - setUnstakeId, - setEthGainId, - setLusdGainId, - ] - ); - expect(castLogEvent.eventNames[0]).eq( - "LogUnstake(address,uint256,uint256,uint256,uint256,uint256)" - ); - expect(castLogEvent.eventParams[0]).eq(expectedEventParams); - }); - }); - - describe("claimStakingGains()", () => { - it("claims gains from staking", async () => { - const stakerDsa = await buildDSAv2(userWallet.address); - const amount = ethers.utils.parseUnits("1000", 18); // 1000 LQTY - - // Stake lots of LQTY - await helpers.sendToken( - liquity.lqtyToken, - amount, - helpers.JUSTIN_SUN_ADDRESS, - stakerDsa.address - ); - const stakeSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stake", - args: [amount, 0, 0, 0, 0], - }; - await stakerDsa - .connect(userWallet) - .cast(...encodeSpells([stakeSpell]), userWallet.address); - - // Open a Trove to cause an ETH issuance gain for stakers - await helpers.createDsaTrove(dsa, userWallet, liquity); - - // Redeem some ETH to cause an LUSD redemption gain for stakers - await helpers.redeem( - ethers.utils.parseUnits("1000", 18), - contracts.STABILITY_POOL_ADDRESS, - userWallet, - liquity - ); - - const setEthGainId = 0; - const setLusdGainId = 0; - const ethGain = await liquity.staking.getPendingETHGain( - stakerDsa.address - ); - const lusdGain = await liquity.staking.getPendingLUSDGain( - stakerDsa.address - ); - - const claimStakingGainsSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "claimStakingGains", - args: [setEthGainId, setLusdGainId], - }; - - const ethBalanceBefore = await ethers.provider.getBalance( - stakerDsa.address - ); - - // Claim gains - await stakerDsa - .connect(userWallet) - .cast( - ...encodeSpells([claimStakingGainsSpell]), - userWallet.address - ); - - const ethBalanceAfter = await ethers.provider.getBalance( - stakerDsa.address - ); - const lusdBalanceAfter = await liquity.lusdToken.balanceOf( - stakerDsa.address - ); - expect(ethBalanceAfter).to.eq(ethBalanceBefore.add(ethGain)); - expect(lusdBalanceAfter).to.eq(lusdGain); - }); - - it("claims gains from staking and stores them for other spells", async () => { - const stakerDsa = await buildDSAv2(userWallet.address); - const amount = ethers.utils.parseUnits("1000", 18); // 1000 LQTY - - // Stake lots of LQTY - await helpers.sendToken( - liquity.lqtyToken, - amount, - helpers.JUSTIN_SUN_ADDRESS, - stakerDsa.address - ); - const stakeSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stake", - args: [amount, 0, 0, 0, 0], - }; - await stakerDsa - .connect(userWallet) - .cast(...encodeSpells([stakeSpell]), userWallet.address); - - // Open a Trove to cause an ETH issuance gain for stakers - await helpers.createDsaTrove(dsa, userWallet, liquity); - - // Redeem some ETH to cause an LUSD redemption gain for stakers - await helpers.redeem( - ethers.utils.parseUnits("1000", 18), - contracts.STABILITY_POOL_ADDRESS, - userWallet, - liquity - ); - - const ethGain = await liquity.staking.getPendingETHGain( - stakerDsa.address - ); - const lusdGain = await liquity.staking.getPendingLUSDGain( - stakerDsa.address - ); - const lusdBalanceBefore = await liquity.lusdToken.balanceOf( - userWallet.address - ); - const ethBalanceBefore = await ethers.provider.getBalance( - userWallet.address - ); - const ethGainId = 111; - const lusdGainId = 222; - - const claimStakingGainsSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "claimStakingGains", - args: [ethGainId, lusdGainId], - }; - - const withdrawEthSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "withdraw", - args: [helpers.ETH_ADDRESS, 0, userWallet.address, ethGainId, 0], - }; - - const withdrawLusdSpell = { - connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, - method: "withdraw", - args: [ - liquity.lusdToken.address, - 0, - userWallet.address, - lusdGainId, - 0, - ], - }; - - const spells = [ - claimStakingGainsSpell, - withdrawEthSpell, - withdrawLusdSpell, - ]; - - // Claim gains - await stakerDsa - .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address, { - gasPrice: 0, - }); - - const ethBalanceAfter = await ethers.provider.getBalance( - userWallet.address - ); - const lusdBalanceAfter = await liquity.lusdToken.balanceOf( - userWallet.address - ); - - expect( - ethBalanceAfter, - "User's ETH balance should have increased by the issuance gain from staking" - ).to.eq(ethBalanceBefore.add(ethGain)); - expect( - lusdBalanceAfter, - "User's LUSD balance should have increased by the redemption gain from staking" - ).to.eq(lusdBalanceBefore.add(lusdGain)); - }); - - it("returns Instadapp event name and data", async () => { - const stakerDsa = await buildDSAv2(userWallet.address); - const amount = ethers.utils.parseUnits("1000", 18); // 1000 LQTY - - // Stake lots of LQTY - await helpers.sendToken( - liquity.lqtyToken, - amount, - helpers.JUSTIN_SUN_ADDRESS, - stakerDsa.address - ); - const stakeSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "stake", - args: [amount, 0, 0, 0, 0], - }; - await stakerDsa - .connect(userWallet) - .cast(...encodeSpells([stakeSpell]), userWallet.address); - - // Open a Trove to cause an ETH issuance gain for stakers - await helpers.createDsaTrove(dsa, userWallet, liquity); - - // Redeem some ETH to cause an LUSD redemption gain for stakers - await helpers.redeem( - ethers.utils.parseUnits("1000", 18), - contracts.STABILITY_POOL_ADDRESS, - userWallet, - liquity - ); - - const setEthGainId = 0; - const setLusdGainId = 0; - const ethGain = await liquity.staking.getPendingETHGain( - stakerDsa.address - ); - const lusdGain = await liquity.staking.getPendingLUSDGain( - stakerDsa.address - ); - - const claimStakingGainsSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "claimStakingGains", - args: [setEthGainId, setLusdGainId], - }; - - // Claim gains - const claimGainsTx = await stakerDsa - .connect(userWallet) - .cast( - ...encodeSpells([claimStakingGainsSpell]), - userWallet.address - ); - - const receipt = await claimGainsTx.wait(); - - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; - const expectedEventParams = ethers.utils.defaultAbiCoder.encode( - ["address", "uint256", "uint256", "uint256", "uint256"], - [stakerDsa.address, ethGain, lusdGain, setEthGainId, setLusdGainId] - ); - expect(castLogEvent.eventNames[0]).eq( - "LogClaimStakingGains(address,uint256,uint256,uint256,uint256)" - ); - expect(castLogEvent.eventParams[0]).eq(expectedEventParams); - }); - }); - }); - }); -}); +// import hre from "hardhat"; +// import { expect } from "chai"; + +// // Instadapp deployment and testing helpers +// import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; +// import { encodeSpells } from "../../../scripts/tests/encodeSpells.js"; + +// // Liquity smart contracts +// import contracts from "./liquity.contracts"; + +// // Liquity helpers +// import helpers from "./liquity.helpers"; + +// describe("Liquity", () => { +// const { waffle, ethers } = hre; +// const { provider } = waffle; + +// // Waffle test account 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 (holds 1000 ETH) +// const userWallet = provider.getWallets()[0]; +// let dsa = null; +// let liquity = null; + +// before(async () => { +// await hre.network.provider.request({ +// method: "hardhat_reset", +// params: [ +// { +// forking: { +// jsonRpcUrl: hre.config.networks.hardhat.forking.url, +// blockNumber: 13300000, +// }, +// }, +// ], +// }); +// liquity = await helpers.deployAndConnect(contracts, true); +// expect(liquity.troveManager.address).to.exist; +// expect(liquity.borrowerOperations.address).to.exist; +// expect(liquity.stabilityPool.address).to.exist; +// expect(liquity.lusdToken.address).to.exist; +// expect(liquity.lqtyToken.address).to.exist; +// expect(liquity.activePool.address).to.exist; +// expect(liquity.priceFeed.address).to.exist; +// expect(liquity.hintHelpers.address).to.exist; +// expect(liquity.sortedTroves.address).to.exist; +// expect(liquity.staking.address).to.exist; +// }); + +// beforeEach(async () => { +// // Build a new DSA before each test so we start each test from the same default state +// dsa = await buildDSAv2(userWallet.address); +// expect(dsa.address).to.exist; +// }); + +// describe("Main (Connector)", () => { +// describe("Trove", () => { +// describe("open()", () => { +// it("opens a Trove", async () => { +// const depositAmount = ethers.utils.parseEther("5"); // 5 ETH +// const borrowAmount = ethers.utils.parseUnits("2000", 18); // 2000 LUSD +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const originalUserBalance = await ethers.provider.getBalance( +// userWallet.address +// ); +// const originalDsaBalance = await ethers.provider.getBalance( +// dsa.address +// ); + +// const openTroveSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "open", +// args: [ +// depositAmount, +// maxFeePercentage, +// borrowAmount, +// upperHint, +// lowerHint, +// [0, 0], +// [0, 0], +// ], +// }; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([openTroveSpell]), userWallet.address, { +// value: depositAmount, +// gasPrice: 0, +// }); + +// const userBalance = await ethers.provider.getBalance( +// userWallet.address +// ); +// const dsaEthBalance = await ethers.provider.getBalance(dsa.address); +// const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); +// const troveDebt = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const troveCollateral = await liquity.troveManager.getTroveColl( +// dsa.address +// ); + +// expect(userBalance).eq( +// originalUserBalance.sub(depositAmount), +// "User's Ether balance should decrease by the amount they deposited" +// ); + +// expect(dsaEthBalance).to.eq( +// originalDsaBalance, +// "User's DSA account Ether should not change after borrowing" +// ); + +// expect( +// dsaLusdBalance, +// "DSA account should now hold the amount the user borrowed" +// ).to.eq(borrowAmount); + +// expect(troveDebt).to.gt( +// borrowAmount, +// "Trove debt should equal the borrowed amount plus fee" +// ); + +// expect(troveCollateral).to.eq( +// depositAmount, +// "Trove collateral should equal the deposited amount" +// ); +// }); + +// it("opens a Trove using ETH collected from a previous spell", async () => { +// const depositAmount = ethers.utils.parseEther("5"); // 5 ETH +// const borrowAmount = ethers.utils.parseUnits("2000", 18); // 2000 LUSD +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const originalUserBalance = await ethers.provider.getBalance( +// userWallet.address +// ); +// const originalDsaBalance = await ethers.provider.getBalance( +// dsa.address +// ); +// const depositId = 1; // Choose an ID to store and retrieve the deposited ETH + +// const depositEthSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "deposit", +// args: [helpers.ETH_ADDRESS, depositAmount, 0, depositId], +// }; + +// const openTroveSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "open", +// args: [ +// 0, // When pulling ETH from a previous spell it doesn't matter what deposit value we put in this param +// maxFeePercentage, +// borrowAmount, +// upperHint, +// lowerHint, +// [depositId, 0], +// [0, 0], +// ], +// }; + +// const spells = [depositEthSpell, openTroveSpell]; +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address, { +// value: depositAmount, +// gasPrice: 0, +// }); + +// const userBalance = await ethers.provider.getBalance( +// userWallet.address +// ); +// const dsaEthBalance = await ethers.provider.getBalance(dsa.address); +// const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); +// const troveDebt = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const troveCollateral = await liquity.troveManager.getTroveColl( +// dsa.address +// ); + +// expect(userBalance).eq( +// originalUserBalance.sub(depositAmount), +// "User's Ether balance should decrease by the amount they deposited" +// ); + +// expect(dsaEthBalance).to.eq( +// originalDsaBalance, +// "DSA balance should not change" +// ); + +// expect( +// dsaLusdBalance, +// "DSA account should now hold the amount the user borrowed" +// ).to.eq(borrowAmount); + +// expect(troveDebt).to.gt( +// borrowAmount, +// "Trove debt should equal the borrowed amount plus fee" +// ); + +// expect(troveCollateral).to.eq( +// depositAmount, +// "Trove collateral should equal the deposited amount" +// ); +// }); + +// it("opens a Trove and stores the debt for other spells to use", async () => { +// const depositAmount = ethers.utils.parseEther("5"); // 5 ETH +// const borrowAmount = ethers.utils.parseUnits("2000", 18); // 2000 LUSD +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const originalUserBalance = await ethers.provider.getBalance( +// userWallet.address +// ); +// const originalDsaBalance = await ethers.provider.getBalance( +// dsa.address +// ); +// const borrowId = 1; + +// const openTroveSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "open", +// args: [ +// depositAmount, +// maxFeePercentage, +// borrowAmount, +// upperHint, +// lowerHint, +// [0, 0], +// [borrowId, 0], +// ], +// }; + +// const withdrawLusdSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "withdraw", +// args: [ +// contracts.LUSD_TOKEN_ADDRESS, +// 0, // Amount comes from the previous spell's setId +// dsa.address, +// borrowId, +// 0, +// ], +// }; + +// const spells = [openTroveSpell, withdrawLusdSpell]; +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address, { +// value: depositAmount, +// gasPrice: 0, +// }); + +// const userBalance = await ethers.provider.getBalance( +// userWallet.address +// ); +// const dsaEthBalance = await ethers.provider.getBalance(dsa.address); +// const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); +// const troveDebt = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const troveCollateral = await liquity.troveManager.getTroveColl( +// dsa.address +// ); + +// expect(userBalance).eq( +// originalUserBalance.sub(depositAmount), +// "User's Ether balance should decrease by the amount they deposited" +// ); + +// expect(dsaEthBalance).to.eq( +// originalDsaBalance, +// "User's DSA account Ether should not change after borrowing" +// ); + +// expect( +// dsaLusdBalance, +// "DSA account should now hold the amount the user borrowed" +// ).to.eq(borrowAmount); + +// expect(troveDebt).to.gt( +// borrowAmount, +// "Trove debt should equal the borrowed amount plus fee" +// ); + +// expect(troveCollateral).to.eq( +// depositAmount, +// "Trove collateral should equal the deposited amount" +// ); +// }); + +// it("returns Instadapp event name and data", async () => { +// const depositAmount = ethers.utils.parseEther("5"); +// const borrowAmount = ethers.utils.parseUnits("2000", 18); +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; + +// const openTroveSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "open", +// args: [ +// depositAmount, +// maxFeePercentage, +// borrowAmount, +// upperHint, +// lowerHint, +// [0, 0], +// [0, 0], +// ], +// }; + +// const openTx = await dsa.cast( +// ...encodeSpells([openTroveSpell]), +// userWallet.address, +// { +// value: depositAmount, +// } +// ); +// const receipt = await openTx.wait(); +// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") +// .args; +// expect(castLogEvent.eventNames[0]).eq( +// "LogOpen(address,uint256,uint256,uint256,uint256[],uint256[])" +// ); +// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( +// [ +// "address", +// "uint256", +// "uint256", +// "uint256", +// "uint256[]", +// "uint256[]", +// ], +// [ +// dsa.address, +// maxFeePercentage, +// depositAmount, +// borrowAmount, +// [0, 0], +// [0, 0], +// ] +// ); +// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); +// }); +// }); + +// describe("close()", () => { +// it("closes a Trove", async () => { +// const depositAmount = ethers.utils.parseEther("5"); +// const borrowAmount = ethers.utils.parseUnits("2000", 18); +// // Create a dummy Trove +// await helpers.createDsaTrove( +// dsa, +// userWallet, +// liquity, +// depositAmount, +// borrowAmount +// ); + +// const troveDebtBefore = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); + +// const troveCollateralBefore = await liquity.troveManager.getTroveColl( +// dsa.address +// ); + +// // Send DSA account enough LUSD (from Stability Pool) to close their Trove +// const extraLusdRequiredToCloseTrove = troveDebtBefore.sub( +// borrowAmount +// ); + +// await helpers.sendToken( +// liquity.lusdToken, +// extraLusdRequiredToCloseTrove, +// contracts.STABILITY_POOL_ADDRESS, +// dsa.address +// ); + +// const originalDsaLusdBalance = await liquity.lusdToken.balanceOf( +// dsa.address +// ); + +// expect( +// originalDsaLusdBalance, +// "DSA account should now hold the LUSD amount required to pay off the Trove debt" +// ).to.eq(troveDebtBefore); + +// const closeTroveSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "close", +// args: [0], +// }; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([closeTroveSpell]), userWallet.address); + +// const dsaEthBalance = await ethers.provider.getBalance(dsa.address); +// const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); +// const troveDebt = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const troveCollateral = await liquity.troveManager.getTroveColl( +// dsa.address +// ); + +// expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); + +// expect( +// troveCollateral, +// "Trove collateral should equal 0 after close" +// ).to.eq(0); + +// expect( +// dsaEthBalance, +// "DSA account should now hold the Trove's ETH collateral" +// ).to.eq(troveCollateralBefore); + +// expect( +// dsaLusdBalance, +// "DSA account should now hold the gas compensation amount of LUSD as it paid off the Trove debt" +// ).to.eq(helpers.LUSD_GAS_COMPENSATION); +// }); + +// it("closes a Trove using LUSD obtained from a previous spell", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// const troveDebtBefore = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const troveCollateralBefore = await liquity.troveManager.getTroveColl( +// dsa.address +// ); + +// // Send user enough LUSD to repay the loan, we'll use a deposit and withdraw spell to obtain it +// await helpers.sendToken( +// liquity.lusdToken, +// troveDebtBefore, +// contracts.STABILITY_POOL_ADDRESS, +// userWallet.address +// ); + +// // Allow DSA to spend user's LUSD +// await liquity.lusdToken +// .connect(userWallet) +// .approve(dsa.address, troveDebtBefore); + +// // Simulate a spell which would have pulled LUSD from somewhere (e.g. Uniswap) into InstaMemory +// // In this case we're simply running a deposit spell from the user's EOA +// const depositLusdSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "deposit", +// args: [contracts.LUSD_TOKEN_ADDRESS, troveDebtBefore, 0, 0], +// }; + +// const closeTroveSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "close", +// args: [0], +// }; +// const spells = [depositLusdSpell, closeTroveSpell]; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address); + +// const dsaEthBalance = await ethers.provider.getBalance(dsa.address); +// const troveDebt = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const troveCollateral = await liquity.troveManager.getTroveColl( +// dsa.address +// ); + +// expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); + +// expect( +// troveCollateral, +// "Trove collateral should equal 0 after close" +// ).to.eq(0); + +// expect( +// dsaEthBalance, +// "DSA account should now hold the Trove's ETH collateral" +// ).to.eq(troveCollateralBefore); +// }); + +// it("closes a Trove and stores the released collateral for other spells to use", async () => { +// const depositAmount = ethers.utils.parseEther("5"); +// const borrowAmount = ethers.utils.parseUnits("2000", 18); +// // Create a dummy Trove +// await helpers.createDsaTrove( +// dsa, +// userWallet, +// liquity, +// depositAmount, +// borrowAmount +// ); + +// const troveDebtBefore = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const troveCollateralBefore = await liquity.troveManager.getTroveColl( +// dsa.address +// ); + +// // Send DSA account enough LUSD (from Stability Pool) to close their Trove +// const extraLusdRequiredToCloseTrove = troveDebtBefore.sub( +// borrowAmount +// ); +// await helpers.sendToken( +// liquity.lusdToken, +// extraLusdRequiredToCloseTrove, +// contracts.STABILITY_POOL_ADDRESS, +// dsa.address +// ); +// const originalDsaLusdBalance = await liquity.lusdToken.balanceOf( +// dsa.address +// ); + +// expect( +// originalDsaLusdBalance, +// "DSA account should now hold the LUSD amount required to pay off the Trove debt" +// ).to.eq(troveDebtBefore); + +// const collateralWithdrawId = 1; + +// const closeTroveSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "close", +// args: [collateralWithdrawId], +// }; + +// const withdrawEthSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "withdraw", +// args: [ +// helpers.ETH_ADDRESS, +// 0, // amount comes from the previous spell's setId +// dsa.address, +// collateralWithdrawId, +// 0, +// ], +// }; + +// await dsa +// .connect(userWallet) +// .cast( +// ...encodeSpells([closeTroveSpell, withdrawEthSpell]), +// userWallet.address +// ); + +// const dsaEthBalance = await ethers.provider.getBalance(dsa.address); +// const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); +// const troveDebt = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const troveCollateral = await liquity.troveManager.getTroveColl( +// dsa.address +// ); + +// expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); + +// expect( +// troveCollateral, +// "Trove collateral should equal 0 after close" +// ).to.eq(0); + +// expect( +// dsaEthBalance, +// "DSA account should now hold the Trove's ETH collateral" +// ).to.eq(troveCollateralBefore); + +// expect( +// dsaLusdBalance, +// "DSA account should now hold the gas compensation amount of LUSD as it paid off the Trove debt" +// ).to.eq(helpers.LUSD_GAS_COMPENSATION); +// }); + +// it("returns Instadapp event name and data", async () => { +// const depositAmount = ethers.utils.parseEther("5"); +// const borrowAmount = ethers.utils.parseUnits("2000", 18); +// // Create a dummy Trove +// await helpers.createDsaTrove( +// dsa, +// userWallet, +// liquity, +// depositAmount, +// borrowAmount +// ); +// await helpers.sendToken( +// liquity.lusdToken, +// ethers.utils.parseUnits("2500", 18), +// contracts.STABILITY_POOL_ADDRESS, +// dsa.address +// ); + +// const closeTroveSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "close", +// args: [0], +// }; + +// const closeTx = await dsa +// .connect(userWallet) +// .cast(...encodeSpells([closeTroveSpell]), userWallet.address); + +// const receipt = await closeTx.wait(); +// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") +// .args; +// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( +// ["address", "uint256"], +// [dsa.address, 0] +// ); +// expect(castLogEvent.eventNames[0]).eq("LogClose(address,uint256)"); +// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); +// }); +// }); + +// describe("deposit()", () => { +// it("deposits ETH into a Trove", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// const troveCollateralBefore = await liquity.troveManager.getTroveColl( +// dsa.address +// ); + +// const topupAmount = ethers.utils.parseEther("1"); +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const depositEthSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "deposit", +// args: [topupAmount, upperHint, lowerHint, 0, 0], +// }; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([depositEthSpell]), userWallet.address, { +// value: topupAmount, +// }); + +// const troveCollateral = await liquity.troveManager.getTroveColl( +// dsa.address +// ); + +// const expectedTroveCollateral = troveCollateralBefore.add( +// topupAmount +// ); + +// expect( +// troveCollateral, +// `Trove collateral should have increased by ${topupAmount} ETH` +// ).to.eq(expectedTroveCollateral); +// }); + +// it("deposits using ETH gained from a previous spell", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); +// const troveCollateralBefore = await liquity.troveManager.getTroveColl( +// dsa.address +// ); + +// const topupAmount = ethers.utils.parseEther("1"); +// const depositId = 1; +// const depositEthSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "deposit", +// args: [helpers.ETH_ADDRESS, topupAmount, 0, depositId], +// }; + +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const depositEthToTroveSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "deposit", +// args: [0, upperHint, lowerHint, depositId, 0], +// }; +// const spells = [depositEthSpell, depositEthToTroveSpell]; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address, { +// value: topupAmount, +// }); + +// const troveCollateral = await liquity.troveManager.getTroveColl( +// dsa.address +// ); + +// const expectedTroveCollateral = troveCollateralBefore.add( +// topupAmount +// ); + +// expect( +// troveCollateral, +// `Trove collateral should have increased by ${topupAmount} ETH` +// ).to.eq(expectedTroveCollateral); +// }); + +// it("returns Instadapp event name and data", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// const topupAmount = ethers.utils.parseEther("1"); +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const depositEthSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "deposit", +// args: [topupAmount, upperHint, lowerHint, 0, 0], +// }; + +// const depositTx = await dsa +// .connect(userWallet) +// .cast(...encodeSpells([depositEthSpell]), userWallet.address, { +// value: topupAmount, +// }); + +// const receipt = await depositTx.wait(); +// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") +// .args; +// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( +// ["address", "uint256", "uint256", "uint256"], +// [dsa.address, topupAmount, 0, 0] +// ); +// expect(castLogEvent.eventNames[0]).eq( +// "LogDeposit(address,uint256,uint256,uint256)" +// ); +// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); +// }); +// }); + +// describe("withdraw()", () => { +// it("withdraws ETH from a Trove", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// const troveCollateralBefore = await liquity.troveManager.getTroveColl( +// dsa.address +// ); +// const withdrawAmount = ethers.utils.parseEther("1"); +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const withdrawEthSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "withdraw", +// args: [withdrawAmount, upperHint, lowerHint, 0, 0], +// }; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([withdrawEthSpell]), userWallet.address); + +// const troveCollateral = await liquity.troveManager.getTroveColl( +// dsa.address +// ); +// const expectedTroveCollateral = troveCollateralBefore.sub( +// withdrawAmount +// ); + +// expect( +// troveCollateral, +// `Trove collateral should have decreased by ${withdrawAmount} ETH` +// ).to.eq(expectedTroveCollateral); +// }); + +// it("withdraws ETH from a Trove and stores the ETH for other spells to use", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// const troveCollateralBefore = await liquity.troveManager.getTroveColl( +// dsa.address +// ); +// const originalUserEthBalance = await ethers.provider.getBalance( +// userWallet.address +// ); + +// const withdrawAmount = ethers.utils.parseEther("1"); +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const withdrawId = 1; +// const withdrawEthFromTroveSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "withdraw", +// args: [withdrawAmount, upperHint, lowerHint, 0, withdrawId], +// }; + +// const withdrawEthSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "withdraw", +// args: [helpers.ETH_ADDRESS, 0, userWallet.address, withdrawId, 0], +// }; +// const spells = [withdrawEthFromTroveSpell, withdrawEthSpell]; +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address, { +// gasPrice: 0, // Remove gas costs so we can check balances have changed correctly +// }); + +// const troveCollateral = await liquity.troveManager.getTroveColl( +// dsa.address +// ); +// const expectedTroveCollateral = troveCollateralBefore.sub( +// withdrawAmount +// ); +// const userEthBalance = await ethers.provider.getBalance( +// userWallet.address +// ); + +// expect( +// troveCollateral, +// `Trove collateral should have decreased by ${withdrawAmount} ETH` +// ).to.eq(expectedTroveCollateral); + +// expect( +// userEthBalance, +// `User ETH balance should have increased by ${withdrawAmount} ETH` +// ).to.eq(originalUserEthBalance.add(withdrawAmount)); +// }); + +// it("returns Instadapp event name and data", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// const withdrawAmount = ethers.utils.parseEther("1"); +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const withdrawEthSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "withdraw", +// args: [withdrawAmount, upperHint, lowerHint, 0, 0], +// }; + +// const withdrawTx = await dsa +// .connect(userWallet) +// .cast(...encodeSpells([withdrawEthSpell]), userWallet.address); + +// const receipt = await withdrawTx.wait(); +// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") +// .args; +// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( +// ["address", "uint256", "uint256", "uint256"], +// [dsa.address, withdrawAmount, 0, 0] +// ); +// expect(castLogEvent.eventNames[0]).eq( +// "LogWithdraw(address,uint256,uint256,uint256)" +// ); +// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); +// }); +// }); + +// describe("borrow()", () => { +// it("borrows LUSD from a Trove", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// const troveDebtBefore = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); + +// const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee +// const borrowSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "borrow", +// args: [maxFeePercentage, borrowAmount, upperHint, lowerHint, 0, 0], +// }; + +// // Borrow more LUSD from the Trove +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([borrowSpell]), userWallet.address); + +// const troveDebt = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const expectedTroveDebt = troveDebtBefore.add(borrowAmount); + +// expect( +// troveDebt, +// `Trove debt should have increased by at least ${borrowAmount} ETH` +// ).to.gte(expectedTroveDebt); +// }); + +// it("borrows LUSD from a Trove and stores the LUSD for other spells to use", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// const troveDebtBefore = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); + +// const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee +// const borrowId = 1; +// const borrowSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "borrow", +// args: [ +// maxFeePercentage, +// borrowAmount, +// upperHint, +// lowerHint, +// 0, +// borrowId, +// ], +// }; +// const withdrawSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "withdraw", +// args: [ +// liquity.lusdToken.address, +// 0, +// userWallet.address, +// borrowId, +// 0, +// ], +// }; +// const spells = [borrowSpell, withdrawSpell]; + +// // Borrow more LUSD from the Trove +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address); + +// const troveDebt = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const expectedTroveDebt = troveDebtBefore.add(borrowAmount); +// const userLusdBalance = await liquity.lusdToken.balanceOf( +// userWallet.address +// ); + +// expect( +// troveDebt, +// `Trove debt should have increased by at least ${borrowAmount} ETH` +// ).to.gte(expectedTroveDebt); + +// expect( +// userLusdBalance, +// `User LUSD balance should equal the borrowed LUSD due to the second withdraw spell` +// ).eq(borrowAmount); +// }); + +// it("returns Instadapp event name and data", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee +// const borrowSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "borrow", +// args: [maxFeePercentage, borrowAmount, upperHint, lowerHint, 0, 0], +// }; + +// const borrowTx = await dsa +// .connect(userWallet) +// .cast(...encodeSpells([borrowSpell]), userWallet.address); + +// const receipt = await borrowTx.wait(); +// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") +// .args; +// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( +// ["address", "uint256", "uint256", "uint256"], +// [dsa.address, borrowAmount, 0, 0] +// ); +// expect(castLogEvent.eventNames[0]).eq( +// "LogBorrow(address,uint256,uint256,uint256)" +// ); +// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); +// }); +// }); + +// describe("repay()", () => { +// it("repays LUSD to a Trove", async () => { +// const depositAmount = ethers.utils.parseEther("5"); +// const borrowAmount = ethers.utils.parseUnits("2500", 18); + +// // Create a dummy Trove +// await helpers.createDsaTrove( +// dsa, +// userWallet, +// liquity, +// depositAmount, +// borrowAmount +// ); + +// const troveDebtBefore = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// // DSA account is holding 2500 LUSD from opening a Trove, so we use some of that to repay +// const repayAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD + +// const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( +// depositAmount, +// borrowAmount, +// liquity +// ); +// const repaySpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "repay", +// args: [repayAmount, upperHint, lowerHint, 0, 0], +// }; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([repaySpell]), userWallet.address); + +// const troveDebt = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const expectedTroveDebt = troveDebtBefore.sub(repayAmount); + +// expect( +// troveDebt, +// `Trove debt should have decreased by ${repayAmount} ETH` +// ).to.eq(expectedTroveDebt); +// }); + +// it("repays LUSD to a Trove using LUSD collected from a previous spell", async () => { +// const depositAmount = ethers.utils.parseEther("5"); +// const borrowAmount = ethers.utils.parseUnits("2500", 18); + +// // Create a dummy Trove +// await helpers.createDsaTrove( +// dsa, +// userWallet, +// liquity, +// depositAmount, +// borrowAmount +// ); + +// const troveDebtBefore = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); + +// const repayAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD +// const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( +// depositAmount, +// borrowAmount, +// liquity +// ); + +// // Drain the DSA's LUSD balance so that we ensure we are repaying using LUSD from a previous spell +// await helpers.sendToken( +// liquity.lusdToken, +// borrowAmount, +// dsa.address, +// userWallet.address +// ); + +// // Allow DSA to spend user's LUSD +// await liquity.lusdToken +// .connect(userWallet) +// .approve(dsa.address, repayAmount); + +// const lusdDepositId = 1; +// const depositSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "deposit", +// args: [liquity.lusdToken.address, repayAmount, 0, lusdDepositId], +// }; +// const borrowSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "repay", +// args: [0, upperHint, lowerHint, lusdDepositId, 0], +// }; + +// const spells = [depositSpell, borrowSpell]; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address); + +// const troveDebt = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const expectedTroveDebt = troveDebtBefore.sub(repayAmount); + +// expect( +// troveDebt, +// `Trove debt should have decreased by ${repayAmount} ETH` +// ).to.eq(expectedTroveDebt); +// }); + +// it("returns Instadapp event name and data", async () => { +// // Create a dummy Trove +// const depositAmount = ethers.utils.parseEther("5"); +// const borrowAmount = ethers.utils.parseUnits("2500", 18); +// await helpers.createDsaTrove( +// dsa, +// userWallet, +// liquity, +// depositAmount, +// borrowAmount +// ); + +// const repayAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD +// const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( +// depositAmount, +// borrowAmount, +// liquity +// ); + +// const borrowSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "repay", +// args: [repayAmount, upperHint, lowerHint, 0, 0], +// }; + +// const repayTx = await dsa +// .connect(userWallet) +// .cast(...encodeSpells([borrowSpell]), userWallet.address, { +// value: repayAmount, +// }); + +// const receipt = await repayTx.wait(); +// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") +// .args; +// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( +// ["address", "uint256", "uint256", "uint256"], +// [dsa.address, repayAmount, 0, 0] +// ); +// expect(castLogEvent.eventNames[0]).eq( +// "LogRepay(address,uint256,uint256,uint256)" +// ); +// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); +// }); +// }); + +// describe("adjust()", () => { +// it("adjusts a Trove: deposit ETH and borrow LUSD", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// const troveCollateralBefore = await liquity.troveManager.getTroveColl( +// dsa.address +// ); +// const troveDebtBefore = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const depositAmount = ethers.utils.parseEther("1"); // 1 ETH +// const borrowAmount = ethers.utils.parseUnits("500", 18); // 500 LUSD +// const withdrawAmount = 0; +// const repayAmount = 0; +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + +// const adjustSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "adjust", +// args: [ +// maxFeePercentage, +// depositAmount, +// withdrawAmount, +// borrowAmount, +// repayAmount, +// upperHint, +// lowerHint, +// [0, 0, 0, 0], +// [0, 0, 0, 0], +// ], +// }; + +// // Adjust Trove by depositing ETH and borrowing LUSD +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([adjustSpell]), userWallet.address, { +// value: depositAmount, +// gasLimit: helpers.MAX_GAS, +// }); + +// const troveCollateral = await liquity.troveManager.getTroveColl( +// dsa.address +// ); +// const troveDebt = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const expectedTroveColl = troveCollateralBefore.add(depositAmount); +// const expectedTroveDebt = troveDebtBefore.add(borrowAmount); + +// expect( +// troveCollateral, +// `Trove collateral should have increased by ${depositAmount} ETH` +// ).to.eq(expectedTroveColl); + +// expect( +// troveDebt, +// `Trove debt should have increased by at least ${borrowAmount} ETH` +// ).to.gte(expectedTroveDebt); +// }); + +// it("adjusts a Trove: withdraw ETH and repay LUSD", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// const troveCollateralBefore = await liquity.troveManager.getTroveColl( +// dsa.address +// ); +// const troveDebtBefore = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const depositAmount = 0; +// const borrowAmount = 0; +// const withdrawAmount = ethers.utils.parseEther("1"); // 1 ETH; +// const repayAmount = ethers.utils.parseUnits("10", 18); // 10 LUSD; +// const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( +// troveCollateralBefore.sub(withdrawAmount), +// troveDebtBefore.sub(repayAmount), +// liquity +// ); +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + +// const adjustSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "adjust", +// args: [ +// maxFeePercentage, +// depositAmount, +// withdrawAmount, +// borrowAmount, +// repayAmount, +// upperHint, +// lowerHint, +// [0, 0, 0, 0], +// [0, 0, 0, 0], +// ], +// }; + +// // Adjust Trove by withdrawing ETH and repaying LUSD +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([adjustSpell]), userWallet.address, { +// value: depositAmount, +// gasLimit: helpers.MAX_GAS, +// }); + +// const troveCollateral = await liquity.troveManager.getTroveColl( +// dsa.address +// ); +// const troveDebt = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const expectedTroveColl = troveCollateralBefore.sub(withdrawAmount); +// const expectedTroveDebt = troveDebtBefore.sub(repayAmount); + +// expect( +// troveCollateral, +// `Trove collateral should have increased by ${depositAmount} ETH` +// ).to.eq(expectedTroveColl); + +// expect( +// troveDebt, +// `Trove debt should have decreased by at least ${repayAmount} LUSD` +// ).to.gte(expectedTroveDebt); +// }); + +// it("adjusts a Trove: deposit ETH and repay LUSD using previous spells", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// const troveCollateralBefore = await liquity.troveManager.getTroveColl( +// dsa.address +// ); +// const troveDebtBefore = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const depositAmount = ethers.utils.parseEther("1"); // 1 ETH +// const borrowAmount = 0; +// const withdrawAmount = 0; +// const repayAmount = ethers.utils.parseUnits("10", 18); // 10 lUSD +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + +// const ethDepositId = 1; +// const lusdRepayId = 2; + +// const depositEthSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "deposit", +// args: [helpers.ETH_ADDRESS, depositAmount, 0, ethDepositId], +// }; + +// const depositLusdSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "deposit", +// args: [liquity.lusdToken.address, repayAmount, 0, lusdRepayId], +// }; + +// const adjustSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "adjust", +// args: [ +// maxFeePercentage, +// 0, // Deposit amount comes from a previous spell's storage slot +// withdrawAmount, +// borrowAmount, +// 0, // Repay amount comes from a previous spell's storage slot +// upperHint, +// lowerHint, +// [ethDepositId, 0, 0, lusdRepayId], +// [0, 0, 0, 0], +// ], +// }; +// const spells = [depositEthSpell, depositLusdSpell, adjustSpell]; + +// // Send user some LUSD so they can repay +// await helpers.sendToken( +// liquity.lusdToken, +// repayAmount, +// helpers.JUSTIN_SUN_ADDRESS, +// userWallet.address +// ); + +// // Allow DSA to spend user's LUSD +// await liquity.lusdToken +// .connect(userWallet) +// .approve(dsa.address, repayAmount); + +// // Adjust Trove by depositing ETH and repaying LUSD +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address, { +// value: depositAmount, +// gasLimit: helpers.MAX_GAS, +// }); + +// const troveCollateral = await liquity.troveManager.getTroveColl( +// dsa.address +// ); +// const troveDebt = await liquity.troveManager.getTroveDebt( +// dsa.address +// ); +// const expectedTroveColl = troveCollateralBefore.add(depositAmount); +// const expectedTroveDebt = troveDebtBefore.sub(repayAmount); + +// expect( +// troveCollateral, +// `Trove collateral should have increased by ${depositAmount} ETH` +// ).to.eq(expectedTroveColl); + +// expect( +// troveDebt, +// `Trove debt (${troveDebtBefore}) should have decreased by at least ${repayAmount} LUSD` +// ).to.eq(expectedTroveDebt); +// }); + +// it("adjusts a Trove: withdraw ETH, borrow LUSD, and store the amounts for other spells", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// const userEthBalanceBefore = await ethers.provider.getBalance( +// userWallet.address +// ); +// const userLusdBalanceBefore = await liquity.lusdToken.balanceOf( +// userWallet.address +// ); + +// const depositAmount = 0; +// const borrowAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD +// const withdrawAmount = ethers.utils.parseEther("1"); // 1 ETH +// const repayAmount = 0; +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + +// const ethWithdrawId = 1; +// const lusdBorrowId = 2; + +// const adjustSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "adjust", +// args: [ +// maxFeePercentage, +// depositAmount, +// withdrawAmount, +// borrowAmount, +// repayAmount, +// upperHint, +// lowerHint, +// [0, 0, 0, 0], +// [0, ethWithdrawId, lusdBorrowId, 0], +// ], +// }; + +// const withdrawEthSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "withdraw", +// args: [ +// helpers.ETH_ADDRESS, +// 0, +// userWallet.address, +// ethWithdrawId, +// 0, +// ], +// }; + +// const withdrawLusdSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "withdraw", +// args: [ +// liquity.lusdToken.address, +// 0, +// userWallet.address, +// lusdBorrowId, +// 0, +// ], +// }; + +// const spells = [adjustSpell, withdrawEthSpell, withdrawLusdSpell]; + +// // Adjust Trove by withdrawing ETH and borrowing LUSD +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address, { +// gasLimit: helpers.MAX_GAS, +// gasPrice: 0, +// }); + +// const userEthBalanceAfter = await ethers.provider.getBalance( +// userWallet.address +// ); +// const userLusdBalanceAfter = await liquity.lusdToken.balanceOf( +// userWallet.address +// ); +// expect(userEthBalanceAfter).eq( +// userEthBalanceBefore.add(withdrawAmount) +// ); +// expect(userLusdBalanceAfter).eq( +// userLusdBalanceBefore.add(borrowAmount) +// ); +// }); + +// it("returns Instadapp event name and data", async () => { +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// const depositAmount = ethers.utils.parseEther("1"); // 1 ETH +// const borrowAmount = ethers.utils.parseUnits("500", 18); // 500 LUSD +// const withdrawAmount = 0; +// const repayAmount = 0; +// const upperHint = ethers.constants.AddressZero; +// const lowerHint = ethers.constants.AddressZero; +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + +// const adjustSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "adjust", +// args: [ +// maxFeePercentage, +// depositAmount, +// withdrawAmount, +// borrowAmount, +// repayAmount, +// upperHint, +// lowerHint, +// [0, 0, 0, 0], +// [0, 0, 0, 0], +// ], +// }; + +// const adjustTx = await dsa +// .connect(userWallet) +// .cast(...encodeSpells([adjustSpell]), userWallet.address, { +// value: depositAmount, +// gasLimit: helpers.MAX_GAS, +// }); + +// const receipt = await adjustTx.wait(); +// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") +// .args; +// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( +// [ +// "address", +// "uint256", +// "uint256", +// "uint256", +// "uint256", +// "uint256", +// "uint256[]", +// "uint256[]", +// ], +// [ +// dsa.address, +// maxFeePercentage, +// depositAmount, +// withdrawAmount, +// borrowAmount, +// repayAmount, +// [0, 0, 0, 0], +// [0, 0, 0, 0], +// ] +// ); +// expect(castLogEvent.eventNames[0]).eq( +// "LogAdjust(address,uint256,uint256,uint256,uint256,uint256,uint256[],uint256[])" +// ); +// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); +// }); +// }); + +// describe("claimCollateralFromRedemption()", () => { +// it("claims collateral from a redeemed Trove", async () => { +// // Create a low collateralized Trove +// const depositAmount = ethers.utils.parseEther("1.5"); +// const borrowAmount = ethers.utils.parseUnits("2500", 18); + +// await helpers.createDsaTrove( +// dsa, +// userWallet, +// liquity, +// depositAmount, +// borrowAmount +// ); + +// // Redeem lots of LUSD to cause the Trove to become redeemed +// const redeemAmount = ethers.utils.parseUnits("10000000", 18); +// await helpers.sendToken( +// liquity.lusdToken, +// redeemAmount, +// contracts.STABILITY_POOL_ADDRESS, +// userWallet.address +// ); +// const { +// partialRedemptionHintNicr, +// firstRedemptionHint, +// upperHint, +// lowerHint, +// } = await helpers.getRedemptionHints(redeemAmount, liquity); +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + +// await liquity.troveManager +// .connect(userWallet) +// .redeemCollateral( +// redeemAmount, +// firstRedemptionHint, +// upperHint, +// lowerHint, +// partialRedemptionHintNicr, +// 0, +// maxFeePercentage, +// { +// gasLimit: helpers.MAX_GAS, // permit max gas +// } +// ); + +// const remainingEthCollateral = await liquity.collSurplus.getCollateral( +// dsa.address +// ); + +// // Claim the remaining collateral from the redeemed Trove +// const claimCollateralFromRedemptionSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "claimCollateralFromRedemption", +// args: [0], +// }; + +// await dsa +// .connect(userWallet) +// .cast( +// ...encodeSpells([claimCollateralFromRedemptionSpell]), +// userWallet.address +// ); + +// const ethBalance = await ethers.provider.getBalance(dsa.address); + +// expect(ethBalance).to.eq(remainingEthCollateral); +// }); + +// it("returns Instadapp event name and data", async () => { +// // Create a low collateralized Trove +// const depositAmount = ethers.utils.parseEther("1.5"); +// const borrowAmount = ethers.utils.parseUnits("2500", 18); + +// await helpers.createDsaTrove( +// dsa, +// userWallet, +// liquity, +// depositAmount, +// borrowAmount +// ); + +// // Redeem lots of LUSD to cause the Trove to become redeemed +// const redeemAmount = ethers.utils.parseUnits("10000000", 18); +// const setId = 0; +// await helpers.sendToken( +// liquity.lusdToken, +// redeemAmount, +// contracts.STABILITY_POOL_ADDRESS, +// userWallet.address +// ); +// const { +// partialRedemptionHintNicr, +// firstRedemptionHint, +// upperHint, +// lowerHint, +// } = await helpers.getRedemptionHints(redeemAmount, liquity); +// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + +// await liquity.troveManager +// .connect(userWallet) +// .redeemCollateral( +// redeemAmount, +// firstRedemptionHint, +// upperHint, +// lowerHint, +// partialRedemptionHintNicr, +// 0, +// maxFeePercentage, +// { +// gasLimit: helpers.MAX_GAS, // permit max gas +// } +// ); +// const claimAmount = await liquity.collSurplus.getCollateral( +// dsa.address +// ); + +// const claimCollateralFromRedemptionSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "claimCollateralFromRedemption", +// args: [setId], +// }; + +// const claimTx = await dsa +// .connect(userWallet) +// .cast( +// ...encodeSpells([claimCollateralFromRedemptionSpell]), +// userWallet.address +// ); + +// const receipt = await claimTx.wait(); +// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") +// .args; +// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( +// ["address", "uint256", "uint256"], +// [dsa.address, claimAmount, setId] +// ); +// expect(castLogEvent.eventNames[0]).eq( +// "LogClaimCollateralFromRedemption(address,uint256,uint256)" +// ); +// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); +// }); +// }); +// }); + +// describe("Stability Pool", () => { +// describe("stabilityDeposit()", () => { +// it("deposits into Stability Pool", async () => { +// const amount = ethers.utils.parseUnits("100", 18); +// const frontendTag = ethers.constants.AddressZero; + +// await helpers.sendToken( +// liquity.lusdToken, +// amount, +// contracts.STABILITY_POOL_ADDRESS, +// dsa.address +// ); + +// const stabilityDepositSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stabilityDeposit", +// args: [amount, frontendTag, 0, 0, 0, 0], +// }; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + +// const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( +// dsa.address +// ); +// expect(depositedAmount).to.eq(amount); +// }); + +// it("deposits into Stability Pool using LUSD collected from a previous spell", async () => { +// const amount = ethers.utils.parseUnits("100", 18); +// const frontendTag = ethers.constants.AddressZero; + +// await helpers.sendToken( +// liquity.lusdToken, +// amount, +// contracts.STABILITY_POOL_ADDRESS, +// userWallet.address +// ); +// const lusdDepositId = 1; + +// const depositLusdSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "deposit", +// args: [liquity.lusdToken.address, amount, 0, lusdDepositId], +// }; +// const stabilityDepositSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stabilityDeposit", +// args: [0, frontendTag, lusdDepositId, 0, 0, 0], +// }; +// const spells = [depositLusdSpell, stabilityDepositSpell]; + +// // Allow DSA to spend user's LUSD +// await liquity.lusdToken +// .connect(userWallet) +// .approve(dsa.address, amount); + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address); + +// const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( +// dsa.address +// ); +// expect(depositedAmount).to.eq(amount); +// }); + +// it("returns Instadapp event name and data", async () => { +// const amount = ethers.utils.parseUnits("100", 18); +// const halfAmount = amount.div(2); +// const frontendTag = ethers.constants.AddressZero; +// const getDepositId = 0; +// const setDepositId = 0; +// const setEthGainId = 0; +// const setLqtyGainId = 0; + +// await helpers.sendToken( +// liquity.lusdToken, +// amount, +// contracts.STABILITY_POOL_ADDRESS, +// dsa.address +// ); + +// const stabilityDepositSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stabilityDeposit", +// args: [ +// halfAmount, +// frontendTag, +// getDepositId, +// setDepositId, +// setEthGainId, +// setLqtyGainId, +// ], +// }; + +// // Create a Stability deposit for this DSA +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + +// // Liquidate a Trove to cause an ETH gain +// await liquity.troveManager.connect(userWallet).liquidateTroves(1, { +// gasLimit: helpers.MAX_GAS, +// }); + +// // Fast forward in time so we have an LQTY gain +// await provider.send("evm_increaseTime", [600]); +// await provider.send("evm_mine"); + +// // Create a Stability Pool deposit with a differen DSA so that LQTY gains can be calculated +// // See: https://github.com/liquity/dev/#lqty-reward-events-and-payouts +// const tempDsa = await buildDSAv2(userWallet.address); +// await helpers.sendToken( +// liquity.lusdToken, +// amount, +// contracts.STABILITY_POOL_ADDRESS, +// tempDsa.address +// ); +// await tempDsa +// .connect(userWallet) +// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + +// const ethGain = await liquity.stabilityPool.getDepositorETHGain( +// dsa.address +// ); +// const lqtyGain = await liquity.stabilityPool.getDepositorLQTYGain( +// dsa.address +// ); + +// // Top up the user's deposit so that we can track their ETH and LQTY gain +// const depositAgainTx = await dsa +// .connect(userWallet) +// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + +// const receipt = await depositAgainTx.wait(); +// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") +// .args; +// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( +// [ +// "address", +// "uint256", +// "uint256", +// "uint256", +// "address", +// "uint256", +// "uint256", +// "uint256", +// "uint256", +// ], +// [ +// dsa.address, +// halfAmount, +// ethGain, +// lqtyGain, +// frontendTag, +// getDepositId, +// setDepositId, +// setEthGainId, +// setLqtyGainId, +// ] +// ); +// expect(castLogEvent.eventNames[0]).eq( +// "LogStabilityDeposit(address,uint256,uint256,uint256,address,uint256,uint256,uint256,uint256)" +// ); +// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); +// }); +// }); + +// describe("stabilityWithdraw()", () => { +// it("withdraws from Stability Pool", async () => { +// // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool +// [liquity, dsa] = await helpers.resetInitialState( +// userWallet.address, +// contracts +// ); + +// // The current block number has liquidatable Troves. +// // Remove them otherwise Stability Pool withdrawals are disabled +// await liquity.troveManager.connect(userWallet).liquidateTroves(90, { +// gasLimit: helpers.MAX_GAS, +// }); + +// const amount = ethers.utils.parseUnits("100", 18); +// const frontendTag = ethers.constants.AddressZero; + +// await helpers.sendToken( +// liquity.lusdToken, +// amount, +// contracts.STABILITY_POOL_ADDRESS, +// dsa.address +// ); + +// const stabilityDepositSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stabilityDeposit", +// args: [amount, frontendTag, 0, 0, 0, 0], +// }; + +// // Withdraw half of the deposit +// const stabilityWithdrawSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stabilityWithdraw", +// args: [amount.div(2), 0, 0, 0, 0], +// }; +// const spells = [stabilityDepositSpell, stabilityWithdrawSpell]; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address); + +// const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( +// dsa.address +// ); +// const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); + +// expect(depositedAmount).to.eq(amount.div(2)); +// expect(dsaLusdBalance).to.eq(amount.div(2)); +// }); + +// it("withdraws from Stability Pool and stores the LUSD for other spells", async () => { +// // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool +// [liquity, dsa] = await helpers.resetInitialState( +// userWallet.address, +// contracts +// ); + +// // The current block number has liquidatable Troves. +// // Remove them otherwise Stability Pool withdrawals are disabled +// await liquity.troveManager.connect(userWallet).liquidateTroves(90, { +// gasLimit: helpers.MAX_GAS, +// }); +// const amount = ethers.utils.parseUnits("100", 18); +// const frontendTag = ethers.constants.AddressZero; +// const withdrawId = 1; + +// await helpers.sendToken( +// liquity.lusdToken, +// amount, +// contracts.STABILITY_POOL_ADDRESS, +// dsa.address +// ); + +// const stabilityDepositSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stabilityDeposit", +// args: [amount, frontendTag, 0, 0, 0, 0], +// }; + +// // Withdraw half of the deposit +// const stabilityWithdrawSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stabilityWithdraw", +// args: [amount.div(2), 0, 0, 0, withdrawId], +// }; + +// const withdrawLusdSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "withdraw", +// args: [ +// liquity.lusdToken.address, +// 0, +// userWallet.address, +// withdrawId, +// 0, +// ], +// }; + +// const spells = [ +// stabilityDepositSpell, +// stabilityWithdrawSpell, +// withdrawLusdSpell, +// ]; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address); + +// const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( +// dsa.address +// ); +// const walletLusdBalance = await liquity.lusdToken.balanceOf( +// dsa.address +// ); + +// expect(depositedAmount).to.eq(amount.div(2)); +// expect(walletLusdBalance).to.eq(amount.div(2)); +// }); + +// it("returns Instadapp event name and data", async () => { +// // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool +// [liquity, dsa] = await helpers.resetInitialState( +// userWallet.address, +// contracts +// ); + +// const amount = ethers.utils.parseUnits("100", 18); +// const frontendTag = ethers.constants.AddressZero; + +// await helpers.sendToken( +// liquity.lusdToken, +// amount, +// contracts.STABILITY_POOL_ADDRESS, +// dsa.address +// ); + +// const stabilityDepositSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stabilityDeposit", +// args: [amount, frontendTag, 0, 0, 0, 0], +// }; + +// // Withdraw half of the deposit +// const withdrawAmount = amount.div(2); +// const getWithdrawId = 0; +// const setWithdrawId = 0; +// const setEthGainId = 0; +// const setLqtyGainId = 0; + +// // Create a Stability Pool deposit +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + +// // The current block number has liquidatable Troves. +// // Remove them otherwise Stability Pool withdrawals are disabled +// await liquity.troveManager.connect(userWallet).liquidateTroves(90, { +// gasLimit: helpers.MAX_GAS, +// }); + +// // Fast forward in time so we have an LQTY gain +// await provider.send("evm_increaseTime", [600]); +// await provider.send("evm_mine"); + +// // Create another Stability Pool deposit so that LQTY gains are realized +// // See: https://github.com/liquity/dev/#lqty-reward-events-and-payouts +// const tempDsa = await buildDSAv2(userWallet.address); +// await helpers.sendToken( +// liquity.lusdToken, +// amount, +// contracts.STABILITY_POOL_ADDRESS, +// tempDsa.address +// ); +// await tempDsa +// .connect(userWallet) +// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + +// const ethGain = await liquity.stabilityPool.getDepositorETHGain( +// dsa.address +// ); +// const lqtyGain = await liquity.stabilityPool.getDepositorLQTYGain( +// dsa.address +// ); + +// const stabilityWithdrawSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stabilityWithdraw", +// args: [ +// withdrawAmount, +// getWithdrawId, +// setWithdrawId, +// setEthGainId, +// setLqtyGainId, +// ], +// }; + +// const withdrawTx = await dsa +// .connect(userWallet) +// .cast( +// ...encodeSpells([stabilityWithdrawSpell]), +// userWallet.address +// ); + +// const receipt = await withdrawTx.wait(); +// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") +// .args; +// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( +// [ +// "address", +// "uint256", +// "uint256", +// "uint256", +// "uint256", +// "uint256", +// "uint256", +// "uint256", +// ], +// [ +// dsa.address, +// withdrawAmount, +// ethGain, +// lqtyGain, +// getWithdrawId, +// setWithdrawId, +// setEthGainId, +// setLqtyGainId, +// ] +// ); +// expect(castLogEvent.eventNames[0]).eq( +// "LogStabilityWithdraw(address,uint256,uint256,uint256,uint256,uint256,uint256,uint256)" +// ); +// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); +// }); +// }); + +// describe("stabilityMoveEthGainToTrove()", () => { +// beforeEach(async () => { +// // Start these test from fresh so that we definitely have a liquidatable Trove within this block +// [liquity, dsa] = await helpers.resetInitialState( +// userWallet.address, +// contracts +// ); +// }); + +// it("moves ETH gain from Stability Pool to Trove", async () => { +// // Create a DSA owned Trove to capture ETH liquidation gains +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); +// const troveCollateralBefore = await liquity.troveManager.getTroveColl( +// dsa.address +// ); + +// // Create a Stability Deposit using the Trove's borrowed LUSD +// const amount = ethers.utils.parseUnits("100", 18); +// const frontendTag = ethers.constants.AddressZero; +// const stabilityDepositSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stabilityDeposit", +// args: [amount, frontendTag, 0, 0, 0, 0], +// }; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + +// // Liquidate a Trove to create an ETH gain for the new DSA Trove +// await liquity.troveManager +// .connect(userWallet) +// .liquidate(helpers.LIQUIDATABLE_TROVE_ADDRESS, { +// gasLimit: helpers.MAX_GAS, // permit max gas +// }); + +// const ethGainFromLiquidation = await liquity.stabilityPool.getDepositorETHGain( +// dsa.address +// ); + +// // Move ETH gain to Trove +// const moveEthGainSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stabilityMoveEthGainToTrove", +// args: [ethers.constants.AddressZero, ethers.constants.AddressZero], +// }; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([moveEthGainSpell]), userWallet.address); + +// const ethGainAfterMove = await liquity.stabilityPool.getDepositorETHGain( +// dsa.address +// ); +// const troveCollateral = await liquity.troveManager.getTroveColl( +// dsa.address +// ); +// const expectedTroveCollateral = troveCollateralBefore.add( +// ethGainFromLiquidation +// ); +// expect(ethGainAfterMove).to.eq(0); +// expect(troveCollateral).to.eq(expectedTroveCollateral); +// }); + +// it("returns Instadapp event name and data", async () => { +// // Create a DSA owned Trove to capture ETH liquidation gains +// // Create a dummy Trove +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// // Create a Stability Deposit using the Trove's borrowed LUSD +// const amount = ethers.utils.parseUnits("100", 18); +// const frontendTag = ethers.constants.AddressZero; +// const stabilityDepositSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stabilityDeposit", +// args: [amount, frontendTag, 0, 0, 0, 0], +// }; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + +// // Liquidate a Trove to create an ETH gain for the new DSA Trove +// await liquity.troveManager +// .connect(userWallet) +// .liquidate(helpers.LIQUIDATABLE_TROVE_ADDRESS, { +// gasLimit: helpers.MAX_GAS, // permit max gas +// }); + +// const ethGainFromLiquidation = await liquity.stabilityPool.getDepositorETHGain( +// dsa.address +// ); + +// // Move ETH gain to Trove +// const moveEthGainSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stabilityMoveEthGainToTrove", +// args: [ethers.constants.AddressZero, ethers.constants.AddressZero], +// }; + +// const moveEthGainTx = await dsa +// .connect(userWallet) +// .cast(...encodeSpells([moveEthGainSpell]), userWallet.address); + +// const receipt = await moveEthGainTx.wait(); + +// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") +// .args; +// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( +// ["address", "uint256"], +// [dsa.address, ethGainFromLiquidation] +// ); +// expect(castLogEvent.eventNames[0]).eq( +// "LogStabilityMoveEthGainToTrove(address,uint256)" +// ); +// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); +// }); +// }); +// }); + +// describe("Staking", () => { +// describe("stake()", () => { +// it("stakes LQTY", async () => { +// const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( +// contracts.STAKING_ADDRESS +// ); + +// const amount = ethers.utils.parseUnits("1", 18); +// await helpers.sendToken( +// liquity.lqtyToken, +// amount, +// helpers.JUSTIN_SUN_ADDRESS, +// dsa.address +// ); + +// const stakeSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stake", +// args: [amount, 0, 0, 0, 0], +// }; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([stakeSpell]), userWallet.address); + +// const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); +// expect(lqtyBalance).to.eq(0); + +// const totalStakingBalance = await liquity.lqtyToken.balanceOf( +// contracts.STAKING_ADDRESS +// ); +// expect(totalStakingBalance).to.eq( +// totalStakingBalanceBefore.add(amount) +// ); +// }); + +// it("stakes LQTY using LQTY obtained from a previous spell", async () => { +// const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( +// contracts.STAKING_ADDRESS +// ); + +// const amount = ethers.utils.parseUnits("1", 18); +// await helpers.sendToken( +// liquity.lqtyToken, +// amount, +// helpers.JUSTIN_SUN_ADDRESS, +// userWallet.address +// ); + +// const lqtyDepositId = 1; +// const depositSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "deposit", +// args: [liquity.lqtyToken.address, amount, 0, lqtyDepositId], +// }; +// const stakeSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stake", +// args: [0, lqtyDepositId, 0, 0, 0], +// }; +// const spells = [depositSpell, stakeSpell]; + +// // Allow DSA to spend user's LQTY +// await liquity.lqtyToken +// .connect(userWallet) +// .approve(dsa.address, amount); + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address); + +// const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); +// expect(lqtyBalance).to.eq(0); + +// const totalStakingBalance = await liquity.lqtyToken.balanceOf( +// contracts.STAKING_ADDRESS +// ); +// expect(totalStakingBalance).to.eq( +// totalStakingBalanceBefore.add(amount) +// ); +// }); + +// it("returns Instadapp event name and data", async () => { +// const amount = ethers.utils.parseUnits("1", 18); +// await helpers.sendToken( +// liquity.lqtyToken, +// amount, +// helpers.JUSTIN_SUN_ADDRESS, +// dsa.address +// ); + +// const getStakeId = 0; +// const setStakeId = 0; +// const setEthGainId = 0; +// const setLusdGainId = 0; +// const stakeSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stake", +// args: [amount, getStakeId, setStakeId, setEthGainId, setLusdGainId], +// }; + +// const stakeTx = await dsa +// .connect(userWallet) +// .cast(...encodeSpells([stakeSpell]), userWallet.address); + +// const receipt = await stakeTx.wait(); + +// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") +// .args; +// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( +// ["address", "uint256", "uint256", "uint256", "uint256", "uint256"], +// [ +// dsa.address, +// amount, +// getStakeId, +// setStakeId, +// setEthGainId, +// setLusdGainId, +// ] +// ); +// expect(castLogEvent.eventNames[0]).eq( +// "LogStake(address,uint256,uint256,uint256,uint256,uint256)" +// ); +// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); +// }); +// }); + +// describe("unstake()", () => { +// it("unstakes LQTY", async () => { +// const amount = ethers.utils.parseUnits("1", 18); +// await helpers.sendToken( +// liquity.lqtyToken, +// amount, +// helpers.JUSTIN_SUN_ADDRESS, +// dsa.address +// ); + +// const stakeSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stake", +// args: [amount, 0, 0, 0, 0], +// }; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([stakeSpell]), userWallet.address); + +// const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( +// contracts.STAKING_ADDRESS +// ); +// const unstakeSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "unstake", +// args: [amount, 0, 0, 0, 0], +// }; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([unstakeSpell]), userWallet.address); + +// const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); +// expect(lqtyBalance).to.eq(amount); + +// const totalStakingBalance = await liquity.lqtyToken.balanceOf( +// contracts.STAKING_ADDRESS +// ); +// expect(totalStakingBalance).to.eq( +// totalStakingBalanceBefore.sub(amount) +// ); +// }); + +// it("unstakes LQTY and stores the LQTY for other spells", async () => { +// const amount = ethers.utils.parseUnits("1", 18); +// await helpers.sendToken( +// liquity.lqtyToken, +// amount, +// helpers.JUSTIN_SUN_ADDRESS, +// dsa.address +// ); + +// const stakeSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stake", +// args: [amount, 0, 0, 0, 0], +// }; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([stakeSpell]), userWallet.address); + +// const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( +// contracts.STAKING_ADDRESS +// ); +// const withdrawId = 1; +// const unstakeSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "unstake", +// args: [amount, 0, withdrawId, 0, 0], +// }; + +// const withdrawLqtySpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "withdraw", +// args: [ +// liquity.lqtyToken.address, +// 0, +// userWallet.address, +// withdrawId, +// 0, +// ], +// }; +// const spells = [unstakeSpell, withdrawLqtySpell]; +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address); + +// const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); +// const totalStakingBalance = await liquity.lqtyToken.balanceOf( +// contracts.STAKING_ADDRESS +// ); +// const userLqtyBalance = await liquity.lqtyToken.balanceOf( +// userWallet.address +// ); +// expect(lqtyBalance).to.eq(0); +// expect(totalStakingBalance).to.eq( +// totalStakingBalanceBefore.sub(amount) +// ); +// expect(userLqtyBalance).to.eq(amount); +// }); + +// it("returns Instadapp event name and data", async () => { +// const amount = ethers.utils.parseUnits("1", 18); +// await helpers.sendToken( +// liquity.lqtyToken, +// amount, +// helpers.JUSTIN_SUN_ADDRESS, +// dsa.address +// ); + +// const stakeSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stake", +// args: [amount, 0, 0, 0, 0], +// }; + +// await dsa +// .connect(userWallet) +// .cast(...encodeSpells([stakeSpell]), userWallet.address); + +// const getUnstakeId = 0; +// const setUnstakeId = 0; +// const setEthGainId = 0; +// const setLusdGainId = 0; +// const unstakeSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "unstake", +// args: [ +// amount, +// getUnstakeId, +// setUnstakeId, +// setEthGainId, +// setLusdGainId, +// ], +// }; + +// const unstakeTx = await dsa +// .connect(userWallet) +// .cast(...encodeSpells([unstakeSpell]), userWallet.address); + +// const receipt = await unstakeTx.wait(); + +// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") +// .args; +// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( +// ["address", "uint256", "uint256", "uint256", "uint256", "uint256"], +// [ +// dsa.address, +// amount, +// getUnstakeId, +// setUnstakeId, +// setEthGainId, +// setLusdGainId, +// ] +// ); +// expect(castLogEvent.eventNames[0]).eq( +// "LogUnstake(address,uint256,uint256,uint256,uint256,uint256)" +// ); +// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); +// }); +// }); + +// describe("claimStakingGains()", () => { +// it("claims gains from staking", async () => { +// const stakerDsa = await buildDSAv2(userWallet.address); +// const amount = ethers.utils.parseUnits("1000", 18); // 1000 LQTY + +// // Stake lots of LQTY +// await helpers.sendToken( +// liquity.lqtyToken, +// amount, +// helpers.JUSTIN_SUN_ADDRESS, +// stakerDsa.address +// ); +// const stakeSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stake", +// args: [amount, 0, 0, 0, 0], +// }; +// await stakerDsa +// .connect(userWallet) +// .cast(...encodeSpells([stakeSpell]), userWallet.address); + +// // Open a Trove to cause an ETH issuance gain for stakers +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// // Redeem some ETH to cause an LUSD redemption gain for stakers +// await helpers.redeem( +// ethers.utils.parseUnits("1000", 18), +// contracts.STABILITY_POOL_ADDRESS, +// userWallet, +// liquity +// ); + +// const setEthGainId = 0; +// const setLusdGainId = 0; +// const ethGain = await liquity.staking.getPendingETHGain( +// stakerDsa.address +// ); +// const lusdGain = await liquity.staking.getPendingLUSDGain( +// stakerDsa.address +// ); + +// const claimStakingGainsSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "claimStakingGains", +// args: [setEthGainId, setLusdGainId], +// }; + +// const ethBalanceBefore = await ethers.provider.getBalance( +// stakerDsa.address +// ); + +// // Claim gains +// await stakerDsa +// .connect(userWallet) +// .cast( +// ...encodeSpells([claimStakingGainsSpell]), +// userWallet.address +// ); + +// const ethBalanceAfter = await ethers.provider.getBalance( +// stakerDsa.address +// ); +// const lusdBalanceAfter = await liquity.lusdToken.balanceOf( +// stakerDsa.address +// ); +// expect(ethBalanceAfter).to.eq(ethBalanceBefore.add(ethGain)); +// expect(lusdBalanceAfter).to.eq(lusdGain); +// }); + +// it("claims gains from staking and stores them for other spells", async () => { +// const stakerDsa = await buildDSAv2(userWallet.address); +// const amount = ethers.utils.parseUnits("1000", 18); // 1000 LQTY + +// // Stake lots of LQTY +// await helpers.sendToken( +// liquity.lqtyToken, +// amount, +// helpers.JUSTIN_SUN_ADDRESS, +// stakerDsa.address +// ); +// const stakeSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stake", +// args: [amount, 0, 0, 0, 0], +// }; +// await stakerDsa +// .connect(userWallet) +// .cast(...encodeSpells([stakeSpell]), userWallet.address); + +// // Open a Trove to cause an ETH issuance gain for stakers +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// // Redeem some ETH to cause an LUSD redemption gain for stakers +// await helpers.redeem( +// ethers.utils.parseUnits("1000", 18), +// contracts.STABILITY_POOL_ADDRESS, +// userWallet, +// liquity +// ); + +// const ethGain = await liquity.staking.getPendingETHGain( +// stakerDsa.address +// ); +// const lusdGain = await liquity.staking.getPendingLUSDGain( +// stakerDsa.address +// ); +// const lusdBalanceBefore = await liquity.lusdToken.balanceOf( +// userWallet.address +// ); +// const ethBalanceBefore = await ethers.provider.getBalance( +// userWallet.address +// ); +// const ethGainId = 111; +// const lusdGainId = 222; + +// const claimStakingGainsSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "claimStakingGains", +// args: [ethGainId, lusdGainId], +// }; + +// const withdrawEthSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "withdraw", +// args: [helpers.ETH_ADDRESS, 0, userWallet.address, ethGainId, 0], +// }; + +// const withdrawLusdSpell = { +// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, +// method: "withdraw", +// args: [ +// liquity.lusdToken.address, +// 0, +// userWallet.address, +// lusdGainId, +// 0, +// ], +// }; + +// const spells = [ +// claimStakingGainsSpell, +// withdrawEthSpell, +// withdrawLusdSpell, +// ]; + +// // Claim gains +// await stakerDsa +// .connect(userWallet) +// .cast(...encodeSpells(spells), userWallet.address, { +// gasPrice: 0, +// }); + +// const ethBalanceAfter = await ethers.provider.getBalance( +// userWallet.address +// ); +// const lusdBalanceAfter = await liquity.lusdToken.balanceOf( +// userWallet.address +// ); + +// expect( +// ethBalanceAfter, +// "User's ETH balance should have increased by the issuance gain from staking" +// ).to.eq(ethBalanceBefore.add(ethGain)); +// expect( +// lusdBalanceAfter, +// "User's LUSD balance should have increased by the redemption gain from staking" +// ).to.eq(lusdBalanceBefore.add(lusdGain)); +// }); + +// it("returns Instadapp event name and data", async () => { +// const stakerDsa = await buildDSAv2(userWallet.address); +// const amount = ethers.utils.parseUnits("1000", 18); // 1000 LQTY + +// // Stake lots of LQTY +// await helpers.sendToken( +// liquity.lqtyToken, +// amount, +// helpers.JUSTIN_SUN_ADDRESS, +// stakerDsa.address +// ); +// const stakeSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "stake", +// args: [amount, 0, 0, 0, 0], +// }; +// await stakerDsa +// .connect(userWallet) +// .cast(...encodeSpells([stakeSpell]), userWallet.address); + +// // Open a Trove to cause an ETH issuance gain for stakers +// await helpers.createDsaTrove(dsa, userWallet, liquity); + +// // Redeem some ETH to cause an LUSD redemption gain for stakers +// await helpers.redeem( +// ethers.utils.parseUnits("1000", 18), +// contracts.STABILITY_POOL_ADDRESS, +// userWallet, +// liquity +// ); + +// const setEthGainId = 0; +// const setLusdGainId = 0; +// const ethGain = await liquity.staking.getPendingETHGain( +// stakerDsa.address +// ); +// const lusdGain = await liquity.staking.getPendingLUSDGain( +// stakerDsa.address +// ); + +// const claimStakingGainsSpell = { +// connector: helpers.LIQUITY_CONNECTOR, +// method: "claimStakingGains", +// args: [setEthGainId, setLusdGainId], +// }; + +// // Claim gains +// const claimGainsTx = await stakerDsa +// .connect(userWallet) +// .cast( +// ...encodeSpells([claimStakingGainsSpell]), +// userWallet.address +// ); + +// const receipt = await claimGainsTx.wait(); + +// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") +// .args; +// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( +// ["address", "uint256", "uint256", "uint256", "uint256"], +// [stakerDsa.address, ethGain, lusdGain, setEthGainId, setLusdGainId] +// ); +// expect(castLogEvent.eventNames[0]).eq( +// "LogClaimStakingGains(address,uint256,uint256,uint256,uint256)" +// ); +// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); +// }); +// }); +// }); +// }); +// }); diff --git a/test/mainnet/pooltogether/pooltogether.test.ts b/test/mainnet/pooltogether/pooltogether.test.ts index 610a3bbe..272f4460 100644 --- a/test/mainnet/pooltogether/pooltogether.test.ts +++ b/test/mainnet/pooltogether/pooltogether.test.ts @@ -1,1225 +1,1225 @@ -import { expect } from "chai"; -import hre from "hardhat"; -const { web3, deployments, waffle, ethers } = hre; -const { provider, deployContract } = waffle; - -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; -import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; -import { encodeSpells } from "../../../scripts/tests/encodeSpells"; -import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; - -import { addresses } from "../../../scripts/constant/addresses"; -import { abis } from "../../../scripts/constant/abis"; -import { constants } from "../../../scripts/constant/constant"; -import { tokens } from "../../../scripts/constant/tokens"; -import type { Signer, Contract } from "ethers"; - -import { - ConnectV2Compound__factory, - ConnectV2PoolTogether__factory, - ConnectV2UniswapV2__factory, -} from "../../../typechain"; - -const DAI_TOKEN_ADDR = tokens.dai.address; // DAI Token - -// PoolTogether Address: https://docs.pooltogether.com/resources/networks/ethereum -const DAI_PRIZE_POOL_ADDR = "0xEBfb47A7ad0FD6e57323C8A42B2E5A6a4F68fc1a"; // DAI Prize Pool -const PT_DAI_TICKET_ADDR = "0x334cBb5858417Aee161B53Ee0D5349cCF54514CF"; // PT DAI Ticket -const DAI_POOL_FAUCET_ADDR = "0xF362ce295F2A4eaE4348fFC8cDBCe8d729ccb8Eb"; // DAI POOL Faucet -const POOL_TOKEN_ADDRESS = "0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e"; // POOL Tocken -const TOKEN_FAUCET_PROXY_FACTORY_ADDR = - "0xE4E9cDB3E139D7E8a41172C20b6Ed17b6750f117"; // TokenFaucetProxyFactory for claimAll -const DAI_POD_ADDR = "0x2f994e2E4F3395649eeE8A89092e63Ca526dA829"; // DAI Pod -const UNISWAP_POOLETHLP_PRIZE_POOL_ADDR = - "0x3AF7072D29Adde20FC7e173a7CB9e45307d2FB0A"; // Uniswap Pool/ETH LP PrizePool -const UNISWAP_POOLETHLP_FAUCET_ADDR = - "0x9A29401EF1856b669f55Ae5b24505b3B6fAEb370"; // Uniswap Pool/ETH LP Faucet -const UNISWAP_POOLETHLP_TOKEN_ADDR = - "0x85cb0bab616fe88a89a35080516a8928f38b518b"; // Uniswap Pool/ETH Token -const PT_UNISWAP_POOLETHLP_TICKET_ADDR = - "0xeb8928ee92efb06c44d072a24c2bcb993b61e543"; // Pool Together Uniswap Pool/ETH LP Ticket -const POOL_PRIZE_POOL_ADDR = "0x396b4489da692788e327e2e4b2b0459a5ef26791"; // POOL Prize Pool -const PT_POOL_TICKET_ADDR = "0x27d22a7648e955e510a40bdb058333e9190d12d4"; // Pool Together POOL Ticket -const WETH_ADDR = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; // WETH -const DAI_POD_TOKEN_DROP = "0xc5209623E3dFdf9C0cCbe497c8012883C4147731"; - -// Community WETH Prize Pool (Rari): https://reference-app.pooltogether.com/pools/mainnet/0xa88ca010b32a54d446fc38091ddbca55750cbfc3/manage#stats -const WETH_PRIZE_POOL_ADDR = "0xa88ca010b32a54d446fc38091ddbca55750cbfc3"; // Community WETH Prize Pool (Rari) -const WETH_POOL_TICKET_ADDR = "0x9b5c30aeb9ce2a6a121cea9a85bc0d662f6d9b40"; // Community WETH Prize Pool Ticket (Rari) - -const prizePoolABI = [ - "function calculateEarlyExitFee( address from, address controlledToken, uint256 amount) external returns ( uint256 exitFee, uint256 burnedCredit)", -]; - -const podABI = [ - "function getEarlyExitFee(uint256 amount) external returns (uint256)", - "function balanceOfUnderlying(address user) external view returns (uint256 amount)", - "function drop() public returns (uint256)", - "function balanceOf(address account) external view returns (uint256)", -]; - -const POD_FACTORY_ADDRESS = "0x4e3a9f9fbafb2ec49727cffa2a411f7a0c1c4ce1"; -const podFactoryABI = [ - "function create( address _prizePool, address _ticket, address _faucet, address _manager, uint8 _decimals) external returns (address pod)", -]; - -const tokenDropABI = [ - "function claim(address user) external returns (uint256)", -]; - -describe("PoolTogether", function() { - const connectorName = "COMPOUND-TEST-A"; - const uniswapConnectorName = "UNISWAP-TEST-A"; - const ptConnectorName = "POOLTOGETHER-TEST-A"; - - let dsaWallet0: any; - let masterSigner: Signer; - let instaConnectorsV2: Contract; - let connector: any; - let ptConnector: any; - let uniswapConnector: any; - - const wallets = provider.getWallets(); - const [wallet0, wallet1, wallet2, wallet3] = wallets; - before(async () => { - masterSigner = await getMasterSigner(); - instaConnectorsV2 = await ethers.getContractAt( - abis.core.connectorsV2, - addresses.core.connectorsV2 - ); - - // Deploy and enable Compound Connector - connector = await deployAndEnableConnector({ - connectorName, - contractArtifact: ConnectV2Compound__factory, - signer: masterSigner, - connectors: instaConnectorsV2, - }); - - // Deploy and enable Pool Together Connector - ptConnector = await deployAndEnableConnector({ - connectorName: ptConnectorName, - contractArtifact: ConnectV2PoolTogether__factory, - signer: masterSigner, - connectors: instaConnectorsV2, - }); - - // Deploy and enable Uniswap Connector - uniswapConnector = await deployAndEnableConnector({ - connectorName: uniswapConnectorName, - contractArtifact: ConnectV2UniswapV2__factory, - signer: masterSigner, - connectors: instaConnectorsV2, - }); - }); - - it("Should have contracts deployed.", async function() { - expect(!!instaConnectorsV2.address).to.be.true; - expect(!!connector.address).to.be.true; - expect(!!ptConnector.address).to.be.true; - expect(!!uniswapConnector.address).to.be.true; - expect(!!(await masterSigner.getAddress())).to.be.true; - }); - - describe("DSA wallet setup", function() { - it("Should build DSA v2", async function() { - dsaWallet0 = await buildDSAv2(wallet0.address); - expect(!!dsaWallet0.address).to.be.true; - }); - - it("Deposit 10 ETH into DSA wallet", async function() { - await wallet0.sendTransaction({ - to: dsaWallet0.address, - value: ethers.utils.parseEther("10"), - }); - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte( - ethers.utils.parseEther("10") - ); - }); - }); - - describe("Main - DAI Prize Pool Test", function() { - it("Should deposit 1 ETH in Compound", async function() { - const amount = ethers.utils.parseEther("1"); // 1 ETH - const spells = [ - { - connector: connectorName, - method: "deposit", - args: ["ETH-A", amount, 0, 0], - }, - ]; - - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); - const receipt = await tx.wait(); - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( - ethers.utils.parseEther("9") - ); - }); - - it("Should borrow 100 DAI from Compound and deposit DAI into DAI Prize Pool", async function() { - const amount = ethers.utils.parseEther("100"); // 100 DAI - const setId = "83478237"; - const spells = [ - { - connector: connectorName, - method: "borrow", - args: ["DAI-A", amount, 0, setId], - }, - { - connector: ptConnectorName, - method: "depositTo", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, setId, 0], - }, - ]; - // Before Spell - let daiToken = await ethers.getContractAt( - abis.basic.erc20, - DAI_TOKEN_ADDR - ); - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance is 0`).to.be.eq( - ethers.utils.parseEther("0") - ); - - let cToken = await ethers.getContractAt( - abis.basic.erc20, - PT_DAI_TICKET_ADDR - ); - const balance = await cToken.balanceOf(dsaWallet0.address); - expect(balance, `PoolTogether DAI Ticket balance is 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); - const receipt = await tx.wait(); - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect( - daiBalance, - `Expect DAI balance to still equal 0 since it was deposited into Prize Pool` - ).to.be.eq(0); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address); - expect( - balanceAfter, - `PoolTogether DAI Ticket balance equals 100` - ).to.be.eq(ethers.utils.parseEther("100")); - - // ETH used for transaction - expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( - ethers.utils.parseEther("9") - ); - }); - - it("Should wait 11 days, withdraw all PrizePool, get back 100 DAI, and claim POOL", async function() { - const amount = ethers.utils.parseEther("100"); // 100 DAI - - let prizePoolContract = new ethers.Contract( - DAI_PRIZE_POOL_ADDR, - prizePoolABI, - ethers.provider - ); - let earlyExitFee = await prizePoolContract.callStatic[ - "calculateEarlyExitFee" - ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); - expect( - earlyExitFee.exitFee, - "Exit Fee equal to 1 DAI because starts at 10%" - ).to.be.eq(ethers.utils.parseEther("1")); - - const spells = [ - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [ - DAI_PRIZE_POOL_ADDR, - amount, - PT_DAI_TICKET_ADDR, - earlyExitFee.exitFee, - 0, - 0, - ], - }, - { - connector: ptConnectorName, - method: "claim", - args: [DAI_POOL_FAUCET_ADDR, 0], - }, - ]; - - // Before spell - let daiToken = await ethers.getContractAt( - abis.basic.erc20, - DAI_TOKEN_ADDR - ); - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance equals 0`).to.be.eq( - ethers.utils.parseEther("0") - ); - - let cToken = await ethers.getContractAt( - abis.basic.erc20, - PT_DAI_TICKET_ADDR - ); - const balance = await cToken.balanceOf(dsaWallet0.address); - expect(balance, `PoolTogether Dai Ticket is 100`).to.be.eq( - ethers.utils.parseEther("100") - ); - - let poolToken = await ethers.getContractAt( - abis.basic.erc20, - POOL_TOKEN_ADDRESS - ); - const poolBalance = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalance, `POOL Token equals 0`).to.be.eq( - ethers.utils.parseEther("0") - ); - - // Increase time by 11 days so we get back all DAI without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); - - earlyExitFee = await prizePoolContract.callStatic[ - "calculateEarlyExitFee" - ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); - expect( - earlyExitFee.exitFee, - "Exit Fee equal to 0 DAI because past 10 days" - ).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); - const receipt = await tx.wait(); - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect( - daiBalance, - `DAI balance to be equal to 100, because of no early withdrawal fee` - ).to.be.eq(ethers.utils.parseEther("100")); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address); - expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); - expect( - poolBalanceAfter, - `POOL Token Balance to be greater than 0` - ).to.be.gt(ethers.utils.parseEther("0")); - }); - - it("Should deposit and withdraw all PrizePool, get back less than 100 DAI", async function() { - const amount = ethers.utils.parseEther("100"); // 100 DAI - const exitFee = ethers.utils.parseEther("1"); // 1 DAI is 10% of 100 DAI - const spells = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0], - }, - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [ - DAI_PRIZE_POOL_ADDR, - amount, - PT_DAI_TICKET_ADDR, - exitFee, - 0, - 0, - ], - }, - ]; - - // Before spell - let daiToken = await ethers.getContractAt( - abis.basic.erc20, - DAI_TOKEN_ADDR - ); - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI Balance equals 0`).to.be.eq( - ethers.utils.parseEther("100") - ); - - let cToken = await ethers.getContractAt( - abis.basic.erc20, - PT_DAI_TICKET_ADDR - ); - const balance = await cToken.balanceOf(dsaWallet0.address); - expect(balance, `PoolTogether DAI Ticket equals 0`).to.be.eq(0); - - let poolToken = await ethers.getContractAt( - abis.basic.erc20, - POOL_TOKEN_ADDRESS - ); - const poolBalance = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalance, `PoolTogether Token greater than 0`).to.be.gt(0); - - // Run spell transaction - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); - const receipt = await tx.wait(); - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect( - daiBalance, - `DAI balance to be less than 100, because of early withdrawal fee` - ).to.be.lt(ethers.utils.parseEther("100")); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address); - expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalanceAfter, `POOL Token Balance to greater than 0`).to.be.gt( - ethers.utils.parseEther("0") - ); - }); - - it("Should deposit, wait 11 days, and withdraw all PrizePool, get 99 DAI, and claim all POOL using claimAll", async function() { - const amount = ethers.utils.parseEther("99"); // 99 DAI - const depositSpells = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0], - }, - ]; - - // Before spell - let daiToken = await ethers.getContractAt( - abis.basic.erc20, - DAI_TOKEN_ADDR - ); - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance less than 100`).to.be.lt( - ethers.utils.parseEther("100") - ); - - let cToken = await ethers.getContractAt( - abis.basic.erc20, - PT_DAI_TICKET_ADDR - ); - const balance = await cToken.balanceOf(dsaWallet0.address); - expect(balance, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); - - let poolToken = await ethers.getContractAt( - abis.basic.erc20, - POOL_TOKEN_ADDRESS - ); - const poolBalance = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalance, `POOL Token is greater than 0`).to.be.gt( - ethers.utils.parseEther("0") - ); - - // Run spell transaction - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(depositSpells), wallet1.address); - const receipt = await tx.wait(); - - const prizePoolContract = new ethers.Contract( - DAI_PRIZE_POOL_ADDR, - prizePoolABI, - ethers.provider - ); - let earlyExitFee = await prizePoolContract.callStatic[ - "calculateEarlyExitFee" - ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); - expect( - earlyExitFee.exitFee, - "Exit Fee equal to .99 DAI because starts at 10%" - ).to.be.eq(ethers.utils.parseEther(".99")); - - // Increase time by 11 days so we get back all DAI without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); - - earlyExitFee = await prizePoolContract.callStatic[ - "calculateEarlyExitFee" - ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); - expect( - earlyExitFee.exitFee, - "Exit Fee equal to 0 DAI because past 10 days" - ).to.be.eq(0); - - const withdrawSpells = [ - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [ - DAI_PRIZE_POOL_ADDR, - amount, - PT_DAI_TICKET_ADDR, - earlyExitFee.exitFee, - 0, - 0, - ], - }, - { - connector: ptConnectorName, - method: "claimAll", - args: [TOKEN_FAUCET_PROXY_FACTORY_ADDR, [DAI_POOL_FAUCET_ADDR]], - }, - ]; - - // Run spell transaction - const tx2 = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(withdrawSpells), wallet1.address); - const receipt2 = await tx2.wait(); - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance equals 99`).to.be.eq( - ethers.utils.parseEther("99") - ); - - const balanceAfter = await cToken.balanceOf(dsaWallet0.address); - expect(balanceAfter, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); - - // Expect - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalanceAfter, `Pool Token to be greateir than 0`).to.be.gt( - ethers.utils.parseEther("0") - ); - }); - }); - - describe("Main - DAI Pod Test", function() { - it("Should deposit 99 DAI in DAI Pod", async function() { - const amount = ethers.utils.parseEther("99"); // 99 DAI - const spells = [ - { - connector: ptConnectorName, - method: "depositToPod", - args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0], - }, - ]; - - // Before spell - let daiToken = await ethers.getContractAt( - abis.basic.erc20, - DAI_TOKEN_ADDR - ); - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI balance equals 99`).to.be.eq( - ethers.utils.parseEther("99") - ); - - let poolToken = await ethers.getContractAt( - abis.basic.erc20, - POOL_TOKEN_ADDRESS - ); - const poolBalance = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); - const podBalance = await podToken.balanceOf(dsaWallet0.address); - expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); - const receipt = await tx.wait(); - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI equals 0`).to.be.eq(0); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalanceAfter, `POOL Token greater than 0`).to.be.gt(0); - - const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); - expect(podBalanceAfter, `Pod DAI token greater than 0`).to.be.eq( - ethers.utils.parseEther("99") - ); - }); - - it("Should claim rewards from pod token drop", async function() { - const spells = [ - { - connector: ptConnectorName, - method: "claimPodTokenDrop", - args: [DAI_POD_TOKEN_DROP, 0], - }, - ]; - - const tokenDropContract = new ethers.Contract( - DAI_POD_TOKEN_DROP, - tokenDropABI, - ethers.provider - ); - const podContract = new ethers.Contract( - DAI_POD_ADDR, - podABI, - masterSigner - ); - - // drop(): Claim TokenDrop asset for PrizePool Pod and transfers token(s) to external Pod TokenDrop - // dropt() also calls batch which, Deposit Pod float into PrizePool. Deposits the current float - // amount into the PrizePool and claims current POOL rewards. - const dropTx = await podContract.drop(); - await dropTx.wait(); - - // POOL Rewards able to claim from Pod Token Drop - let claimAmount = await tokenDropContract.callStatic["claim"]( - dsaWallet0.address - ); - - // Before spell - let poolToken = await ethers.getContractAt( - abis.basic.erc20, - POOL_TOKEN_ADDRESS - ); - const poolBalance = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - // Run spell transaction - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); - const receipt = await tx.wait(); - - // After spell - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); - const total = claimAmount.add(poolBalance); - expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq( - total - ); - }); - - it("Should wait 11 days, withdraw all podTokens, get back 99 DAI", async function() { - const amount = ethers.utils.parseEther("99"); // 99 DAI - - const podContract = new ethers.Contract( - DAI_POD_ADDR, - podABI, - ethers.provider - ); - let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); - // maxFee depends on if token has been deposited to PrizePool yet - // since we called drop in previous test case, the tokens were deposited to PrizePool - expect( - maxFee, - "Exit Fee equal to .99 DAI because token still in float" - ).to.be.eq(ethers.utils.parseEther(".99")); - - const spells = [ - { - connector: ptConnectorName, - method: "withdrawFromPod", - args: [DAI_POD_ADDR, amount, maxFee, 0, 0], - }, - ]; - - // Before spell - let daiToken = await ethers.getContractAt( - abis.basic.erc20, - DAI_TOKEN_ADDR - ); - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI Balance equals 0`).to.be.eq(0); - - let poolToken = await ethers.getContractAt( - abis.basic.erc20, - POOL_TOKEN_ADDRESS - ); - const poolBalance = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalance, `POOL Token balance greater than 0`).to.be.gt(0); - - let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); - const podBalance = await podToken.balanceOf(dsaWallet0.address); - expect(podBalance, `Pod DAI Token equals 99`).to.be.eq( - ethers.utils.parseEther("99") - ); - - // Increase time by 11 days so we get back all DAI without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); - - // Run spell transaction - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); - const receipt = await tx.wait(); - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect( - daiBalance, - `DAI balance equals 99, because of no early withdrawal fee` - ).to.be.eq(ethers.utils.parseEther("99")); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalanceAfter, `POOL Token to be greater than 0`).to.be.gt(0); - - const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); - expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq(0); - }); - - it("Should deposit and withdraw from pod, get back same amount of 99 DAI", async function() { - const amount = ethers.utils.parseEther("99"); - const maxFee = 0; // maxFee 0 since it doesn't give chance for Pod to actually deposit into PrizePool - - const spells = [ - { - connector: ptConnectorName, - method: "depositToPod", - args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0], - }, - { - connector: ptConnectorName, - method: "withdrawFromPod", - args: [DAI_POD_ADDR, amount, maxFee, 0, 0], - }, - ]; - - // Before spell - let daiToken = await ethers.getContractAt( - abis.basic.erc20, - DAI_TOKEN_ADDR - ); - let daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect(daiBalance, `DAI equals 99`).to.be.eq( - ethers.utils.parseEther("99") - ); - - let poolToken = await ethers.getContractAt( - abis.basic.erc20, - POOL_TOKEN_ADDRESS - ); - const poolBalance = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - // PodToken is 0 - let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); - const podBalance = await podToken.balanceOf(dsaWallet0.address); - expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); - const receipt = await tx.wait(); - - // After spell - daiBalance = await daiToken.balanceOf(dsaWallet0.address); - expect( - daiBalance, - `DAI balance to be equal to 99, because funds still in 'float` - ).to.be.eq(ethers.utils.parseEther("99")); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq( - poolBalance - ); - - // Expect Pod Token Balance to equal 0 - const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); - expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq( - ethers.utils.parseEther("0") - ); - }); - }); - - describe("Main - UNISWAP POOL/ETH Prize Pool Test", function() { - it("Should use uniswap to swap ETH for POOL, deposit to POOL/ETH LP, deposit POOL/ETH LP to PrizePool", async function() { - const amount = ethers.utils.parseEther("100"); // 100 POOL - const slippage = ethers.utils.parseEther("0.03"); - const setId = "83478237"; - - const UniswapV2Router02ABI = [ - "function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts)", - ]; - - // Get amount of ETH for 100 POOL from Uniswap - const UniswapV2Router02 = await ethers.getContractAt( - UniswapV2Router02ABI, - "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D" - ); - const amounts = await UniswapV2Router02.getAmountsOut(amount, [ - POOL_TOKEN_ADDRESS, - WETH_ADDR, - ]); - const unitAmount = ethers.utils.parseEther( - ((amounts[1] * 1.03) / amounts[0]).toString() - ); - - const spells = [ - { - connector: uniswapConnectorName, - method: "buy", - args: [ - POOL_TOKEN_ADDRESS, - tokens.eth.address, - amount, - unitAmount, - 0, - setId, - ], - }, - { - connector: uniswapConnectorName, - method: "deposit", - args: [ - POOL_TOKEN_ADDRESS, - tokens.eth.address, - amount, - unitAmount, - slippage, - 0, - setId, - ], - }, - { - connector: ptConnectorName, - method: "depositTo", - args: [ - UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, - 0, - PT_UNISWAP_POOLETHLP_TICKET_ADDR, - setId, - 0, - ], - }, - ]; - - // Before Spell - let ethBalance = await ethers.provider.getBalance(dsaWallet0.address); - expect(ethBalance, `ETH Balance equals 9`).to.be.eq( - ethers.utils.parseEther("9") - ); - - let poolToken = await ethers.getContractAt( - abis.basic.erc20, - POOL_TOKEN_ADDRESS - ); - const poolBalance = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - let uniswapLPToken = await ethers.getContractAt( - abis.basic.erc20, - UNISWAP_POOLETHLP_TOKEN_ADDR - ); - const uniswapPoolEthBalance = await uniswapLPToken.balanceOf( - dsaWallet0.address - ); - expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); - - let ptUniswapPoolEthToken = await ethers.getContractAt( - abis.basic.erc20, - PT_UNISWAP_POOLETHLP_TICKET_ADDR - ); - const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf( - dsaWallet0.address - ); - expect( - ptUniswapPoolEthBalance, - `PoolTogether Uniswap POOL?ETH LP equals 0` - ).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); - const receipt = await tx.wait(); - - // After spell - ethBalance = await ethers.provider.getBalance(dsaWallet0.address); - expect(ethBalance, `ETH Balance less than 9`).to.be.lt( - ethers.utils.parseEther("9") - ); - - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalanceAfter, `POOL Token to be same after spell`).to.be.eq( - poolBalance - ); - - const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf( - dsaWallet0.address - ); - expect( - uniswapPoolEthBalanceAfter, - `Uniswap POOL/ETH LP equals 0` - ).to.be.eq(0); - - const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf( - dsaWallet0.address - ); - expect( - ptUniswapPoolEthBalanceAfter, - `PT Uniswap POOL/ETH LP to greater than 0` - ).to.be.gt(0); - }); - - it("Should withdraw all PrizePool, get back Uniswap LP, claim POOL, deposit claimed POOL into Pool PrizePool", async function() { - let ptUniswapPoolEthToken = await ethers.getContractAt( - abis.basic.erc20, - PT_UNISWAP_POOLETHLP_TICKET_ADDR - ); - const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf( - dsaWallet0.address - ); - const setId = "83478237"; - - let uniswapPrizePoolContract = new ethers.Contract( - UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, - prizePoolABI, - ethers.provider - ); - let earlyExitFee = await uniswapPrizePoolContract.callStatic[ - "calculateEarlyExitFee" - ]( - dsaWallet0.address, - PT_UNISWAP_POOLETHLP_TICKET_ADDR, - ptUniswapPoolEthBalance - ); - expect( - earlyExitFee.exitFee, - "Exit Fee equals 0 because no early exit fee for this prize pool" - ).to.be.eq(0); - - const spells = [ - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [ - UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, - ptUniswapPoolEthBalance, - PT_UNISWAP_POOLETHLP_TICKET_ADDR, - earlyExitFee.exitFee, - 0, - 0, - ], - }, - { - connector: ptConnectorName, - method: "claim", - args: [UNISWAP_POOLETHLP_FAUCET_ADDR, setId], - }, - { - connector: ptConnectorName, - method: "depositTo", - args: [POOL_PRIZE_POOL_ADDR, 0, PT_POOL_TICKET_ADDR, setId, 0], - }, - ]; - - // Before spell - let poolToken = await ethers.getContractAt( - abis.basic.erc20, - POOL_TOKEN_ADDRESS - ); - const poolBalance = await poolToken.balanceOf(dsaWallet0.address); - expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - - // Uniswap POOL/ETH LP is 0 - let uniswapLPToken = await ethers.getContractAt( - abis.basic.erc20, - UNISWAP_POOLETHLP_TOKEN_ADDR - ); - const uniswapPoolEthBalance = await uniswapLPToken.balanceOf( - dsaWallet0.address - ); - expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); - - expect( - ptUniswapPoolEthBalance, - `PT Uniswap POOL/ETH LP greater than 0` - ).to.be.gt(0); - - let poolPoolTicket = await ethers.getContractAt( - abis.basic.erc20, - PT_POOL_TICKET_ADDR - ); - const poolPoolTicketBalance = await poolPoolTicket.balanceOf( - dsaWallet0.address - ); - expect( - poolPoolTicketBalance, - `PoolTogether POOL Ticket equals 0` - ).to.be.eq(0); - - // Run spell transaction - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); - const receipt = await tx.wait(); - - // After spell - const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); - expect( - poolBalanceAfter, - `Pool Token Balance equal to balance before spell` - ).to.be.eq(poolBalance); - - const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf( - dsaWallet0.address - ); - expect( - uniswapPoolEthBalanceAfter, - `Uniswap POOL/ETH LP to greater than 0` - ).to.be.gt(0); - - const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf( - dsaWallet0.address - ); - expect( - ptUniswapPoolEthBalanceAfter, - `PT Uniswap POOL/ETH LP equal 0` - ).to.be.eq(0); - - const poolPoolTicketBalanceAfter = await poolPoolTicket.balanceOf( - dsaWallet0.address - ); - expect( - poolPoolTicketBalanceAfter, - `PoolTogether POOL Ticket greater than 0` - ).to.be.gt(0); - }); - }); - - describe("Main - WETH Prize Pool Test", function() { - it("Deposit 1 ETH into WETH Prize Pool and withdraw immediately", async function() { - const amount = ethers.utils.parseEther("1"); // 1 ETH - const setId = "83478237"; - const spells = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, setId], - }, - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [ - WETH_PRIZE_POOL_ADDR, - amount, - WETH_POOL_TICKET_ADDR, - amount, - setId, - 0, - ], - }, - ]; - // Before Spell - const ethBalanceBefore = await ethers.provider.getBalance( - dsaWallet0.address - ); - - // Run spell transaction - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); - const receipt = await tx.wait(); - - // After spell - const ethBalanceAfter = await ethers.provider.getBalance( - dsaWallet0.address - ); - - // ETH used for transaction - expect( - ethBalanceAfter, - `ETH Balance less than before spell because of early withdrawal fee` - ).to.be.lte(ethBalanceBefore); - }); - - it("Deposit 1 ETH into WETH Prize Pool, wait 14 days, then withdraw", async function() { - const amount = ethers.utils.parseEther("1"); // 1 ETH - const depositSpell = [ - { - connector: ptConnectorName, - method: "depositTo", - args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, 0], - }, - ]; - - const withdrawSpell = [ - { - connector: ptConnectorName, - method: "withdrawInstantlyFrom", - args: [ - WETH_PRIZE_POOL_ADDR, - amount, - WETH_POOL_TICKET_ADDR, - amount, - 0, - 0, - ], - }, - ]; - - // Before Deposit Spell - let ethBalanceBefore = await ethers.provider.getBalance( - dsaWallet0.address - ); - - // Run deposit spell transaction - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(depositSpell), wallet1.address); - const receipt = await tx.wait(); - - // After Deposit spell - let ethBalanceAfter = await ethers.provider.getBalance( - dsaWallet0.address - ); - - expect(ethBalanceAfter, `ETH Balance less than before spell`).to.be.lte( - ethBalanceBefore - ); - - // Increase time by 11 days so we get back all ETH without early withdrawal fee - await ethers.provider.send("evm_increaseTime", [14 * 24 * 60 * 60]); - - // Run withdraw spell transaction - const tx2 = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(withdrawSpell), wallet1.address); - const receipt2 = await tx.wait(); - - // After Deposit spell - ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - - expect( - ethBalanceAfter, - `ETH Balance equal to before spell because no early exit fee` - ).to.be.eq(ethBalanceBefore); - }); - }); - - describe("Main - WETH Pod Test", function() { - let podAddress: string; - it("Should deposit 1 ETH in WETH Pod and get Pod Ticket", async function() { - const amount = ethers.utils.parseEther("1"); - - // Create Pod for WETH Prize Pool (Rari) - const podFactoryContract = new ethers.Contract( - POD_FACTORY_ADDRESS, - podFactoryABI, - masterSigner - ); - podAddress = await podFactoryContract.callStatic.create( - WETH_PRIZE_POOL_ADDR, - WETH_POOL_TICKET_ADDR, - constants.address_zero, - wallet0.address, - 18 - ); - await podFactoryContract.create( - WETH_PRIZE_POOL_ADDR, - WETH_POOL_TICKET_ADDR, - constants.address_zero, - wallet0.address, - 18 - ); - - const spells = [ - { - connector: ptConnectorName, - method: "depositToPod", - args: [WETH_ADDR, podAddress, amount, 0, 0], - }, - ]; - - // Before Deposit Spell - const podContract = new ethers.Contract( - podAddress, - podABI, - ethers.provider - ); - let podBalanceBefore = await podContract.balanceOfUnderlying( - dsaWallet0.address - ); - expect(podBalanceBefore, `Pod balance equal to 0`).to.be.eq(0); - - let ethBalanceBefore = await ethers.provider.getBalance( - dsaWallet0.address - ); - - // Run spell transaction - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); - const receipt = await tx.wait(); - - // After Deposit spell - let ethBalanceAfter = await ethers.provider.getBalance( - dsaWallet0.address - ); - expect(ethBalanceAfter, `ETH balance less than before`).to.be.lt( - ethBalanceBefore - ); - - let podBalanceAfter = await podContract.balanceOfUnderlying( - dsaWallet0.address - ); - expect(podBalanceAfter, `Pod balance equal to 1`).to.be.eq( - ethers.utils.parseEther("1") - ); - }); - - it("Should withdraw 1 Ticket from WETH Pod and get back ETH", async function() { - const amount = ethers.utils.parseEther("1"); - - const podContract = new ethers.Contract( - podAddress, - podABI, - ethers.provider - ); - let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); - expect( - maxFee, - "Exit Fee equal to 0 DAI because token still in float" - ).to.be.eq(0); - // maxFee depends on if token has been deposited to PrizePool yet - - const spells = [ - { - connector: ptConnectorName, - method: "withdrawFromPod", - args: [podAddress, amount, maxFee, 0, 0], - }, - ]; - - // Before Deposit Spell - let podBalanceBefore = await podContract.balanceOfUnderlying( - dsaWallet0.address - ); - expect(podBalanceBefore, `Pod balance equal to 1`).to.be.eq( - ethers.utils.parseEther("1") - ); - - let ethBalanceBefore = await ethers.provider.getBalance( - dsaWallet0.address - ); - - // Run spell transaction - const tx = await dsaWallet0 - .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); - const receipt = await tx.wait(); - - // After Deposit spell - let ethBalanceAfter = await ethers.provider.getBalance( - dsaWallet0.address - ); - expect(ethBalanceAfter, `ETH balance greater than before`).to.be.gt( - ethBalanceBefore - ); - - let podBalanceAfter = await podContract.balanceOfUnderlying( - dsaWallet0.address - ); - expect(podBalanceAfter, `Pod balance equal to 0`).to.be.eq( - ethers.utils.parseEther("0") - ); - }); - }); -}); +// import { expect } from "chai"; +// import hre from "hardhat"; +// const { web3, deployments, waffle, ethers } = hre; +// const { provider, deployContract } = waffle; + +// import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; +// import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; +// import { encodeSpells } from "../../../scripts/tests/encodeSpells"; +// import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; + +// import { addresses } from "../../../scripts/constant/addresses"; +// import { abis } from "../../../scripts/constant/abis"; +// import { constants } from "../../../scripts/constant/constant"; +// import { tokens } from "../../../scripts/constant/tokens"; +// import type { Signer, Contract } from "ethers"; + +// import { +// ConnectV2Compound__factory, +// ConnectV2PoolTogether__factory, +// ConnectV2UniswapV2__factory, +// } from "../../../typechain"; + +// const DAI_TOKEN_ADDR = tokens.dai.address; // DAI Token + +// // PoolTogether Address: https://docs.pooltogether.com/resources/networks/ethereum +// const DAI_PRIZE_POOL_ADDR = "0xEBfb47A7ad0FD6e57323C8A42B2E5A6a4F68fc1a"; // DAI Prize Pool +// const PT_DAI_TICKET_ADDR = "0x334cBb5858417Aee161B53Ee0D5349cCF54514CF"; // PT DAI Ticket +// const DAI_POOL_FAUCET_ADDR = "0xF362ce295F2A4eaE4348fFC8cDBCe8d729ccb8Eb"; // DAI POOL Faucet +// const POOL_TOKEN_ADDRESS = "0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e"; // POOL Tocken +// const TOKEN_FAUCET_PROXY_FACTORY_ADDR = +// "0xE4E9cDB3E139D7E8a41172C20b6Ed17b6750f117"; // TokenFaucetProxyFactory for claimAll +// const DAI_POD_ADDR = "0x2f994e2E4F3395649eeE8A89092e63Ca526dA829"; // DAI Pod +// const UNISWAP_POOLETHLP_PRIZE_POOL_ADDR = +// "0x3AF7072D29Adde20FC7e173a7CB9e45307d2FB0A"; // Uniswap Pool/ETH LP PrizePool +// const UNISWAP_POOLETHLP_FAUCET_ADDR = +// "0x9A29401EF1856b669f55Ae5b24505b3B6fAEb370"; // Uniswap Pool/ETH LP Faucet +// const UNISWAP_POOLETHLP_TOKEN_ADDR = +// "0x85cb0bab616fe88a89a35080516a8928f38b518b"; // Uniswap Pool/ETH Token +// const PT_UNISWAP_POOLETHLP_TICKET_ADDR = +// "0xeb8928ee92efb06c44d072a24c2bcb993b61e543"; // Pool Together Uniswap Pool/ETH LP Ticket +// const POOL_PRIZE_POOL_ADDR = "0x396b4489da692788e327e2e4b2b0459a5ef26791"; // POOL Prize Pool +// const PT_POOL_TICKET_ADDR = "0x27d22a7648e955e510a40bdb058333e9190d12d4"; // Pool Together POOL Ticket +// const WETH_ADDR = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; // WETH +// const DAI_POD_TOKEN_DROP = "0xc5209623E3dFdf9C0cCbe497c8012883C4147731"; + +// // Community WETH Prize Pool (Rari): https://reference-app.pooltogether.com/pools/mainnet/0xa88ca010b32a54d446fc38091ddbca55750cbfc3/manage#stats +// const WETH_PRIZE_POOL_ADDR = "0xa88ca010b32a54d446fc38091ddbca55750cbfc3"; // Community WETH Prize Pool (Rari) +// const WETH_POOL_TICKET_ADDR = "0x9b5c30aeb9ce2a6a121cea9a85bc0d662f6d9b40"; // Community WETH Prize Pool Ticket (Rari) + +// const prizePoolABI = [ +// "function calculateEarlyExitFee( address from, address controlledToken, uint256 amount) external returns ( uint256 exitFee, uint256 burnedCredit)", +// ]; + +// const podABI = [ +// "function getEarlyExitFee(uint256 amount) external returns (uint256)", +// "function balanceOfUnderlying(address user) external view returns (uint256 amount)", +// "function drop() public returns (uint256)", +// "function balanceOf(address account) external view returns (uint256)", +// ]; + +// const POD_FACTORY_ADDRESS = "0x4e3a9f9fbafb2ec49727cffa2a411f7a0c1c4ce1"; +// const podFactoryABI = [ +// "function create( address _prizePool, address _ticket, address _faucet, address _manager, uint8 _decimals) external returns (address pod)", +// ]; + +// const tokenDropABI = [ +// "function claim(address user) external returns (uint256)", +// ]; + +// describe("PoolTogether", function() { +// const connectorName = "COMPOUND-TEST-A"; +// const uniswapConnectorName = "UNISWAP-TEST-A"; +// const ptConnectorName = "POOLTOGETHER-TEST-A"; + +// let dsaWallet0: any; +// let masterSigner: Signer; +// let instaConnectorsV2: Contract; +// let connector: any; +// let ptConnector: any; +// let uniswapConnector: any; + +// const wallets = provider.getWallets(); +// const [wallet0, wallet1, wallet2, wallet3] = wallets; +// before(async () => { +// masterSigner = await getMasterSigner(); +// instaConnectorsV2 = await ethers.getContractAt( +// abis.core.connectorsV2, +// addresses.core.connectorsV2 +// ); + +// // Deploy and enable Compound Connector +// connector = await deployAndEnableConnector({ +// connectorName, +// contractArtifact: ConnectV2Compound__factory, +// signer: masterSigner, +// connectors: instaConnectorsV2, +// }); + +// // Deploy and enable Pool Together Connector +// ptConnector = await deployAndEnableConnector({ +// connectorName: ptConnectorName, +// contractArtifact: ConnectV2PoolTogether__factory, +// signer: masterSigner, +// connectors: instaConnectorsV2, +// }); + +// // Deploy and enable Uniswap Connector +// uniswapConnector = await deployAndEnableConnector({ +// connectorName: uniswapConnectorName, +// contractArtifact: ConnectV2UniswapV2__factory, +// signer: masterSigner, +// connectors: instaConnectorsV2, +// }); +// }); + +// it("Should have contracts deployed.", async function() { +// expect(!!instaConnectorsV2.address).to.be.true; +// expect(!!connector.address).to.be.true; +// expect(!!ptConnector.address).to.be.true; +// expect(!!uniswapConnector.address).to.be.true; +// expect(!!(await masterSigner.getAddress())).to.be.true; +// }); + +// describe("DSA wallet setup", function() { +// it("Should build DSA v2", async function() { +// dsaWallet0 = await buildDSAv2(wallet0.address); +// expect(!!dsaWallet0.address).to.be.true; +// }); + +// it("Deposit 10 ETH into DSA wallet", async function() { +// await wallet0.sendTransaction({ +// to: dsaWallet0.address, +// value: ethers.utils.parseEther("10"), +// }); +// expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte( +// ethers.utils.parseEther("10") +// ); +// }); +// }); + +// describe("Main - DAI Prize Pool Test", function() { +// it("Should deposit 1 ETH in Compound", async function() { +// const amount = ethers.utils.parseEther("1"); // 1 ETH +// const spells = [ +// { +// connector: connectorName, +// method: "deposit", +// args: ["ETH-A", amount, 0, 0], +// }, +// ]; + +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(spells), wallet1.address); +// const receipt = await tx.wait(); +// expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( +// ethers.utils.parseEther("9") +// ); +// }); + +// it("Should borrow 100 DAI from Compound and deposit DAI into DAI Prize Pool", async function() { +// const amount = ethers.utils.parseEther("100"); // 100 DAI +// const setId = "83478237"; +// const spells = [ +// { +// connector: connectorName, +// method: "borrow", +// args: ["DAI-A", amount, 0, setId], +// }, +// { +// connector: ptConnectorName, +// method: "depositTo", +// args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, setId, 0], +// }, +// ]; +// // Before Spell +// let daiToken = await ethers.getContractAt( +// abis.basic.erc20, +// DAI_TOKEN_ADDR +// ); +// let daiBalance = await daiToken.balanceOf(dsaWallet0.address); +// expect(daiBalance, `DAI balance is 0`).to.be.eq( +// ethers.utils.parseEther("0") +// ); + +// let cToken = await ethers.getContractAt( +// abis.basic.erc20, +// PT_DAI_TICKET_ADDR +// ); +// const balance = await cToken.balanceOf(dsaWallet0.address); +// expect(balance, `PoolTogether DAI Ticket balance is 0`).to.be.eq(0); + +// // Run spell transaction +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(spells), wallet1.address); +// const receipt = await tx.wait(); + +// // After spell +// daiBalance = await daiToken.balanceOf(dsaWallet0.address); +// expect( +// daiBalance, +// `Expect DAI balance to still equal 0 since it was deposited into Prize Pool` +// ).to.be.eq(0); + +// const balanceAfter = await cToken.balanceOf(dsaWallet0.address); +// expect( +// balanceAfter, +// `PoolTogether DAI Ticket balance equals 100` +// ).to.be.eq(ethers.utils.parseEther("100")); + +// // ETH used for transaction +// expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( +// ethers.utils.parseEther("9") +// ); +// }); + +// it("Should wait 11 days, withdraw all PrizePool, get back 100 DAI, and claim POOL", async function() { +// const amount = ethers.utils.parseEther("100"); // 100 DAI + +// let prizePoolContract = new ethers.Contract( +// DAI_PRIZE_POOL_ADDR, +// prizePoolABI, +// ethers.provider +// ); +// let earlyExitFee = await prizePoolContract.callStatic[ +// "calculateEarlyExitFee" +// ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); +// expect( +// earlyExitFee.exitFee, +// "Exit Fee equal to 1 DAI because starts at 10%" +// ).to.be.eq(ethers.utils.parseEther("1")); + +// const spells = [ +// { +// connector: ptConnectorName, +// method: "withdrawInstantlyFrom", +// args: [ +// DAI_PRIZE_POOL_ADDR, +// amount, +// PT_DAI_TICKET_ADDR, +// earlyExitFee.exitFee, +// 0, +// 0, +// ], +// }, +// { +// connector: ptConnectorName, +// method: "claim", +// args: [DAI_POOL_FAUCET_ADDR, 0], +// }, +// ]; + +// // Before spell +// let daiToken = await ethers.getContractAt( +// abis.basic.erc20, +// DAI_TOKEN_ADDR +// ); +// let daiBalance = await daiToken.balanceOf(dsaWallet0.address); +// expect(daiBalance, `DAI balance equals 0`).to.be.eq( +// ethers.utils.parseEther("0") +// ); + +// let cToken = await ethers.getContractAt( +// abis.basic.erc20, +// PT_DAI_TICKET_ADDR +// ); +// const balance = await cToken.balanceOf(dsaWallet0.address); +// expect(balance, `PoolTogether Dai Ticket is 100`).to.be.eq( +// ethers.utils.parseEther("100") +// ); + +// let poolToken = await ethers.getContractAt( +// abis.basic.erc20, +// POOL_TOKEN_ADDRESS +// ); +// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalance, `POOL Token equals 0`).to.be.eq( +// ethers.utils.parseEther("0") +// ); + +// // Increase time by 11 days so we get back all DAI without early withdrawal fee +// await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); + +// earlyExitFee = await prizePoolContract.callStatic[ +// "calculateEarlyExitFee" +// ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); +// expect( +// earlyExitFee.exitFee, +// "Exit Fee equal to 0 DAI because past 10 days" +// ).to.be.eq(0); + +// // Run spell transaction +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(spells), wallet1.address); +// const receipt = await tx.wait(); + +// // After spell +// daiBalance = await daiToken.balanceOf(dsaWallet0.address); +// expect( +// daiBalance, +// `DAI balance to be equal to 100, because of no early withdrawal fee` +// ).to.be.eq(ethers.utils.parseEther("100")); + +// const balanceAfter = await cToken.balanceOf(dsaWallet0.address); +// expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); + +// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); +// expect( +// poolBalanceAfter, +// `POOL Token Balance to be greater than 0` +// ).to.be.gt(ethers.utils.parseEther("0")); +// }); + +// it("Should deposit and withdraw all PrizePool, get back less than 100 DAI", async function() { +// const amount = ethers.utils.parseEther("100"); // 100 DAI +// const exitFee = ethers.utils.parseEther("1"); // 1 DAI is 10% of 100 DAI +// const spells = [ +// { +// connector: ptConnectorName, +// method: "depositTo", +// args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0], +// }, +// { +// connector: ptConnectorName, +// method: "withdrawInstantlyFrom", +// args: [ +// DAI_PRIZE_POOL_ADDR, +// amount, +// PT_DAI_TICKET_ADDR, +// exitFee, +// 0, +// 0, +// ], +// }, +// ]; + +// // Before spell +// let daiToken = await ethers.getContractAt( +// abis.basic.erc20, +// DAI_TOKEN_ADDR +// ); +// let daiBalance = await daiToken.balanceOf(dsaWallet0.address); +// expect(daiBalance, `DAI Balance equals 0`).to.be.eq( +// ethers.utils.parseEther("100") +// ); + +// let cToken = await ethers.getContractAt( +// abis.basic.erc20, +// PT_DAI_TICKET_ADDR +// ); +// const balance = await cToken.balanceOf(dsaWallet0.address); +// expect(balance, `PoolTogether DAI Ticket equals 0`).to.be.eq(0); + +// let poolToken = await ethers.getContractAt( +// abis.basic.erc20, +// POOL_TOKEN_ADDRESS +// ); +// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalance, `PoolTogether Token greater than 0`).to.be.gt(0); + +// // Run spell transaction +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(spells), wallet1.address); +// const receipt = await tx.wait(); + +// // After spell +// daiBalance = await daiToken.balanceOf(dsaWallet0.address); +// expect( +// daiBalance, +// `DAI balance to be less than 100, because of early withdrawal fee` +// ).to.be.lt(ethers.utils.parseEther("100")); + +// const balanceAfter = await cToken.balanceOf(dsaWallet0.address); +// expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); + +// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalanceAfter, `POOL Token Balance to greater than 0`).to.be.gt( +// ethers.utils.parseEther("0") +// ); +// }); + +// it("Should deposit, wait 11 days, and withdraw all PrizePool, get 99 DAI, and claim all POOL using claimAll", async function() { +// const amount = ethers.utils.parseEther("99"); // 99 DAI +// const depositSpells = [ +// { +// connector: ptConnectorName, +// method: "depositTo", +// args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0], +// }, +// ]; + +// // Before spell +// let daiToken = await ethers.getContractAt( +// abis.basic.erc20, +// DAI_TOKEN_ADDR +// ); +// let daiBalance = await daiToken.balanceOf(dsaWallet0.address); +// expect(daiBalance, `DAI balance less than 100`).to.be.lt( +// ethers.utils.parseEther("100") +// ); + +// let cToken = await ethers.getContractAt( +// abis.basic.erc20, +// PT_DAI_TICKET_ADDR +// ); +// const balance = await cToken.balanceOf(dsaWallet0.address); +// expect(balance, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); + +// let poolToken = await ethers.getContractAt( +// abis.basic.erc20, +// POOL_TOKEN_ADDRESS +// ); +// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalance, `POOL Token is greater than 0`).to.be.gt( +// ethers.utils.parseEther("0") +// ); + +// // Run spell transaction +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(depositSpells), wallet1.address); +// const receipt = await tx.wait(); + +// const prizePoolContract = new ethers.Contract( +// DAI_PRIZE_POOL_ADDR, +// prizePoolABI, +// ethers.provider +// ); +// let earlyExitFee = await prizePoolContract.callStatic[ +// "calculateEarlyExitFee" +// ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); +// expect( +// earlyExitFee.exitFee, +// "Exit Fee equal to .99 DAI because starts at 10%" +// ).to.be.eq(ethers.utils.parseEther(".99")); + +// // Increase time by 11 days so we get back all DAI without early withdrawal fee +// await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); + +// earlyExitFee = await prizePoolContract.callStatic[ +// "calculateEarlyExitFee" +// ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); +// expect( +// earlyExitFee.exitFee, +// "Exit Fee equal to 0 DAI because past 10 days" +// ).to.be.eq(0); + +// const withdrawSpells = [ +// { +// connector: ptConnectorName, +// method: "withdrawInstantlyFrom", +// args: [ +// DAI_PRIZE_POOL_ADDR, +// amount, +// PT_DAI_TICKET_ADDR, +// earlyExitFee.exitFee, +// 0, +// 0, +// ], +// }, +// { +// connector: ptConnectorName, +// method: "claimAll", +// args: [TOKEN_FAUCET_PROXY_FACTORY_ADDR, [DAI_POOL_FAUCET_ADDR]], +// }, +// ]; + +// // Run spell transaction +// const tx2 = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(withdrawSpells), wallet1.address); +// const receipt2 = await tx2.wait(); + +// // After spell +// daiBalance = await daiToken.balanceOf(dsaWallet0.address); +// expect(daiBalance, `DAI balance equals 99`).to.be.eq( +// ethers.utils.parseEther("99") +// ); + +// const balanceAfter = await cToken.balanceOf(dsaWallet0.address); +// expect(balanceAfter, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); + +// // Expect +// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalanceAfter, `Pool Token to be greateir than 0`).to.be.gt( +// ethers.utils.parseEther("0") +// ); +// }); +// }); + +// describe("Main - DAI Pod Test", function() { +// it("Should deposit 99 DAI in DAI Pod", async function() { +// const amount = ethers.utils.parseEther("99"); // 99 DAI +// const spells = [ +// { +// connector: ptConnectorName, +// method: "depositToPod", +// args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0], +// }, +// ]; + +// // Before spell +// let daiToken = await ethers.getContractAt( +// abis.basic.erc20, +// DAI_TOKEN_ADDR +// ); +// let daiBalance = await daiToken.balanceOf(dsaWallet0.address); +// expect(daiBalance, `DAI balance equals 99`).to.be.eq( +// ethers.utils.parseEther("99") +// ); + +// let poolToken = await ethers.getContractAt( +// abis.basic.erc20, +// POOL_TOKEN_ADDRESS +// ); +// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalance, `POOL Token greater than 0`).to.be.gte(0); + +// let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); +// const podBalance = await podToken.balanceOf(dsaWallet0.address); +// expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); + +// // Run spell transaction +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(spells), wallet1.address); +// const receipt = await tx.wait(); + +// // After spell +// daiBalance = await daiToken.balanceOf(dsaWallet0.address); +// expect(daiBalance, `DAI equals 0`).to.be.eq(0); + +// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalanceAfter, `POOL Token greater than 0`).to.be.gt(0); + +// const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); +// expect(podBalanceAfter, `Pod DAI token greater than 0`).to.be.eq( +// ethers.utils.parseEther("99") +// ); +// }); + +// it("Should claim rewards from pod token drop", async function() { +// const spells = [ +// { +// connector: ptConnectorName, +// method: "claimPodTokenDrop", +// args: [DAI_POD_TOKEN_DROP, 0], +// }, +// ]; + +// const tokenDropContract = new ethers.Contract( +// DAI_POD_TOKEN_DROP, +// tokenDropABI, +// ethers.provider +// ); +// const podContract = new ethers.Contract( +// DAI_POD_ADDR, +// podABI, +// masterSigner +// ); + +// // drop(): Claim TokenDrop asset for PrizePool Pod and transfers token(s) to external Pod TokenDrop +// // dropt() also calls batch which, Deposit Pod float into PrizePool. Deposits the current float +// // amount into the PrizePool and claims current POOL rewards. +// const dropTx = await podContract.drop(); +// await dropTx.wait(); + +// // POOL Rewards able to claim from Pod Token Drop +// let claimAmount = await tokenDropContract.callStatic["claim"]( +// dsaWallet0.address +// ); + +// // Before spell +// let poolToken = await ethers.getContractAt( +// abis.basic.erc20, +// POOL_TOKEN_ADDRESS +// ); +// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + +// // Run spell transaction +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(spells), wallet1.address); +// const receipt = await tx.wait(); + +// // After spell +// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); +// const total = claimAmount.add(poolBalance); +// expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq( +// total +// ); +// }); + +// it("Should wait 11 days, withdraw all podTokens, get back 99 DAI", async function() { +// const amount = ethers.utils.parseEther("99"); // 99 DAI + +// const podContract = new ethers.Contract( +// DAI_POD_ADDR, +// podABI, +// ethers.provider +// ); +// let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); +// // maxFee depends on if token has been deposited to PrizePool yet +// // since we called drop in previous test case, the tokens were deposited to PrizePool +// expect( +// maxFee, +// "Exit Fee equal to .99 DAI because token still in float" +// ).to.be.eq(ethers.utils.parseEther(".99")); + +// const spells = [ +// { +// connector: ptConnectorName, +// method: "withdrawFromPod", +// args: [DAI_POD_ADDR, amount, maxFee, 0, 0], +// }, +// ]; + +// // Before spell +// let daiToken = await ethers.getContractAt( +// abis.basic.erc20, +// DAI_TOKEN_ADDR +// ); +// let daiBalance = await daiToken.balanceOf(dsaWallet0.address); +// expect(daiBalance, `DAI Balance equals 0`).to.be.eq(0); + +// let poolToken = await ethers.getContractAt( +// abis.basic.erc20, +// POOL_TOKEN_ADDRESS +// ); +// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalance, `POOL Token balance greater than 0`).to.be.gt(0); + +// let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); +// const podBalance = await podToken.balanceOf(dsaWallet0.address); +// expect(podBalance, `Pod DAI Token equals 99`).to.be.eq( +// ethers.utils.parseEther("99") +// ); + +// // Increase time by 11 days so we get back all DAI without early withdrawal fee +// await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); + +// // Run spell transaction +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(spells), wallet1.address); +// const receipt = await tx.wait(); + +// // After spell +// daiBalance = await daiToken.balanceOf(dsaWallet0.address); +// expect( +// daiBalance, +// `DAI balance equals 99, because of no early withdrawal fee` +// ).to.be.eq(ethers.utils.parseEther("99")); + +// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalanceAfter, `POOL Token to be greater than 0`).to.be.gt(0); + +// const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); +// expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq(0); +// }); + +// it("Should deposit and withdraw from pod, get back same amount of 99 DAI", async function() { +// const amount = ethers.utils.parseEther("99"); +// const maxFee = 0; // maxFee 0 since it doesn't give chance for Pod to actually deposit into PrizePool + +// const spells = [ +// { +// connector: ptConnectorName, +// method: "depositToPod", +// args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0], +// }, +// { +// connector: ptConnectorName, +// method: "withdrawFromPod", +// args: [DAI_POD_ADDR, amount, maxFee, 0, 0], +// }, +// ]; + +// // Before spell +// let daiToken = await ethers.getContractAt( +// abis.basic.erc20, +// DAI_TOKEN_ADDR +// ); +// let daiBalance = await daiToken.balanceOf(dsaWallet0.address); +// expect(daiBalance, `DAI equals 99`).to.be.eq( +// ethers.utils.parseEther("99") +// ); + +// let poolToken = await ethers.getContractAt( +// abis.basic.erc20, +// POOL_TOKEN_ADDRESS +// ); +// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + +// // PodToken is 0 +// let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); +// const podBalance = await podToken.balanceOf(dsaWallet0.address); +// expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); + +// // Run spell transaction +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(spells), wallet1.address); +// const receipt = await tx.wait(); + +// // After spell +// daiBalance = await daiToken.balanceOf(dsaWallet0.address); +// expect( +// daiBalance, +// `DAI balance to be equal to 99, because funds still in 'float` +// ).to.be.eq(ethers.utils.parseEther("99")); + +// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq( +// poolBalance +// ); + +// // Expect Pod Token Balance to equal 0 +// const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); +// expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq( +// ethers.utils.parseEther("0") +// ); +// }); +// }); + +// describe("Main - UNISWAP POOL/ETH Prize Pool Test", function() { +// it("Should use uniswap to swap ETH for POOL, deposit to POOL/ETH LP, deposit POOL/ETH LP to PrizePool", async function() { +// const amount = ethers.utils.parseEther("100"); // 100 POOL +// const slippage = ethers.utils.parseEther("0.03"); +// const setId = "83478237"; + +// const UniswapV2Router02ABI = [ +// "function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts)", +// ]; + +// // Get amount of ETH for 100 POOL from Uniswap +// const UniswapV2Router02 = await ethers.getContractAt( +// UniswapV2Router02ABI, +// "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D" +// ); +// const amounts = await UniswapV2Router02.getAmountsOut(amount, [ +// POOL_TOKEN_ADDRESS, +// WETH_ADDR, +// ]); +// const unitAmount = ethers.utils.parseEther( +// ((amounts[1] * 1.03) / amounts[0]).toString() +// ); + +// const spells = [ +// { +// connector: uniswapConnectorName, +// method: "buy", +// args: [ +// POOL_TOKEN_ADDRESS, +// tokens.eth.address, +// amount, +// unitAmount, +// 0, +// setId, +// ], +// }, +// { +// connector: uniswapConnectorName, +// method: "deposit", +// args: [ +// POOL_TOKEN_ADDRESS, +// tokens.eth.address, +// amount, +// unitAmount, +// slippage, +// 0, +// setId, +// ], +// }, +// { +// connector: ptConnectorName, +// method: "depositTo", +// args: [ +// UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, +// 0, +// PT_UNISWAP_POOLETHLP_TICKET_ADDR, +// setId, +// 0, +// ], +// }, +// ]; + +// // Before Spell +// let ethBalance = await ethers.provider.getBalance(dsaWallet0.address); +// expect(ethBalance, `ETH Balance equals 9`).to.be.eq( +// ethers.utils.parseEther("9") +// ); + +// let poolToken = await ethers.getContractAt( +// abis.basic.erc20, +// POOL_TOKEN_ADDRESS +// ); +// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalance, `POOL Token greater than 0`).to.be.gte(0); + +// let uniswapLPToken = await ethers.getContractAt( +// abis.basic.erc20, +// UNISWAP_POOLETHLP_TOKEN_ADDR +// ); +// const uniswapPoolEthBalance = await uniswapLPToken.balanceOf( +// dsaWallet0.address +// ); +// expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); + +// let ptUniswapPoolEthToken = await ethers.getContractAt( +// abis.basic.erc20, +// PT_UNISWAP_POOLETHLP_TICKET_ADDR +// ); +// const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf( +// dsaWallet0.address +// ); +// expect( +// ptUniswapPoolEthBalance, +// `PoolTogether Uniswap POOL?ETH LP equals 0` +// ).to.be.eq(0); + +// // Run spell transaction +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(spells), wallet1.address); +// const receipt = await tx.wait(); + +// // After spell +// ethBalance = await ethers.provider.getBalance(dsaWallet0.address); +// expect(ethBalance, `ETH Balance less than 9`).to.be.lt( +// ethers.utils.parseEther("9") +// ); + +// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalanceAfter, `POOL Token to be same after spell`).to.be.eq( +// poolBalance +// ); + +// const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf( +// dsaWallet0.address +// ); +// expect( +// uniswapPoolEthBalanceAfter, +// `Uniswap POOL/ETH LP equals 0` +// ).to.be.eq(0); + +// const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf( +// dsaWallet0.address +// ); +// expect( +// ptUniswapPoolEthBalanceAfter, +// `PT Uniswap POOL/ETH LP to greater than 0` +// ).to.be.gt(0); +// }); + +// it("Should withdraw all PrizePool, get back Uniswap LP, claim POOL, deposit claimed POOL into Pool PrizePool", async function() { +// let ptUniswapPoolEthToken = await ethers.getContractAt( +// abis.basic.erc20, +// PT_UNISWAP_POOLETHLP_TICKET_ADDR +// ); +// const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf( +// dsaWallet0.address +// ); +// const setId = "83478237"; + +// let uniswapPrizePoolContract = new ethers.Contract( +// UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, +// prizePoolABI, +// ethers.provider +// ); +// let earlyExitFee = await uniswapPrizePoolContract.callStatic[ +// "calculateEarlyExitFee" +// ]( +// dsaWallet0.address, +// PT_UNISWAP_POOLETHLP_TICKET_ADDR, +// ptUniswapPoolEthBalance +// ); +// expect( +// earlyExitFee.exitFee, +// "Exit Fee equals 0 because no early exit fee for this prize pool" +// ).to.be.eq(0); + +// const spells = [ +// { +// connector: ptConnectorName, +// method: "withdrawInstantlyFrom", +// args: [ +// UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, +// ptUniswapPoolEthBalance, +// PT_UNISWAP_POOLETHLP_TICKET_ADDR, +// earlyExitFee.exitFee, +// 0, +// 0, +// ], +// }, +// { +// connector: ptConnectorName, +// method: "claim", +// args: [UNISWAP_POOLETHLP_FAUCET_ADDR, setId], +// }, +// { +// connector: ptConnectorName, +// method: "depositTo", +// args: [POOL_PRIZE_POOL_ADDR, 0, PT_POOL_TICKET_ADDR, setId, 0], +// }, +// ]; + +// // Before spell +// let poolToken = await ethers.getContractAt( +// abis.basic.erc20, +// POOL_TOKEN_ADDRESS +// ); +// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); +// expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + +// // Uniswap POOL/ETH LP is 0 +// let uniswapLPToken = await ethers.getContractAt( +// abis.basic.erc20, +// UNISWAP_POOLETHLP_TOKEN_ADDR +// ); +// const uniswapPoolEthBalance = await uniswapLPToken.balanceOf( +// dsaWallet0.address +// ); +// expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); + +// expect( +// ptUniswapPoolEthBalance, +// `PT Uniswap POOL/ETH LP greater than 0` +// ).to.be.gt(0); + +// let poolPoolTicket = await ethers.getContractAt( +// abis.basic.erc20, +// PT_POOL_TICKET_ADDR +// ); +// const poolPoolTicketBalance = await poolPoolTicket.balanceOf( +// dsaWallet0.address +// ); +// expect( +// poolPoolTicketBalance, +// `PoolTogether POOL Ticket equals 0` +// ).to.be.eq(0); + +// // Run spell transaction +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(spells), wallet1.address); +// const receipt = await tx.wait(); + +// // After spell +// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); +// expect( +// poolBalanceAfter, +// `Pool Token Balance equal to balance before spell` +// ).to.be.eq(poolBalance); + +// const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf( +// dsaWallet0.address +// ); +// expect( +// uniswapPoolEthBalanceAfter, +// `Uniswap POOL/ETH LP to greater than 0` +// ).to.be.gt(0); + +// const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf( +// dsaWallet0.address +// ); +// expect( +// ptUniswapPoolEthBalanceAfter, +// `PT Uniswap POOL/ETH LP equal 0` +// ).to.be.eq(0); + +// const poolPoolTicketBalanceAfter = await poolPoolTicket.balanceOf( +// dsaWallet0.address +// ); +// expect( +// poolPoolTicketBalanceAfter, +// `PoolTogether POOL Ticket greater than 0` +// ).to.be.gt(0); +// }); +// }); + +// describe("Main - WETH Prize Pool Test", function() { +// it("Deposit 1 ETH into WETH Prize Pool and withdraw immediately", async function() { +// const amount = ethers.utils.parseEther("1"); // 1 ETH +// const setId = "83478237"; +// const spells = [ +// { +// connector: ptConnectorName, +// method: "depositTo", +// args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, setId], +// }, +// { +// connector: ptConnectorName, +// method: "withdrawInstantlyFrom", +// args: [ +// WETH_PRIZE_POOL_ADDR, +// amount, +// WETH_POOL_TICKET_ADDR, +// amount, +// setId, +// 0, +// ], +// }, +// ]; +// // Before Spell +// const ethBalanceBefore = await ethers.provider.getBalance( +// dsaWallet0.address +// ); + +// // Run spell transaction +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(spells), wallet1.address); +// const receipt = await tx.wait(); + +// // After spell +// const ethBalanceAfter = await ethers.provider.getBalance( +// dsaWallet0.address +// ); + +// // ETH used for transaction +// expect( +// ethBalanceAfter, +// `ETH Balance less than before spell because of early withdrawal fee` +// ).to.be.lte(ethBalanceBefore); +// }); + +// it("Deposit 1 ETH into WETH Prize Pool, wait 14 days, then withdraw", async function() { +// const amount = ethers.utils.parseEther("1"); // 1 ETH +// const depositSpell = [ +// { +// connector: ptConnectorName, +// method: "depositTo", +// args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, 0], +// }, +// ]; + +// const withdrawSpell = [ +// { +// connector: ptConnectorName, +// method: "withdrawInstantlyFrom", +// args: [ +// WETH_PRIZE_POOL_ADDR, +// amount, +// WETH_POOL_TICKET_ADDR, +// amount, +// 0, +// 0, +// ], +// }, +// ]; + +// // Before Deposit Spell +// let ethBalanceBefore = await ethers.provider.getBalance( +// dsaWallet0.address +// ); + +// // Run deposit spell transaction +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(depositSpell), wallet1.address); +// const receipt = await tx.wait(); + +// // After Deposit spell +// let ethBalanceAfter = await ethers.provider.getBalance( +// dsaWallet0.address +// ); + +// expect(ethBalanceAfter, `ETH Balance less than before spell`).to.be.lte( +// ethBalanceBefore +// ); + +// // Increase time by 11 days so we get back all ETH without early withdrawal fee +// await ethers.provider.send("evm_increaseTime", [14 * 24 * 60 * 60]); + +// // Run withdraw spell transaction +// const tx2 = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(withdrawSpell), wallet1.address); +// const receipt2 = await tx.wait(); + +// // After Deposit spell +// ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); + +// expect( +// ethBalanceAfter, +// `ETH Balance equal to before spell because no early exit fee` +// ).to.be.eq(ethBalanceBefore); +// }); +// }); + +// describe("Main - WETH Pod Test", function() { +// let podAddress: string; +// it("Should deposit 1 ETH in WETH Pod and get Pod Ticket", async function() { +// const amount = ethers.utils.parseEther("1"); + +// // Create Pod for WETH Prize Pool (Rari) +// const podFactoryContract = new ethers.Contract( +// POD_FACTORY_ADDRESS, +// podFactoryABI, +// masterSigner +// ); +// podAddress = await podFactoryContract.callStatic.create( +// WETH_PRIZE_POOL_ADDR, +// WETH_POOL_TICKET_ADDR, +// constants.address_zero, +// wallet0.address, +// 18 +// ); +// await podFactoryContract.create( +// WETH_PRIZE_POOL_ADDR, +// WETH_POOL_TICKET_ADDR, +// constants.address_zero, +// wallet0.address, +// 18 +// ); + +// const spells = [ +// { +// connector: ptConnectorName, +// method: "depositToPod", +// args: [WETH_ADDR, podAddress, amount, 0, 0], +// }, +// ]; + +// // Before Deposit Spell +// const podContract = new ethers.Contract( +// podAddress, +// podABI, +// ethers.provider +// ); +// let podBalanceBefore = await podContract.balanceOfUnderlying( +// dsaWallet0.address +// ); +// expect(podBalanceBefore, `Pod balance equal to 0`).to.be.eq(0); + +// let ethBalanceBefore = await ethers.provider.getBalance( +// dsaWallet0.address +// ); + +// // Run spell transaction +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(spells), wallet1.address); +// const receipt = await tx.wait(); + +// // After Deposit spell +// let ethBalanceAfter = await ethers.provider.getBalance( +// dsaWallet0.address +// ); +// expect(ethBalanceAfter, `ETH balance less than before`).to.be.lt( +// ethBalanceBefore +// ); + +// let podBalanceAfter = await podContract.balanceOfUnderlying( +// dsaWallet0.address +// ); +// expect(podBalanceAfter, `Pod balance equal to 1`).to.be.eq( +// ethers.utils.parseEther("1") +// ); +// }); + +// it("Should withdraw 1 Ticket from WETH Pod and get back ETH", async function() { +// const amount = ethers.utils.parseEther("1"); + +// const podContract = new ethers.Contract( +// podAddress, +// podABI, +// ethers.provider +// ); +// let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); +// expect( +// maxFee, +// "Exit Fee equal to 0 DAI because token still in float" +// ).to.be.eq(0); +// // maxFee depends on if token has been deposited to PrizePool yet + +// const spells = [ +// { +// connector: ptConnectorName, +// method: "withdrawFromPod", +// args: [podAddress, amount, maxFee, 0, 0], +// }, +// ]; + +// // Before Deposit Spell +// let podBalanceBefore = await podContract.balanceOfUnderlying( +// dsaWallet0.address +// ); +// expect(podBalanceBefore, `Pod balance equal to 1`).to.be.eq( +// ethers.utils.parseEther("1") +// ); + +// let ethBalanceBefore = await ethers.provider.getBalance( +// dsaWallet0.address +// ); + +// // Run spell transaction +// const tx = await dsaWallet0 +// .connect(wallet0) +// .cast(...encodeSpells(spells), wallet1.address); +// const receipt = await tx.wait(); + +// // After Deposit spell +// let ethBalanceAfter = await ethers.provider.getBalance( +// dsaWallet0.address +// ); +// expect(ethBalanceAfter, `ETH balance greater than before`).to.be.gt( +// ethBalanceBefore +// ); + +// let podBalanceAfter = await podContract.balanceOfUnderlying( +// dsaWallet0.address +// ); +// expect(podBalanceAfter, `Pod balance equal to 0`).to.be.eq( +// ethers.utils.parseEther("0") +// ); +// }); +// }); +// }); diff --git a/test/mainnet/uniswapStake/uniswapStake.test.ts b/test/mainnet/uniswapStake/uniswapStake.test.ts index bc2cf3e0..f9352153 100644 --- a/test/mainnet/uniswapStake/uniswapStake.test.ts +++ b/test/mainnet/uniswapStake/uniswapStake.test.ts @@ -40,7 +40,7 @@ describe("UniswapV3", function () { const connectorUniswap = "UniswapV3-v1" let dsaWallet0: any - let masterSigner: any; + let masterSigner: Signer; let instaConnectorsV2: any; let connector: any; let startTime: any, endTime: any; @@ -83,7 +83,7 @@ describe("UniswapV3", function () { it("Should have contracts deployed.", async function () { expect(!!instaConnectorsV2.address).to.be.true; expect(!!connector.address).to.be.true; - expect(!!masterSigner.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; }); describe("DSA wallet setup", function () { @@ -183,7 +183,7 @@ describe("UniswapV3", function () { let event = await castEvent let balance = await nftManager.connect(wallet0).balanceOf(dsaWallet0.address) - console.log("Balance", balance) + console.log("Balance", balance.toString()) }); it("Should create incentive successfully", async function () { @@ -277,7 +277,7 @@ describe("UniswapV3", function () { let receipt = await tx.wait() let balance = await nftManager.connect(wallet0).balanceOf(dsaWallet0.address) - console.log("Balance", balance) + console.log("Balance", balance.toString()) }); it("Should claim rewards successfully", async function () { @@ -348,7 +348,7 @@ describe("UniswapV3", function () { let receipt = await tx.wait() let balance = await nftManager.connect(wallet0).balanceOf(dsaWallet0.address) - console.log("Balance", balance) + console.log("Balance", balance.toString()) }); }) }) diff --git a/test/mainnet/pooltogether-polygon/pooltogether.test.ts b/test/polygon/pooltogether/pooltogether.test.ts similarity index 100% rename from test/mainnet/pooltogether-polygon/pooltogether.test.ts rename to test/polygon/pooltogether/pooltogether.test.ts diff --git a/yarn.lock b/yarn.lock index 7d4de696..a5bbacb4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1291,6 +1291,14 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/inquirer@^8.1.3": + "integrity" "sha512-AayK4ZL5ssPzR1OtnOLGAwpT0Dda3Xi/h1G0l1oJDNrowp7T1423q4Zb8/emr7tzRlCy4ssEri0LWVexAqHyKQ==" + "resolved" "https://registry.npmjs.org/@types/inquirer/-/inquirer-8.1.3.tgz" + "version" "8.1.3" + dependencies: + "@types/through" "*" + "rxjs" "^7.2.0" + "@types/level-errors@*": "integrity" "sha512-/lMtoq/Cf/2DVOm6zE6ORyOM+3ZVm/BvzEZVxUhf6bgh8ZHglXlBqxbxSlJeVp8FCbD3IVvk/VbsaNmDjrQvqQ==" "resolved" "https://registry.npmjs.org/@types/level-errors/-/level-errors-3.0.0.tgz" @@ -1391,6 +1399,13 @@ dependencies: "@sinonjs/fake-timers" "^7.0.4" +"@types/through@*": + "integrity" "sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==" + "resolved" "https://registry.npmjs.org/@types/through/-/through-0.0.30.tgz" + "version" "0.0.30" + dependencies: + "@types/node" "*" + "@types/underscore@*": "integrity" "sha512-Ls2ylbo7++ITrWk2Yc3G/jijwSq5V3GT0tlgVXEl2kKYXY3ImrtmTCoE2uyTWFRI5owMBriloZFWbE1SXOsE7w==" "resolved" "https://registry.npmjs.org/@types/underscore/-/underscore-1.11.2.tgz" @@ -1784,7 +1799,7 @@ "resolved" "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz" "version" "3.2.3" -"ansi-escapes@^4.3.0": +"ansi-escapes@^4.2.1", "ansi-escapes@^4.3.0": "integrity" "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==" "resolved" "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz" "version" "4.3.2" @@ -1817,6 +1832,11 @@ "resolved" "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz" "version" "4.1.0" +"ansi-regex@^5.0.1": + "integrity" "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + "resolved" "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" + "version" "5.0.1" + "ansi-styles@^2.2.1": "version" "2.2.1" @@ -2574,7 +2594,7 @@ "safe-buffer" "^5.0.1" "unorm" "^1.3.3" -"bl@^4.0.3": +"bl@^4.0.3", "bl@^4.1.0": "integrity" "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==" "resolved" "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz" "version" "4.1.0" @@ -3037,6 +3057,22 @@ "escape-string-regexp" "^1.0.5" "supports-color" "^5.3.0" +"chalk@^4.1.0": + "integrity" "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==" + "resolved" "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" + "version" "4.1.2" + dependencies: + "ansi-styles" "^4.1.0" + "supports-color" "^7.1.0" + +"chalk@^4.1.1": + "integrity" "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==" + "resolved" "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" + "version" "4.1.2" + dependencies: + "ansi-styles" "^4.1.0" + "supports-color" "^7.1.0" + "chalk@^4.1.2": "integrity" "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==" "resolved" "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" @@ -3074,6 +3110,11 @@ "upper-case" "^1.1.1" "upper-case-first" "^1.1.0" +"chardet@^0.7.0": + "integrity" "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" + "resolved" "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz" + "version" "0.7.0" + "check-error@^1.0.2": "integrity" "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=" "resolved" "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz" @@ -3213,6 +3254,23 @@ dependencies: "source-map" "~0.6.0" +"cli-cursor@^3.1.0": + "integrity" "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==" + "resolved" "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz" + "version" "3.1.0" + dependencies: + "restore-cursor" "^3.1.0" + +"cli-spinners@^2.5.0": + "integrity" "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==" + "resolved" "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz" + "version" "2.6.1" + +"cli-width@^3.0.0": + "integrity" "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==" + "resolved" "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz" + "version" "3.0.0" + "cliui@^2.1.0": "integrity" "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=" "resolved" "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz" @@ -3247,6 +3305,11 @@ dependencies: "mimic-response" "^1.0.0" +"clone@^1.0.2": + "integrity" "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=" + "resolved" "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz" + "version" "1.0.4" + "clone@^2.0.0", "clone@2.1.2": "version" "2.1.2" @@ -3781,6 +3844,13 @@ "resolved" "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" "version" "0.1.4" +"defaults@^1.0.3": + "integrity" "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=" + "resolved" "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz" + "version" "1.0.3" + dependencies: + "clone" "^1.0.2" + "defer-to-connect@^1.0.1": "integrity" "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==" "resolved" "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz" @@ -4038,6 +4108,11 @@ "resolved" "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz" "version" "7.0.3" +"emoji-regex@^8.0.0": + "integrity" "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "resolved" "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" + "version" "8.0.0" + "emojis-list@^2.0.0": "integrity" "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=" "resolved" "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz" @@ -5026,6 +5101,15 @@ "resolved" "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz" "version" "3.0.2" +"external-editor@^3.0.3": + "integrity" "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==" + "resolved" "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz" + "version" "3.1.0" + dependencies: + "chardet" "^0.7.0" + "iconv-lite" "^0.4.24" + "tmp" "^0.0.33" + "extglob@^2.0.4": "integrity" "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==" "resolved" "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz" @@ -5105,6 +5189,13 @@ "resolved" "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz" "version" "3.5.2" +"figures@^3.0.0": + "integrity" "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==" + "resolved" "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz" + "version" "3.2.0" + dependencies: + "escape-string-regexp" "^1.0.5" + "file-uri-to-path@1.0.0": "integrity" "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" "resolved" "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz" @@ -6147,18 +6238,18 @@ "resolved" "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz" "version" "7.0.4" -"iconv-lite@^0.6.2": - "version" "0.6.2" - dependencies: - "safer-buffer" ">= 2.1.2 < 3.0.0" - -"iconv-lite@0.4.24": +"iconv-lite@^0.4.24", "iconv-lite@0.4.24": "integrity" "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==" "resolved" "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz" "version" "0.4.24" dependencies: "safer-buffer" ">= 2.1.2 < 3" +"iconv-lite@^0.6.2": + "version" "0.6.2" + dependencies: + "safer-buffer" ">= 2.1.2 < 3.0.0" + "icss-replace-symbols@^1.1.0": "integrity" "sha1-Bupvg2ead0njhs/h/oEq5dsiPe0=" "resolved" "https://registry.npmjs.org/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz" @@ -6251,6 +6342,26 @@ "resolved" "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz" "version" "1.3.8" +"inquirer@^8.2.0": + "integrity" "sha512-0crLweprevJ02tTuA6ThpoAERAGyVILC4sS74uib58Xf/zSr1/ZWtmm7D5CI+bSQEaA04f0K7idaHpQbSWgiVQ==" + "resolved" "https://registry.npmjs.org/inquirer/-/inquirer-8.2.0.tgz" + "version" "8.2.0" + dependencies: + "ansi-escapes" "^4.2.1" + "chalk" "^4.1.1" + "cli-cursor" "^3.1.0" + "cli-width" "^3.0.0" + "external-editor" "^3.0.3" + "figures" "^3.0.0" + "lodash" "^4.17.21" + "mute-stream" "0.0.8" + "ora" "^5.4.1" + "run-async" "^2.4.0" + "rxjs" "^7.2.0" + "string-width" "^4.1.0" + "strip-ansi" "^6.0.0" + "through" "^2.3.6" + "internal-slot@^1.0.3": "integrity" "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==" "resolved" "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz" @@ -6454,6 +6565,11 @@ "resolved" "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz" "version" "2.0.0" +"is-fullwidth-code-point@^3.0.0": + "integrity" "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + "resolved" "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz" + "version" "3.0.0" + "is-function@^1.0.1": "integrity" "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" "resolved" "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz" @@ -6485,6 +6601,11 @@ "resolved" "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz" "version" "1.0.0" +"is-interactive@^1.0.0": + "integrity" "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==" + "resolved" "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz" + "version" "1.0.0" + "is-lower-case@^1.1.0": "integrity" "sha1-fhR75HaNxGbbO/shzGCzHmrWk5M=" "resolved" "https://registry.npmjs.org/is-lower-case/-/is-lower-case-1.1.3.tgz" @@ -6600,6 +6721,11 @@ "resolved" "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" "version" "1.0.0" +"is-unicode-supported@^0.1.0": + "integrity" "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==" + "resolved" "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz" + "version" "0.1.0" + "is-upper-case@^1.1.0": "integrity" "sha1-jQsfp+eTOh5YSDYA7H2WYcuvdW8=" "resolved" "https://registry.npmjs.org/is-upper-case/-/is-upper-case-1.1.2.tgz" @@ -7207,6 +7333,14 @@ "lodash@^4.17.4", "lodash@4.17.20": "version" "4.17.20" +"log-symbols@^4.1.0": + "integrity" "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==" + "resolved" "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz" + "version" "4.1.0" + dependencies: + "chalk" "^4.1.0" + "is-unicode-supported" "^0.1.0" + "log-symbols@3.0.0": "integrity" "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==" "resolved" "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz" @@ -7560,6 +7694,11 @@ "resolved" "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz" "version" "2.1.0" +"mimic-fn@^2.1.0": + "integrity" "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + "resolved" "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz" + "version" "2.1.0" + "mimic-response@^1.0.0", "mimic-response@^1.0.1": "integrity" "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" "resolved" "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz" @@ -7790,6 +7929,11 @@ "fmix" "^0.1.0" "imul" "^1.0.0" +"mute-stream@0.0.8": + "integrity" "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + "resolved" "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz" + "version" "0.0.8" + "nan@^2.12.1": "integrity" "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" "resolved" "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz" @@ -8170,6 +8314,13 @@ dependencies: "wrappy" "1" +"onetime@^5.1.0": + "integrity" "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==" + "resolved" "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz" + "version" "5.1.2" + dependencies: + "mimic-fn" "^2.1.0" + "open@^7.4.2": "integrity" "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==" "resolved" "https://registry.npmjs.org/open/-/open-7.4.2.tgz" @@ -8190,6 +8341,21 @@ "type-check" "~0.3.2" "word-wrap" "~1.2.3" +"ora@^5.4.1": + "integrity" "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==" + "resolved" "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz" + "version" "5.4.1" + dependencies: + "bl" "^4.1.0" + "chalk" "^4.1.0" + "cli-cursor" "^3.1.0" + "cli-spinners" "^2.5.0" + "is-interactive" "^1.0.0" + "is-unicode-supported" "^0.1.0" + "log-symbols" "^4.1.0" + "strip-ansi" "^6.0.0" + "wcwidth" "^1.0.1" + "os-browserify@^0.3.0": "integrity" "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=" "resolved" "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz" @@ -9013,7 +9179,16 @@ "string_decoder" "^1.1.1" "util-deprecate" "^1.0.1" -"readable-stream@^3.1.1", "readable-stream@^3.4.0": +"readable-stream@^3.1.1": + "integrity" "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==" + "resolved" "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz" + "version" "3.6.0" + dependencies: + "inherits" "^2.0.3" + "string_decoder" "^1.1.1" + "util-deprecate" "^1.0.1" + +"readable-stream@^3.4.0": "integrity" "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==" "resolved" "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz" "version" "3.6.0" @@ -9239,6 +9414,14 @@ dependencies: "lowercase-keys" "^1.0.0" +"restore-cursor@^3.1.0": + "integrity" "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==" + "resolved" "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz" + "version" "3.1.0" + dependencies: + "onetime" "^5.1.0" + "signal-exit" "^3.0.2" + "resumer@~0.0.0": "version" "0.0.0" dependencies: @@ -9288,6 +9471,11 @@ dependencies: "bn.js" "^4.11.1" +"run-async@^2.4.0": + "integrity" "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==" + "resolved" "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz" + "version" "2.4.1" + "run-parallel@^1.1.9": "integrity" "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==" "resolved" "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz" @@ -9307,6 +9495,13 @@ "resolved" "https://registry.npmjs.org/rustbn.js/-/rustbn.js-0.2.0.tgz" "version" "0.2.0" +"rxjs@^7.2.0": + "integrity" "sha512-7SQDi7xeTMCJpqViXh8gL/lebcwlp3d831F05+9B44A4B0WfsEwUQHR64gsH1kvJ+Ep/J9K2+n1hVl1CsGN23w==" + "resolved" "https://registry.npmjs.org/rxjs/-/rxjs-7.4.0.tgz" + "version" "7.4.0" + dependencies: + "tslib" "~2.1.0" + "rxjs@6": "integrity" "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==" "resolved" "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz" @@ -9595,7 +9790,7 @@ "get-intrinsic" "^1.0.2" "object-inspect" "^1.9.0" -"signal-exit@^3.0.0": +"signal-exit@^3.0.0", "signal-exit@^3.0.2": "integrity" "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" "resolved" "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz" "version" "3.0.3" @@ -9969,6 +10164,15 @@ "is-fullwidth-code-point" "^2.0.0" "strip-ansi" "^5.1.0" +"string-width@^4.1.0": + "integrity" "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==" + "resolved" "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" + "version" "4.2.3" + dependencies: + "emoji-regex" "^8.0.0" + "is-fullwidth-code-point" "^3.0.0" + "strip-ansi" "^6.0.1" + "string.prototype.trim@~1.2.1": "version" "1.2.3" dependencies: @@ -10025,6 +10229,13 @@ dependencies: "ansi-regex" "^4.1.0" +"strip-ansi@^6.0.0", "strip-ansi@^6.0.1": + "integrity" "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==" + "resolved" "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" + "version" "6.0.1" + dependencies: + "ansi-regex" "^5.0.1" + "strip-bom@^2.0.0": "integrity" "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=" "resolved" "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz" @@ -10234,6 +10445,11 @@ "resolved" "https://registry.npmjs.org/testrpc/-/testrpc-0.0.1.tgz" "version" "0.0.1" +"through@^2.3.6": + "integrity" "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + "resolved" "https://registry.npmjs.org/through/-/through-2.3.8.tgz" + "version" "2.3.8" + "through@~2.3.4", "through@~2.3.8": "version" "2.3.8" @@ -10412,6 +10628,11 @@ "resolved" "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz" "version" "2.3.1" +"tslib@~2.1.0": + "integrity" "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==" + "resolved" "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz" + "version" "2.1.0" + "tsort@0.0.1": "integrity" "sha1-4igPXoF/i/QnVlf9D5rr1E9aJ4Y=" "resolved" "https://registry.npmjs.org/tsort/-/tsort-0.0.1.tgz" @@ -10932,6 +11153,13 @@ "chokidar" "^3.4.1" "watchpack-chokidar2" "^2.0.1" +"wcwidth@^1.0.1": + "integrity" "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=" + "resolved" "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz" + "version" "1.0.1" + dependencies: + "defaults" "^1.0.3" + "web3-bzz@1.2.11": "version" "1.2.11" dependencies: From bd96a9585300da8031fb7dc94df969eefad64034 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Mon, 6 Dec 2021 16:47:50 +0530 Subject: [PATCH 24/39] update --- test/mainnet/liquity/liquity.contracts.ts | 168 +- test/mainnet/liquity/liquity.helpers.ts | 604 +- test/mainnet/liquity/liquity.test.ts | 5438 ++++++++--------- .../mainnet/pooltogether/pooltogether.test.ts | 2450 ++++---- 4 files changed, 4330 insertions(+), 4330 deletions(-) diff --git a/test/mainnet/liquity/liquity.contracts.ts b/test/mainnet/liquity/liquity.contracts.ts index 44fa6534..f6a6df74 100644 --- a/test/mainnet/liquity/liquity.contracts.ts +++ b/test/mainnet/liquity/liquity.contracts.ts @@ -1,95 +1,95 @@ -// const TROVE_MANAGER_ADDRESS = "0xA39739EF8b0231DbFA0DcdA07d7e29faAbCf4bb2"; -// const TROVE_MANAGER_ABI = [ -// "function getTroveColl(address _borrower) external view returns (uint)", -// "function getTroveDebt(address _borrower) external view returns (uint)", -// "function getTroveStatus(address _borrower) external view returns (uint)", -// "function redeemCollateral(uint _LUSDAmount, address _firstRedemptionHint, address _upperPartialRedemptionHint, address _lowerPartialRedemptionHint, uint _partialRedemptionHintNICR, uint _maxIterations, uint _maxFee) external returns (uint)", -// "function getNominalICR(address _borrower) external view returns (uint)", -// "function liquidate(address _borrower) external", -// "function liquidateTroves(uint _n) external", -// ]; +const TROVE_MANAGER_ADDRESS = "0xA39739EF8b0231DbFA0DcdA07d7e29faAbCf4bb2"; +const TROVE_MANAGER_ABI = [ + "function getTroveColl(address _borrower) external view returns (uint)", + "function getTroveDebt(address _borrower) external view returns (uint)", + "function getTroveStatus(address _borrower) external view returns (uint)", + "function redeemCollateral(uint _LUSDAmount, address _firstRedemptionHint, address _upperPartialRedemptionHint, address _lowerPartialRedemptionHint, uint _partialRedemptionHintNICR, uint _maxIterations, uint _maxFee) external returns (uint)", + "function getNominalICR(address _borrower) external view returns (uint)", + "function liquidate(address _borrower) external", + "function liquidateTroves(uint _n) external", +]; -// const BORROWER_OPERATIONS_ADDRESS = -// "0x24179CD81c9e782A4096035f7eC97fB8B783e007"; -// const BORROWER_OPERATIONS_ABI = [ -// "function openTrove(uint256 _maxFee, uint256 _LUSDAmount, address _upperHint, address _lowerHint) external payable", -// "function closeTrove() external", -// ]; +const BORROWER_OPERATIONS_ADDRESS = + "0x24179CD81c9e782A4096035f7eC97fB8B783e007"; +const BORROWER_OPERATIONS_ABI = [ + "function openTrove(uint256 _maxFee, uint256 _LUSDAmount, address _upperHint, address _lowerHint) external payable", + "function closeTrove() external", +]; -// const LUSD_TOKEN_ADDRESS = "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0"; -// const LUSD_TOKEN_ABI = [ -// "function transfer(address _to, uint256 _value) public returns (bool success)", -// "function balanceOf(address account) external view returns (uint256)", -// "function approve(address spender, uint256 amount) external returns (bool)", -// ]; +const LUSD_TOKEN_ADDRESS = "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0"; +const LUSD_TOKEN_ABI = [ + "function transfer(address _to, uint256 _value) public returns (bool success)", + "function balanceOf(address account) external view returns (uint256)", + "function approve(address spender, uint256 amount) external returns (bool)", +]; -// const ACTIVE_POOL_ADDRESS = "0xDf9Eb223bAFBE5c5271415C75aeCD68C21fE3D7F"; -// const ACTIVE_POOL_ABI = ["function getLUSDDebt() external view returns (uint)"]; +const ACTIVE_POOL_ADDRESS = "0xDf9Eb223bAFBE5c5271415C75aeCD68C21fE3D7F"; +const ACTIVE_POOL_ABI = ["function getLUSDDebt() external view returns (uint)"]; -// const PRICE_FEED_ADDRESS = "0x4c517D4e2C851CA76d7eC94B805269Df0f2201De"; -// const PRICE_FEED_ABI = ["function fetchPrice() external returns (uint)"]; +const PRICE_FEED_ADDRESS = "0x4c517D4e2C851CA76d7eC94B805269Df0f2201De"; +const PRICE_FEED_ABI = ["function fetchPrice() external returns (uint)"]; -// const HINT_HELPERS_ADDRESS = "0xE84251b93D9524E0d2e621Ba7dc7cb3579F997C0"; -// const HINT_HELPERS_ABI = [ -// "function getRedemptionHints(uint _LUSDamount, uint _price, uint _maxIterations) external view returns (address firstRedemptionHint, uint partialRedemptionHintNICR, uint truncatedLUSDamount)", -// "function getApproxHint(uint _CR, uint _numTrials, uint _inputRandomSeed) view returns (address hintAddress, uint diff, uint latestRandomSeed)", -// "function computeNominalCR(uint _coll, uint _debt) external pure returns (uint)", -// ]; +const HINT_HELPERS_ADDRESS = "0xE84251b93D9524E0d2e621Ba7dc7cb3579F997C0"; +const HINT_HELPERS_ABI = [ + "function getRedemptionHints(uint _LUSDamount, uint _price, uint _maxIterations) external view returns (address firstRedemptionHint, uint partialRedemptionHintNICR, uint truncatedLUSDamount)", + "function getApproxHint(uint _CR, uint _numTrials, uint _inputRandomSeed) view returns (address hintAddress, uint diff, uint latestRandomSeed)", + "function computeNominalCR(uint _coll, uint _debt) external pure returns (uint)", +]; -// const SORTED_TROVES_ADDRESS = "0x8FdD3fbFEb32b28fb73555518f8b361bCeA741A6"; -// const SORTED_TROVES_ABI = [ -// "function findInsertPosition(uint256 _ICR, address _prevId, address _nextId) external view returns (address, address)", -// "function getLast() external view returns (address)", -// ]; +const SORTED_TROVES_ADDRESS = "0x8FdD3fbFEb32b28fb73555518f8b361bCeA741A6"; +const SORTED_TROVES_ABI = [ + "function findInsertPosition(uint256 _ICR, address _prevId, address _nextId) external view returns (address, address)", + "function getLast() external view returns (address)", +]; -// const STABILITY_POOL_ADDRESS = "0x66017D22b0f8556afDd19FC67041899Eb65a21bb"; -// const STABILITY_POOL_ABI = [ -// "function getCompoundedLUSDDeposit(address _depositor) external view returns (uint)", -// "function getDepositorETHGain(address _depositor) external view returns (uint)", -// "function getDepositorLQTYGain(address _depositor) external view returns (uint)", -// ]; +const STABILITY_POOL_ADDRESS = "0x66017D22b0f8556afDd19FC67041899Eb65a21bb"; +const STABILITY_POOL_ABI = [ + "function getCompoundedLUSDDeposit(address _depositor) external view returns (uint)", + "function getDepositorETHGain(address _depositor) external view returns (uint)", + "function getDepositorLQTYGain(address _depositor) external view returns (uint)", +]; -// const STAKING_ADDRESS = "0x4f9Fbb3f1E99B56e0Fe2892e623Ed36A76Fc605d"; -// const STAKING_ABI = [ -// "function stake(uint _LQTYamount) external", -// "function unstake(uint _LQTYamount) external", -// "function getPendingETHGain(address _user) external view returns (uint)", -// "function getPendingLUSDGain(address _user) external view returns (uint)", -// ]; +const STAKING_ADDRESS = "0x4f9Fbb3f1E99B56e0Fe2892e623Ed36A76Fc605d"; +const STAKING_ABI = [ + "function stake(uint _LQTYamount) external", + "function unstake(uint _LQTYamount) external", + "function getPendingETHGain(address _user) external view returns (uint)", + "function getPendingLUSDGain(address _user) external view returns (uint)", +]; -// const LQTY_TOKEN_ADDRESS = "0x6DEA81C8171D0bA574754EF6F8b412F2Ed88c54D"; -// const LQTY_TOKEN_ABI = [ -// "function balanceOf(address account) external view returns (uint256)", -// "function transfer(address _to, uint256 _value) public returns (bool success)", -// "function approve(address spender, uint256 amount) external returns (bool)", -// ]; +const LQTY_TOKEN_ADDRESS = "0x6DEA81C8171D0bA574754EF6F8b412F2Ed88c54D"; +const LQTY_TOKEN_ABI = [ + "function balanceOf(address account) external view returns (uint256)", + "function transfer(address _to, uint256 _value) public returns (bool success)", + "function approve(address spender, uint256 amount) external returns (bool)", +]; -// const COLL_SURPLUS_ADDRESS = "0x3D32e8b97Ed5881324241Cf03b2DA5E2EBcE5521"; -// const COLL_SURPLUS_ABI = [ -// "function getCollateral(address _account) external view returns (uint)", -// ]; +const COLL_SURPLUS_ADDRESS = "0x3D32e8b97Ed5881324241Cf03b2DA5E2EBcE5521"; +const COLL_SURPLUS_ABI = [ + "function getCollateral(address _account) external view returns (uint)", +]; -// module.exports = { -// TROVE_MANAGER_ADDRESS, -// TROVE_MANAGER_ABI, -// BORROWER_OPERATIONS_ADDRESS, -// BORROWER_OPERATIONS_ABI, -// LUSD_TOKEN_ADDRESS, -// LUSD_TOKEN_ABI, -// STABILITY_POOL_ADDRESS, -// STABILITY_POOL_ABI, -// ACTIVE_POOL_ADDRESS, -// ACTIVE_POOL_ABI, -// PRICE_FEED_ADDRESS, -// PRICE_FEED_ABI, -// HINT_HELPERS_ADDRESS, -// HINT_HELPERS_ABI, -// SORTED_TROVES_ADDRESS, -// SORTED_TROVES_ABI, -// STAKING_ADDRESS, -// STAKING_ABI, -// LQTY_TOKEN_ADDRESS, -// LQTY_TOKEN_ABI, -// COLL_SURPLUS_ADDRESS, -// COLL_SURPLUS_ABI, -// }; +module.exports = { + TROVE_MANAGER_ADDRESS, + TROVE_MANAGER_ABI, + BORROWER_OPERATIONS_ADDRESS, + BORROWER_OPERATIONS_ABI, + LUSD_TOKEN_ADDRESS, + LUSD_TOKEN_ABI, + STABILITY_POOL_ADDRESS, + STABILITY_POOL_ABI, + ACTIVE_POOL_ADDRESS, + ACTIVE_POOL_ABI, + PRICE_FEED_ADDRESS, + PRICE_FEED_ABI, + HINT_HELPERS_ADDRESS, + HINT_HELPERS_ABI, + SORTED_TROVES_ADDRESS, + SORTED_TROVES_ABI, + STAKING_ADDRESS, + STAKING_ABI, + LQTY_TOKEN_ADDRESS, + LQTY_TOKEN_ABI, + COLL_SURPLUS_ADDRESS, + COLL_SURPLUS_ABI, +}; diff --git a/test/mainnet/liquity/liquity.helpers.ts b/test/mainnet/liquity/liquity.helpers.ts index 26ff0851..bab90124 100644 --- a/test/mainnet/liquity/liquity.helpers.ts +++ b/test/mainnet/liquity/liquity.helpers.ts @@ -1,343 +1,343 @@ -// import hre from "hardhat"; -// import { ethers } from "hardhat"; -// import hardhatConfig from "../../../hardhat.config"; +import hre from "hardhat"; +import { ethers } from "hardhat"; +import hardhatConfig from "../../../hardhat.config"; -// // Instadapp deployment and testing helpers -// import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" -// import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -// import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" -// import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" +// Instadapp deployment and testing helpers +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -// // Instadapp instadappAddresses/ABIs -// import { instadappAddresses } from "../../../scripts/important/addresses"; -// import { instadappAbi } from "../../../scripts/constant/abis"; +// Instadapp instadappAddresses/ABIs +import { instadappAddresses } from "../../../scripts/important/addresses"; +import { instadappAbi } from "../../../scripts/constant/abis"; -// // Instadapp Liquity Connector artifacts -// import { ConnectV2Liquity__factory, ConnectV2Basic__factory } from "../../../typechain"; +// Instadapp Liquity Connector artifacts +import { ConnectV2Liquity__factory, ConnectV2Basic__factory } from "../../../typechain"; -// // Instadapp uses a fake address to represent native ETH -// import { constants } from "../../../scripts/constant/constant.js"; -// import type { Signer, Contract } from "ethers"; +// Instadapp uses a fake address to represent native ETH +import { constants } from "../../../scripts/constant/constant.js"; +import type { Signer, Contract } from "ethers"; -// const LIQUITY_CONNECTOR = "LIQUITY-v1-TEST"; -// const LUSD_GAS_COMPENSATION = hre.ethers.utils.parseUnits("200", 18); // 200 LUSD gas compensation repaid after loan repayment -// const LIQUIDATABLE_TROVES_BLOCK_NUMBER = 12478159; // Deterministic block number for tests to run against, if you change this, tests will break. -// const JUSTIN_SUN_ADDRESS = "0x903d12bf2c57a29f32365917c706ce0e1a84cce3"; // LQTY whale address -// const LIQUIDATABLE_TROVE_ADDRESS = "0xafbeb4cb97f3b08ec2fe07ef0dac15d37013a347"; // Trove which is liquidatable at blockNumber: LIQUIDATABLE_TROVES_BLOCK_NUMBER -// // const MAX_GAS = hardhatConfig.networks.hardhat.blockGasLimit; // Maximum gas limit (12000000) -// const INSTADAPP_BASIC_V1_CONNECTOR = "Basic-v1"; +const LIQUITY_CONNECTOR = "LIQUITY-v1-TEST"; +const LUSD_GAS_COMPENSATION = hre.ethers.utils.parseUnits("200", 18); // 200 LUSD gas compensation repaid after loan repayment +const LIQUIDATABLE_TROVES_BLOCK_NUMBER = 12478159; // Deterministic block number for tests to run against, if you change this, tests will break. +const JUSTIN_SUN_ADDRESS = "0x903d12bf2c57a29f32365917c706ce0e1a84cce3"; // LQTY whale address +const LIQUIDATABLE_TROVE_ADDRESS = "0xafbeb4cb97f3b08ec2fe07ef0dac15d37013a347"; // Trove which is liquidatable at blockNumber: LIQUIDATABLE_TROVES_BLOCK_NUMBER +// const MAX_GAS = hardhatConfig.networks.hardhat.blockGasLimit; // Maximum gas limit (12000000) +const INSTADAPP_BASIC_V1_CONNECTOR = "Basic-v1"; -// const openTroveSpell = async ( -// dsa: any, -// signer: Signer, -// depositAmount: any, -// borrowAmount: any, -// upperHint: any, -// lowerHint: any, -// maxFeePercentage: any -// ) => { -// let address = await signer.getAddress(); +const openTroveSpell = async ( + dsa: any, + signer: Signer, + depositAmount: any, + borrowAmount: any, + upperHint: any, + lowerHint: any, + maxFeePercentage: any +) => { + let address = await signer.getAddress(); -// const openTroveSpell = { -// connector: LIQUITY_CONNECTOR, -// method: "open", -// args: [ -// depositAmount, -// maxFeePercentage, -// borrowAmount, -// upperHint, -// lowerHint, -// [0, 0], -// [0, 0], -// ], -// }; + const openTroveSpell = { + connector: LIQUITY_CONNECTOR, + method: "open", + args: [ + depositAmount, + maxFeePercentage, + borrowAmount, + upperHint, + lowerHint, + [0, 0], + [0, 0], + ], + }; -// return await dsa -// .connect(signer) -// .cast(...encodeSpells([openTroveSpell]), address, { -// value: depositAmount, -// }); -// }; + return await dsa + .connect(signer) + .cast(...encodeSpells([openTroveSpell]), address, { + value: depositAmount, + }); +}; -// const createDsaTrove = async ( -// dsa: any, -// signer: any, -// liquity: any, -// depositAmount = hre.ethers.utils.parseEther("5"), -// borrowAmount = hre.ethers.utils.parseUnits("2000", 18) -// ) => { -// const maxFeePercentage = hre.ethers.utils.parseUnits("0.5", 18); // 0.5% max fee -// const { upperHint, lowerHint } = await getTroveInsertionHints( -// depositAmount, -// borrowAmount, -// liquity -// ); -// return await openTroveSpell( -// dsa, -// signer, -// depositAmount, -// borrowAmount, -// upperHint, -// lowerHint, -// maxFeePercentage -// ); -// }; +const createDsaTrove = async ( + dsa: any, + signer: any, + liquity: any, + depositAmount = hre.ethers.utils.parseEther("5"), + borrowAmount = hre.ethers.utils.parseUnits("2000", 18) +) => { + const maxFeePercentage = hre.ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + const { upperHint, lowerHint } = await getTroveInsertionHints( + depositAmount, + borrowAmount, + liquity + ); + return await openTroveSpell( + dsa, + signer, + depositAmount, + borrowAmount, + upperHint, + lowerHint, + maxFeePercentage + ); +}; -// const sendToken = async (token: any, amount: any, from: any, to: any) => { -// await hre.network.provider.request({ -// method: "hardhat_impersonateAccount", -// params: [from], -// }); -// const signer = hre.ethers.provider.getSigner(from); +const sendToken = async (token: any, amount: any, from: any, to: any) => { + await hre.network.provider.request({ + method: "hardhat_impersonateAccount", + params: [from], + }); + const signer = hre.ethers.provider.getSigner(from); -// return await token.connect(signer).transfer(to, amount, { -// gasPrice: 0, -// }); -// }; + return await token.connect(signer).transfer(to, amount, { + gasPrice: 0, + }); +}; -// const resetInitialState = async (walletAddress: any, contracts: any, isDebug = false) => { -// const liquity = await deployAndConnect(contracts, isDebug); -// const dsa = await buildDSAv2(walletAddress); +const resetInitialState = async (walletAddress: any, contracts: any, isDebug = false) => { + const liquity = await deployAndConnect(contracts, isDebug); + const dsa = await buildDSAv2(walletAddress); -// return [liquity, dsa]; -// }; + return [liquity, dsa]; +}; -// const resetHardhatBlockNumber = async (blockNumber: number) => { -// return await hre.network.provider.request({ -// method: "hardhat_reset", -// params: [ -// { -// forking: { -// // @ts-ignore -// jsonRpcUrl: hre.config.networks.hardhat.forking.url, -// blockNumber, -// }, -// }, -// ], -// }); -// }; +const resetHardhatBlockNumber = async (blockNumber: number) => { + return await hre.network.provider.request({ + method: "hardhat_reset", + params: [ + { + forking: { + // @ts-ignore + jsonRpcUrl: hre.config.networks.hardhat.forking.url, + blockNumber, + }, + }, + ], + }); +}; -// const deployAndConnect = async (contracts: any, isDebug = false) => { -// // Pin Liquity tests to a particular block number to create deterministic state (Ether price etc.) -// await resetHardhatBlockNumber(LIQUIDATABLE_TROVES_BLOCK_NUMBER); -// let liquity = { -// troveManager: Contract, -// borrowerOperations: null, -// stabilityPool: null, -// lusdToken: null, -// lqtyToken: null, -// activePool: null, -// priceFeed: null, -// hintHelpers: null, -// sortedTroves: null, -// staking: null, -// collSurplus: null, -// }; +const deployAndConnect = async (contracts: any, isDebug = false) => { + // Pin Liquity tests to a particular block number to create deterministic state (Ether price etc.) + await resetHardhatBlockNumber(LIQUIDATABLE_TROVES_BLOCK_NUMBER); + let liquity = { + troveManager: Contract, + borrowerOperations: null, + stabilityPool: null, + lusdToken: null, + lqtyToken: null, + activePool: null, + priceFeed: null, + hintHelpers: null, + sortedTroves: null, + staking: null, + collSurplus: null, + }; -// const masterSigner = await getMasterSigner(); -// const instaConnectorsV2 = await ethers.getContractAt( -// instadappAbi.core.connectorsV2, -// instadappAddresses.core.connectorsV2 -// ); -// const connector = await deployAndEnableConnector({ -// connectorName: LIQUITY_CONNECTOR, -// contractArtifact: ConnectV2Liquity__factory, -// signer: masterSigner, -// connectors: instaConnectorsV2, -// }); -// isDebug && -// console.log(`${LIQUITY_CONNECTOR} Connector address`, connector.address); + const masterSigner = await getMasterSigner(); + const instaConnectorsV2 = await ethers.getContractAt( + instadappAbi.core.connectorsV2, + instadappAddresses.core.connectorsV2 + ); + const connector = await deployAndEnableConnector({ + connectorName: LIQUITY_CONNECTOR, + contractArtifact: ConnectV2Liquity__factory, + signer: masterSigner, + connectors: instaConnectorsV2, + }); + isDebug && + console.log(`${LIQUITY_CONNECTOR} Connector address`, connector.address); -// const basicConnector = await deployAndEnableConnector({ -// connectorName: "Basic-v1", -// contractArtifact: ConnectV2Basic__factory, -// signer: masterSigner, -// connectors: instaConnectorsV2, -// }); -// isDebug && console.log("Basic-v1 Connector address", basicConnector.address); + const basicConnector = await deployAndEnableConnector({ + connectorName: "Basic-v1", + contractArtifact: ConnectV2Basic__factory, + signer: masterSigner, + connectors: instaConnectorsV2, + }); + isDebug && console.log("Basic-v1 Connector address", basicConnector.address); -// liquity.troveManager = new ethers.Contract( -// contracts.TROVE_MANAGER_ADDRESS, -// contracts.TROVE_MANAGER_ABI, -// ethers.provider -// ); + liquity.troveManager = new ethers.Contract( + contracts.TROVE_MANAGER_ADDRESS, + contracts.TROVE_MANAGER_ABI, + ethers.provider + ); -// liquity.borrowerOperations = new ethers.Contract( -// contracts.BORROWER_OPERATIONS_ADDRESS, -// contracts.BORROWER_OPERATIONS_ABI, -// ethers.provider -// ); + liquity.borrowerOperations = new ethers.Contract( + contracts.BORROWER_OPERATIONS_ADDRESS, + contracts.BORROWER_OPERATIONS_ABI, + ethers.provider + ); -// liquity.stabilityPool = new ethers.Contract( -// contracts.STABILITY_POOL_ADDRESS, -// contracts.STABILITY_POOL_ABI, -// ethers.provider -// ); + liquity.stabilityPool = new ethers.Contract( + contracts.STABILITY_POOL_ADDRESS, + contracts.STABILITY_POOL_ABI, + ethers.provider + ); -// liquity.lusdToken = new ethers.Contract( -// contracts.LUSD_TOKEN_ADDRESS, -// contracts.LUSD_TOKEN_ABI, -// ethers.provider -// ); + liquity.lusdToken = new ethers.Contract( + contracts.LUSD_TOKEN_ADDRESS, + contracts.LUSD_TOKEN_ABI, + ethers.provider + ); -// liquity.lqtyToken = new ethers.Contract( -// contracts.LQTY_TOKEN_ADDRESS, -// contracts.LQTY_TOKEN_ABI, -// ethers.provider -// ); + liquity.lqtyToken = new ethers.Contract( + contracts.LQTY_TOKEN_ADDRESS, + contracts.LQTY_TOKEN_ABI, + ethers.provider + ); -// liquity.activePool = new ethers.Contract( -// contracts.ACTIVE_POOL_ADDRESS, -// contracts.ACTIVE_POOL_ABI, -// ethers.provider -// ); + liquity.activePool = new ethers.Contract( + contracts.ACTIVE_POOL_ADDRESS, + contracts.ACTIVE_POOL_ABI, + ethers.provider + ); -// liquity.priceFeed = new ethers.Contract( -// contracts.PRICE_FEED_ADDRESS, -// contracts.PRICE_FEED_ABI, -// ethers.provider -// ); + liquity.priceFeed = new ethers.Contract( + contracts.PRICE_FEED_ADDRESS, + contracts.PRICE_FEED_ABI, + ethers.provider + ); -// liquity.hintHelpers = new ethers.Contract( -// contracts.HINT_HELPERS_ADDRESS, -// contracts.HINT_HELPERS_ABI, -// ethers.provider -// ); + liquity.hintHelpers = new ethers.Contract( + contracts.HINT_HELPERS_ADDRESS, + contracts.HINT_HELPERS_ABI, + ethers.provider + ); -// liquity.sortedTroves = new ethers.Contract( -// contracts.SORTED_TROVES_ADDRESS, -// contracts.SORTED_TROVES_ABI, -// ethers.provider -// ); + liquity.sortedTroves = new ethers.Contract( + contracts.SORTED_TROVES_ADDRESS, + contracts.SORTED_TROVES_ABI, + ethers.provider + ); -// liquity.staking = new ethers.Contract( -// contracts.STAKING_ADDRESS, -// contracts.STAKING_ABI, -// ethers.provider -// ); -// liquity.collSurplus = new ethers.Contract( -// contracts.COLL_SURPLUS_ADDRESS, -// contracts.COLL_SURPLUS_ABI, -// ethers.provider -// ); + liquity.staking = new ethers.Contract( + contracts.STAKING_ADDRESS, + contracts.STAKING_ABI, + ethers.provider + ); + liquity.collSurplus = new ethers.Contract( + contracts.COLL_SURPLUS_ADDRESS, + contracts.COLL_SURPLUS_ABI, + ethers.provider + ); -// return liquity; -// }; + return liquity; +}; -// const getTroveInsertionHints = async (depositAmount, borrowAmount, liquity: any) => { -// const nominalCR = await liquity.hintHelpers.computeNominalCR( -// depositAmount, -// borrowAmount -// ); +const getTroveInsertionHints = async (depositAmount, borrowAmount, liquity: any) => { + const nominalCR = await liquity.hintHelpers.computeNominalCR( + depositAmount, + borrowAmount + ); -// const { -// hintAddress, -// latestRandomSeed, -// } = await liquity.hintHelpers.getApproxHint(nominalCR, 50, 1298379, { -// gasLimit: MAX_GAS, -// }); -// randomSeed = latestRandomSeed; + const { + hintAddress, + latestRandomSeed, + } = await liquity.hintHelpers.getApproxHint(nominalCR, 50, 1298379, { + gasLimit: MAX_GAS, + }); + randomSeed = latestRandomSeed; -// const { -// 0: upperHint, -// 1: lowerHint, -// } = await liquity.sortedTroves.findInsertPosition( -// nominalCR, -// hintAddress, -// hintAddress, -// { -// gasLimit: MAX_GAS, -// } -// ); + const { + 0: upperHint, + 1: lowerHint, + } = await liquity.sortedTroves.findInsertPosition( + nominalCR, + hintAddress, + hintAddress, + { + gasLimit: MAX_GAS, + } + ); -// return { -// upperHint, -// lowerHint, -// }; -// }; + return { + upperHint, + lowerHint, + }; +}; -// let randomSeed = 4223; +let randomSeed = 4223; -// const getRedemptionHints = async (amount, liquity) => { -// const ethPrice = await liquity.priceFeed.callStatic.fetchPrice(); -// const [ -// firstRedemptionHint, -// partialRedemptionHintNicr, -// ] = await liquity.hintHelpers.getRedemptionHints(amount, ethPrice, 0); +const getRedemptionHints = async (amount, liquity) => { + const ethPrice = await liquity.priceFeed.callStatic.fetchPrice(); + const [ + firstRedemptionHint, + partialRedemptionHintNicr, + ] = await liquity.hintHelpers.getRedemptionHints(amount, ethPrice, 0); -// const { -// hintAddress, -// latestRandomSeed, -// } = await liquity.hintHelpers.getApproxHint( -// partialRedemptionHintNicr, -// 50, -// randomSeed, -// { -// gasLimit: MAX_GAS, -// } -// ); -// randomSeed = latestRandomSeed; + const { + hintAddress, + latestRandomSeed, + } = await liquity.hintHelpers.getApproxHint( + partialRedemptionHintNicr, + 50, + randomSeed, + { + gasLimit: MAX_GAS, + } + ); + randomSeed = latestRandomSeed; -// const { -// 0: upperHint, -// 1: lowerHint, -// } = await liquity.sortedTroves.findInsertPosition( -// partialRedemptionHintNicr, -// hintAddress, -// hintAddress, -// { -// gasLimit: MAX_GAS, -// } -// ); + const { + 0: upperHint, + 1: lowerHint, + } = await liquity.sortedTroves.findInsertPosition( + partialRedemptionHintNicr, + hintAddress, + hintAddress, + { + gasLimit: MAX_GAS, + } + ); -// return { -// partialRedemptionHintNicr, -// firstRedemptionHint, -// upperHint, -// lowerHint, -// }; -// }; + return { + partialRedemptionHintNicr, + firstRedemptionHint, + upperHint, + lowerHint, + }; +}; -// const redeem = async (amount, from, wallet, liquity) => { -// await sendToken(liquity.lusdToken, amount, from, wallet.address); -// const { -// partialRedemptionHintNicr, -// firstRedemptionHint, -// upperHint, -// lowerHint, -// } = await getRedemptionHints(amount, liquity); -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee +const redeem = async (amount, from, wallet, liquity) => { + await sendToken(liquity.lusdToken, amount, from, wallet.address); + const { + partialRedemptionHintNicr, + firstRedemptionHint, + upperHint, + lowerHint, + } = await getRedemptionHints(amount, liquity); + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee -// return await liquity.troveManager -// .connect(wallet) -// .redeemCollateral( -// amount, -// firstRedemptionHint, -// upperHint, -// lowerHint, -// partialRedemptionHintNicr, -// 0, -// maxFeePercentage, -// { -// gasLimit: MAX_GAS, // permit max gas -// } -// ); -// }; + return await liquity.troveManager + .connect(wallet) + .redeemCollateral( + amount, + firstRedemptionHint, + upperHint, + lowerHint, + partialRedemptionHintNicr, + 0, + maxFeePercentage, + { + gasLimit: MAX_GAS, // permit max gas + } + ); +}; -// module.exports = { -// deployAndConnect, -// resetInitialState, -// createDsaTrove, -// sendToken, -// getTroveInsertionHints, -// getRedemptionHints, -// redeem, -// LIQUITY_CONNECTOR, -// LUSD_GAS_COMPENSATION, -// JUSTIN_SUN_ADDRESS, -// LIQUIDATABLE_TROVE_ADDRESS, -// MAX_GAS, -// INSTADAPP_BASIC_V1_CONNECTOR, -// ETH_ADDRESS, -// }; +module.exports = { + deployAndConnect, + resetInitialState, + createDsaTrove, + sendToken, + getTroveInsertionHints, + getRedemptionHints, + redeem, + LIQUITY_CONNECTOR, + LUSD_GAS_COMPENSATION, + JUSTIN_SUN_ADDRESS, + LIQUIDATABLE_TROVE_ADDRESS, + MAX_GAS, + INSTADAPP_BASIC_V1_CONNECTOR, + ETH_ADDRESS, +}; diff --git a/test/mainnet/liquity/liquity.test.ts b/test/mainnet/liquity/liquity.test.ts index 151c1881..fd5ccd69 100644 --- a/test/mainnet/liquity/liquity.test.ts +++ b/test/mainnet/liquity/liquity.test.ts @@ -1,2719 +1,2719 @@ -// import hre from "hardhat"; -// import { expect } from "chai"; - -// // Instadapp deployment and testing helpers -// import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; -// import { encodeSpells } from "../../../scripts/tests/encodeSpells.js"; - -// // Liquity smart contracts -// import contracts from "./liquity.contracts"; - -// // Liquity helpers -// import helpers from "./liquity.helpers"; - -// describe("Liquity", () => { -// const { waffle, ethers } = hre; -// const { provider } = waffle; - -// // Waffle test account 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 (holds 1000 ETH) -// const userWallet = provider.getWallets()[0]; -// let dsa = null; -// let liquity = null; - -// before(async () => { -// await hre.network.provider.request({ -// method: "hardhat_reset", -// params: [ -// { -// forking: { -// jsonRpcUrl: hre.config.networks.hardhat.forking.url, -// blockNumber: 13300000, -// }, -// }, -// ], -// }); -// liquity = await helpers.deployAndConnect(contracts, true); -// expect(liquity.troveManager.address).to.exist; -// expect(liquity.borrowerOperations.address).to.exist; -// expect(liquity.stabilityPool.address).to.exist; -// expect(liquity.lusdToken.address).to.exist; -// expect(liquity.lqtyToken.address).to.exist; -// expect(liquity.activePool.address).to.exist; -// expect(liquity.priceFeed.address).to.exist; -// expect(liquity.hintHelpers.address).to.exist; -// expect(liquity.sortedTroves.address).to.exist; -// expect(liquity.staking.address).to.exist; -// }); - -// beforeEach(async () => { -// // Build a new DSA before each test so we start each test from the same default state -// dsa = await buildDSAv2(userWallet.address); -// expect(dsa.address).to.exist; -// }); - -// describe("Main (Connector)", () => { -// describe("Trove", () => { -// describe("open()", () => { -// it("opens a Trove", async () => { -// const depositAmount = ethers.utils.parseEther("5"); // 5 ETH -// const borrowAmount = ethers.utils.parseUnits("2000", 18); // 2000 LUSD -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const originalUserBalance = await ethers.provider.getBalance( -// userWallet.address -// ); -// const originalDsaBalance = await ethers.provider.getBalance( -// dsa.address -// ); - -// const openTroveSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "open", -// args: [ -// depositAmount, -// maxFeePercentage, -// borrowAmount, -// upperHint, -// lowerHint, -// [0, 0], -// [0, 0], -// ], -// }; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([openTroveSpell]), userWallet.address, { -// value: depositAmount, -// gasPrice: 0, -// }); - -// const userBalance = await ethers.provider.getBalance( -// userWallet.address -// ); -// const dsaEthBalance = await ethers.provider.getBalance(dsa.address); -// const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); -// const troveDebt = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const troveCollateral = await liquity.troveManager.getTroveColl( -// dsa.address -// ); - -// expect(userBalance).eq( -// originalUserBalance.sub(depositAmount), -// "User's Ether balance should decrease by the amount they deposited" -// ); - -// expect(dsaEthBalance).to.eq( -// originalDsaBalance, -// "User's DSA account Ether should not change after borrowing" -// ); - -// expect( -// dsaLusdBalance, -// "DSA account should now hold the amount the user borrowed" -// ).to.eq(borrowAmount); - -// expect(troveDebt).to.gt( -// borrowAmount, -// "Trove debt should equal the borrowed amount plus fee" -// ); - -// expect(troveCollateral).to.eq( -// depositAmount, -// "Trove collateral should equal the deposited amount" -// ); -// }); - -// it("opens a Trove using ETH collected from a previous spell", async () => { -// const depositAmount = ethers.utils.parseEther("5"); // 5 ETH -// const borrowAmount = ethers.utils.parseUnits("2000", 18); // 2000 LUSD -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const originalUserBalance = await ethers.provider.getBalance( -// userWallet.address -// ); -// const originalDsaBalance = await ethers.provider.getBalance( -// dsa.address -// ); -// const depositId = 1; // Choose an ID to store and retrieve the deposited ETH - -// const depositEthSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "deposit", -// args: [helpers.ETH_ADDRESS, depositAmount, 0, depositId], -// }; - -// const openTroveSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "open", -// args: [ -// 0, // When pulling ETH from a previous spell it doesn't matter what deposit value we put in this param -// maxFeePercentage, -// borrowAmount, -// upperHint, -// lowerHint, -// [depositId, 0], -// [0, 0], -// ], -// }; - -// const spells = [depositEthSpell, openTroveSpell]; -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address, { -// value: depositAmount, -// gasPrice: 0, -// }); - -// const userBalance = await ethers.provider.getBalance( -// userWallet.address -// ); -// const dsaEthBalance = await ethers.provider.getBalance(dsa.address); -// const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); -// const troveDebt = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const troveCollateral = await liquity.troveManager.getTroveColl( -// dsa.address -// ); - -// expect(userBalance).eq( -// originalUserBalance.sub(depositAmount), -// "User's Ether balance should decrease by the amount they deposited" -// ); - -// expect(dsaEthBalance).to.eq( -// originalDsaBalance, -// "DSA balance should not change" -// ); - -// expect( -// dsaLusdBalance, -// "DSA account should now hold the amount the user borrowed" -// ).to.eq(borrowAmount); - -// expect(troveDebt).to.gt( -// borrowAmount, -// "Trove debt should equal the borrowed amount plus fee" -// ); - -// expect(troveCollateral).to.eq( -// depositAmount, -// "Trove collateral should equal the deposited amount" -// ); -// }); - -// it("opens a Trove and stores the debt for other spells to use", async () => { -// const depositAmount = ethers.utils.parseEther("5"); // 5 ETH -// const borrowAmount = ethers.utils.parseUnits("2000", 18); // 2000 LUSD -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const originalUserBalance = await ethers.provider.getBalance( -// userWallet.address -// ); -// const originalDsaBalance = await ethers.provider.getBalance( -// dsa.address -// ); -// const borrowId = 1; - -// const openTroveSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "open", -// args: [ -// depositAmount, -// maxFeePercentage, -// borrowAmount, -// upperHint, -// lowerHint, -// [0, 0], -// [borrowId, 0], -// ], -// }; - -// const withdrawLusdSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "withdraw", -// args: [ -// contracts.LUSD_TOKEN_ADDRESS, -// 0, // Amount comes from the previous spell's setId -// dsa.address, -// borrowId, -// 0, -// ], -// }; - -// const spells = [openTroveSpell, withdrawLusdSpell]; -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address, { -// value: depositAmount, -// gasPrice: 0, -// }); - -// const userBalance = await ethers.provider.getBalance( -// userWallet.address -// ); -// const dsaEthBalance = await ethers.provider.getBalance(dsa.address); -// const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); -// const troveDebt = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const troveCollateral = await liquity.troveManager.getTroveColl( -// dsa.address -// ); - -// expect(userBalance).eq( -// originalUserBalance.sub(depositAmount), -// "User's Ether balance should decrease by the amount they deposited" -// ); - -// expect(dsaEthBalance).to.eq( -// originalDsaBalance, -// "User's DSA account Ether should not change after borrowing" -// ); - -// expect( -// dsaLusdBalance, -// "DSA account should now hold the amount the user borrowed" -// ).to.eq(borrowAmount); - -// expect(troveDebt).to.gt( -// borrowAmount, -// "Trove debt should equal the borrowed amount plus fee" -// ); - -// expect(troveCollateral).to.eq( -// depositAmount, -// "Trove collateral should equal the deposited amount" -// ); -// }); - -// it("returns Instadapp event name and data", async () => { -// const depositAmount = ethers.utils.parseEther("5"); -// const borrowAmount = ethers.utils.parseUnits("2000", 18); -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; - -// const openTroveSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "open", -// args: [ -// depositAmount, -// maxFeePercentage, -// borrowAmount, -// upperHint, -// lowerHint, -// [0, 0], -// [0, 0], -// ], -// }; - -// const openTx = await dsa.cast( -// ...encodeSpells([openTroveSpell]), -// userWallet.address, -// { -// value: depositAmount, -// } -// ); -// const receipt = await openTx.wait(); -// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") -// .args; -// expect(castLogEvent.eventNames[0]).eq( -// "LogOpen(address,uint256,uint256,uint256,uint256[],uint256[])" -// ); -// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( -// [ -// "address", -// "uint256", -// "uint256", -// "uint256", -// "uint256[]", -// "uint256[]", -// ], -// [ -// dsa.address, -// maxFeePercentage, -// depositAmount, -// borrowAmount, -// [0, 0], -// [0, 0], -// ] -// ); -// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); -// }); -// }); - -// describe("close()", () => { -// it("closes a Trove", async () => { -// const depositAmount = ethers.utils.parseEther("5"); -// const borrowAmount = ethers.utils.parseUnits("2000", 18); -// // Create a dummy Trove -// await helpers.createDsaTrove( -// dsa, -// userWallet, -// liquity, -// depositAmount, -// borrowAmount -// ); - -// const troveDebtBefore = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); - -// const troveCollateralBefore = await liquity.troveManager.getTroveColl( -// dsa.address -// ); - -// // Send DSA account enough LUSD (from Stability Pool) to close their Trove -// const extraLusdRequiredToCloseTrove = troveDebtBefore.sub( -// borrowAmount -// ); - -// await helpers.sendToken( -// liquity.lusdToken, -// extraLusdRequiredToCloseTrove, -// contracts.STABILITY_POOL_ADDRESS, -// dsa.address -// ); - -// const originalDsaLusdBalance = await liquity.lusdToken.balanceOf( -// dsa.address -// ); - -// expect( -// originalDsaLusdBalance, -// "DSA account should now hold the LUSD amount required to pay off the Trove debt" -// ).to.eq(troveDebtBefore); - -// const closeTroveSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "close", -// args: [0], -// }; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([closeTroveSpell]), userWallet.address); - -// const dsaEthBalance = await ethers.provider.getBalance(dsa.address); -// const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); -// const troveDebt = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const troveCollateral = await liquity.troveManager.getTroveColl( -// dsa.address -// ); - -// expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); - -// expect( -// troveCollateral, -// "Trove collateral should equal 0 after close" -// ).to.eq(0); - -// expect( -// dsaEthBalance, -// "DSA account should now hold the Trove's ETH collateral" -// ).to.eq(troveCollateralBefore); - -// expect( -// dsaLusdBalance, -// "DSA account should now hold the gas compensation amount of LUSD as it paid off the Trove debt" -// ).to.eq(helpers.LUSD_GAS_COMPENSATION); -// }); - -// it("closes a Trove using LUSD obtained from a previous spell", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// const troveDebtBefore = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const troveCollateralBefore = await liquity.troveManager.getTroveColl( -// dsa.address -// ); - -// // Send user enough LUSD to repay the loan, we'll use a deposit and withdraw spell to obtain it -// await helpers.sendToken( -// liquity.lusdToken, -// troveDebtBefore, -// contracts.STABILITY_POOL_ADDRESS, -// userWallet.address -// ); - -// // Allow DSA to spend user's LUSD -// await liquity.lusdToken -// .connect(userWallet) -// .approve(dsa.address, troveDebtBefore); - -// // Simulate a spell which would have pulled LUSD from somewhere (e.g. Uniswap) into InstaMemory -// // In this case we're simply running a deposit spell from the user's EOA -// const depositLusdSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "deposit", -// args: [contracts.LUSD_TOKEN_ADDRESS, troveDebtBefore, 0, 0], -// }; - -// const closeTroveSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "close", -// args: [0], -// }; -// const spells = [depositLusdSpell, closeTroveSpell]; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address); - -// const dsaEthBalance = await ethers.provider.getBalance(dsa.address); -// const troveDebt = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const troveCollateral = await liquity.troveManager.getTroveColl( -// dsa.address -// ); - -// expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); - -// expect( -// troveCollateral, -// "Trove collateral should equal 0 after close" -// ).to.eq(0); - -// expect( -// dsaEthBalance, -// "DSA account should now hold the Trove's ETH collateral" -// ).to.eq(troveCollateralBefore); -// }); - -// it("closes a Trove and stores the released collateral for other spells to use", async () => { -// const depositAmount = ethers.utils.parseEther("5"); -// const borrowAmount = ethers.utils.parseUnits("2000", 18); -// // Create a dummy Trove -// await helpers.createDsaTrove( -// dsa, -// userWallet, -// liquity, -// depositAmount, -// borrowAmount -// ); - -// const troveDebtBefore = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const troveCollateralBefore = await liquity.troveManager.getTroveColl( -// dsa.address -// ); - -// // Send DSA account enough LUSD (from Stability Pool) to close their Trove -// const extraLusdRequiredToCloseTrove = troveDebtBefore.sub( -// borrowAmount -// ); -// await helpers.sendToken( -// liquity.lusdToken, -// extraLusdRequiredToCloseTrove, -// contracts.STABILITY_POOL_ADDRESS, -// dsa.address -// ); -// const originalDsaLusdBalance = await liquity.lusdToken.balanceOf( -// dsa.address -// ); - -// expect( -// originalDsaLusdBalance, -// "DSA account should now hold the LUSD amount required to pay off the Trove debt" -// ).to.eq(troveDebtBefore); - -// const collateralWithdrawId = 1; - -// const closeTroveSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "close", -// args: [collateralWithdrawId], -// }; - -// const withdrawEthSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "withdraw", -// args: [ -// helpers.ETH_ADDRESS, -// 0, // amount comes from the previous spell's setId -// dsa.address, -// collateralWithdrawId, -// 0, -// ], -// }; - -// await dsa -// .connect(userWallet) -// .cast( -// ...encodeSpells([closeTroveSpell, withdrawEthSpell]), -// userWallet.address -// ); - -// const dsaEthBalance = await ethers.provider.getBalance(dsa.address); -// const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); -// const troveDebt = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const troveCollateral = await liquity.troveManager.getTroveColl( -// dsa.address -// ); - -// expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); - -// expect( -// troveCollateral, -// "Trove collateral should equal 0 after close" -// ).to.eq(0); - -// expect( -// dsaEthBalance, -// "DSA account should now hold the Trove's ETH collateral" -// ).to.eq(troveCollateralBefore); - -// expect( -// dsaLusdBalance, -// "DSA account should now hold the gas compensation amount of LUSD as it paid off the Trove debt" -// ).to.eq(helpers.LUSD_GAS_COMPENSATION); -// }); - -// it("returns Instadapp event name and data", async () => { -// const depositAmount = ethers.utils.parseEther("5"); -// const borrowAmount = ethers.utils.parseUnits("2000", 18); -// // Create a dummy Trove -// await helpers.createDsaTrove( -// dsa, -// userWallet, -// liquity, -// depositAmount, -// borrowAmount -// ); -// await helpers.sendToken( -// liquity.lusdToken, -// ethers.utils.parseUnits("2500", 18), -// contracts.STABILITY_POOL_ADDRESS, -// dsa.address -// ); - -// const closeTroveSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "close", -// args: [0], -// }; - -// const closeTx = await dsa -// .connect(userWallet) -// .cast(...encodeSpells([closeTroveSpell]), userWallet.address); - -// const receipt = await closeTx.wait(); -// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") -// .args; -// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( -// ["address", "uint256"], -// [dsa.address, 0] -// ); -// expect(castLogEvent.eventNames[0]).eq("LogClose(address,uint256)"); -// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); -// }); -// }); - -// describe("deposit()", () => { -// it("deposits ETH into a Trove", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// const troveCollateralBefore = await liquity.troveManager.getTroveColl( -// dsa.address -// ); - -// const topupAmount = ethers.utils.parseEther("1"); -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const depositEthSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "deposit", -// args: [topupAmount, upperHint, lowerHint, 0, 0], -// }; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([depositEthSpell]), userWallet.address, { -// value: topupAmount, -// }); - -// const troveCollateral = await liquity.troveManager.getTroveColl( -// dsa.address -// ); - -// const expectedTroveCollateral = troveCollateralBefore.add( -// topupAmount -// ); - -// expect( -// troveCollateral, -// `Trove collateral should have increased by ${topupAmount} ETH` -// ).to.eq(expectedTroveCollateral); -// }); - -// it("deposits using ETH gained from a previous spell", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); -// const troveCollateralBefore = await liquity.troveManager.getTroveColl( -// dsa.address -// ); - -// const topupAmount = ethers.utils.parseEther("1"); -// const depositId = 1; -// const depositEthSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "deposit", -// args: [helpers.ETH_ADDRESS, topupAmount, 0, depositId], -// }; - -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const depositEthToTroveSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "deposit", -// args: [0, upperHint, lowerHint, depositId, 0], -// }; -// const spells = [depositEthSpell, depositEthToTroveSpell]; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address, { -// value: topupAmount, -// }); - -// const troveCollateral = await liquity.troveManager.getTroveColl( -// dsa.address -// ); - -// const expectedTroveCollateral = troveCollateralBefore.add( -// topupAmount -// ); - -// expect( -// troveCollateral, -// `Trove collateral should have increased by ${topupAmount} ETH` -// ).to.eq(expectedTroveCollateral); -// }); - -// it("returns Instadapp event name and data", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// const topupAmount = ethers.utils.parseEther("1"); -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const depositEthSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "deposit", -// args: [topupAmount, upperHint, lowerHint, 0, 0], -// }; - -// const depositTx = await dsa -// .connect(userWallet) -// .cast(...encodeSpells([depositEthSpell]), userWallet.address, { -// value: topupAmount, -// }); - -// const receipt = await depositTx.wait(); -// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") -// .args; -// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( -// ["address", "uint256", "uint256", "uint256"], -// [dsa.address, topupAmount, 0, 0] -// ); -// expect(castLogEvent.eventNames[0]).eq( -// "LogDeposit(address,uint256,uint256,uint256)" -// ); -// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); -// }); -// }); - -// describe("withdraw()", () => { -// it("withdraws ETH from a Trove", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// const troveCollateralBefore = await liquity.troveManager.getTroveColl( -// dsa.address -// ); -// const withdrawAmount = ethers.utils.parseEther("1"); -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const withdrawEthSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "withdraw", -// args: [withdrawAmount, upperHint, lowerHint, 0, 0], -// }; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([withdrawEthSpell]), userWallet.address); - -// const troveCollateral = await liquity.troveManager.getTroveColl( -// dsa.address -// ); -// const expectedTroveCollateral = troveCollateralBefore.sub( -// withdrawAmount -// ); - -// expect( -// troveCollateral, -// `Trove collateral should have decreased by ${withdrawAmount} ETH` -// ).to.eq(expectedTroveCollateral); -// }); - -// it("withdraws ETH from a Trove and stores the ETH for other spells to use", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// const troveCollateralBefore = await liquity.troveManager.getTroveColl( -// dsa.address -// ); -// const originalUserEthBalance = await ethers.provider.getBalance( -// userWallet.address -// ); - -// const withdrawAmount = ethers.utils.parseEther("1"); -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const withdrawId = 1; -// const withdrawEthFromTroveSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "withdraw", -// args: [withdrawAmount, upperHint, lowerHint, 0, withdrawId], -// }; - -// const withdrawEthSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "withdraw", -// args: [helpers.ETH_ADDRESS, 0, userWallet.address, withdrawId, 0], -// }; -// const spells = [withdrawEthFromTroveSpell, withdrawEthSpell]; -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address, { -// gasPrice: 0, // Remove gas costs so we can check balances have changed correctly -// }); - -// const troveCollateral = await liquity.troveManager.getTroveColl( -// dsa.address -// ); -// const expectedTroveCollateral = troveCollateralBefore.sub( -// withdrawAmount -// ); -// const userEthBalance = await ethers.provider.getBalance( -// userWallet.address -// ); - -// expect( -// troveCollateral, -// `Trove collateral should have decreased by ${withdrawAmount} ETH` -// ).to.eq(expectedTroveCollateral); - -// expect( -// userEthBalance, -// `User ETH balance should have increased by ${withdrawAmount} ETH` -// ).to.eq(originalUserEthBalance.add(withdrawAmount)); -// }); - -// it("returns Instadapp event name and data", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// const withdrawAmount = ethers.utils.parseEther("1"); -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const withdrawEthSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "withdraw", -// args: [withdrawAmount, upperHint, lowerHint, 0, 0], -// }; - -// const withdrawTx = await dsa -// .connect(userWallet) -// .cast(...encodeSpells([withdrawEthSpell]), userWallet.address); - -// const receipt = await withdrawTx.wait(); -// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") -// .args; -// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( -// ["address", "uint256", "uint256", "uint256"], -// [dsa.address, withdrawAmount, 0, 0] -// ); -// expect(castLogEvent.eventNames[0]).eq( -// "LogWithdraw(address,uint256,uint256,uint256)" -// ); -// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); -// }); -// }); - -// describe("borrow()", () => { -// it("borrows LUSD from a Trove", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// const troveDebtBefore = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); - -// const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee -// const borrowSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "borrow", -// args: [maxFeePercentage, borrowAmount, upperHint, lowerHint, 0, 0], -// }; - -// // Borrow more LUSD from the Trove -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([borrowSpell]), userWallet.address); - -// const troveDebt = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const expectedTroveDebt = troveDebtBefore.add(borrowAmount); - -// expect( -// troveDebt, -// `Trove debt should have increased by at least ${borrowAmount} ETH` -// ).to.gte(expectedTroveDebt); -// }); - -// it("borrows LUSD from a Trove and stores the LUSD for other spells to use", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// const troveDebtBefore = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); - -// const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee -// const borrowId = 1; -// const borrowSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "borrow", -// args: [ -// maxFeePercentage, -// borrowAmount, -// upperHint, -// lowerHint, -// 0, -// borrowId, -// ], -// }; -// const withdrawSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "withdraw", -// args: [ -// liquity.lusdToken.address, -// 0, -// userWallet.address, -// borrowId, -// 0, -// ], -// }; -// const spells = [borrowSpell, withdrawSpell]; - -// // Borrow more LUSD from the Trove -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address); - -// const troveDebt = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const expectedTroveDebt = troveDebtBefore.add(borrowAmount); -// const userLusdBalance = await liquity.lusdToken.balanceOf( -// userWallet.address -// ); - -// expect( -// troveDebt, -// `Trove debt should have increased by at least ${borrowAmount} ETH` -// ).to.gte(expectedTroveDebt); - -// expect( -// userLusdBalance, -// `User LUSD balance should equal the borrowed LUSD due to the second withdraw spell` -// ).eq(borrowAmount); -// }); - -// it("returns Instadapp event name and data", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee -// const borrowSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "borrow", -// args: [maxFeePercentage, borrowAmount, upperHint, lowerHint, 0, 0], -// }; - -// const borrowTx = await dsa -// .connect(userWallet) -// .cast(...encodeSpells([borrowSpell]), userWallet.address); - -// const receipt = await borrowTx.wait(); -// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") -// .args; -// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( -// ["address", "uint256", "uint256", "uint256"], -// [dsa.address, borrowAmount, 0, 0] -// ); -// expect(castLogEvent.eventNames[0]).eq( -// "LogBorrow(address,uint256,uint256,uint256)" -// ); -// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); -// }); -// }); - -// describe("repay()", () => { -// it("repays LUSD to a Trove", async () => { -// const depositAmount = ethers.utils.parseEther("5"); -// const borrowAmount = ethers.utils.parseUnits("2500", 18); - -// // Create a dummy Trove -// await helpers.createDsaTrove( -// dsa, -// userWallet, -// liquity, -// depositAmount, -// borrowAmount -// ); - -// const troveDebtBefore = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// // DSA account is holding 2500 LUSD from opening a Trove, so we use some of that to repay -// const repayAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD - -// const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( -// depositAmount, -// borrowAmount, -// liquity -// ); -// const repaySpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "repay", -// args: [repayAmount, upperHint, lowerHint, 0, 0], -// }; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([repaySpell]), userWallet.address); - -// const troveDebt = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const expectedTroveDebt = troveDebtBefore.sub(repayAmount); - -// expect( -// troveDebt, -// `Trove debt should have decreased by ${repayAmount} ETH` -// ).to.eq(expectedTroveDebt); -// }); - -// it("repays LUSD to a Trove using LUSD collected from a previous spell", async () => { -// const depositAmount = ethers.utils.parseEther("5"); -// const borrowAmount = ethers.utils.parseUnits("2500", 18); - -// // Create a dummy Trove -// await helpers.createDsaTrove( -// dsa, -// userWallet, -// liquity, -// depositAmount, -// borrowAmount -// ); - -// const troveDebtBefore = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); - -// const repayAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD -// const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( -// depositAmount, -// borrowAmount, -// liquity -// ); - -// // Drain the DSA's LUSD balance so that we ensure we are repaying using LUSD from a previous spell -// await helpers.sendToken( -// liquity.lusdToken, -// borrowAmount, -// dsa.address, -// userWallet.address -// ); - -// // Allow DSA to spend user's LUSD -// await liquity.lusdToken -// .connect(userWallet) -// .approve(dsa.address, repayAmount); - -// const lusdDepositId = 1; -// const depositSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "deposit", -// args: [liquity.lusdToken.address, repayAmount, 0, lusdDepositId], -// }; -// const borrowSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "repay", -// args: [0, upperHint, lowerHint, lusdDepositId, 0], -// }; - -// const spells = [depositSpell, borrowSpell]; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address); - -// const troveDebt = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const expectedTroveDebt = troveDebtBefore.sub(repayAmount); - -// expect( -// troveDebt, -// `Trove debt should have decreased by ${repayAmount} ETH` -// ).to.eq(expectedTroveDebt); -// }); - -// it("returns Instadapp event name and data", async () => { -// // Create a dummy Trove -// const depositAmount = ethers.utils.parseEther("5"); -// const borrowAmount = ethers.utils.parseUnits("2500", 18); -// await helpers.createDsaTrove( -// dsa, -// userWallet, -// liquity, -// depositAmount, -// borrowAmount -// ); - -// const repayAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD -// const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( -// depositAmount, -// borrowAmount, -// liquity -// ); - -// const borrowSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "repay", -// args: [repayAmount, upperHint, lowerHint, 0, 0], -// }; - -// const repayTx = await dsa -// .connect(userWallet) -// .cast(...encodeSpells([borrowSpell]), userWallet.address, { -// value: repayAmount, -// }); - -// const receipt = await repayTx.wait(); -// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") -// .args; -// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( -// ["address", "uint256", "uint256", "uint256"], -// [dsa.address, repayAmount, 0, 0] -// ); -// expect(castLogEvent.eventNames[0]).eq( -// "LogRepay(address,uint256,uint256,uint256)" -// ); -// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); -// }); -// }); - -// describe("adjust()", () => { -// it("adjusts a Trove: deposit ETH and borrow LUSD", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// const troveCollateralBefore = await liquity.troveManager.getTroveColl( -// dsa.address -// ); -// const troveDebtBefore = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const depositAmount = ethers.utils.parseEther("1"); // 1 ETH -// const borrowAmount = ethers.utils.parseUnits("500", 18); // 500 LUSD -// const withdrawAmount = 0; -// const repayAmount = 0; -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - -// const adjustSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "adjust", -// args: [ -// maxFeePercentage, -// depositAmount, -// withdrawAmount, -// borrowAmount, -// repayAmount, -// upperHint, -// lowerHint, -// [0, 0, 0, 0], -// [0, 0, 0, 0], -// ], -// }; - -// // Adjust Trove by depositing ETH and borrowing LUSD -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([adjustSpell]), userWallet.address, { -// value: depositAmount, -// gasLimit: helpers.MAX_GAS, -// }); - -// const troveCollateral = await liquity.troveManager.getTroveColl( -// dsa.address -// ); -// const troveDebt = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const expectedTroveColl = troveCollateralBefore.add(depositAmount); -// const expectedTroveDebt = troveDebtBefore.add(borrowAmount); - -// expect( -// troveCollateral, -// `Trove collateral should have increased by ${depositAmount} ETH` -// ).to.eq(expectedTroveColl); - -// expect( -// troveDebt, -// `Trove debt should have increased by at least ${borrowAmount} ETH` -// ).to.gte(expectedTroveDebt); -// }); - -// it("adjusts a Trove: withdraw ETH and repay LUSD", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// const troveCollateralBefore = await liquity.troveManager.getTroveColl( -// dsa.address -// ); -// const troveDebtBefore = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const depositAmount = 0; -// const borrowAmount = 0; -// const withdrawAmount = ethers.utils.parseEther("1"); // 1 ETH; -// const repayAmount = ethers.utils.parseUnits("10", 18); // 10 LUSD; -// const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( -// troveCollateralBefore.sub(withdrawAmount), -// troveDebtBefore.sub(repayAmount), -// liquity -// ); -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - -// const adjustSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "adjust", -// args: [ -// maxFeePercentage, -// depositAmount, -// withdrawAmount, -// borrowAmount, -// repayAmount, -// upperHint, -// lowerHint, -// [0, 0, 0, 0], -// [0, 0, 0, 0], -// ], -// }; - -// // Adjust Trove by withdrawing ETH and repaying LUSD -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([adjustSpell]), userWallet.address, { -// value: depositAmount, -// gasLimit: helpers.MAX_GAS, -// }); - -// const troveCollateral = await liquity.troveManager.getTroveColl( -// dsa.address -// ); -// const troveDebt = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const expectedTroveColl = troveCollateralBefore.sub(withdrawAmount); -// const expectedTroveDebt = troveDebtBefore.sub(repayAmount); - -// expect( -// troveCollateral, -// `Trove collateral should have increased by ${depositAmount} ETH` -// ).to.eq(expectedTroveColl); - -// expect( -// troveDebt, -// `Trove debt should have decreased by at least ${repayAmount} LUSD` -// ).to.gte(expectedTroveDebt); -// }); - -// it("adjusts a Trove: deposit ETH and repay LUSD using previous spells", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// const troveCollateralBefore = await liquity.troveManager.getTroveColl( -// dsa.address -// ); -// const troveDebtBefore = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const depositAmount = ethers.utils.parseEther("1"); // 1 ETH -// const borrowAmount = 0; -// const withdrawAmount = 0; -// const repayAmount = ethers.utils.parseUnits("10", 18); // 10 lUSD -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - -// const ethDepositId = 1; -// const lusdRepayId = 2; - -// const depositEthSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "deposit", -// args: [helpers.ETH_ADDRESS, depositAmount, 0, ethDepositId], -// }; - -// const depositLusdSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "deposit", -// args: [liquity.lusdToken.address, repayAmount, 0, lusdRepayId], -// }; - -// const adjustSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "adjust", -// args: [ -// maxFeePercentage, -// 0, // Deposit amount comes from a previous spell's storage slot -// withdrawAmount, -// borrowAmount, -// 0, // Repay amount comes from a previous spell's storage slot -// upperHint, -// lowerHint, -// [ethDepositId, 0, 0, lusdRepayId], -// [0, 0, 0, 0], -// ], -// }; -// const spells = [depositEthSpell, depositLusdSpell, adjustSpell]; - -// // Send user some LUSD so they can repay -// await helpers.sendToken( -// liquity.lusdToken, -// repayAmount, -// helpers.JUSTIN_SUN_ADDRESS, -// userWallet.address -// ); - -// // Allow DSA to spend user's LUSD -// await liquity.lusdToken -// .connect(userWallet) -// .approve(dsa.address, repayAmount); - -// // Adjust Trove by depositing ETH and repaying LUSD -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address, { -// value: depositAmount, -// gasLimit: helpers.MAX_GAS, -// }); - -// const troveCollateral = await liquity.troveManager.getTroveColl( -// dsa.address -// ); -// const troveDebt = await liquity.troveManager.getTroveDebt( -// dsa.address -// ); -// const expectedTroveColl = troveCollateralBefore.add(depositAmount); -// const expectedTroveDebt = troveDebtBefore.sub(repayAmount); - -// expect( -// troveCollateral, -// `Trove collateral should have increased by ${depositAmount} ETH` -// ).to.eq(expectedTroveColl); - -// expect( -// troveDebt, -// `Trove debt (${troveDebtBefore}) should have decreased by at least ${repayAmount} LUSD` -// ).to.eq(expectedTroveDebt); -// }); - -// it("adjusts a Trove: withdraw ETH, borrow LUSD, and store the amounts for other spells", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// const userEthBalanceBefore = await ethers.provider.getBalance( -// userWallet.address -// ); -// const userLusdBalanceBefore = await liquity.lusdToken.balanceOf( -// userWallet.address -// ); - -// const depositAmount = 0; -// const borrowAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD -// const withdrawAmount = ethers.utils.parseEther("1"); // 1 ETH -// const repayAmount = 0; -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - -// const ethWithdrawId = 1; -// const lusdBorrowId = 2; - -// const adjustSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "adjust", -// args: [ -// maxFeePercentage, -// depositAmount, -// withdrawAmount, -// borrowAmount, -// repayAmount, -// upperHint, -// lowerHint, -// [0, 0, 0, 0], -// [0, ethWithdrawId, lusdBorrowId, 0], -// ], -// }; - -// const withdrawEthSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "withdraw", -// args: [ -// helpers.ETH_ADDRESS, -// 0, -// userWallet.address, -// ethWithdrawId, -// 0, -// ], -// }; - -// const withdrawLusdSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "withdraw", -// args: [ -// liquity.lusdToken.address, -// 0, -// userWallet.address, -// lusdBorrowId, -// 0, -// ], -// }; - -// const spells = [adjustSpell, withdrawEthSpell, withdrawLusdSpell]; - -// // Adjust Trove by withdrawing ETH and borrowing LUSD -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address, { -// gasLimit: helpers.MAX_GAS, -// gasPrice: 0, -// }); - -// const userEthBalanceAfter = await ethers.provider.getBalance( -// userWallet.address -// ); -// const userLusdBalanceAfter = await liquity.lusdToken.balanceOf( -// userWallet.address -// ); -// expect(userEthBalanceAfter).eq( -// userEthBalanceBefore.add(withdrawAmount) -// ); -// expect(userLusdBalanceAfter).eq( -// userLusdBalanceBefore.add(borrowAmount) -// ); -// }); - -// it("returns Instadapp event name and data", async () => { -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// const depositAmount = ethers.utils.parseEther("1"); // 1 ETH -// const borrowAmount = ethers.utils.parseUnits("500", 18); // 500 LUSD -// const withdrawAmount = 0; -// const repayAmount = 0; -// const upperHint = ethers.constants.AddressZero; -// const lowerHint = ethers.constants.AddressZero; -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - -// const adjustSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "adjust", -// args: [ -// maxFeePercentage, -// depositAmount, -// withdrawAmount, -// borrowAmount, -// repayAmount, -// upperHint, -// lowerHint, -// [0, 0, 0, 0], -// [0, 0, 0, 0], -// ], -// }; - -// const adjustTx = await dsa -// .connect(userWallet) -// .cast(...encodeSpells([adjustSpell]), userWallet.address, { -// value: depositAmount, -// gasLimit: helpers.MAX_GAS, -// }); - -// const receipt = await adjustTx.wait(); -// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") -// .args; -// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( -// [ -// "address", -// "uint256", -// "uint256", -// "uint256", -// "uint256", -// "uint256", -// "uint256[]", -// "uint256[]", -// ], -// [ -// dsa.address, -// maxFeePercentage, -// depositAmount, -// withdrawAmount, -// borrowAmount, -// repayAmount, -// [0, 0, 0, 0], -// [0, 0, 0, 0], -// ] -// ); -// expect(castLogEvent.eventNames[0]).eq( -// "LogAdjust(address,uint256,uint256,uint256,uint256,uint256,uint256[],uint256[])" -// ); -// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); -// }); -// }); - -// describe("claimCollateralFromRedemption()", () => { -// it("claims collateral from a redeemed Trove", async () => { -// // Create a low collateralized Trove -// const depositAmount = ethers.utils.parseEther("1.5"); -// const borrowAmount = ethers.utils.parseUnits("2500", 18); - -// await helpers.createDsaTrove( -// dsa, -// userWallet, -// liquity, -// depositAmount, -// borrowAmount -// ); - -// // Redeem lots of LUSD to cause the Trove to become redeemed -// const redeemAmount = ethers.utils.parseUnits("10000000", 18); -// await helpers.sendToken( -// liquity.lusdToken, -// redeemAmount, -// contracts.STABILITY_POOL_ADDRESS, -// userWallet.address -// ); -// const { -// partialRedemptionHintNicr, -// firstRedemptionHint, -// upperHint, -// lowerHint, -// } = await helpers.getRedemptionHints(redeemAmount, liquity); -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - -// await liquity.troveManager -// .connect(userWallet) -// .redeemCollateral( -// redeemAmount, -// firstRedemptionHint, -// upperHint, -// lowerHint, -// partialRedemptionHintNicr, -// 0, -// maxFeePercentage, -// { -// gasLimit: helpers.MAX_GAS, // permit max gas -// } -// ); - -// const remainingEthCollateral = await liquity.collSurplus.getCollateral( -// dsa.address -// ); - -// // Claim the remaining collateral from the redeemed Trove -// const claimCollateralFromRedemptionSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "claimCollateralFromRedemption", -// args: [0], -// }; - -// await dsa -// .connect(userWallet) -// .cast( -// ...encodeSpells([claimCollateralFromRedemptionSpell]), -// userWallet.address -// ); - -// const ethBalance = await ethers.provider.getBalance(dsa.address); - -// expect(ethBalance).to.eq(remainingEthCollateral); -// }); - -// it("returns Instadapp event name and data", async () => { -// // Create a low collateralized Trove -// const depositAmount = ethers.utils.parseEther("1.5"); -// const borrowAmount = ethers.utils.parseUnits("2500", 18); - -// await helpers.createDsaTrove( -// dsa, -// userWallet, -// liquity, -// depositAmount, -// borrowAmount -// ); - -// // Redeem lots of LUSD to cause the Trove to become redeemed -// const redeemAmount = ethers.utils.parseUnits("10000000", 18); -// const setId = 0; -// await helpers.sendToken( -// liquity.lusdToken, -// redeemAmount, -// contracts.STABILITY_POOL_ADDRESS, -// userWallet.address -// ); -// const { -// partialRedemptionHintNicr, -// firstRedemptionHint, -// upperHint, -// lowerHint, -// } = await helpers.getRedemptionHints(redeemAmount, liquity); -// const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee - -// await liquity.troveManager -// .connect(userWallet) -// .redeemCollateral( -// redeemAmount, -// firstRedemptionHint, -// upperHint, -// lowerHint, -// partialRedemptionHintNicr, -// 0, -// maxFeePercentage, -// { -// gasLimit: helpers.MAX_GAS, // permit max gas -// } -// ); -// const claimAmount = await liquity.collSurplus.getCollateral( -// dsa.address -// ); - -// const claimCollateralFromRedemptionSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "claimCollateralFromRedemption", -// args: [setId], -// }; - -// const claimTx = await dsa -// .connect(userWallet) -// .cast( -// ...encodeSpells([claimCollateralFromRedemptionSpell]), -// userWallet.address -// ); - -// const receipt = await claimTx.wait(); -// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") -// .args; -// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( -// ["address", "uint256", "uint256"], -// [dsa.address, claimAmount, setId] -// ); -// expect(castLogEvent.eventNames[0]).eq( -// "LogClaimCollateralFromRedemption(address,uint256,uint256)" -// ); -// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); -// }); -// }); -// }); - -// describe("Stability Pool", () => { -// describe("stabilityDeposit()", () => { -// it("deposits into Stability Pool", async () => { -// const amount = ethers.utils.parseUnits("100", 18); -// const frontendTag = ethers.constants.AddressZero; - -// await helpers.sendToken( -// liquity.lusdToken, -// amount, -// contracts.STABILITY_POOL_ADDRESS, -// dsa.address -// ); - -// const stabilityDepositSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stabilityDeposit", -// args: [amount, frontendTag, 0, 0, 0, 0], -// }; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - -// const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( -// dsa.address -// ); -// expect(depositedAmount).to.eq(amount); -// }); - -// it("deposits into Stability Pool using LUSD collected from a previous spell", async () => { -// const amount = ethers.utils.parseUnits("100", 18); -// const frontendTag = ethers.constants.AddressZero; - -// await helpers.sendToken( -// liquity.lusdToken, -// amount, -// contracts.STABILITY_POOL_ADDRESS, -// userWallet.address -// ); -// const lusdDepositId = 1; - -// const depositLusdSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "deposit", -// args: [liquity.lusdToken.address, amount, 0, lusdDepositId], -// }; -// const stabilityDepositSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stabilityDeposit", -// args: [0, frontendTag, lusdDepositId, 0, 0, 0], -// }; -// const spells = [depositLusdSpell, stabilityDepositSpell]; - -// // Allow DSA to spend user's LUSD -// await liquity.lusdToken -// .connect(userWallet) -// .approve(dsa.address, amount); - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address); - -// const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( -// dsa.address -// ); -// expect(depositedAmount).to.eq(amount); -// }); - -// it("returns Instadapp event name and data", async () => { -// const amount = ethers.utils.parseUnits("100", 18); -// const halfAmount = amount.div(2); -// const frontendTag = ethers.constants.AddressZero; -// const getDepositId = 0; -// const setDepositId = 0; -// const setEthGainId = 0; -// const setLqtyGainId = 0; - -// await helpers.sendToken( -// liquity.lusdToken, -// amount, -// contracts.STABILITY_POOL_ADDRESS, -// dsa.address -// ); - -// const stabilityDepositSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stabilityDeposit", -// args: [ -// halfAmount, -// frontendTag, -// getDepositId, -// setDepositId, -// setEthGainId, -// setLqtyGainId, -// ], -// }; - -// // Create a Stability deposit for this DSA -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - -// // Liquidate a Trove to cause an ETH gain -// await liquity.troveManager.connect(userWallet).liquidateTroves(1, { -// gasLimit: helpers.MAX_GAS, -// }); - -// // Fast forward in time so we have an LQTY gain -// await provider.send("evm_increaseTime", [600]); -// await provider.send("evm_mine"); - -// // Create a Stability Pool deposit with a differen DSA so that LQTY gains can be calculated -// // See: https://github.com/liquity/dev/#lqty-reward-events-and-payouts -// const tempDsa = await buildDSAv2(userWallet.address); -// await helpers.sendToken( -// liquity.lusdToken, -// amount, -// contracts.STABILITY_POOL_ADDRESS, -// tempDsa.address -// ); -// await tempDsa -// .connect(userWallet) -// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - -// const ethGain = await liquity.stabilityPool.getDepositorETHGain( -// dsa.address -// ); -// const lqtyGain = await liquity.stabilityPool.getDepositorLQTYGain( -// dsa.address -// ); - -// // Top up the user's deposit so that we can track their ETH and LQTY gain -// const depositAgainTx = await dsa -// .connect(userWallet) -// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - -// const receipt = await depositAgainTx.wait(); -// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") -// .args; -// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( -// [ -// "address", -// "uint256", -// "uint256", -// "uint256", -// "address", -// "uint256", -// "uint256", -// "uint256", -// "uint256", -// ], -// [ -// dsa.address, -// halfAmount, -// ethGain, -// lqtyGain, -// frontendTag, -// getDepositId, -// setDepositId, -// setEthGainId, -// setLqtyGainId, -// ] -// ); -// expect(castLogEvent.eventNames[0]).eq( -// "LogStabilityDeposit(address,uint256,uint256,uint256,address,uint256,uint256,uint256,uint256)" -// ); -// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); -// }); -// }); - -// describe("stabilityWithdraw()", () => { -// it("withdraws from Stability Pool", async () => { -// // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool -// [liquity, dsa] = await helpers.resetInitialState( -// userWallet.address, -// contracts -// ); - -// // The current block number has liquidatable Troves. -// // Remove them otherwise Stability Pool withdrawals are disabled -// await liquity.troveManager.connect(userWallet).liquidateTroves(90, { -// gasLimit: helpers.MAX_GAS, -// }); - -// const amount = ethers.utils.parseUnits("100", 18); -// const frontendTag = ethers.constants.AddressZero; - -// await helpers.sendToken( -// liquity.lusdToken, -// amount, -// contracts.STABILITY_POOL_ADDRESS, -// dsa.address -// ); - -// const stabilityDepositSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stabilityDeposit", -// args: [amount, frontendTag, 0, 0, 0, 0], -// }; - -// // Withdraw half of the deposit -// const stabilityWithdrawSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stabilityWithdraw", -// args: [amount.div(2), 0, 0, 0, 0], -// }; -// const spells = [stabilityDepositSpell, stabilityWithdrawSpell]; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address); - -// const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( -// dsa.address -// ); -// const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); - -// expect(depositedAmount).to.eq(amount.div(2)); -// expect(dsaLusdBalance).to.eq(amount.div(2)); -// }); - -// it("withdraws from Stability Pool and stores the LUSD for other spells", async () => { -// // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool -// [liquity, dsa] = await helpers.resetInitialState( -// userWallet.address, -// contracts -// ); - -// // The current block number has liquidatable Troves. -// // Remove them otherwise Stability Pool withdrawals are disabled -// await liquity.troveManager.connect(userWallet).liquidateTroves(90, { -// gasLimit: helpers.MAX_GAS, -// }); -// const amount = ethers.utils.parseUnits("100", 18); -// const frontendTag = ethers.constants.AddressZero; -// const withdrawId = 1; - -// await helpers.sendToken( -// liquity.lusdToken, -// amount, -// contracts.STABILITY_POOL_ADDRESS, -// dsa.address -// ); - -// const stabilityDepositSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stabilityDeposit", -// args: [amount, frontendTag, 0, 0, 0, 0], -// }; - -// // Withdraw half of the deposit -// const stabilityWithdrawSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stabilityWithdraw", -// args: [amount.div(2), 0, 0, 0, withdrawId], -// }; - -// const withdrawLusdSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "withdraw", -// args: [ -// liquity.lusdToken.address, -// 0, -// userWallet.address, -// withdrawId, -// 0, -// ], -// }; - -// const spells = [ -// stabilityDepositSpell, -// stabilityWithdrawSpell, -// withdrawLusdSpell, -// ]; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address); - -// const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( -// dsa.address -// ); -// const walletLusdBalance = await liquity.lusdToken.balanceOf( -// dsa.address -// ); - -// expect(depositedAmount).to.eq(amount.div(2)); -// expect(walletLusdBalance).to.eq(amount.div(2)); -// }); - -// it("returns Instadapp event name and data", async () => { -// // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool -// [liquity, dsa] = await helpers.resetInitialState( -// userWallet.address, -// contracts -// ); - -// const amount = ethers.utils.parseUnits("100", 18); -// const frontendTag = ethers.constants.AddressZero; - -// await helpers.sendToken( -// liquity.lusdToken, -// amount, -// contracts.STABILITY_POOL_ADDRESS, -// dsa.address -// ); - -// const stabilityDepositSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stabilityDeposit", -// args: [amount, frontendTag, 0, 0, 0, 0], -// }; - -// // Withdraw half of the deposit -// const withdrawAmount = amount.div(2); -// const getWithdrawId = 0; -// const setWithdrawId = 0; -// const setEthGainId = 0; -// const setLqtyGainId = 0; - -// // Create a Stability Pool deposit -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - -// // The current block number has liquidatable Troves. -// // Remove them otherwise Stability Pool withdrawals are disabled -// await liquity.troveManager.connect(userWallet).liquidateTroves(90, { -// gasLimit: helpers.MAX_GAS, -// }); - -// // Fast forward in time so we have an LQTY gain -// await provider.send("evm_increaseTime", [600]); -// await provider.send("evm_mine"); - -// // Create another Stability Pool deposit so that LQTY gains are realized -// // See: https://github.com/liquity/dev/#lqty-reward-events-and-payouts -// const tempDsa = await buildDSAv2(userWallet.address); -// await helpers.sendToken( -// liquity.lusdToken, -// amount, -// contracts.STABILITY_POOL_ADDRESS, -// tempDsa.address -// ); -// await tempDsa -// .connect(userWallet) -// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - -// const ethGain = await liquity.stabilityPool.getDepositorETHGain( -// dsa.address -// ); -// const lqtyGain = await liquity.stabilityPool.getDepositorLQTYGain( -// dsa.address -// ); - -// const stabilityWithdrawSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stabilityWithdraw", -// args: [ -// withdrawAmount, -// getWithdrawId, -// setWithdrawId, -// setEthGainId, -// setLqtyGainId, -// ], -// }; - -// const withdrawTx = await dsa -// .connect(userWallet) -// .cast( -// ...encodeSpells([stabilityWithdrawSpell]), -// userWallet.address -// ); - -// const receipt = await withdrawTx.wait(); -// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") -// .args; -// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( -// [ -// "address", -// "uint256", -// "uint256", -// "uint256", -// "uint256", -// "uint256", -// "uint256", -// "uint256", -// ], -// [ -// dsa.address, -// withdrawAmount, -// ethGain, -// lqtyGain, -// getWithdrawId, -// setWithdrawId, -// setEthGainId, -// setLqtyGainId, -// ] -// ); -// expect(castLogEvent.eventNames[0]).eq( -// "LogStabilityWithdraw(address,uint256,uint256,uint256,uint256,uint256,uint256,uint256)" -// ); -// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); -// }); -// }); - -// describe("stabilityMoveEthGainToTrove()", () => { -// beforeEach(async () => { -// // Start these test from fresh so that we definitely have a liquidatable Trove within this block -// [liquity, dsa] = await helpers.resetInitialState( -// userWallet.address, -// contracts -// ); -// }); - -// it("moves ETH gain from Stability Pool to Trove", async () => { -// // Create a DSA owned Trove to capture ETH liquidation gains -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); -// const troveCollateralBefore = await liquity.troveManager.getTroveColl( -// dsa.address -// ); - -// // Create a Stability Deposit using the Trove's borrowed LUSD -// const amount = ethers.utils.parseUnits("100", 18); -// const frontendTag = ethers.constants.AddressZero; -// const stabilityDepositSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stabilityDeposit", -// args: [amount, frontendTag, 0, 0, 0, 0], -// }; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - -// // Liquidate a Trove to create an ETH gain for the new DSA Trove -// await liquity.troveManager -// .connect(userWallet) -// .liquidate(helpers.LIQUIDATABLE_TROVE_ADDRESS, { -// gasLimit: helpers.MAX_GAS, // permit max gas -// }); - -// const ethGainFromLiquidation = await liquity.stabilityPool.getDepositorETHGain( -// dsa.address -// ); - -// // Move ETH gain to Trove -// const moveEthGainSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stabilityMoveEthGainToTrove", -// args: [ethers.constants.AddressZero, ethers.constants.AddressZero], -// }; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([moveEthGainSpell]), userWallet.address); - -// const ethGainAfterMove = await liquity.stabilityPool.getDepositorETHGain( -// dsa.address -// ); -// const troveCollateral = await liquity.troveManager.getTroveColl( -// dsa.address -// ); -// const expectedTroveCollateral = troveCollateralBefore.add( -// ethGainFromLiquidation -// ); -// expect(ethGainAfterMove).to.eq(0); -// expect(troveCollateral).to.eq(expectedTroveCollateral); -// }); - -// it("returns Instadapp event name and data", async () => { -// // Create a DSA owned Trove to capture ETH liquidation gains -// // Create a dummy Trove -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// // Create a Stability Deposit using the Trove's borrowed LUSD -// const amount = ethers.utils.parseUnits("100", 18); -// const frontendTag = ethers.constants.AddressZero; -// const stabilityDepositSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stabilityDeposit", -// args: [amount, frontendTag, 0, 0, 0, 0], -// }; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); - -// // Liquidate a Trove to create an ETH gain for the new DSA Trove -// await liquity.troveManager -// .connect(userWallet) -// .liquidate(helpers.LIQUIDATABLE_TROVE_ADDRESS, { -// gasLimit: helpers.MAX_GAS, // permit max gas -// }); - -// const ethGainFromLiquidation = await liquity.stabilityPool.getDepositorETHGain( -// dsa.address -// ); - -// // Move ETH gain to Trove -// const moveEthGainSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stabilityMoveEthGainToTrove", -// args: [ethers.constants.AddressZero, ethers.constants.AddressZero], -// }; - -// const moveEthGainTx = await dsa -// .connect(userWallet) -// .cast(...encodeSpells([moveEthGainSpell]), userWallet.address); - -// const receipt = await moveEthGainTx.wait(); - -// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") -// .args; -// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( -// ["address", "uint256"], -// [dsa.address, ethGainFromLiquidation] -// ); -// expect(castLogEvent.eventNames[0]).eq( -// "LogStabilityMoveEthGainToTrove(address,uint256)" -// ); -// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); -// }); -// }); -// }); - -// describe("Staking", () => { -// describe("stake()", () => { -// it("stakes LQTY", async () => { -// const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( -// contracts.STAKING_ADDRESS -// ); - -// const amount = ethers.utils.parseUnits("1", 18); -// await helpers.sendToken( -// liquity.lqtyToken, -// amount, -// helpers.JUSTIN_SUN_ADDRESS, -// dsa.address -// ); - -// const stakeSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stake", -// args: [amount, 0, 0, 0, 0], -// }; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([stakeSpell]), userWallet.address); - -// const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); -// expect(lqtyBalance).to.eq(0); - -// const totalStakingBalance = await liquity.lqtyToken.balanceOf( -// contracts.STAKING_ADDRESS -// ); -// expect(totalStakingBalance).to.eq( -// totalStakingBalanceBefore.add(amount) -// ); -// }); - -// it("stakes LQTY using LQTY obtained from a previous spell", async () => { -// const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( -// contracts.STAKING_ADDRESS -// ); - -// const amount = ethers.utils.parseUnits("1", 18); -// await helpers.sendToken( -// liquity.lqtyToken, -// amount, -// helpers.JUSTIN_SUN_ADDRESS, -// userWallet.address -// ); - -// const lqtyDepositId = 1; -// const depositSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "deposit", -// args: [liquity.lqtyToken.address, amount, 0, lqtyDepositId], -// }; -// const stakeSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stake", -// args: [0, lqtyDepositId, 0, 0, 0], -// }; -// const spells = [depositSpell, stakeSpell]; - -// // Allow DSA to spend user's LQTY -// await liquity.lqtyToken -// .connect(userWallet) -// .approve(dsa.address, amount); - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address); - -// const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); -// expect(lqtyBalance).to.eq(0); - -// const totalStakingBalance = await liquity.lqtyToken.balanceOf( -// contracts.STAKING_ADDRESS -// ); -// expect(totalStakingBalance).to.eq( -// totalStakingBalanceBefore.add(amount) -// ); -// }); - -// it("returns Instadapp event name and data", async () => { -// const amount = ethers.utils.parseUnits("1", 18); -// await helpers.sendToken( -// liquity.lqtyToken, -// amount, -// helpers.JUSTIN_SUN_ADDRESS, -// dsa.address -// ); - -// const getStakeId = 0; -// const setStakeId = 0; -// const setEthGainId = 0; -// const setLusdGainId = 0; -// const stakeSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stake", -// args: [amount, getStakeId, setStakeId, setEthGainId, setLusdGainId], -// }; - -// const stakeTx = await dsa -// .connect(userWallet) -// .cast(...encodeSpells([stakeSpell]), userWallet.address); - -// const receipt = await stakeTx.wait(); - -// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") -// .args; -// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( -// ["address", "uint256", "uint256", "uint256", "uint256", "uint256"], -// [ -// dsa.address, -// amount, -// getStakeId, -// setStakeId, -// setEthGainId, -// setLusdGainId, -// ] -// ); -// expect(castLogEvent.eventNames[0]).eq( -// "LogStake(address,uint256,uint256,uint256,uint256,uint256)" -// ); -// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); -// }); -// }); - -// describe("unstake()", () => { -// it("unstakes LQTY", async () => { -// const amount = ethers.utils.parseUnits("1", 18); -// await helpers.sendToken( -// liquity.lqtyToken, -// amount, -// helpers.JUSTIN_SUN_ADDRESS, -// dsa.address -// ); - -// const stakeSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stake", -// args: [amount, 0, 0, 0, 0], -// }; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([stakeSpell]), userWallet.address); - -// const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( -// contracts.STAKING_ADDRESS -// ); -// const unstakeSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "unstake", -// args: [amount, 0, 0, 0, 0], -// }; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([unstakeSpell]), userWallet.address); - -// const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); -// expect(lqtyBalance).to.eq(amount); - -// const totalStakingBalance = await liquity.lqtyToken.balanceOf( -// contracts.STAKING_ADDRESS -// ); -// expect(totalStakingBalance).to.eq( -// totalStakingBalanceBefore.sub(amount) -// ); -// }); - -// it("unstakes LQTY and stores the LQTY for other spells", async () => { -// const amount = ethers.utils.parseUnits("1", 18); -// await helpers.sendToken( -// liquity.lqtyToken, -// amount, -// helpers.JUSTIN_SUN_ADDRESS, -// dsa.address -// ); - -// const stakeSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stake", -// args: [amount, 0, 0, 0, 0], -// }; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([stakeSpell]), userWallet.address); - -// const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( -// contracts.STAKING_ADDRESS -// ); -// const withdrawId = 1; -// const unstakeSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "unstake", -// args: [amount, 0, withdrawId, 0, 0], -// }; - -// const withdrawLqtySpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "withdraw", -// args: [ -// liquity.lqtyToken.address, -// 0, -// userWallet.address, -// withdrawId, -// 0, -// ], -// }; -// const spells = [unstakeSpell, withdrawLqtySpell]; -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address); - -// const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); -// const totalStakingBalance = await liquity.lqtyToken.balanceOf( -// contracts.STAKING_ADDRESS -// ); -// const userLqtyBalance = await liquity.lqtyToken.balanceOf( -// userWallet.address -// ); -// expect(lqtyBalance).to.eq(0); -// expect(totalStakingBalance).to.eq( -// totalStakingBalanceBefore.sub(amount) -// ); -// expect(userLqtyBalance).to.eq(amount); -// }); - -// it("returns Instadapp event name and data", async () => { -// const amount = ethers.utils.parseUnits("1", 18); -// await helpers.sendToken( -// liquity.lqtyToken, -// amount, -// helpers.JUSTIN_SUN_ADDRESS, -// dsa.address -// ); - -// const stakeSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stake", -// args: [amount, 0, 0, 0, 0], -// }; - -// await dsa -// .connect(userWallet) -// .cast(...encodeSpells([stakeSpell]), userWallet.address); - -// const getUnstakeId = 0; -// const setUnstakeId = 0; -// const setEthGainId = 0; -// const setLusdGainId = 0; -// const unstakeSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "unstake", -// args: [ -// amount, -// getUnstakeId, -// setUnstakeId, -// setEthGainId, -// setLusdGainId, -// ], -// }; - -// const unstakeTx = await dsa -// .connect(userWallet) -// .cast(...encodeSpells([unstakeSpell]), userWallet.address); - -// const receipt = await unstakeTx.wait(); - -// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") -// .args; -// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( -// ["address", "uint256", "uint256", "uint256", "uint256", "uint256"], -// [ -// dsa.address, -// amount, -// getUnstakeId, -// setUnstakeId, -// setEthGainId, -// setLusdGainId, -// ] -// ); -// expect(castLogEvent.eventNames[0]).eq( -// "LogUnstake(address,uint256,uint256,uint256,uint256,uint256)" -// ); -// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); -// }); -// }); - -// describe("claimStakingGains()", () => { -// it("claims gains from staking", async () => { -// const stakerDsa = await buildDSAv2(userWallet.address); -// const amount = ethers.utils.parseUnits("1000", 18); // 1000 LQTY - -// // Stake lots of LQTY -// await helpers.sendToken( -// liquity.lqtyToken, -// amount, -// helpers.JUSTIN_SUN_ADDRESS, -// stakerDsa.address -// ); -// const stakeSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stake", -// args: [amount, 0, 0, 0, 0], -// }; -// await stakerDsa -// .connect(userWallet) -// .cast(...encodeSpells([stakeSpell]), userWallet.address); - -// // Open a Trove to cause an ETH issuance gain for stakers -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// // Redeem some ETH to cause an LUSD redemption gain for stakers -// await helpers.redeem( -// ethers.utils.parseUnits("1000", 18), -// contracts.STABILITY_POOL_ADDRESS, -// userWallet, -// liquity -// ); - -// const setEthGainId = 0; -// const setLusdGainId = 0; -// const ethGain = await liquity.staking.getPendingETHGain( -// stakerDsa.address -// ); -// const lusdGain = await liquity.staking.getPendingLUSDGain( -// stakerDsa.address -// ); - -// const claimStakingGainsSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "claimStakingGains", -// args: [setEthGainId, setLusdGainId], -// }; - -// const ethBalanceBefore = await ethers.provider.getBalance( -// stakerDsa.address -// ); - -// // Claim gains -// await stakerDsa -// .connect(userWallet) -// .cast( -// ...encodeSpells([claimStakingGainsSpell]), -// userWallet.address -// ); - -// const ethBalanceAfter = await ethers.provider.getBalance( -// stakerDsa.address -// ); -// const lusdBalanceAfter = await liquity.lusdToken.balanceOf( -// stakerDsa.address -// ); -// expect(ethBalanceAfter).to.eq(ethBalanceBefore.add(ethGain)); -// expect(lusdBalanceAfter).to.eq(lusdGain); -// }); - -// it("claims gains from staking and stores them for other spells", async () => { -// const stakerDsa = await buildDSAv2(userWallet.address); -// const amount = ethers.utils.parseUnits("1000", 18); // 1000 LQTY - -// // Stake lots of LQTY -// await helpers.sendToken( -// liquity.lqtyToken, -// amount, -// helpers.JUSTIN_SUN_ADDRESS, -// stakerDsa.address -// ); -// const stakeSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stake", -// args: [amount, 0, 0, 0, 0], -// }; -// await stakerDsa -// .connect(userWallet) -// .cast(...encodeSpells([stakeSpell]), userWallet.address); - -// // Open a Trove to cause an ETH issuance gain for stakers -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// // Redeem some ETH to cause an LUSD redemption gain for stakers -// await helpers.redeem( -// ethers.utils.parseUnits("1000", 18), -// contracts.STABILITY_POOL_ADDRESS, -// userWallet, -// liquity -// ); - -// const ethGain = await liquity.staking.getPendingETHGain( -// stakerDsa.address -// ); -// const lusdGain = await liquity.staking.getPendingLUSDGain( -// stakerDsa.address -// ); -// const lusdBalanceBefore = await liquity.lusdToken.balanceOf( -// userWallet.address -// ); -// const ethBalanceBefore = await ethers.provider.getBalance( -// userWallet.address -// ); -// const ethGainId = 111; -// const lusdGainId = 222; - -// const claimStakingGainsSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "claimStakingGains", -// args: [ethGainId, lusdGainId], -// }; - -// const withdrawEthSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "withdraw", -// args: [helpers.ETH_ADDRESS, 0, userWallet.address, ethGainId, 0], -// }; - -// const withdrawLusdSpell = { -// connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, -// method: "withdraw", -// args: [ -// liquity.lusdToken.address, -// 0, -// userWallet.address, -// lusdGainId, -// 0, -// ], -// }; - -// const spells = [ -// claimStakingGainsSpell, -// withdrawEthSpell, -// withdrawLusdSpell, -// ]; - -// // Claim gains -// await stakerDsa -// .connect(userWallet) -// .cast(...encodeSpells(spells), userWallet.address, { -// gasPrice: 0, -// }); - -// const ethBalanceAfter = await ethers.provider.getBalance( -// userWallet.address -// ); -// const lusdBalanceAfter = await liquity.lusdToken.balanceOf( -// userWallet.address -// ); - -// expect( -// ethBalanceAfter, -// "User's ETH balance should have increased by the issuance gain from staking" -// ).to.eq(ethBalanceBefore.add(ethGain)); -// expect( -// lusdBalanceAfter, -// "User's LUSD balance should have increased by the redemption gain from staking" -// ).to.eq(lusdBalanceBefore.add(lusdGain)); -// }); - -// it("returns Instadapp event name and data", async () => { -// const stakerDsa = await buildDSAv2(userWallet.address); -// const amount = ethers.utils.parseUnits("1000", 18); // 1000 LQTY - -// // Stake lots of LQTY -// await helpers.sendToken( -// liquity.lqtyToken, -// amount, -// helpers.JUSTIN_SUN_ADDRESS, -// stakerDsa.address -// ); -// const stakeSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "stake", -// args: [amount, 0, 0, 0, 0], -// }; -// await stakerDsa -// .connect(userWallet) -// .cast(...encodeSpells([stakeSpell]), userWallet.address); - -// // Open a Trove to cause an ETH issuance gain for stakers -// await helpers.createDsaTrove(dsa, userWallet, liquity); - -// // Redeem some ETH to cause an LUSD redemption gain for stakers -// await helpers.redeem( -// ethers.utils.parseUnits("1000", 18), -// contracts.STABILITY_POOL_ADDRESS, -// userWallet, -// liquity -// ); - -// const setEthGainId = 0; -// const setLusdGainId = 0; -// const ethGain = await liquity.staking.getPendingETHGain( -// stakerDsa.address -// ); -// const lusdGain = await liquity.staking.getPendingLUSDGain( -// stakerDsa.address -// ); - -// const claimStakingGainsSpell = { -// connector: helpers.LIQUITY_CONNECTOR, -// method: "claimStakingGains", -// args: [setEthGainId, setLusdGainId], -// }; - -// // Claim gains -// const claimGainsTx = await stakerDsa -// .connect(userWallet) -// .cast( -// ...encodeSpells([claimStakingGainsSpell]), -// userWallet.address -// ); - -// const receipt = await claimGainsTx.wait(); - -// const castLogEvent = receipt.events.find((e) => e.event === "LogCast") -// .args; -// const expectedEventParams = ethers.utils.defaultAbiCoder.encode( -// ["address", "uint256", "uint256", "uint256", "uint256"], -// [stakerDsa.address, ethGain, lusdGain, setEthGainId, setLusdGainId] -// ); -// expect(castLogEvent.eventNames[0]).eq( -// "LogClaimStakingGains(address,uint256,uint256,uint256,uint256)" -// ); -// expect(castLogEvent.eventParams[0]).eq(expectedEventParams); -// }); -// }); -// }); -// }); -// }); +import hre from "hardhat"; +import { expect } from "chai"; + +// Instadapp deployment and testing helpers +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; +import { encodeSpells } from "../../../scripts/tests/encodeSpells.js"; + +// Liquity smart contracts +import contracts from "./liquity.contracts"; + +// Liquity helpers +import helpers from "./liquity.helpers"; + +describe("Liquity", () => { + const { waffle, ethers } = hre; + const { provider } = waffle; + + // Waffle test account 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 (holds 1000 ETH) + const userWallet = provider.getWallets()[0]; + let dsa = null; + let liquity = null; + + before(async () => { + await hre.network.provider.request({ + method: "hardhat_reset", + params: [ + { + forking: { + jsonRpcUrl: hre.config.networks.hardhat.forking.url, + blockNumber: 13300000, + }, + }, + ], + }); + liquity = await helpers.deployAndConnect(contracts, true); + expect(liquity.troveManager.address).to.exist; + expect(liquity.borrowerOperations.address).to.exist; + expect(liquity.stabilityPool.address).to.exist; + expect(liquity.lusdToken.address).to.exist; + expect(liquity.lqtyToken.address).to.exist; + expect(liquity.activePool.address).to.exist; + expect(liquity.priceFeed.address).to.exist; + expect(liquity.hintHelpers.address).to.exist; + expect(liquity.sortedTroves.address).to.exist; + expect(liquity.staking.address).to.exist; + }); + + beforeEach(async () => { + // Build a new DSA before each test so we start each test from the same default state + dsa = await buildDSAv2(userWallet.address); + expect(dsa.address).to.exist; + }); + + describe("Main (Connector)", () => { + describe("Trove", () => { + describe("open()", () => { + it("opens a Trove", async () => { + const depositAmount = ethers.utils.parseEther("5"); // 5 ETH + const borrowAmount = ethers.utils.parseUnits("2000", 18); // 2000 LUSD + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const originalUserBalance = await ethers.provider.getBalance( + userWallet.address + ); + const originalDsaBalance = await ethers.provider.getBalance( + dsa.address + ); + + const openTroveSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "open", + args: [ + depositAmount, + maxFeePercentage, + borrowAmount, + upperHint, + lowerHint, + [0, 0], + [0, 0], + ], + }; + + await dsa + .connect(userWallet) + .cast(...encodeSpells([openTroveSpell]), userWallet.address, { + value: depositAmount, + gasPrice: 0, + }); + + const userBalance = await ethers.provider.getBalance( + userWallet.address + ); + const dsaEthBalance = await ethers.provider.getBalance(dsa.address); + const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); + const troveDebt = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const troveCollateral = await liquity.troveManager.getTroveColl( + dsa.address + ); + + expect(userBalance).eq( + originalUserBalance.sub(depositAmount), + "User's Ether balance should decrease by the amount they deposited" + ); + + expect(dsaEthBalance).to.eq( + originalDsaBalance, + "User's DSA account Ether should not change after borrowing" + ); + + expect( + dsaLusdBalance, + "DSA account should now hold the amount the user borrowed" + ).to.eq(borrowAmount); + + expect(troveDebt).to.gt( + borrowAmount, + "Trove debt should equal the borrowed amount plus fee" + ); + + expect(troveCollateral).to.eq( + depositAmount, + "Trove collateral should equal the deposited amount" + ); + }); + + it("opens a Trove using ETH collected from a previous spell", async () => { + const depositAmount = ethers.utils.parseEther("5"); // 5 ETH + const borrowAmount = ethers.utils.parseUnits("2000", 18); // 2000 LUSD + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const originalUserBalance = await ethers.provider.getBalance( + userWallet.address + ); + const originalDsaBalance = await ethers.provider.getBalance( + dsa.address + ); + const depositId = 1; // Choose an ID to store and retrieve the deposited ETH + + const depositEthSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "deposit", + args: [helpers.ETH_ADDRESS, depositAmount, 0, depositId], + }; + + const openTroveSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "open", + args: [ + 0, // When pulling ETH from a previous spell it doesn't matter what deposit value we put in this param + maxFeePercentage, + borrowAmount, + upperHint, + lowerHint, + [depositId, 0], + [0, 0], + ], + }; + + const spells = [depositEthSpell, openTroveSpell]; + await dsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address, { + value: depositAmount, + gasPrice: 0, + }); + + const userBalance = await ethers.provider.getBalance( + userWallet.address + ); + const dsaEthBalance = await ethers.provider.getBalance(dsa.address); + const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); + const troveDebt = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const troveCollateral = await liquity.troveManager.getTroveColl( + dsa.address + ); + + expect(userBalance).eq( + originalUserBalance.sub(depositAmount), + "User's Ether balance should decrease by the amount they deposited" + ); + + expect(dsaEthBalance).to.eq( + originalDsaBalance, + "DSA balance should not change" + ); + + expect( + dsaLusdBalance, + "DSA account should now hold the amount the user borrowed" + ).to.eq(borrowAmount); + + expect(troveDebt).to.gt( + borrowAmount, + "Trove debt should equal the borrowed amount plus fee" + ); + + expect(troveCollateral).to.eq( + depositAmount, + "Trove collateral should equal the deposited amount" + ); + }); + + it("opens a Trove and stores the debt for other spells to use", async () => { + const depositAmount = ethers.utils.parseEther("5"); // 5 ETH + const borrowAmount = ethers.utils.parseUnits("2000", 18); // 2000 LUSD + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const originalUserBalance = await ethers.provider.getBalance( + userWallet.address + ); + const originalDsaBalance = await ethers.provider.getBalance( + dsa.address + ); + const borrowId = 1; + + const openTroveSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "open", + args: [ + depositAmount, + maxFeePercentage, + borrowAmount, + upperHint, + lowerHint, + [0, 0], + [borrowId, 0], + ], + }; + + const withdrawLusdSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "withdraw", + args: [ + contracts.LUSD_TOKEN_ADDRESS, + 0, // Amount comes from the previous spell's setId + dsa.address, + borrowId, + 0, + ], + }; + + const spells = [openTroveSpell, withdrawLusdSpell]; + await dsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address, { + value: depositAmount, + gasPrice: 0, + }); + + const userBalance = await ethers.provider.getBalance( + userWallet.address + ); + const dsaEthBalance = await ethers.provider.getBalance(dsa.address); + const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); + const troveDebt = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const troveCollateral = await liquity.troveManager.getTroveColl( + dsa.address + ); + + expect(userBalance).eq( + originalUserBalance.sub(depositAmount), + "User's Ether balance should decrease by the amount they deposited" + ); + + expect(dsaEthBalance).to.eq( + originalDsaBalance, + "User's DSA account Ether should not change after borrowing" + ); + + expect( + dsaLusdBalance, + "DSA account should now hold the amount the user borrowed" + ).to.eq(borrowAmount); + + expect(troveDebt).to.gt( + borrowAmount, + "Trove debt should equal the borrowed amount plus fee" + ); + + expect(troveCollateral).to.eq( + depositAmount, + "Trove collateral should equal the deposited amount" + ); + }); + + it("returns Instadapp event name and data", async () => { + const depositAmount = ethers.utils.parseEther("5"); + const borrowAmount = ethers.utils.parseUnits("2000", 18); + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + + const openTroveSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "open", + args: [ + depositAmount, + maxFeePercentage, + borrowAmount, + upperHint, + lowerHint, + [0, 0], + [0, 0], + ], + }; + + const openTx = await dsa.cast( + ...encodeSpells([openTroveSpell]), + userWallet.address, + { + value: depositAmount, + } + ); + const receipt = await openTx.wait(); + const castLogEvent = receipt.events.find((e) => e.event === "LogCast") + .args; + expect(castLogEvent.eventNames[0]).eq( + "LogOpen(address,uint256,uint256,uint256,uint256[],uint256[])" + ); + const expectedEventParams = ethers.utils.defaultAbiCoder.encode( + [ + "address", + "uint256", + "uint256", + "uint256", + "uint256[]", + "uint256[]", + ], + [ + dsa.address, + maxFeePercentage, + depositAmount, + borrowAmount, + [0, 0], + [0, 0], + ] + ); + expect(castLogEvent.eventParams[0]).eq(expectedEventParams); + }); + }); + + describe("close()", () => { + it("closes a Trove", async () => { + const depositAmount = ethers.utils.parseEther("5"); + const borrowAmount = ethers.utils.parseUnits("2000", 18); + // Create a dummy Trove + await helpers.createDsaTrove( + dsa, + userWallet, + liquity, + depositAmount, + borrowAmount + ); + + const troveDebtBefore = await liquity.troveManager.getTroveDebt( + dsa.address + ); + + const troveCollateralBefore = await liquity.troveManager.getTroveColl( + dsa.address + ); + + // Send DSA account enough LUSD (from Stability Pool) to close their Trove + const extraLusdRequiredToCloseTrove = troveDebtBefore.sub( + borrowAmount + ); + + await helpers.sendToken( + liquity.lusdToken, + extraLusdRequiredToCloseTrove, + contracts.STABILITY_POOL_ADDRESS, + dsa.address + ); + + const originalDsaLusdBalance = await liquity.lusdToken.balanceOf( + dsa.address + ); + + expect( + originalDsaLusdBalance, + "DSA account should now hold the LUSD amount required to pay off the Trove debt" + ).to.eq(troveDebtBefore); + + const closeTroveSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "close", + args: [0], + }; + + await dsa + .connect(userWallet) + .cast(...encodeSpells([closeTroveSpell]), userWallet.address); + + const dsaEthBalance = await ethers.provider.getBalance(dsa.address); + const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); + const troveDebt = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const troveCollateral = await liquity.troveManager.getTroveColl( + dsa.address + ); + + expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); + + expect( + troveCollateral, + "Trove collateral should equal 0 after close" + ).to.eq(0); + + expect( + dsaEthBalance, + "DSA account should now hold the Trove's ETH collateral" + ).to.eq(troveCollateralBefore); + + expect( + dsaLusdBalance, + "DSA account should now hold the gas compensation amount of LUSD as it paid off the Trove debt" + ).to.eq(helpers.LUSD_GAS_COMPENSATION); + }); + + it("closes a Trove using LUSD obtained from a previous spell", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + const troveDebtBefore = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const troveCollateralBefore = await liquity.troveManager.getTroveColl( + dsa.address + ); + + // Send user enough LUSD to repay the loan, we'll use a deposit and withdraw spell to obtain it + await helpers.sendToken( + liquity.lusdToken, + troveDebtBefore, + contracts.STABILITY_POOL_ADDRESS, + userWallet.address + ); + + // Allow DSA to spend user's LUSD + await liquity.lusdToken + .connect(userWallet) + .approve(dsa.address, troveDebtBefore); + + // Simulate a spell which would have pulled LUSD from somewhere (e.g. Uniswap) into InstaMemory + // In this case we're simply running a deposit spell from the user's EOA + const depositLusdSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "deposit", + args: [contracts.LUSD_TOKEN_ADDRESS, troveDebtBefore, 0, 0], + }; + + const closeTroveSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "close", + args: [0], + }; + const spells = [depositLusdSpell, closeTroveSpell]; + + await dsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address); + + const dsaEthBalance = await ethers.provider.getBalance(dsa.address); + const troveDebt = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const troveCollateral = await liquity.troveManager.getTroveColl( + dsa.address + ); + + expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); + + expect( + troveCollateral, + "Trove collateral should equal 0 after close" + ).to.eq(0); + + expect( + dsaEthBalance, + "DSA account should now hold the Trove's ETH collateral" + ).to.eq(troveCollateralBefore); + }); + + it("closes a Trove and stores the released collateral for other spells to use", async () => { + const depositAmount = ethers.utils.parseEther("5"); + const borrowAmount = ethers.utils.parseUnits("2000", 18); + // Create a dummy Trove + await helpers.createDsaTrove( + dsa, + userWallet, + liquity, + depositAmount, + borrowAmount + ); + + const troveDebtBefore = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const troveCollateralBefore = await liquity.troveManager.getTroveColl( + dsa.address + ); + + // Send DSA account enough LUSD (from Stability Pool) to close their Trove + const extraLusdRequiredToCloseTrove = troveDebtBefore.sub( + borrowAmount + ); + await helpers.sendToken( + liquity.lusdToken, + extraLusdRequiredToCloseTrove, + contracts.STABILITY_POOL_ADDRESS, + dsa.address + ); + const originalDsaLusdBalance = await liquity.lusdToken.balanceOf( + dsa.address + ); + + expect( + originalDsaLusdBalance, + "DSA account should now hold the LUSD amount required to pay off the Trove debt" + ).to.eq(troveDebtBefore); + + const collateralWithdrawId = 1; + + const closeTroveSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "close", + args: [collateralWithdrawId], + }; + + const withdrawEthSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "withdraw", + args: [ + helpers.ETH_ADDRESS, + 0, // amount comes from the previous spell's setId + dsa.address, + collateralWithdrawId, + 0, + ], + }; + + await dsa + .connect(userWallet) + .cast( + ...encodeSpells([closeTroveSpell, withdrawEthSpell]), + userWallet.address + ); + + const dsaEthBalance = await ethers.provider.getBalance(dsa.address); + const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); + const troveDebt = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const troveCollateral = await liquity.troveManager.getTroveColl( + dsa.address + ); + + expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); + + expect( + troveCollateral, + "Trove collateral should equal 0 after close" + ).to.eq(0); + + expect( + dsaEthBalance, + "DSA account should now hold the Trove's ETH collateral" + ).to.eq(troveCollateralBefore); + + expect( + dsaLusdBalance, + "DSA account should now hold the gas compensation amount of LUSD as it paid off the Trove debt" + ).to.eq(helpers.LUSD_GAS_COMPENSATION); + }); + + it("returns Instadapp event name and data", async () => { + const depositAmount = ethers.utils.parseEther("5"); + const borrowAmount = ethers.utils.parseUnits("2000", 18); + // Create a dummy Trove + await helpers.createDsaTrove( + dsa, + userWallet, + liquity, + depositAmount, + borrowAmount + ); + await helpers.sendToken( + liquity.lusdToken, + ethers.utils.parseUnits("2500", 18), + contracts.STABILITY_POOL_ADDRESS, + dsa.address + ); + + const closeTroveSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "close", + args: [0], + }; + + const closeTx = await dsa + .connect(userWallet) + .cast(...encodeSpells([closeTroveSpell]), userWallet.address); + + const receipt = await closeTx.wait(); + const castLogEvent = receipt.events.find((e) => e.event === "LogCast") + .args; + const expectedEventParams = ethers.utils.defaultAbiCoder.encode( + ["address", "uint256"], + [dsa.address, 0] + ); + expect(castLogEvent.eventNames[0]).eq("LogClose(address,uint256)"); + expect(castLogEvent.eventParams[0]).eq(expectedEventParams); + }); + }); + + describe("deposit()", () => { + it("deposits ETH into a Trove", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + const troveCollateralBefore = await liquity.troveManager.getTroveColl( + dsa.address + ); + + const topupAmount = ethers.utils.parseEther("1"); + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const depositEthSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "deposit", + args: [topupAmount, upperHint, lowerHint, 0, 0], + }; + + await dsa + .connect(userWallet) + .cast(...encodeSpells([depositEthSpell]), userWallet.address, { + value: topupAmount, + }); + + const troveCollateral = await liquity.troveManager.getTroveColl( + dsa.address + ); + + const expectedTroveCollateral = troveCollateralBefore.add( + topupAmount + ); + + expect( + troveCollateral, + `Trove collateral should have increased by ${topupAmount} ETH` + ).to.eq(expectedTroveCollateral); + }); + + it("deposits using ETH gained from a previous spell", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + const troveCollateralBefore = await liquity.troveManager.getTroveColl( + dsa.address + ); + + const topupAmount = ethers.utils.parseEther("1"); + const depositId = 1; + const depositEthSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "deposit", + args: [helpers.ETH_ADDRESS, topupAmount, 0, depositId], + }; + + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const depositEthToTroveSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "deposit", + args: [0, upperHint, lowerHint, depositId, 0], + }; + const spells = [depositEthSpell, depositEthToTroveSpell]; + + await dsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address, { + value: topupAmount, + }); + + const troveCollateral = await liquity.troveManager.getTroveColl( + dsa.address + ); + + const expectedTroveCollateral = troveCollateralBefore.add( + topupAmount + ); + + expect( + troveCollateral, + `Trove collateral should have increased by ${topupAmount} ETH` + ).to.eq(expectedTroveCollateral); + }); + + it("returns Instadapp event name and data", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + const topupAmount = ethers.utils.parseEther("1"); + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const depositEthSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "deposit", + args: [topupAmount, upperHint, lowerHint, 0, 0], + }; + + const depositTx = await dsa + .connect(userWallet) + .cast(...encodeSpells([depositEthSpell]), userWallet.address, { + value: topupAmount, + }); + + const receipt = await depositTx.wait(); + const castLogEvent = receipt.events.find((e) => e.event === "LogCast") + .args; + const expectedEventParams = ethers.utils.defaultAbiCoder.encode( + ["address", "uint256", "uint256", "uint256"], + [dsa.address, topupAmount, 0, 0] + ); + expect(castLogEvent.eventNames[0]).eq( + "LogDeposit(address,uint256,uint256,uint256)" + ); + expect(castLogEvent.eventParams[0]).eq(expectedEventParams); + }); + }); + + describe("withdraw()", () => { + it("withdraws ETH from a Trove", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + const troveCollateralBefore = await liquity.troveManager.getTroveColl( + dsa.address + ); + const withdrawAmount = ethers.utils.parseEther("1"); + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const withdrawEthSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "withdraw", + args: [withdrawAmount, upperHint, lowerHint, 0, 0], + }; + + await dsa + .connect(userWallet) + .cast(...encodeSpells([withdrawEthSpell]), userWallet.address); + + const troveCollateral = await liquity.troveManager.getTroveColl( + dsa.address + ); + const expectedTroveCollateral = troveCollateralBefore.sub( + withdrawAmount + ); + + expect( + troveCollateral, + `Trove collateral should have decreased by ${withdrawAmount} ETH` + ).to.eq(expectedTroveCollateral); + }); + + it("withdraws ETH from a Trove and stores the ETH for other spells to use", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + const troveCollateralBefore = await liquity.troveManager.getTroveColl( + dsa.address + ); + const originalUserEthBalance = await ethers.provider.getBalance( + userWallet.address + ); + + const withdrawAmount = ethers.utils.parseEther("1"); + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const withdrawId = 1; + const withdrawEthFromTroveSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "withdraw", + args: [withdrawAmount, upperHint, lowerHint, 0, withdrawId], + }; + + const withdrawEthSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "withdraw", + args: [helpers.ETH_ADDRESS, 0, userWallet.address, withdrawId, 0], + }; + const spells = [withdrawEthFromTroveSpell, withdrawEthSpell]; + await dsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address, { + gasPrice: 0, // Remove gas costs so we can check balances have changed correctly + }); + + const troveCollateral = await liquity.troveManager.getTroveColl( + dsa.address + ); + const expectedTroveCollateral = troveCollateralBefore.sub( + withdrawAmount + ); + const userEthBalance = await ethers.provider.getBalance( + userWallet.address + ); + + expect( + troveCollateral, + `Trove collateral should have decreased by ${withdrawAmount} ETH` + ).to.eq(expectedTroveCollateral); + + expect( + userEthBalance, + `User ETH balance should have increased by ${withdrawAmount} ETH` + ).to.eq(originalUserEthBalance.add(withdrawAmount)); + }); + + it("returns Instadapp event name and data", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + const withdrawAmount = ethers.utils.parseEther("1"); + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const withdrawEthSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "withdraw", + args: [withdrawAmount, upperHint, lowerHint, 0, 0], + }; + + const withdrawTx = await dsa + .connect(userWallet) + .cast(...encodeSpells([withdrawEthSpell]), userWallet.address); + + const receipt = await withdrawTx.wait(); + const castLogEvent = receipt.events.find((e) => e.event === "LogCast") + .args; + const expectedEventParams = ethers.utils.defaultAbiCoder.encode( + ["address", "uint256", "uint256", "uint256"], + [dsa.address, withdrawAmount, 0, 0] + ); + expect(castLogEvent.eventNames[0]).eq( + "LogWithdraw(address,uint256,uint256,uint256)" + ); + expect(castLogEvent.eventParams[0]).eq(expectedEventParams); + }); + }); + + describe("borrow()", () => { + it("borrows LUSD from a Trove", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + const troveDebtBefore = await liquity.troveManager.getTroveDebt( + dsa.address + ); + + const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + const borrowSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "borrow", + args: [maxFeePercentage, borrowAmount, upperHint, lowerHint, 0, 0], + }; + + // Borrow more LUSD from the Trove + await dsa + .connect(userWallet) + .cast(...encodeSpells([borrowSpell]), userWallet.address); + + const troveDebt = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const expectedTroveDebt = troveDebtBefore.add(borrowAmount); + + expect( + troveDebt, + `Trove debt should have increased by at least ${borrowAmount} ETH` + ).to.gte(expectedTroveDebt); + }); + + it("borrows LUSD from a Trove and stores the LUSD for other spells to use", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + const troveDebtBefore = await liquity.troveManager.getTroveDebt( + dsa.address + ); + + const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + const borrowId = 1; + const borrowSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "borrow", + args: [ + maxFeePercentage, + borrowAmount, + upperHint, + lowerHint, + 0, + borrowId, + ], + }; + const withdrawSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "withdraw", + args: [ + liquity.lusdToken.address, + 0, + userWallet.address, + borrowId, + 0, + ], + }; + const spells = [borrowSpell, withdrawSpell]; + + // Borrow more LUSD from the Trove + await dsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address); + + const troveDebt = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const expectedTroveDebt = troveDebtBefore.add(borrowAmount); + const userLusdBalance = await liquity.lusdToken.balanceOf( + userWallet.address + ); + + expect( + troveDebt, + `Trove debt should have increased by at least ${borrowAmount} ETH` + ).to.gte(expectedTroveDebt); + + expect( + userLusdBalance, + `User LUSD balance should equal the borrowed LUSD due to the second withdraw spell` + ).eq(borrowAmount); + }); + + it("returns Instadapp event name and data", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + const borrowSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "borrow", + args: [maxFeePercentage, borrowAmount, upperHint, lowerHint, 0, 0], + }; + + const borrowTx = await dsa + .connect(userWallet) + .cast(...encodeSpells([borrowSpell]), userWallet.address); + + const receipt = await borrowTx.wait(); + const castLogEvent = receipt.events.find((e) => e.event === "LogCast") + .args; + const expectedEventParams = ethers.utils.defaultAbiCoder.encode( + ["address", "uint256", "uint256", "uint256"], + [dsa.address, borrowAmount, 0, 0] + ); + expect(castLogEvent.eventNames[0]).eq( + "LogBorrow(address,uint256,uint256,uint256)" + ); + expect(castLogEvent.eventParams[0]).eq(expectedEventParams); + }); + }); + + describe("repay()", () => { + it("repays LUSD to a Trove", async () => { + const depositAmount = ethers.utils.parseEther("5"); + const borrowAmount = ethers.utils.parseUnits("2500", 18); + + // Create a dummy Trove + await helpers.createDsaTrove( + dsa, + userWallet, + liquity, + depositAmount, + borrowAmount + ); + + const troveDebtBefore = await liquity.troveManager.getTroveDebt( + dsa.address + ); + // DSA account is holding 2500 LUSD from opening a Trove, so we use some of that to repay + const repayAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD + + const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( + depositAmount, + borrowAmount, + liquity + ); + const repaySpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "repay", + args: [repayAmount, upperHint, lowerHint, 0, 0], + }; + + await dsa + .connect(userWallet) + .cast(...encodeSpells([repaySpell]), userWallet.address); + + const troveDebt = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const expectedTroveDebt = troveDebtBefore.sub(repayAmount); + + expect( + troveDebt, + `Trove debt should have decreased by ${repayAmount} ETH` + ).to.eq(expectedTroveDebt); + }); + + it("repays LUSD to a Trove using LUSD collected from a previous spell", async () => { + const depositAmount = ethers.utils.parseEther("5"); + const borrowAmount = ethers.utils.parseUnits("2500", 18); + + // Create a dummy Trove + await helpers.createDsaTrove( + dsa, + userWallet, + liquity, + depositAmount, + borrowAmount + ); + + const troveDebtBefore = await liquity.troveManager.getTroveDebt( + dsa.address + ); + + const repayAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD + const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( + depositAmount, + borrowAmount, + liquity + ); + + // Drain the DSA's LUSD balance so that we ensure we are repaying using LUSD from a previous spell + await helpers.sendToken( + liquity.lusdToken, + borrowAmount, + dsa.address, + userWallet.address + ); + + // Allow DSA to spend user's LUSD + await liquity.lusdToken + .connect(userWallet) + .approve(dsa.address, repayAmount); + + const lusdDepositId = 1; + const depositSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "deposit", + args: [liquity.lusdToken.address, repayAmount, 0, lusdDepositId], + }; + const borrowSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "repay", + args: [0, upperHint, lowerHint, lusdDepositId, 0], + }; + + const spells = [depositSpell, borrowSpell]; + + await dsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address); + + const troveDebt = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const expectedTroveDebt = troveDebtBefore.sub(repayAmount); + + expect( + troveDebt, + `Trove debt should have decreased by ${repayAmount} ETH` + ).to.eq(expectedTroveDebt); + }); + + it("returns Instadapp event name and data", async () => { + // Create a dummy Trove + const depositAmount = ethers.utils.parseEther("5"); + const borrowAmount = ethers.utils.parseUnits("2500", 18); + await helpers.createDsaTrove( + dsa, + userWallet, + liquity, + depositAmount, + borrowAmount + ); + + const repayAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD + const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( + depositAmount, + borrowAmount, + liquity + ); + + const borrowSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "repay", + args: [repayAmount, upperHint, lowerHint, 0, 0], + }; + + const repayTx = await dsa + .connect(userWallet) + .cast(...encodeSpells([borrowSpell]), userWallet.address, { + value: repayAmount, + }); + + const receipt = await repayTx.wait(); + const castLogEvent = receipt.events.find((e) => e.event === "LogCast") + .args; + const expectedEventParams = ethers.utils.defaultAbiCoder.encode( + ["address", "uint256", "uint256", "uint256"], + [dsa.address, repayAmount, 0, 0] + ); + expect(castLogEvent.eventNames[0]).eq( + "LogRepay(address,uint256,uint256,uint256)" + ); + expect(castLogEvent.eventParams[0]).eq(expectedEventParams); + }); + }); + + describe("adjust()", () => { + it("adjusts a Trove: deposit ETH and borrow LUSD", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + const troveCollateralBefore = await liquity.troveManager.getTroveColl( + dsa.address + ); + const troveDebtBefore = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const depositAmount = ethers.utils.parseEther("1"); // 1 ETH + const borrowAmount = ethers.utils.parseUnits("500", 18); // 500 LUSD + const withdrawAmount = 0; + const repayAmount = 0; + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + + const adjustSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "adjust", + args: [ + maxFeePercentage, + depositAmount, + withdrawAmount, + borrowAmount, + repayAmount, + upperHint, + lowerHint, + [0, 0, 0, 0], + [0, 0, 0, 0], + ], + }; + + // Adjust Trove by depositing ETH and borrowing LUSD + await dsa + .connect(userWallet) + .cast(...encodeSpells([adjustSpell]), userWallet.address, { + value: depositAmount, + gasLimit: helpers.MAX_GAS, + }); + + const troveCollateral = await liquity.troveManager.getTroveColl( + dsa.address + ); + const troveDebt = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const expectedTroveColl = troveCollateralBefore.add(depositAmount); + const expectedTroveDebt = troveDebtBefore.add(borrowAmount); + + expect( + troveCollateral, + `Trove collateral should have increased by ${depositAmount} ETH` + ).to.eq(expectedTroveColl); + + expect( + troveDebt, + `Trove debt should have increased by at least ${borrowAmount} ETH` + ).to.gte(expectedTroveDebt); + }); + + it("adjusts a Trove: withdraw ETH and repay LUSD", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + const troveCollateralBefore = await liquity.troveManager.getTroveColl( + dsa.address + ); + const troveDebtBefore = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const depositAmount = 0; + const borrowAmount = 0; + const withdrawAmount = ethers.utils.parseEther("1"); // 1 ETH; + const repayAmount = ethers.utils.parseUnits("10", 18); // 10 LUSD; + const { upperHint, lowerHint } = await helpers.getTroveInsertionHints( + troveCollateralBefore.sub(withdrawAmount), + troveDebtBefore.sub(repayAmount), + liquity + ); + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + + const adjustSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "adjust", + args: [ + maxFeePercentage, + depositAmount, + withdrawAmount, + borrowAmount, + repayAmount, + upperHint, + lowerHint, + [0, 0, 0, 0], + [0, 0, 0, 0], + ], + }; + + // Adjust Trove by withdrawing ETH and repaying LUSD + await dsa + .connect(userWallet) + .cast(...encodeSpells([adjustSpell]), userWallet.address, { + value: depositAmount, + gasLimit: helpers.MAX_GAS, + }); + + const troveCollateral = await liquity.troveManager.getTroveColl( + dsa.address + ); + const troveDebt = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const expectedTroveColl = troveCollateralBefore.sub(withdrawAmount); + const expectedTroveDebt = troveDebtBefore.sub(repayAmount); + + expect( + troveCollateral, + `Trove collateral should have increased by ${depositAmount} ETH` + ).to.eq(expectedTroveColl); + + expect( + troveDebt, + `Trove debt should have decreased by at least ${repayAmount} LUSD` + ).to.gte(expectedTroveDebt); + }); + + it("adjusts a Trove: deposit ETH and repay LUSD using previous spells", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + const troveCollateralBefore = await liquity.troveManager.getTroveColl( + dsa.address + ); + const troveDebtBefore = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const depositAmount = ethers.utils.parseEther("1"); // 1 ETH + const borrowAmount = 0; + const withdrawAmount = 0; + const repayAmount = ethers.utils.parseUnits("10", 18); // 10 lUSD + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + + const ethDepositId = 1; + const lusdRepayId = 2; + + const depositEthSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "deposit", + args: [helpers.ETH_ADDRESS, depositAmount, 0, ethDepositId], + }; + + const depositLusdSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "deposit", + args: [liquity.lusdToken.address, repayAmount, 0, lusdRepayId], + }; + + const adjustSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "adjust", + args: [ + maxFeePercentage, + 0, // Deposit amount comes from a previous spell's storage slot + withdrawAmount, + borrowAmount, + 0, // Repay amount comes from a previous spell's storage slot + upperHint, + lowerHint, + [ethDepositId, 0, 0, lusdRepayId], + [0, 0, 0, 0], + ], + }; + const spells = [depositEthSpell, depositLusdSpell, adjustSpell]; + + // Send user some LUSD so they can repay + await helpers.sendToken( + liquity.lusdToken, + repayAmount, + helpers.JUSTIN_SUN_ADDRESS, + userWallet.address + ); + + // Allow DSA to spend user's LUSD + await liquity.lusdToken + .connect(userWallet) + .approve(dsa.address, repayAmount); + + // Adjust Trove by depositing ETH and repaying LUSD + await dsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address, { + value: depositAmount, + gasLimit: helpers.MAX_GAS, + }); + + const troveCollateral = await liquity.troveManager.getTroveColl( + dsa.address + ); + const troveDebt = await liquity.troveManager.getTroveDebt( + dsa.address + ); + const expectedTroveColl = troveCollateralBefore.add(depositAmount); + const expectedTroveDebt = troveDebtBefore.sub(repayAmount); + + expect( + troveCollateral, + `Trove collateral should have increased by ${depositAmount} ETH` + ).to.eq(expectedTroveColl); + + expect( + troveDebt, + `Trove debt (${troveDebtBefore}) should have decreased by at least ${repayAmount} LUSD` + ).to.eq(expectedTroveDebt); + }); + + it("adjusts a Trove: withdraw ETH, borrow LUSD, and store the amounts for other spells", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + const userEthBalanceBefore = await ethers.provider.getBalance( + userWallet.address + ); + const userLusdBalanceBefore = await liquity.lusdToken.balanceOf( + userWallet.address + ); + + const depositAmount = 0; + const borrowAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD + const withdrawAmount = ethers.utils.parseEther("1"); // 1 ETH + const repayAmount = 0; + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + + const ethWithdrawId = 1; + const lusdBorrowId = 2; + + const adjustSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "adjust", + args: [ + maxFeePercentage, + depositAmount, + withdrawAmount, + borrowAmount, + repayAmount, + upperHint, + lowerHint, + [0, 0, 0, 0], + [0, ethWithdrawId, lusdBorrowId, 0], + ], + }; + + const withdrawEthSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "withdraw", + args: [ + helpers.ETH_ADDRESS, + 0, + userWallet.address, + ethWithdrawId, + 0, + ], + }; + + const withdrawLusdSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "withdraw", + args: [ + liquity.lusdToken.address, + 0, + userWallet.address, + lusdBorrowId, + 0, + ], + }; + + const spells = [adjustSpell, withdrawEthSpell, withdrawLusdSpell]; + + // Adjust Trove by withdrawing ETH and borrowing LUSD + await dsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address, { + gasLimit: helpers.MAX_GAS, + gasPrice: 0, + }); + + const userEthBalanceAfter = await ethers.provider.getBalance( + userWallet.address + ); + const userLusdBalanceAfter = await liquity.lusdToken.balanceOf( + userWallet.address + ); + expect(userEthBalanceAfter).eq( + userEthBalanceBefore.add(withdrawAmount) + ); + expect(userLusdBalanceAfter).eq( + userLusdBalanceBefore.add(borrowAmount) + ); + }); + + it("returns Instadapp event name and data", async () => { + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + const depositAmount = ethers.utils.parseEther("1"); // 1 ETH + const borrowAmount = ethers.utils.parseUnits("500", 18); // 500 LUSD + const withdrawAmount = 0; + const repayAmount = 0; + const upperHint = ethers.constants.AddressZero; + const lowerHint = ethers.constants.AddressZero; + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + + const adjustSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "adjust", + args: [ + maxFeePercentage, + depositAmount, + withdrawAmount, + borrowAmount, + repayAmount, + upperHint, + lowerHint, + [0, 0, 0, 0], + [0, 0, 0, 0], + ], + }; + + const adjustTx = await dsa + .connect(userWallet) + .cast(...encodeSpells([adjustSpell]), userWallet.address, { + value: depositAmount, + gasLimit: helpers.MAX_GAS, + }); + + const receipt = await adjustTx.wait(); + const castLogEvent = receipt.events.find((e) => e.event === "LogCast") + .args; + const expectedEventParams = ethers.utils.defaultAbiCoder.encode( + [ + "address", + "uint256", + "uint256", + "uint256", + "uint256", + "uint256", + "uint256[]", + "uint256[]", + ], + [ + dsa.address, + maxFeePercentage, + depositAmount, + withdrawAmount, + borrowAmount, + repayAmount, + [0, 0, 0, 0], + [0, 0, 0, 0], + ] + ); + expect(castLogEvent.eventNames[0]).eq( + "LogAdjust(address,uint256,uint256,uint256,uint256,uint256,uint256[],uint256[])" + ); + expect(castLogEvent.eventParams[0]).eq(expectedEventParams); + }); + }); + + describe("claimCollateralFromRedemption()", () => { + it("claims collateral from a redeemed Trove", async () => { + // Create a low collateralized Trove + const depositAmount = ethers.utils.parseEther("1.5"); + const borrowAmount = ethers.utils.parseUnits("2500", 18); + + await helpers.createDsaTrove( + dsa, + userWallet, + liquity, + depositAmount, + borrowAmount + ); + + // Redeem lots of LUSD to cause the Trove to become redeemed + const redeemAmount = ethers.utils.parseUnits("10000000", 18); + await helpers.sendToken( + liquity.lusdToken, + redeemAmount, + contracts.STABILITY_POOL_ADDRESS, + userWallet.address + ); + const { + partialRedemptionHintNicr, + firstRedemptionHint, + upperHint, + lowerHint, + } = await helpers.getRedemptionHints(redeemAmount, liquity); + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + + await liquity.troveManager + .connect(userWallet) + .redeemCollateral( + redeemAmount, + firstRedemptionHint, + upperHint, + lowerHint, + partialRedemptionHintNicr, + 0, + maxFeePercentage, + { + gasLimit: helpers.MAX_GAS, // permit max gas + } + ); + + const remainingEthCollateral = await liquity.collSurplus.getCollateral( + dsa.address + ); + + // Claim the remaining collateral from the redeemed Trove + const claimCollateralFromRedemptionSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "claimCollateralFromRedemption", + args: [0], + }; + + await dsa + .connect(userWallet) + .cast( + ...encodeSpells([claimCollateralFromRedemptionSpell]), + userWallet.address + ); + + const ethBalance = await ethers.provider.getBalance(dsa.address); + + expect(ethBalance).to.eq(remainingEthCollateral); + }); + + it("returns Instadapp event name and data", async () => { + // Create a low collateralized Trove + const depositAmount = ethers.utils.parseEther("1.5"); + const borrowAmount = ethers.utils.parseUnits("2500", 18); + + await helpers.createDsaTrove( + dsa, + userWallet, + liquity, + depositAmount, + borrowAmount + ); + + // Redeem lots of LUSD to cause the Trove to become redeemed + const redeemAmount = ethers.utils.parseUnits("10000000", 18); + const setId = 0; + await helpers.sendToken( + liquity.lusdToken, + redeemAmount, + contracts.STABILITY_POOL_ADDRESS, + userWallet.address + ); + const { + partialRedemptionHintNicr, + firstRedemptionHint, + upperHint, + lowerHint, + } = await helpers.getRedemptionHints(redeemAmount, liquity); + const maxFeePercentage = ethers.utils.parseUnits("0.5", 18); // 0.5% max fee + + await liquity.troveManager + .connect(userWallet) + .redeemCollateral( + redeemAmount, + firstRedemptionHint, + upperHint, + lowerHint, + partialRedemptionHintNicr, + 0, + maxFeePercentage, + { + gasLimit: helpers.MAX_GAS, // permit max gas + } + ); + const claimAmount = await liquity.collSurplus.getCollateral( + dsa.address + ); + + const claimCollateralFromRedemptionSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "claimCollateralFromRedemption", + args: [setId], + }; + + const claimTx = await dsa + .connect(userWallet) + .cast( + ...encodeSpells([claimCollateralFromRedemptionSpell]), + userWallet.address + ); + + const receipt = await claimTx.wait(); + const castLogEvent = receipt.events.find((e) => e.event === "LogCast") + .args; + const expectedEventParams = ethers.utils.defaultAbiCoder.encode( + ["address", "uint256", "uint256"], + [dsa.address, claimAmount, setId] + ); + expect(castLogEvent.eventNames[0]).eq( + "LogClaimCollateralFromRedemption(address,uint256,uint256)" + ); + expect(castLogEvent.eventParams[0]).eq(expectedEventParams); + }); + }); + }); + + describe("Stability Pool", () => { + describe("stabilityDeposit()", () => { + it("deposits into Stability Pool", async () => { + const amount = ethers.utils.parseUnits("100", 18); + const frontendTag = ethers.constants.AddressZero; + + await helpers.sendToken( + liquity.lusdToken, + amount, + contracts.STABILITY_POOL_ADDRESS, + dsa.address + ); + + const stabilityDepositSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stabilityDeposit", + args: [amount, frontendTag, 0, 0, 0, 0], + }; + + await dsa + .connect(userWallet) + .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + + const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( + dsa.address + ); + expect(depositedAmount).to.eq(amount); + }); + + it("deposits into Stability Pool using LUSD collected from a previous spell", async () => { + const amount = ethers.utils.parseUnits("100", 18); + const frontendTag = ethers.constants.AddressZero; + + await helpers.sendToken( + liquity.lusdToken, + amount, + contracts.STABILITY_POOL_ADDRESS, + userWallet.address + ); + const lusdDepositId = 1; + + const depositLusdSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "deposit", + args: [liquity.lusdToken.address, amount, 0, lusdDepositId], + }; + const stabilityDepositSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stabilityDeposit", + args: [0, frontendTag, lusdDepositId, 0, 0, 0], + }; + const spells = [depositLusdSpell, stabilityDepositSpell]; + + // Allow DSA to spend user's LUSD + await liquity.lusdToken + .connect(userWallet) + .approve(dsa.address, amount); + + await dsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address); + + const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( + dsa.address + ); + expect(depositedAmount).to.eq(amount); + }); + + it("returns Instadapp event name and data", async () => { + const amount = ethers.utils.parseUnits("100", 18); + const halfAmount = amount.div(2); + const frontendTag = ethers.constants.AddressZero; + const getDepositId = 0; + const setDepositId = 0; + const setEthGainId = 0; + const setLqtyGainId = 0; + + await helpers.sendToken( + liquity.lusdToken, + amount, + contracts.STABILITY_POOL_ADDRESS, + dsa.address + ); + + const stabilityDepositSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stabilityDeposit", + args: [ + halfAmount, + frontendTag, + getDepositId, + setDepositId, + setEthGainId, + setLqtyGainId, + ], + }; + + // Create a Stability deposit for this DSA + await dsa + .connect(userWallet) + .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + + // Liquidate a Trove to cause an ETH gain + await liquity.troveManager.connect(userWallet).liquidateTroves(1, { + gasLimit: helpers.MAX_GAS, + }); + + // Fast forward in time so we have an LQTY gain + await provider.send("evm_increaseTime", [600]); + await provider.send("evm_mine"); + + // Create a Stability Pool deposit with a differen DSA so that LQTY gains can be calculated + // See: https://github.com/liquity/dev/#lqty-reward-events-and-payouts + const tempDsa = await buildDSAv2(userWallet.address); + await helpers.sendToken( + liquity.lusdToken, + amount, + contracts.STABILITY_POOL_ADDRESS, + tempDsa.address + ); + await tempDsa + .connect(userWallet) + .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + + const ethGain = await liquity.stabilityPool.getDepositorETHGain( + dsa.address + ); + const lqtyGain = await liquity.stabilityPool.getDepositorLQTYGain( + dsa.address + ); + + // Top up the user's deposit so that we can track their ETH and LQTY gain + const depositAgainTx = await dsa + .connect(userWallet) + .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + + const receipt = await depositAgainTx.wait(); + const castLogEvent = receipt.events.find((e) => e.event === "LogCast") + .args; + const expectedEventParams = ethers.utils.defaultAbiCoder.encode( + [ + "address", + "uint256", + "uint256", + "uint256", + "address", + "uint256", + "uint256", + "uint256", + "uint256", + ], + [ + dsa.address, + halfAmount, + ethGain, + lqtyGain, + frontendTag, + getDepositId, + setDepositId, + setEthGainId, + setLqtyGainId, + ] + ); + expect(castLogEvent.eventNames[0]).eq( + "LogStabilityDeposit(address,uint256,uint256,uint256,address,uint256,uint256,uint256,uint256)" + ); + expect(castLogEvent.eventParams[0]).eq(expectedEventParams); + }); + }); + + describe("stabilityWithdraw()", () => { + it("withdraws from Stability Pool", async () => { + // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool + [liquity, dsa] = await helpers.resetInitialState( + userWallet.address, + contracts + ); + + // The current block number has liquidatable Troves. + // Remove them otherwise Stability Pool withdrawals are disabled + await liquity.troveManager.connect(userWallet).liquidateTroves(90, { + gasLimit: helpers.MAX_GAS, + }); + + const amount = ethers.utils.parseUnits("100", 18); + const frontendTag = ethers.constants.AddressZero; + + await helpers.sendToken( + liquity.lusdToken, + amount, + contracts.STABILITY_POOL_ADDRESS, + dsa.address + ); + + const stabilityDepositSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stabilityDeposit", + args: [amount, frontendTag, 0, 0, 0, 0], + }; + + // Withdraw half of the deposit + const stabilityWithdrawSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stabilityWithdraw", + args: [amount.div(2), 0, 0, 0, 0], + }; + const spells = [stabilityDepositSpell, stabilityWithdrawSpell]; + + await dsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address); + + const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( + dsa.address + ); + const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); + + expect(depositedAmount).to.eq(amount.div(2)); + expect(dsaLusdBalance).to.eq(amount.div(2)); + }); + + it("withdraws from Stability Pool and stores the LUSD for other spells", async () => { + // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool + [liquity, dsa] = await helpers.resetInitialState( + userWallet.address, + contracts + ); + + // The current block number has liquidatable Troves. + // Remove them otherwise Stability Pool withdrawals are disabled + await liquity.troveManager.connect(userWallet).liquidateTroves(90, { + gasLimit: helpers.MAX_GAS, + }); + const amount = ethers.utils.parseUnits("100", 18); + const frontendTag = ethers.constants.AddressZero; + const withdrawId = 1; + + await helpers.sendToken( + liquity.lusdToken, + amount, + contracts.STABILITY_POOL_ADDRESS, + dsa.address + ); + + const stabilityDepositSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stabilityDeposit", + args: [amount, frontendTag, 0, 0, 0, 0], + }; + + // Withdraw half of the deposit + const stabilityWithdrawSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stabilityWithdraw", + args: [amount.div(2), 0, 0, 0, withdrawId], + }; + + const withdrawLusdSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "withdraw", + args: [ + liquity.lusdToken.address, + 0, + userWallet.address, + withdrawId, + 0, + ], + }; + + const spells = [ + stabilityDepositSpell, + stabilityWithdrawSpell, + withdrawLusdSpell, + ]; + + await dsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address); + + const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( + dsa.address + ); + const walletLusdBalance = await liquity.lusdToken.balanceOf( + dsa.address + ); + + expect(depositedAmount).to.eq(amount.div(2)); + expect(walletLusdBalance).to.eq(amount.div(2)); + }); + + it("returns Instadapp event name and data", async () => { + // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool + [liquity, dsa] = await helpers.resetInitialState( + userWallet.address, + contracts + ); + + const amount = ethers.utils.parseUnits("100", 18); + const frontendTag = ethers.constants.AddressZero; + + await helpers.sendToken( + liquity.lusdToken, + amount, + contracts.STABILITY_POOL_ADDRESS, + dsa.address + ); + + const stabilityDepositSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stabilityDeposit", + args: [amount, frontendTag, 0, 0, 0, 0], + }; + + // Withdraw half of the deposit + const withdrawAmount = amount.div(2); + const getWithdrawId = 0; + const setWithdrawId = 0; + const setEthGainId = 0; + const setLqtyGainId = 0; + + // Create a Stability Pool deposit + await dsa + .connect(userWallet) + .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + + // The current block number has liquidatable Troves. + // Remove them otherwise Stability Pool withdrawals are disabled + await liquity.troveManager.connect(userWallet).liquidateTroves(90, { + gasLimit: helpers.MAX_GAS, + }); + + // Fast forward in time so we have an LQTY gain + await provider.send("evm_increaseTime", [600]); + await provider.send("evm_mine"); + + // Create another Stability Pool deposit so that LQTY gains are realized + // See: https://github.com/liquity/dev/#lqty-reward-events-and-payouts + const tempDsa = await buildDSAv2(userWallet.address); + await helpers.sendToken( + liquity.lusdToken, + amount, + contracts.STABILITY_POOL_ADDRESS, + tempDsa.address + ); + await tempDsa + .connect(userWallet) + .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + + const ethGain = await liquity.stabilityPool.getDepositorETHGain( + dsa.address + ); + const lqtyGain = await liquity.stabilityPool.getDepositorLQTYGain( + dsa.address + ); + + const stabilityWithdrawSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stabilityWithdraw", + args: [ + withdrawAmount, + getWithdrawId, + setWithdrawId, + setEthGainId, + setLqtyGainId, + ], + }; + + const withdrawTx = await dsa + .connect(userWallet) + .cast( + ...encodeSpells([stabilityWithdrawSpell]), + userWallet.address + ); + + const receipt = await withdrawTx.wait(); + const castLogEvent = receipt.events.find((e) => e.event === "LogCast") + .args; + const expectedEventParams = ethers.utils.defaultAbiCoder.encode( + [ + "address", + "uint256", + "uint256", + "uint256", + "uint256", + "uint256", + "uint256", + "uint256", + ], + [ + dsa.address, + withdrawAmount, + ethGain, + lqtyGain, + getWithdrawId, + setWithdrawId, + setEthGainId, + setLqtyGainId, + ] + ); + expect(castLogEvent.eventNames[0]).eq( + "LogStabilityWithdraw(address,uint256,uint256,uint256,uint256,uint256,uint256,uint256)" + ); + expect(castLogEvent.eventParams[0]).eq(expectedEventParams); + }); + }); + + describe("stabilityMoveEthGainToTrove()", () => { + beforeEach(async () => { + // Start these test from fresh so that we definitely have a liquidatable Trove within this block + [liquity, dsa] = await helpers.resetInitialState( + userWallet.address, + contracts + ); + }); + + it("moves ETH gain from Stability Pool to Trove", async () => { + // Create a DSA owned Trove to capture ETH liquidation gains + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + const troveCollateralBefore = await liquity.troveManager.getTroveColl( + dsa.address + ); + + // Create a Stability Deposit using the Trove's borrowed LUSD + const amount = ethers.utils.parseUnits("100", 18); + const frontendTag = ethers.constants.AddressZero; + const stabilityDepositSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stabilityDeposit", + args: [amount, frontendTag, 0, 0, 0, 0], + }; + + await dsa + .connect(userWallet) + .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + + // Liquidate a Trove to create an ETH gain for the new DSA Trove + await liquity.troveManager + .connect(userWallet) + .liquidate(helpers.LIQUIDATABLE_TROVE_ADDRESS, { + gasLimit: helpers.MAX_GAS, // permit max gas + }); + + const ethGainFromLiquidation = await liquity.stabilityPool.getDepositorETHGain( + dsa.address + ); + + // Move ETH gain to Trove + const moveEthGainSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stabilityMoveEthGainToTrove", + args: [ethers.constants.AddressZero, ethers.constants.AddressZero], + }; + + await dsa + .connect(userWallet) + .cast(...encodeSpells([moveEthGainSpell]), userWallet.address); + + const ethGainAfterMove = await liquity.stabilityPool.getDepositorETHGain( + dsa.address + ); + const troveCollateral = await liquity.troveManager.getTroveColl( + dsa.address + ); + const expectedTroveCollateral = troveCollateralBefore.add( + ethGainFromLiquidation + ); + expect(ethGainAfterMove).to.eq(0); + expect(troveCollateral).to.eq(expectedTroveCollateral); + }); + + it("returns Instadapp event name and data", async () => { + // Create a DSA owned Trove to capture ETH liquidation gains + // Create a dummy Trove + await helpers.createDsaTrove(dsa, userWallet, liquity); + + // Create a Stability Deposit using the Trove's borrowed LUSD + const amount = ethers.utils.parseUnits("100", 18); + const frontendTag = ethers.constants.AddressZero; + const stabilityDepositSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stabilityDeposit", + args: [amount, frontendTag, 0, 0, 0, 0], + }; + + await dsa + .connect(userWallet) + .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); + + // Liquidate a Trove to create an ETH gain for the new DSA Trove + await liquity.troveManager + .connect(userWallet) + .liquidate(helpers.LIQUIDATABLE_TROVE_ADDRESS, { + gasLimit: helpers.MAX_GAS, // permit max gas + }); + + const ethGainFromLiquidation = await liquity.stabilityPool.getDepositorETHGain( + dsa.address + ); + + // Move ETH gain to Trove + const moveEthGainSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stabilityMoveEthGainToTrove", + args: [ethers.constants.AddressZero, ethers.constants.AddressZero], + }; + + const moveEthGainTx = await dsa + .connect(userWallet) + .cast(...encodeSpells([moveEthGainSpell]), userWallet.address); + + const receipt = await moveEthGainTx.wait(); + + const castLogEvent = receipt.events.find((e) => e.event === "LogCast") + .args; + const expectedEventParams = ethers.utils.defaultAbiCoder.encode( + ["address", "uint256"], + [dsa.address, ethGainFromLiquidation] + ); + expect(castLogEvent.eventNames[0]).eq( + "LogStabilityMoveEthGainToTrove(address,uint256)" + ); + expect(castLogEvent.eventParams[0]).eq(expectedEventParams); + }); + }); + }); + + describe("Staking", () => { + describe("stake()", () => { + it("stakes LQTY", async () => { + const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( + contracts.STAKING_ADDRESS + ); + + const amount = ethers.utils.parseUnits("1", 18); + await helpers.sendToken( + liquity.lqtyToken, + amount, + helpers.JUSTIN_SUN_ADDRESS, + dsa.address + ); + + const stakeSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stake", + args: [amount, 0, 0, 0, 0], + }; + + await dsa + .connect(userWallet) + .cast(...encodeSpells([stakeSpell]), userWallet.address); + + const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); + expect(lqtyBalance).to.eq(0); + + const totalStakingBalance = await liquity.lqtyToken.balanceOf( + contracts.STAKING_ADDRESS + ); + expect(totalStakingBalance).to.eq( + totalStakingBalanceBefore.add(amount) + ); + }); + + it("stakes LQTY using LQTY obtained from a previous spell", async () => { + const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( + contracts.STAKING_ADDRESS + ); + + const amount = ethers.utils.parseUnits("1", 18); + await helpers.sendToken( + liquity.lqtyToken, + amount, + helpers.JUSTIN_SUN_ADDRESS, + userWallet.address + ); + + const lqtyDepositId = 1; + const depositSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "deposit", + args: [liquity.lqtyToken.address, amount, 0, lqtyDepositId], + }; + const stakeSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stake", + args: [0, lqtyDepositId, 0, 0, 0], + }; + const spells = [depositSpell, stakeSpell]; + + // Allow DSA to spend user's LQTY + await liquity.lqtyToken + .connect(userWallet) + .approve(dsa.address, amount); + + await dsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address); + + const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); + expect(lqtyBalance).to.eq(0); + + const totalStakingBalance = await liquity.lqtyToken.balanceOf( + contracts.STAKING_ADDRESS + ); + expect(totalStakingBalance).to.eq( + totalStakingBalanceBefore.add(amount) + ); + }); + + it("returns Instadapp event name and data", async () => { + const amount = ethers.utils.parseUnits("1", 18); + await helpers.sendToken( + liquity.lqtyToken, + amount, + helpers.JUSTIN_SUN_ADDRESS, + dsa.address + ); + + const getStakeId = 0; + const setStakeId = 0; + const setEthGainId = 0; + const setLusdGainId = 0; + const stakeSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stake", + args: [amount, getStakeId, setStakeId, setEthGainId, setLusdGainId], + }; + + const stakeTx = await dsa + .connect(userWallet) + .cast(...encodeSpells([stakeSpell]), userWallet.address); + + const receipt = await stakeTx.wait(); + + const castLogEvent = receipt.events.find((e) => e.event === "LogCast") + .args; + const expectedEventParams = ethers.utils.defaultAbiCoder.encode( + ["address", "uint256", "uint256", "uint256", "uint256", "uint256"], + [ + dsa.address, + amount, + getStakeId, + setStakeId, + setEthGainId, + setLusdGainId, + ] + ); + expect(castLogEvent.eventNames[0]).eq( + "LogStake(address,uint256,uint256,uint256,uint256,uint256)" + ); + expect(castLogEvent.eventParams[0]).eq(expectedEventParams); + }); + }); + + describe("unstake()", () => { + it("unstakes LQTY", async () => { + const amount = ethers.utils.parseUnits("1", 18); + await helpers.sendToken( + liquity.lqtyToken, + amount, + helpers.JUSTIN_SUN_ADDRESS, + dsa.address + ); + + const stakeSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stake", + args: [amount, 0, 0, 0, 0], + }; + + await dsa + .connect(userWallet) + .cast(...encodeSpells([stakeSpell]), userWallet.address); + + const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( + contracts.STAKING_ADDRESS + ); + const unstakeSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "unstake", + args: [amount, 0, 0, 0, 0], + }; + + await dsa + .connect(userWallet) + .cast(...encodeSpells([unstakeSpell]), userWallet.address); + + const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); + expect(lqtyBalance).to.eq(amount); + + const totalStakingBalance = await liquity.lqtyToken.balanceOf( + contracts.STAKING_ADDRESS + ); + expect(totalStakingBalance).to.eq( + totalStakingBalanceBefore.sub(amount) + ); + }); + + it("unstakes LQTY and stores the LQTY for other spells", async () => { + const amount = ethers.utils.parseUnits("1", 18); + await helpers.sendToken( + liquity.lqtyToken, + amount, + helpers.JUSTIN_SUN_ADDRESS, + dsa.address + ); + + const stakeSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stake", + args: [amount, 0, 0, 0, 0], + }; + + await dsa + .connect(userWallet) + .cast(...encodeSpells([stakeSpell]), userWallet.address); + + const totalStakingBalanceBefore = await liquity.lqtyToken.balanceOf( + contracts.STAKING_ADDRESS + ); + const withdrawId = 1; + const unstakeSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "unstake", + args: [amount, 0, withdrawId, 0, 0], + }; + + const withdrawLqtySpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "withdraw", + args: [ + liquity.lqtyToken.address, + 0, + userWallet.address, + withdrawId, + 0, + ], + }; + const spells = [unstakeSpell, withdrawLqtySpell]; + await dsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address); + + const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); + const totalStakingBalance = await liquity.lqtyToken.balanceOf( + contracts.STAKING_ADDRESS + ); + const userLqtyBalance = await liquity.lqtyToken.balanceOf( + userWallet.address + ); + expect(lqtyBalance).to.eq(0); + expect(totalStakingBalance).to.eq( + totalStakingBalanceBefore.sub(amount) + ); + expect(userLqtyBalance).to.eq(amount); + }); + + it("returns Instadapp event name and data", async () => { + const amount = ethers.utils.parseUnits("1", 18); + await helpers.sendToken( + liquity.lqtyToken, + amount, + helpers.JUSTIN_SUN_ADDRESS, + dsa.address + ); + + const stakeSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stake", + args: [amount, 0, 0, 0, 0], + }; + + await dsa + .connect(userWallet) + .cast(...encodeSpells([stakeSpell]), userWallet.address); + + const getUnstakeId = 0; + const setUnstakeId = 0; + const setEthGainId = 0; + const setLusdGainId = 0; + const unstakeSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "unstake", + args: [ + amount, + getUnstakeId, + setUnstakeId, + setEthGainId, + setLusdGainId, + ], + }; + + const unstakeTx = await dsa + .connect(userWallet) + .cast(...encodeSpells([unstakeSpell]), userWallet.address); + + const receipt = await unstakeTx.wait(); + + const castLogEvent = receipt.events.find((e) => e.event === "LogCast") + .args; + const expectedEventParams = ethers.utils.defaultAbiCoder.encode( + ["address", "uint256", "uint256", "uint256", "uint256", "uint256"], + [ + dsa.address, + amount, + getUnstakeId, + setUnstakeId, + setEthGainId, + setLusdGainId, + ] + ); + expect(castLogEvent.eventNames[0]).eq( + "LogUnstake(address,uint256,uint256,uint256,uint256,uint256)" + ); + expect(castLogEvent.eventParams[0]).eq(expectedEventParams); + }); + }); + + describe("claimStakingGains()", () => { + it("claims gains from staking", async () => { + const stakerDsa = await buildDSAv2(userWallet.address); + const amount = ethers.utils.parseUnits("1000", 18); // 1000 LQTY + + // Stake lots of LQTY + await helpers.sendToken( + liquity.lqtyToken, + amount, + helpers.JUSTIN_SUN_ADDRESS, + stakerDsa.address + ); + const stakeSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stake", + args: [amount, 0, 0, 0, 0], + }; + await stakerDsa + .connect(userWallet) + .cast(...encodeSpells([stakeSpell]), userWallet.address); + + // Open a Trove to cause an ETH issuance gain for stakers + await helpers.createDsaTrove(dsa, userWallet, liquity); + + // Redeem some ETH to cause an LUSD redemption gain for stakers + await helpers.redeem( + ethers.utils.parseUnits("1000", 18), + contracts.STABILITY_POOL_ADDRESS, + userWallet, + liquity + ); + + const setEthGainId = 0; + const setLusdGainId = 0; + const ethGain = await liquity.staking.getPendingETHGain( + stakerDsa.address + ); + const lusdGain = await liquity.staking.getPendingLUSDGain( + stakerDsa.address + ); + + const claimStakingGainsSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "claimStakingGains", + args: [setEthGainId, setLusdGainId], + }; + + const ethBalanceBefore = await ethers.provider.getBalance( + stakerDsa.address + ); + + // Claim gains + await stakerDsa + .connect(userWallet) + .cast( + ...encodeSpells([claimStakingGainsSpell]), + userWallet.address + ); + + const ethBalanceAfter = await ethers.provider.getBalance( + stakerDsa.address + ); + const lusdBalanceAfter = await liquity.lusdToken.balanceOf( + stakerDsa.address + ); + expect(ethBalanceAfter).to.eq(ethBalanceBefore.add(ethGain)); + expect(lusdBalanceAfter).to.eq(lusdGain); + }); + + it("claims gains from staking and stores them for other spells", async () => { + const stakerDsa = await buildDSAv2(userWallet.address); + const amount = ethers.utils.parseUnits("1000", 18); // 1000 LQTY + + // Stake lots of LQTY + await helpers.sendToken( + liquity.lqtyToken, + amount, + helpers.JUSTIN_SUN_ADDRESS, + stakerDsa.address + ); + const stakeSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stake", + args: [amount, 0, 0, 0, 0], + }; + await stakerDsa + .connect(userWallet) + .cast(...encodeSpells([stakeSpell]), userWallet.address); + + // Open a Trove to cause an ETH issuance gain for stakers + await helpers.createDsaTrove(dsa, userWallet, liquity); + + // Redeem some ETH to cause an LUSD redemption gain for stakers + await helpers.redeem( + ethers.utils.parseUnits("1000", 18), + contracts.STABILITY_POOL_ADDRESS, + userWallet, + liquity + ); + + const ethGain = await liquity.staking.getPendingETHGain( + stakerDsa.address + ); + const lusdGain = await liquity.staking.getPendingLUSDGain( + stakerDsa.address + ); + const lusdBalanceBefore = await liquity.lusdToken.balanceOf( + userWallet.address + ); + const ethBalanceBefore = await ethers.provider.getBalance( + userWallet.address + ); + const ethGainId = 111; + const lusdGainId = 222; + + const claimStakingGainsSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "claimStakingGains", + args: [ethGainId, lusdGainId], + }; + + const withdrawEthSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "withdraw", + args: [helpers.ETH_ADDRESS, 0, userWallet.address, ethGainId, 0], + }; + + const withdrawLusdSpell = { + connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, + method: "withdraw", + args: [ + liquity.lusdToken.address, + 0, + userWallet.address, + lusdGainId, + 0, + ], + }; + + const spells = [ + claimStakingGainsSpell, + withdrawEthSpell, + withdrawLusdSpell, + ]; + + // Claim gains + await stakerDsa + .connect(userWallet) + .cast(...encodeSpells(spells), userWallet.address, { + gasPrice: 0, + }); + + const ethBalanceAfter = await ethers.provider.getBalance( + userWallet.address + ); + const lusdBalanceAfter = await liquity.lusdToken.balanceOf( + userWallet.address + ); + + expect( + ethBalanceAfter, + "User's ETH balance should have increased by the issuance gain from staking" + ).to.eq(ethBalanceBefore.add(ethGain)); + expect( + lusdBalanceAfter, + "User's LUSD balance should have increased by the redemption gain from staking" + ).to.eq(lusdBalanceBefore.add(lusdGain)); + }); + + it("returns Instadapp event name and data", async () => { + const stakerDsa = await buildDSAv2(userWallet.address); + const amount = ethers.utils.parseUnits("1000", 18); // 1000 LQTY + + // Stake lots of LQTY + await helpers.sendToken( + liquity.lqtyToken, + amount, + helpers.JUSTIN_SUN_ADDRESS, + stakerDsa.address + ); + const stakeSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "stake", + args: [amount, 0, 0, 0, 0], + }; + await stakerDsa + .connect(userWallet) + .cast(...encodeSpells([stakeSpell]), userWallet.address); + + // Open a Trove to cause an ETH issuance gain for stakers + await helpers.createDsaTrove(dsa, userWallet, liquity); + + // Redeem some ETH to cause an LUSD redemption gain for stakers + await helpers.redeem( + ethers.utils.parseUnits("1000", 18), + contracts.STABILITY_POOL_ADDRESS, + userWallet, + liquity + ); + + const setEthGainId = 0; + const setLusdGainId = 0; + const ethGain = await liquity.staking.getPendingETHGain( + stakerDsa.address + ); + const lusdGain = await liquity.staking.getPendingLUSDGain( + stakerDsa.address + ); + + const claimStakingGainsSpell = { + connector: helpers.LIQUITY_CONNECTOR, + method: "claimStakingGains", + args: [setEthGainId, setLusdGainId], + }; + + // Claim gains + const claimGainsTx = await stakerDsa + .connect(userWallet) + .cast( + ...encodeSpells([claimStakingGainsSpell]), + userWallet.address + ); + + const receipt = await claimGainsTx.wait(); + + const castLogEvent = receipt.events.find((e) => e.event === "LogCast") + .args; + const expectedEventParams = ethers.utils.defaultAbiCoder.encode( + ["address", "uint256", "uint256", "uint256", "uint256"], + [stakerDsa.address, ethGain, lusdGain, setEthGainId, setLusdGainId] + ); + expect(castLogEvent.eventNames[0]).eq( + "LogClaimStakingGains(address,uint256,uint256,uint256,uint256)" + ); + expect(castLogEvent.eventParams[0]).eq(expectedEventParams); + }); + }); + }); + }); +}); diff --git a/test/mainnet/pooltogether/pooltogether.test.ts b/test/mainnet/pooltogether/pooltogether.test.ts index 272f4460..48644259 100644 --- a/test/mainnet/pooltogether/pooltogether.test.ts +++ b/test/mainnet/pooltogether/pooltogether.test.ts @@ -1,1225 +1,1225 @@ -// import { expect } from "chai"; -// import hre from "hardhat"; -// const { web3, deployments, waffle, ethers } = hre; -// const { provider, deployContract } = waffle; - -// import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; -// import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; -// import { encodeSpells } from "../../../scripts/tests/encodeSpells"; -// import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; - -// import { addresses } from "../../../scripts/constant/addresses"; -// import { abis } from "../../../scripts/constant/abis"; -// import { constants } from "../../../scripts/constant/constant"; -// import { tokens } from "../../../scripts/constant/tokens"; -// import type { Signer, Contract } from "ethers"; - -// import { -// ConnectV2Compound__factory, -// ConnectV2PoolTogether__factory, -// ConnectV2UniswapV2__factory, -// } from "../../../typechain"; - -// const DAI_TOKEN_ADDR = tokens.dai.address; // DAI Token - -// // PoolTogether Address: https://docs.pooltogether.com/resources/networks/ethereum -// const DAI_PRIZE_POOL_ADDR = "0xEBfb47A7ad0FD6e57323C8A42B2E5A6a4F68fc1a"; // DAI Prize Pool -// const PT_DAI_TICKET_ADDR = "0x334cBb5858417Aee161B53Ee0D5349cCF54514CF"; // PT DAI Ticket -// const DAI_POOL_FAUCET_ADDR = "0xF362ce295F2A4eaE4348fFC8cDBCe8d729ccb8Eb"; // DAI POOL Faucet -// const POOL_TOKEN_ADDRESS = "0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e"; // POOL Tocken -// const TOKEN_FAUCET_PROXY_FACTORY_ADDR = -// "0xE4E9cDB3E139D7E8a41172C20b6Ed17b6750f117"; // TokenFaucetProxyFactory for claimAll -// const DAI_POD_ADDR = "0x2f994e2E4F3395649eeE8A89092e63Ca526dA829"; // DAI Pod -// const UNISWAP_POOLETHLP_PRIZE_POOL_ADDR = -// "0x3AF7072D29Adde20FC7e173a7CB9e45307d2FB0A"; // Uniswap Pool/ETH LP PrizePool -// const UNISWAP_POOLETHLP_FAUCET_ADDR = -// "0x9A29401EF1856b669f55Ae5b24505b3B6fAEb370"; // Uniswap Pool/ETH LP Faucet -// const UNISWAP_POOLETHLP_TOKEN_ADDR = -// "0x85cb0bab616fe88a89a35080516a8928f38b518b"; // Uniswap Pool/ETH Token -// const PT_UNISWAP_POOLETHLP_TICKET_ADDR = -// "0xeb8928ee92efb06c44d072a24c2bcb993b61e543"; // Pool Together Uniswap Pool/ETH LP Ticket -// const POOL_PRIZE_POOL_ADDR = "0x396b4489da692788e327e2e4b2b0459a5ef26791"; // POOL Prize Pool -// const PT_POOL_TICKET_ADDR = "0x27d22a7648e955e510a40bdb058333e9190d12d4"; // Pool Together POOL Ticket -// const WETH_ADDR = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; // WETH -// const DAI_POD_TOKEN_DROP = "0xc5209623E3dFdf9C0cCbe497c8012883C4147731"; - -// // Community WETH Prize Pool (Rari): https://reference-app.pooltogether.com/pools/mainnet/0xa88ca010b32a54d446fc38091ddbca55750cbfc3/manage#stats -// const WETH_PRIZE_POOL_ADDR = "0xa88ca010b32a54d446fc38091ddbca55750cbfc3"; // Community WETH Prize Pool (Rari) -// const WETH_POOL_TICKET_ADDR = "0x9b5c30aeb9ce2a6a121cea9a85bc0d662f6d9b40"; // Community WETH Prize Pool Ticket (Rari) - -// const prizePoolABI = [ -// "function calculateEarlyExitFee( address from, address controlledToken, uint256 amount) external returns ( uint256 exitFee, uint256 burnedCredit)", -// ]; - -// const podABI = [ -// "function getEarlyExitFee(uint256 amount) external returns (uint256)", -// "function balanceOfUnderlying(address user) external view returns (uint256 amount)", -// "function drop() public returns (uint256)", -// "function balanceOf(address account) external view returns (uint256)", -// ]; - -// const POD_FACTORY_ADDRESS = "0x4e3a9f9fbafb2ec49727cffa2a411f7a0c1c4ce1"; -// const podFactoryABI = [ -// "function create( address _prizePool, address _ticket, address _faucet, address _manager, uint8 _decimals) external returns (address pod)", -// ]; - -// const tokenDropABI = [ -// "function claim(address user) external returns (uint256)", -// ]; - -// describe("PoolTogether", function() { -// const connectorName = "COMPOUND-TEST-A"; -// const uniswapConnectorName = "UNISWAP-TEST-A"; -// const ptConnectorName = "POOLTOGETHER-TEST-A"; - -// let dsaWallet0: any; -// let masterSigner: Signer; -// let instaConnectorsV2: Contract; -// let connector: any; -// let ptConnector: any; -// let uniswapConnector: any; - -// const wallets = provider.getWallets(); -// const [wallet0, wallet1, wallet2, wallet3] = wallets; -// before(async () => { -// masterSigner = await getMasterSigner(); -// instaConnectorsV2 = await ethers.getContractAt( -// abis.core.connectorsV2, -// addresses.core.connectorsV2 -// ); - -// // Deploy and enable Compound Connector -// connector = await deployAndEnableConnector({ -// connectorName, -// contractArtifact: ConnectV2Compound__factory, -// signer: masterSigner, -// connectors: instaConnectorsV2, -// }); - -// // Deploy and enable Pool Together Connector -// ptConnector = await deployAndEnableConnector({ -// connectorName: ptConnectorName, -// contractArtifact: ConnectV2PoolTogether__factory, -// signer: masterSigner, -// connectors: instaConnectorsV2, -// }); - -// // Deploy and enable Uniswap Connector -// uniswapConnector = await deployAndEnableConnector({ -// connectorName: uniswapConnectorName, -// contractArtifact: ConnectV2UniswapV2__factory, -// signer: masterSigner, -// connectors: instaConnectorsV2, -// }); -// }); - -// it("Should have contracts deployed.", async function() { -// expect(!!instaConnectorsV2.address).to.be.true; -// expect(!!connector.address).to.be.true; -// expect(!!ptConnector.address).to.be.true; -// expect(!!uniswapConnector.address).to.be.true; -// expect(!!(await masterSigner.getAddress())).to.be.true; -// }); - -// describe("DSA wallet setup", function() { -// it("Should build DSA v2", async function() { -// dsaWallet0 = await buildDSAv2(wallet0.address); -// expect(!!dsaWallet0.address).to.be.true; -// }); - -// it("Deposit 10 ETH into DSA wallet", async function() { -// await wallet0.sendTransaction({ -// to: dsaWallet0.address, -// value: ethers.utils.parseEther("10"), -// }); -// expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte( -// ethers.utils.parseEther("10") -// ); -// }); -// }); - -// describe("Main - DAI Prize Pool Test", function() { -// it("Should deposit 1 ETH in Compound", async function() { -// const amount = ethers.utils.parseEther("1"); // 1 ETH -// const spells = [ -// { -// connector: connectorName, -// method: "deposit", -// args: ["ETH-A", amount, 0, 0], -// }, -// ]; - -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(spells), wallet1.address); -// const receipt = await tx.wait(); -// expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( -// ethers.utils.parseEther("9") -// ); -// }); - -// it("Should borrow 100 DAI from Compound and deposit DAI into DAI Prize Pool", async function() { -// const amount = ethers.utils.parseEther("100"); // 100 DAI -// const setId = "83478237"; -// const spells = [ -// { -// connector: connectorName, -// method: "borrow", -// args: ["DAI-A", amount, 0, setId], -// }, -// { -// connector: ptConnectorName, -// method: "depositTo", -// args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, setId, 0], -// }, -// ]; -// // Before Spell -// let daiToken = await ethers.getContractAt( -// abis.basic.erc20, -// DAI_TOKEN_ADDR -// ); -// let daiBalance = await daiToken.balanceOf(dsaWallet0.address); -// expect(daiBalance, `DAI balance is 0`).to.be.eq( -// ethers.utils.parseEther("0") -// ); - -// let cToken = await ethers.getContractAt( -// abis.basic.erc20, -// PT_DAI_TICKET_ADDR -// ); -// const balance = await cToken.balanceOf(dsaWallet0.address); -// expect(balance, `PoolTogether DAI Ticket balance is 0`).to.be.eq(0); - -// // Run spell transaction -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(spells), wallet1.address); -// const receipt = await tx.wait(); - -// // After spell -// daiBalance = await daiToken.balanceOf(dsaWallet0.address); -// expect( -// daiBalance, -// `Expect DAI balance to still equal 0 since it was deposited into Prize Pool` -// ).to.be.eq(0); - -// const balanceAfter = await cToken.balanceOf(dsaWallet0.address); -// expect( -// balanceAfter, -// `PoolTogether DAI Ticket balance equals 100` -// ).to.be.eq(ethers.utils.parseEther("100")); - -// // ETH used for transaction -// expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( -// ethers.utils.parseEther("9") -// ); -// }); - -// it("Should wait 11 days, withdraw all PrizePool, get back 100 DAI, and claim POOL", async function() { -// const amount = ethers.utils.parseEther("100"); // 100 DAI - -// let prizePoolContract = new ethers.Contract( -// DAI_PRIZE_POOL_ADDR, -// prizePoolABI, -// ethers.provider -// ); -// let earlyExitFee = await prizePoolContract.callStatic[ -// "calculateEarlyExitFee" -// ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); -// expect( -// earlyExitFee.exitFee, -// "Exit Fee equal to 1 DAI because starts at 10%" -// ).to.be.eq(ethers.utils.parseEther("1")); - -// const spells = [ -// { -// connector: ptConnectorName, -// method: "withdrawInstantlyFrom", -// args: [ -// DAI_PRIZE_POOL_ADDR, -// amount, -// PT_DAI_TICKET_ADDR, -// earlyExitFee.exitFee, -// 0, -// 0, -// ], -// }, -// { -// connector: ptConnectorName, -// method: "claim", -// args: [DAI_POOL_FAUCET_ADDR, 0], -// }, -// ]; - -// // Before spell -// let daiToken = await ethers.getContractAt( -// abis.basic.erc20, -// DAI_TOKEN_ADDR -// ); -// let daiBalance = await daiToken.balanceOf(dsaWallet0.address); -// expect(daiBalance, `DAI balance equals 0`).to.be.eq( -// ethers.utils.parseEther("0") -// ); - -// let cToken = await ethers.getContractAt( -// abis.basic.erc20, -// PT_DAI_TICKET_ADDR -// ); -// const balance = await cToken.balanceOf(dsaWallet0.address); -// expect(balance, `PoolTogether Dai Ticket is 100`).to.be.eq( -// ethers.utils.parseEther("100") -// ); - -// let poolToken = await ethers.getContractAt( -// abis.basic.erc20, -// POOL_TOKEN_ADDRESS -// ); -// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalance, `POOL Token equals 0`).to.be.eq( -// ethers.utils.parseEther("0") -// ); - -// // Increase time by 11 days so we get back all DAI without early withdrawal fee -// await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); - -// earlyExitFee = await prizePoolContract.callStatic[ -// "calculateEarlyExitFee" -// ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); -// expect( -// earlyExitFee.exitFee, -// "Exit Fee equal to 0 DAI because past 10 days" -// ).to.be.eq(0); - -// // Run spell transaction -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(spells), wallet1.address); -// const receipt = await tx.wait(); - -// // After spell -// daiBalance = await daiToken.balanceOf(dsaWallet0.address); -// expect( -// daiBalance, -// `DAI balance to be equal to 100, because of no early withdrawal fee` -// ).to.be.eq(ethers.utils.parseEther("100")); - -// const balanceAfter = await cToken.balanceOf(dsaWallet0.address); -// expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); - -// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); -// expect( -// poolBalanceAfter, -// `POOL Token Balance to be greater than 0` -// ).to.be.gt(ethers.utils.parseEther("0")); -// }); - -// it("Should deposit and withdraw all PrizePool, get back less than 100 DAI", async function() { -// const amount = ethers.utils.parseEther("100"); // 100 DAI -// const exitFee = ethers.utils.parseEther("1"); // 1 DAI is 10% of 100 DAI -// const spells = [ -// { -// connector: ptConnectorName, -// method: "depositTo", -// args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0], -// }, -// { -// connector: ptConnectorName, -// method: "withdrawInstantlyFrom", -// args: [ -// DAI_PRIZE_POOL_ADDR, -// amount, -// PT_DAI_TICKET_ADDR, -// exitFee, -// 0, -// 0, -// ], -// }, -// ]; - -// // Before spell -// let daiToken = await ethers.getContractAt( -// abis.basic.erc20, -// DAI_TOKEN_ADDR -// ); -// let daiBalance = await daiToken.balanceOf(dsaWallet0.address); -// expect(daiBalance, `DAI Balance equals 0`).to.be.eq( -// ethers.utils.parseEther("100") -// ); - -// let cToken = await ethers.getContractAt( -// abis.basic.erc20, -// PT_DAI_TICKET_ADDR -// ); -// const balance = await cToken.balanceOf(dsaWallet0.address); -// expect(balance, `PoolTogether DAI Ticket equals 0`).to.be.eq(0); - -// let poolToken = await ethers.getContractAt( -// abis.basic.erc20, -// POOL_TOKEN_ADDRESS -// ); -// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalance, `PoolTogether Token greater than 0`).to.be.gt(0); - -// // Run spell transaction -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(spells), wallet1.address); -// const receipt = await tx.wait(); - -// // After spell -// daiBalance = await daiToken.balanceOf(dsaWallet0.address); -// expect( -// daiBalance, -// `DAI balance to be less than 100, because of early withdrawal fee` -// ).to.be.lt(ethers.utils.parseEther("100")); - -// const balanceAfter = await cToken.balanceOf(dsaWallet0.address); -// expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); - -// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalanceAfter, `POOL Token Balance to greater than 0`).to.be.gt( -// ethers.utils.parseEther("0") -// ); -// }); - -// it("Should deposit, wait 11 days, and withdraw all PrizePool, get 99 DAI, and claim all POOL using claimAll", async function() { -// const amount = ethers.utils.parseEther("99"); // 99 DAI -// const depositSpells = [ -// { -// connector: ptConnectorName, -// method: "depositTo", -// args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0], -// }, -// ]; - -// // Before spell -// let daiToken = await ethers.getContractAt( -// abis.basic.erc20, -// DAI_TOKEN_ADDR -// ); -// let daiBalance = await daiToken.balanceOf(dsaWallet0.address); -// expect(daiBalance, `DAI balance less than 100`).to.be.lt( -// ethers.utils.parseEther("100") -// ); - -// let cToken = await ethers.getContractAt( -// abis.basic.erc20, -// PT_DAI_TICKET_ADDR -// ); -// const balance = await cToken.balanceOf(dsaWallet0.address); -// expect(balance, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); - -// let poolToken = await ethers.getContractAt( -// abis.basic.erc20, -// POOL_TOKEN_ADDRESS -// ); -// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalance, `POOL Token is greater than 0`).to.be.gt( -// ethers.utils.parseEther("0") -// ); - -// // Run spell transaction -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(depositSpells), wallet1.address); -// const receipt = await tx.wait(); - -// const prizePoolContract = new ethers.Contract( -// DAI_PRIZE_POOL_ADDR, -// prizePoolABI, -// ethers.provider -// ); -// let earlyExitFee = await prizePoolContract.callStatic[ -// "calculateEarlyExitFee" -// ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); -// expect( -// earlyExitFee.exitFee, -// "Exit Fee equal to .99 DAI because starts at 10%" -// ).to.be.eq(ethers.utils.parseEther(".99")); - -// // Increase time by 11 days so we get back all DAI without early withdrawal fee -// await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); - -// earlyExitFee = await prizePoolContract.callStatic[ -// "calculateEarlyExitFee" -// ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); -// expect( -// earlyExitFee.exitFee, -// "Exit Fee equal to 0 DAI because past 10 days" -// ).to.be.eq(0); - -// const withdrawSpells = [ -// { -// connector: ptConnectorName, -// method: "withdrawInstantlyFrom", -// args: [ -// DAI_PRIZE_POOL_ADDR, -// amount, -// PT_DAI_TICKET_ADDR, -// earlyExitFee.exitFee, -// 0, -// 0, -// ], -// }, -// { -// connector: ptConnectorName, -// method: "claimAll", -// args: [TOKEN_FAUCET_PROXY_FACTORY_ADDR, [DAI_POOL_FAUCET_ADDR]], -// }, -// ]; - -// // Run spell transaction -// const tx2 = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(withdrawSpells), wallet1.address); -// const receipt2 = await tx2.wait(); - -// // After spell -// daiBalance = await daiToken.balanceOf(dsaWallet0.address); -// expect(daiBalance, `DAI balance equals 99`).to.be.eq( -// ethers.utils.parseEther("99") -// ); - -// const balanceAfter = await cToken.balanceOf(dsaWallet0.address); -// expect(balanceAfter, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); - -// // Expect -// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalanceAfter, `Pool Token to be greateir than 0`).to.be.gt( -// ethers.utils.parseEther("0") -// ); -// }); -// }); - -// describe("Main - DAI Pod Test", function() { -// it("Should deposit 99 DAI in DAI Pod", async function() { -// const amount = ethers.utils.parseEther("99"); // 99 DAI -// const spells = [ -// { -// connector: ptConnectorName, -// method: "depositToPod", -// args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0], -// }, -// ]; - -// // Before spell -// let daiToken = await ethers.getContractAt( -// abis.basic.erc20, -// DAI_TOKEN_ADDR -// ); -// let daiBalance = await daiToken.balanceOf(dsaWallet0.address); -// expect(daiBalance, `DAI balance equals 99`).to.be.eq( -// ethers.utils.parseEther("99") -// ); - -// let poolToken = await ethers.getContractAt( -// abis.basic.erc20, -// POOL_TOKEN_ADDRESS -// ); -// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalance, `POOL Token greater than 0`).to.be.gte(0); - -// let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); -// const podBalance = await podToken.balanceOf(dsaWallet0.address); -// expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); - -// // Run spell transaction -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(spells), wallet1.address); -// const receipt = await tx.wait(); - -// // After spell -// daiBalance = await daiToken.balanceOf(dsaWallet0.address); -// expect(daiBalance, `DAI equals 0`).to.be.eq(0); - -// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalanceAfter, `POOL Token greater than 0`).to.be.gt(0); - -// const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); -// expect(podBalanceAfter, `Pod DAI token greater than 0`).to.be.eq( -// ethers.utils.parseEther("99") -// ); -// }); - -// it("Should claim rewards from pod token drop", async function() { -// const spells = [ -// { -// connector: ptConnectorName, -// method: "claimPodTokenDrop", -// args: [DAI_POD_TOKEN_DROP, 0], -// }, -// ]; - -// const tokenDropContract = new ethers.Contract( -// DAI_POD_TOKEN_DROP, -// tokenDropABI, -// ethers.provider -// ); -// const podContract = new ethers.Contract( -// DAI_POD_ADDR, -// podABI, -// masterSigner -// ); - -// // drop(): Claim TokenDrop asset for PrizePool Pod and transfers token(s) to external Pod TokenDrop -// // dropt() also calls batch which, Deposit Pod float into PrizePool. Deposits the current float -// // amount into the PrizePool and claims current POOL rewards. -// const dropTx = await podContract.drop(); -// await dropTx.wait(); - -// // POOL Rewards able to claim from Pod Token Drop -// let claimAmount = await tokenDropContract.callStatic["claim"]( -// dsaWallet0.address -// ); - -// // Before spell -// let poolToken = await ethers.getContractAt( -// abis.basic.erc20, -// POOL_TOKEN_ADDRESS -// ); -// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - -// // Run spell transaction -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(spells), wallet1.address); -// const receipt = await tx.wait(); - -// // After spell -// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); -// const total = claimAmount.add(poolBalance); -// expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq( -// total -// ); -// }); - -// it("Should wait 11 days, withdraw all podTokens, get back 99 DAI", async function() { -// const amount = ethers.utils.parseEther("99"); // 99 DAI - -// const podContract = new ethers.Contract( -// DAI_POD_ADDR, -// podABI, -// ethers.provider -// ); -// let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); -// // maxFee depends on if token has been deposited to PrizePool yet -// // since we called drop in previous test case, the tokens were deposited to PrizePool -// expect( -// maxFee, -// "Exit Fee equal to .99 DAI because token still in float" -// ).to.be.eq(ethers.utils.parseEther(".99")); - -// const spells = [ -// { -// connector: ptConnectorName, -// method: "withdrawFromPod", -// args: [DAI_POD_ADDR, amount, maxFee, 0, 0], -// }, -// ]; - -// // Before spell -// let daiToken = await ethers.getContractAt( -// abis.basic.erc20, -// DAI_TOKEN_ADDR -// ); -// let daiBalance = await daiToken.balanceOf(dsaWallet0.address); -// expect(daiBalance, `DAI Balance equals 0`).to.be.eq(0); - -// let poolToken = await ethers.getContractAt( -// abis.basic.erc20, -// POOL_TOKEN_ADDRESS -// ); -// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalance, `POOL Token balance greater than 0`).to.be.gt(0); - -// let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); -// const podBalance = await podToken.balanceOf(dsaWallet0.address); -// expect(podBalance, `Pod DAI Token equals 99`).to.be.eq( -// ethers.utils.parseEther("99") -// ); - -// // Increase time by 11 days so we get back all DAI without early withdrawal fee -// await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); - -// // Run spell transaction -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(spells), wallet1.address); -// const receipt = await tx.wait(); - -// // After spell -// daiBalance = await daiToken.balanceOf(dsaWallet0.address); -// expect( -// daiBalance, -// `DAI balance equals 99, because of no early withdrawal fee` -// ).to.be.eq(ethers.utils.parseEther("99")); - -// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalanceAfter, `POOL Token to be greater than 0`).to.be.gt(0); - -// const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); -// expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq(0); -// }); - -// it("Should deposit and withdraw from pod, get back same amount of 99 DAI", async function() { -// const amount = ethers.utils.parseEther("99"); -// const maxFee = 0; // maxFee 0 since it doesn't give chance for Pod to actually deposit into PrizePool - -// const spells = [ -// { -// connector: ptConnectorName, -// method: "depositToPod", -// args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0], -// }, -// { -// connector: ptConnectorName, -// method: "withdrawFromPod", -// args: [DAI_POD_ADDR, amount, maxFee, 0, 0], -// }, -// ]; - -// // Before spell -// let daiToken = await ethers.getContractAt( -// abis.basic.erc20, -// DAI_TOKEN_ADDR -// ); -// let daiBalance = await daiToken.balanceOf(dsaWallet0.address); -// expect(daiBalance, `DAI equals 99`).to.be.eq( -// ethers.utils.parseEther("99") -// ); - -// let poolToken = await ethers.getContractAt( -// abis.basic.erc20, -// POOL_TOKEN_ADDRESS -// ); -// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - -// // PodToken is 0 -// let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); -// const podBalance = await podToken.balanceOf(dsaWallet0.address); -// expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); - -// // Run spell transaction -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(spells), wallet1.address); -// const receipt = await tx.wait(); - -// // After spell -// daiBalance = await daiToken.balanceOf(dsaWallet0.address); -// expect( -// daiBalance, -// `DAI balance to be equal to 99, because funds still in 'float` -// ).to.be.eq(ethers.utils.parseEther("99")); - -// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq( -// poolBalance -// ); - -// // Expect Pod Token Balance to equal 0 -// const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); -// expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq( -// ethers.utils.parseEther("0") -// ); -// }); -// }); - -// describe("Main - UNISWAP POOL/ETH Prize Pool Test", function() { -// it("Should use uniswap to swap ETH for POOL, deposit to POOL/ETH LP, deposit POOL/ETH LP to PrizePool", async function() { -// const amount = ethers.utils.parseEther("100"); // 100 POOL -// const slippage = ethers.utils.parseEther("0.03"); -// const setId = "83478237"; - -// const UniswapV2Router02ABI = [ -// "function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts)", -// ]; - -// // Get amount of ETH for 100 POOL from Uniswap -// const UniswapV2Router02 = await ethers.getContractAt( -// UniswapV2Router02ABI, -// "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D" -// ); -// const amounts = await UniswapV2Router02.getAmountsOut(amount, [ -// POOL_TOKEN_ADDRESS, -// WETH_ADDR, -// ]); -// const unitAmount = ethers.utils.parseEther( -// ((amounts[1] * 1.03) / amounts[0]).toString() -// ); - -// const spells = [ -// { -// connector: uniswapConnectorName, -// method: "buy", -// args: [ -// POOL_TOKEN_ADDRESS, -// tokens.eth.address, -// amount, -// unitAmount, -// 0, -// setId, -// ], -// }, -// { -// connector: uniswapConnectorName, -// method: "deposit", -// args: [ -// POOL_TOKEN_ADDRESS, -// tokens.eth.address, -// amount, -// unitAmount, -// slippage, -// 0, -// setId, -// ], -// }, -// { -// connector: ptConnectorName, -// method: "depositTo", -// args: [ -// UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, -// 0, -// PT_UNISWAP_POOLETHLP_TICKET_ADDR, -// setId, -// 0, -// ], -// }, -// ]; - -// // Before Spell -// let ethBalance = await ethers.provider.getBalance(dsaWallet0.address); -// expect(ethBalance, `ETH Balance equals 9`).to.be.eq( -// ethers.utils.parseEther("9") -// ); - -// let poolToken = await ethers.getContractAt( -// abis.basic.erc20, -// POOL_TOKEN_ADDRESS -// ); -// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalance, `POOL Token greater than 0`).to.be.gte(0); - -// let uniswapLPToken = await ethers.getContractAt( -// abis.basic.erc20, -// UNISWAP_POOLETHLP_TOKEN_ADDR -// ); -// const uniswapPoolEthBalance = await uniswapLPToken.balanceOf( -// dsaWallet0.address -// ); -// expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); - -// let ptUniswapPoolEthToken = await ethers.getContractAt( -// abis.basic.erc20, -// PT_UNISWAP_POOLETHLP_TICKET_ADDR -// ); -// const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf( -// dsaWallet0.address -// ); -// expect( -// ptUniswapPoolEthBalance, -// `PoolTogether Uniswap POOL?ETH LP equals 0` -// ).to.be.eq(0); - -// // Run spell transaction -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(spells), wallet1.address); -// const receipt = await tx.wait(); - -// // After spell -// ethBalance = await ethers.provider.getBalance(dsaWallet0.address); -// expect(ethBalance, `ETH Balance less than 9`).to.be.lt( -// ethers.utils.parseEther("9") -// ); - -// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalanceAfter, `POOL Token to be same after spell`).to.be.eq( -// poolBalance -// ); - -// const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf( -// dsaWallet0.address -// ); -// expect( -// uniswapPoolEthBalanceAfter, -// `Uniswap POOL/ETH LP equals 0` -// ).to.be.eq(0); - -// const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf( -// dsaWallet0.address -// ); -// expect( -// ptUniswapPoolEthBalanceAfter, -// `PT Uniswap POOL/ETH LP to greater than 0` -// ).to.be.gt(0); -// }); - -// it("Should withdraw all PrizePool, get back Uniswap LP, claim POOL, deposit claimed POOL into Pool PrizePool", async function() { -// let ptUniswapPoolEthToken = await ethers.getContractAt( -// abis.basic.erc20, -// PT_UNISWAP_POOLETHLP_TICKET_ADDR -// ); -// const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf( -// dsaWallet0.address -// ); -// const setId = "83478237"; - -// let uniswapPrizePoolContract = new ethers.Contract( -// UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, -// prizePoolABI, -// ethers.provider -// ); -// let earlyExitFee = await uniswapPrizePoolContract.callStatic[ -// "calculateEarlyExitFee" -// ]( -// dsaWallet0.address, -// PT_UNISWAP_POOLETHLP_TICKET_ADDR, -// ptUniswapPoolEthBalance -// ); -// expect( -// earlyExitFee.exitFee, -// "Exit Fee equals 0 because no early exit fee for this prize pool" -// ).to.be.eq(0); - -// const spells = [ -// { -// connector: ptConnectorName, -// method: "withdrawInstantlyFrom", -// args: [ -// UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, -// ptUniswapPoolEthBalance, -// PT_UNISWAP_POOLETHLP_TICKET_ADDR, -// earlyExitFee.exitFee, -// 0, -// 0, -// ], -// }, -// { -// connector: ptConnectorName, -// method: "claim", -// args: [UNISWAP_POOLETHLP_FAUCET_ADDR, setId], -// }, -// { -// connector: ptConnectorName, -// method: "depositTo", -// args: [POOL_PRIZE_POOL_ADDR, 0, PT_POOL_TICKET_ADDR, setId, 0], -// }, -// ]; - -// // Before spell -// let poolToken = await ethers.getContractAt( -// abis.basic.erc20, -// POOL_TOKEN_ADDRESS -// ); -// const poolBalance = await poolToken.balanceOf(dsaWallet0.address); -// expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); - -// // Uniswap POOL/ETH LP is 0 -// let uniswapLPToken = await ethers.getContractAt( -// abis.basic.erc20, -// UNISWAP_POOLETHLP_TOKEN_ADDR -// ); -// const uniswapPoolEthBalance = await uniswapLPToken.balanceOf( -// dsaWallet0.address -// ); -// expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); - -// expect( -// ptUniswapPoolEthBalance, -// `PT Uniswap POOL/ETH LP greater than 0` -// ).to.be.gt(0); - -// let poolPoolTicket = await ethers.getContractAt( -// abis.basic.erc20, -// PT_POOL_TICKET_ADDR -// ); -// const poolPoolTicketBalance = await poolPoolTicket.balanceOf( -// dsaWallet0.address -// ); -// expect( -// poolPoolTicketBalance, -// `PoolTogether POOL Ticket equals 0` -// ).to.be.eq(0); - -// // Run spell transaction -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(spells), wallet1.address); -// const receipt = await tx.wait(); - -// // After spell -// const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); -// expect( -// poolBalanceAfter, -// `Pool Token Balance equal to balance before spell` -// ).to.be.eq(poolBalance); - -// const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf( -// dsaWallet0.address -// ); -// expect( -// uniswapPoolEthBalanceAfter, -// `Uniswap POOL/ETH LP to greater than 0` -// ).to.be.gt(0); - -// const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf( -// dsaWallet0.address -// ); -// expect( -// ptUniswapPoolEthBalanceAfter, -// `PT Uniswap POOL/ETH LP equal 0` -// ).to.be.eq(0); - -// const poolPoolTicketBalanceAfter = await poolPoolTicket.balanceOf( -// dsaWallet0.address -// ); -// expect( -// poolPoolTicketBalanceAfter, -// `PoolTogether POOL Ticket greater than 0` -// ).to.be.gt(0); -// }); -// }); - -// describe("Main - WETH Prize Pool Test", function() { -// it("Deposit 1 ETH into WETH Prize Pool and withdraw immediately", async function() { -// const amount = ethers.utils.parseEther("1"); // 1 ETH -// const setId = "83478237"; -// const spells = [ -// { -// connector: ptConnectorName, -// method: "depositTo", -// args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, setId], -// }, -// { -// connector: ptConnectorName, -// method: "withdrawInstantlyFrom", -// args: [ -// WETH_PRIZE_POOL_ADDR, -// amount, -// WETH_POOL_TICKET_ADDR, -// amount, -// setId, -// 0, -// ], -// }, -// ]; -// // Before Spell -// const ethBalanceBefore = await ethers.provider.getBalance( -// dsaWallet0.address -// ); - -// // Run spell transaction -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(spells), wallet1.address); -// const receipt = await tx.wait(); - -// // After spell -// const ethBalanceAfter = await ethers.provider.getBalance( -// dsaWallet0.address -// ); - -// // ETH used for transaction -// expect( -// ethBalanceAfter, -// `ETH Balance less than before spell because of early withdrawal fee` -// ).to.be.lte(ethBalanceBefore); -// }); - -// it("Deposit 1 ETH into WETH Prize Pool, wait 14 days, then withdraw", async function() { -// const amount = ethers.utils.parseEther("1"); // 1 ETH -// const depositSpell = [ -// { -// connector: ptConnectorName, -// method: "depositTo", -// args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, 0], -// }, -// ]; - -// const withdrawSpell = [ -// { -// connector: ptConnectorName, -// method: "withdrawInstantlyFrom", -// args: [ -// WETH_PRIZE_POOL_ADDR, -// amount, -// WETH_POOL_TICKET_ADDR, -// amount, -// 0, -// 0, -// ], -// }, -// ]; - -// // Before Deposit Spell -// let ethBalanceBefore = await ethers.provider.getBalance( -// dsaWallet0.address -// ); - -// // Run deposit spell transaction -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(depositSpell), wallet1.address); -// const receipt = await tx.wait(); - -// // After Deposit spell -// let ethBalanceAfter = await ethers.provider.getBalance( -// dsaWallet0.address -// ); - -// expect(ethBalanceAfter, `ETH Balance less than before spell`).to.be.lte( -// ethBalanceBefore -// ); - -// // Increase time by 11 days so we get back all ETH without early withdrawal fee -// await ethers.provider.send("evm_increaseTime", [14 * 24 * 60 * 60]); - -// // Run withdraw spell transaction -// const tx2 = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(withdrawSpell), wallet1.address); -// const receipt2 = await tx.wait(); - -// // After Deposit spell -// ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); - -// expect( -// ethBalanceAfter, -// `ETH Balance equal to before spell because no early exit fee` -// ).to.be.eq(ethBalanceBefore); -// }); -// }); - -// describe("Main - WETH Pod Test", function() { -// let podAddress: string; -// it("Should deposit 1 ETH in WETH Pod and get Pod Ticket", async function() { -// const amount = ethers.utils.parseEther("1"); - -// // Create Pod for WETH Prize Pool (Rari) -// const podFactoryContract = new ethers.Contract( -// POD_FACTORY_ADDRESS, -// podFactoryABI, -// masterSigner -// ); -// podAddress = await podFactoryContract.callStatic.create( -// WETH_PRIZE_POOL_ADDR, -// WETH_POOL_TICKET_ADDR, -// constants.address_zero, -// wallet0.address, -// 18 -// ); -// await podFactoryContract.create( -// WETH_PRIZE_POOL_ADDR, -// WETH_POOL_TICKET_ADDR, -// constants.address_zero, -// wallet0.address, -// 18 -// ); - -// const spells = [ -// { -// connector: ptConnectorName, -// method: "depositToPod", -// args: [WETH_ADDR, podAddress, amount, 0, 0], -// }, -// ]; - -// // Before Deposit Spell -// const podContract = new ethers.Contract( -// podAddress, -// podABI, -// ethers.provider -// ); -// let podBalanceBefore = await podContract.balanceOfUnderlying( -// dsaWallet0.address -// ); -// expect(podBalanceBefore, `Pod balance equal to 0`).to.be.eq(0); - -// let ethBalanceBefore = await ethers.provider.getBalance( -// dsaWallet0.address -// ); - -// // Run spell transaction -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(spells), wallet1.address); -// const receipt = await tx.wait(); - -// // After Deposit spell -// let ethBalanceAfter = await ethers.provider.getBalance( -// dsaWallet0.address -// ); -// expect(ethBalanceAfter, `ETH balance less than before`).to.be.lt( -// ethBalanceBefore -// ); - -// let podBalanceAfter = await podContract.balanceOfUnderlying( -// dsaWallet0.address -// ); -// expect(podBalanceAfter, `Pod balance equal to 1`).to.be.eq( -// ethers.utils.parseEther("1") -// ); -// }); - -// it("Should withdraw 1 Ticket from WETH Pod and get back ETH", async function() { -// const amount = ethers.utils.parseEther("1"); - -// const podContract = new ethers.Contract( -// podAddress, -// podABI, -// ethers.provider -// ); -// let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); -// expect( -// maxFee, -// "Exit Fee equal to 0 DAI because token still in float" -// ).to.be.eq(0); -// // maxFee depends on if token has been deposited to PrizePool yet - -// const spells = [ -// { -// connector: ptConnectorName, -// method: "withdrawFromPod", -// args: [podAddress, amount, maxFee, 0, 0], -// }, -// ]; - -// // Before Deposit Spell -// let podBalanceBefore = await podContract.balanceOfUnderlying( -// dsaWallet0.address -// ); -// expect(podBalanceBefore, `Pod balance equal to 1`).to.be.eq( -// ethers.utils.parseEther("1") -// ); - -// let ethBalanceBefore = await ethers.provider.getBalance( -// dsaWallet0.address -// ); - -// // Run spell transaction -// const tx = await dsaWallet0 -// .connect(wallet0) -// .cast(...encodeSpells(spells), wallet1.address); -// const receipt = await tx.wait(); - -// // After Deposit spell -// let ethBalanceAfter = await ethers.provider.getBalance( -// dsaWallet0.address -// ); -// expect(ethBalanceAfter, `ETH balance greater than before`).to.be.gt( -// ethBalanceBefore -// ); - -// let podBalanceAfter = await podContract.balanceOfUnderlying( -// dsaWallet0.address -// ); -// expect(podBalanceAfter, `Pod balance equal to 0`).to.be.eq( -// ethers.utils.parseEther("0") -// ); -// }); -// }); -// }); +import { expect } from "chai"; +import hre from "hardhat"; +const { web3, deployments, waffle, ethers } = hre; +const { provider, deployContract } = waffle; + +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; +import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; +import { encodeSpells } from "../../../scripts/tests/encodeSpells"; +import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; + +import { addresses } from "../../../scripts/constant/addresses"; +import { abis } from "../../../scripts/constant/abis"; +import { constants } from "../../../scripts/constant/constant"; +import { tokens } from "../../../scripts/constant/tokens"; +import type { Signer, Contract } from "ethers"; + +import { + ConnectV2Compound__factory, + ConnectV2PoolTogether__factory, + ConnectV2UniswapV2__factory, +} from "../../../typechain"; + +const DAI_TOKEN_ADDR = tokens.dai.address; // DAI Token + +// PoolTogether Address: https://docs.pooltogether.com/resources/networks/ethereum +const DAI_PRIZE_POOL_ADDR = "0xEBfb47A7ad0FD6e57323C8A42B2E5A6a4F68fc1a"; // DAI Prize Pool +const PT_DAI_TICKET_ADDR = "0x334cBb5858417Aee161B53Ee0D5349cCF54514CF"; // PT DAI Ticket +const DAI_POOL_FAUCET_ADDR = "0xF362ce295F2A4eaE4348fFC8cDBCe8d729ccb8Eb"; // DAI POOL Faucet +const POOL_TOKEN_ADDRESS = "0x0cEC1A9154Ff802e7934Fc916Ed7Ca50bDE6844e"; // POOL Tocken +const TOKEN_FAUCET_PROXY_FACTORY_ADDR = + "0xE4E9cDB3E139D7E8a41172C20b6Ed17b6750f117"; // TokenFaucetProxyFactory for claimAll +const DAI_POD_ADDR = "0x2f994e2E4F3395649eeE8A89092e63Ca526dA829"; // DAI Pod +const UNISWAP_POOLETHLP_PRIZE_POOL_ADDR = + "0x3AF7072D29Adde20FC7e173a7CB9e45307d2FB0A"; // Uniswap Pool/ETH LP PrizePool +const UNISWAP_POOLETHLP_FAUCET_ADDR = + "0x9A29401EF1856b669f55Ae5b24505b3B6fAEb370"; // Uniswap Pool/ETH LP Faucet +const UNISWAP_POOLETHLP_TOKEN_ADDR = + "0x85cb0bab616fe88a89a35080516a8928f38b518b"; // Uniswap Pool/ETH Token +const PT_UNISWAP_POOLETHLP_TICKET_ADDR = + "0xeb8928ee92efb06c44d072a24c2bcb993b61e543"; // Pool Together Uniswap Pool/ETH LP Ticket +const POOL_PRIZE_POOL_ADDR = "0x396b4489da692788e327e2e4b2b0459a5ef26791"; // POOL Prize Pool +const PT_POOL_TICKET_ADDR = "0x27d22a7648e955e510a40bdb058333e9190d12d4"; // Pool Together POOL Ticket +const WETH_ADDR = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; // WETH +const DAI_POD_TOKEN_DROP = "0xc5209623E3dFdf9C0cCbe497c8012883C4147731"; + +// Community WETH Prize Pool (Rari): https://reference-app.pooltogether.com/pools/mainnet/0xa88ca010b32a54d446fc38091ddbca55750cbfc3/manage#stats +const WETH_PRIZE_POOL_ADDR = "0xa88ca010b32a54d446fc38091ddbca55750cbfc3"; // Community WETH Prize Pool (Rari) +const WETH_POOL_TICKET_ADDR = "0x9b5c30aeb9ce2a6a121cea9a85bc0d662f6d9b40"; // Community WETH Prize Pool Ticket (Rari) + +const prizePoolABI = [ + "function calculateEarlyExitFee( address from, address controlledToken, uint256 amount) external returns ( uint256 exitFee, uint256 burnedCredit)", +]; + +const podABI = [ + "function getEarlyExitFee(uint256 amount) external returns (uint256)", + "function balanceOfUnderlying(address user) external view returns (uint256 amount)", + "function drop() public returns (uint256)", + "function balanceOf(address account) external view returns (uint256)", +]; + +const POD_FACTORY_ADDRESS = "0x4e3a9f9fbafb2ec49727cffa2a411f7a0c1c4ce1"; +const podFactoryABI = [ + "function create( address _prizePool, address _ticket, address _faucet, address _manager, uint8 _decimals) external returns (address pod)", +]; + +const tokenDropABI = [ + "function claim(address user) external returns (uint256)", +]; + +describe("PoolTogether", function() { + const connectorName = "COMPOUND-TEST-A"; + const uniswapConnectorName = "UNISWAP-TEST-A"; + const ptConnectorName = "POOLTOGETHER-TEST-A"; + + let dsaWallet0: any; + let masterSigner: Signer; + let instaConnectorsV2: Contract; + let connector: any; + let ptConnector: any; + let uniswapConnector: any; + + const wallets = provider.getWallets(); + const [wallet0, wallet1, wallet2, wallet3] = wallets; + before(async () => { + masterSigner = await getMasterSigner(); + instaConnectorsV2 = await ethers.getContractAt( + abis.core.connectorsV2, + addresses.core.connectorsV2 + ); + + // Deploy and enable Compound Connector + connector = await deployAndEnableConnector({ + connectorName, + contractArtifact: ConnectV2Compound__factory, + signer: masterSigner, + connectors: instaConnectorsV2, + }); + + // Deploy and enable Pool Together Connector + ptConnector = await deployAndEnableConnector({ + connectorName: ptConnectorName, + contractArtifact: ConnectV2PoolTogether__factory, + signer: masterSigner, + connectors: instaConnectorsV2, + }); + + // Deploy and enable Uniswap Connector + uniswapConnector = await deployAndEnableConnector({ + connectorName: uniswapConnectorName, + contractArtifact: ConnectV2UniswapV2__factory, + signer: masterSigner, + connectors: instaConnectorsV2, + }); + }); + + it("Should have contracts deployed.", async function() { + expect(!!instaConnectorsV2.address).to.be.true; + expect(!!connector.address).to.be.true; + expect(!!ptConnector.address).to.be.true; + expect(!!uniswapConnector.address).to.be.true; + expect(!!(await masterSigner.getAddress())).to.be.true; + }); + + describe("DSA wallet setup", function() { + it("Should build DSA v2", async function() { + dsaWallet0 = await buildDSAv2(wallet0.address); + expect(!!dsaWallet0.address).to.be.true; + }); + + it("Deposit 10 ETH into DSA wallet", async function() { + await wallet0.sendTransaction({ + to: dsaWallet0.address, + value: ethers.utils.parseEther("10"), + }); + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte( + ethers.utils.parseEther("10") + ); + }); + }); + + describe("Main - DAI Prize Pool Test", function() { + it("Should deposit 1 ETH in Compound", async function() { + const amount = ethers.utils.parseEther("1"); // 1 ETH + const spells = [ + { + connector: connectorName, + method: "deposit", + args: ["ETH-A", amount, 0, 0], + }, + ]; + + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( + ethers.utils.parseEther("9") + ); + }); + + it("Should borrow 100 DAI from Compound and deposit DAI into DAI Prize Pool", async function() { + const amount = ethers.utils.parseEther("100"); // 100 DAI + const setId = "83478237"; + const spells = [ + { + connector: connectorName, + method: "borrow", + args: ["DAI-A", amount, 0, setId], + }, + { + connector: ptConnectorName, + method: "depositTo", + args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, setId, 0], + }, + ]; + // Before Spell + let daiToken = await ethers.getContractAt( + abis.basic.erc20, + DAI_TOKEN_ADDR + ); + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance is 0`).to.be.eq( + ethers.utils.parseEther("0") + ); + + let cToken = await ethers.getContractAt( + abis.basic.erc20, + PT_DAI_TICKET_ADDR + ); + const balance = await cToken.balanceOf(dsaWallet0.address); + expect(balance, `PoolTogether DAI Ticket balance is 0`).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect( + daiBalance, + `Expect DAI balance to still equal 0 since it was deposited into Prize Pool` + ).to.be.eq(0); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address); + expect( + balanceAfter, + `PoolTogether DAI Ticket balance equals 100` + ).to.be.eq(ethers.utils.parseEther("100")); + + // ETH used for transaction + expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( + ethers.utils.parseEther("9") + ); + }); + + it("Should wait 11 days, withdraw all PrizePool, get back 100 DAI, and claim POOL", async function() { + const amount = ethers.utils.parseEther("100"); // 100 DAI + + let prizePoolContract = new ethers.Contract( + DAI_PRIZE_POOL_ADDR, + prizePoolABI, + ethers.provider + ); + let earlyExitFee = await prizePoolContract.callStatic[ + "calculateEarlyExitFee" + ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); + expect( + earlyExitFee.exitFee, + "Exit Fee equal to 1 DAI because starts at 10%" + ).to.be.eq(ethers.utils.parseEther("1")); + + const spells = [ + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + DAI_PRIZE_POOL_ADDR, + amount, + PT_DAI_TICKET_ADDR, + earlyExitFee.exitFee, + 0, + 0, + ], + }, + { + connector: ptConnectorName, + method: "claim", + args: [DAI_POOL_FAUCET_ADDR, 0], + }, + ]; + + // Before spell + let daiToken = await ethers.getContractAt( + abis.basic.erc20, + DAI_TOKEN_ADDR + ); + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance equals 0`).to.be.eq( + ethers.utils.parseEther("0") + ); + + let cToken = await ethers.getContractAt( + abis.basic.erc20, + PT_DAI_TICKET_ADDR + ); + const balance = await cToken.balanceOf(dsaWallet0.address); + expect(balance, `PoolTogether Dai Ticket is 100`).to.be.eq( + ethers.utils.parseEther("100") + ); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token equals 0`).to.be.eq( + ethers.utils.parseEther("0") + ); + + // Increase time by 11 days so we get back all DAI without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); + + earlyExitFee = await prizePoolContract.callStatic[ + "calculateEarlyExitFee" + ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); + expect( + earlyExitFee.exitFee, + "Exit Fee equal to 0 DAI because past 10 days" + ).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect( + daiBalance, + `DAI balance to be equal to 100, because of no early withdrawal fee` + ).to.be.eq(ethers.utils.parseEther("100")); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address); + expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect( + poolBalanceAfter, + `POOL Token Balance to be greater than 0` + ).to.be.gt(ethers.utils.parseEther("0")); + }); + + it("Should deposit and withdraw all PrizePool, get back less than 100 DAI", async function() { + const amount = ethers.utils.parseEther("100"); // 100 DAI + const exitFee = ethers.utils.parseEther("1"); // 1 DAI is 10% of 100 DAI + const spells = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0], + }, + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + DAI_PRIZE_POOL_ADDR, + amount, + PT_DAI_TICKET_ADDR, + exitFee, + 0, + 0, + ], + }, + ]; + + // Before spell + let daiToken = await ethers.getContractAt( + abis.basic.erc20, + DAI_TOKEN_ADDR + ); + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI Balance equals 0`).to.be.eq( + ethers.utils.parseEther("100") + ); + + let cToken = await ethers.getContractAt( + abis.basic.erc20, + PT_DAI_TICKET_ADDR + ); + const balance = await cToken.balanceOf(dsaWallet0.address); + expect(balance, `PoolTogether DAI Ticket equals 0`).to.be.eq(0); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `PoolTogether Token greater than 0`).to.be.gt(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect( + daiBalance, + `DAI balance to be less than 100, because of early withdrawal fee` + ).to.be.lt(ethers.utils.parseEther("100")); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address); + expect(balanceAfter, `PoolTogether Dai Ticket to equal 0`).to.be.eq(0); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalanceAfter, `POOL Token Balance to greater than 0`).to.be.gt( + ethers.utils.parseEther("0") + ); + }); + + it("Should deposit, wait 11 days, and withdraw all PrizePool, get 99 DAI, and claim all POOL using claimAll", async function() { + const amount = ethers.utils.parseEther("99"); // 99 DAI + const depositSpells = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [DAI_PRIZE_POOL_ADDR, amount, PT_DAI_TICKET_ADDR, 0, 0], + }, + ]; + + // Before spell + let daiToken = await ethers.getContractAt( + abis.basic.erc20, + DAI_TOKEN_ADDR + ); + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance less than 100`).to.be.lt( + ethers.utils.parseEther("100") + ); + + let cToken = await ethers.getContractAt( + abis.basic.erc20, + PT_DAI_TICKET_ADDR + ); + const balance = await cToken.balanceOf(dsaWallet0.address); + expect(balance, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token is greater than 0`).to.be.gt( + ethers.utils.parseEther("0") + ); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(depositSpells), wallet1.address); + const receipt = await tx.wait(); + + const prizePoolContract = new ethers.Contract( + DAI_PRIZE_POOL_ADDR, + prizePoolABI, + ethers.provider + ); + let earlyExitFee = await prizePoolContract.callStatic[ + "calculateEarlyExitFee" + ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); + expect( + earlyExitFee.exitFee, + "Exit Fee equal to .99 DAI because starts at 10%" + ).to.be.eq(ethers.utils.parseEther(".99")); + + // Increase time by 11 days so we get back all DAI without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); + + earlyExitFee = await prizePoolContract.callStatic[ + "calculateEarlyExitFee" + ](dsaWallet0.address, PT_DAI_TICKET_ADDR, amount); + expect( + earlyExitFee.exitFee, + "Exit Fee equal to 0 DAI because past 10 days" + ).to.be.eq(0); + + const withdrawSpells = [ + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + DAI_PRIZE_POOL_ADDR, + amount, + PT_DAI_TICKET_ADDR, + earlyExitFee.exitFee, + 0, + 0, + ], + }, + { + connector: ptConnectorName, + method: "claimAll", + args: [TOKEN_FAUCET_PROXY_FACTORY_ADDR, [DAI_POOL_FAUCET_ADDR]], + }, + ]; + + // Run spell transaction + const tx2 = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(withdrawSpells), wallet1.address); + const receipt2 = await tx2.wait(); + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance equals 99`).to.be.eq( + ethers.utils.parseEther("99") + ); + + const balanceAfter = await cToken.balanceOf(dsaWallet0.address); + expect(balanceAfter, `PoolTogether DAI Ticket equal 0`).to.be.eq(0); + + // Expect + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalanceAfter, `Pool Token to be greateir than 0`).to.be.gt( + ethers.utils.parseEther("0") + ); + }); + }); + + describe("Main - DAI Pod Test", function() { + it("Should deposit 99 DAI in DAI Pod", async function() { + const amount = ethers.utils.parseEther("99"); // 99 DAI + const spells = [ + { + connector: ptConnectorName, + method: "depositToPod", + args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0], + }, + ]; + + // Before spell + let daiToken = await ethers.getContractAt( + abis.basic.erc20, + DAI_TOKEN_ADDR + ); + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI balance equals 99`).to.be.eq( + ethers.utils.parseEther("99") + ); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token greater than 0`).to.be.gte(0); + + let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); + const podBalance = await podToken.balanceOf(dsaWallet0.address); + expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI equals 0`).to.be.eq(0); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalanceAfter, `POOL Token greater than 0`).to.be.gt(0); + + const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); + expect(podBalanceAfter, `Pod DAI token greater than 0`).to.be.eq( + ethers.utils.parseEther("99") + ); + }); + + it("Should claim rewards from pod token drop", async function() { + const spells = [ + { + connector: ptConnectorName, + method: "claimPodTokenDrop", + args: [DAI_POD_TOKEN_DROP, 0], + }, + ]; + + const tokenDropContract = new ethers.Contract( + DAI_POD_TOKEN_DROP, + tokenDropABI, + ethers.provider + ); + const podContract = new ethers.Contract( + DAI_POD_ADDR, + podABI, + masterSigner + ); + + // drop(): Claim TokenDrop asset for PrizePool Pod and transfers token(s) to external Pod TokenDrop + // dropt() also calls batch which, Deposit Pod float into PrizePool. Deposits the current float + // amount into the PrizePool and claims current POOL rewards. + const dropTx = await podContract.drop(); + await dropTx.wait(); + + // POOL Rewards able to claim from Pod Token Drop + let claimAmount = await tokenDropContract.callStatic["claim"]( + dsaWallet0.address + ); + + // Before spell + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + const total = claimAmount.add(poolBalance); + expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq( + total + ); + }); + + it("Should wait 11 days, withdraw all podTokens, get back 99 DAI", async function() { + const amount = ethers.utils.parseEther("99"); // 99 DAI + + const podContract = new ethers.Contract( + DAI_POD_ADDR, + podABI, + ethers.provider + ); + let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); + // maxFee depends on if token has been deposited to PrizePool yet + // since we called drop in previous test case, the tokens were deposited to PrizePool + expect( + maxFee, + "Exit Fee equal to .99 DAI because token still in float" + ).to.be.eq(ethers.utils.parseEther(".99")); + + const spells = [ + { + connector: ptConnectorName, + method: "withdrawFromPod", + args: [DAI_POD_ADDR, amount, maxFee, 0, 0], + }, + ]; + + // Before spell + let daiToken = await ethers.getContractAt( + abis.basic.erc20, + DAI_TOKEN_ADDR + ); + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI Balance equals 0`).to.be.eq(0); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token balance greater than 0`).to.be.gt(0); + + let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); + const podBalance = await podToken.balanceOf(dsaWallet0.address); + expect(podBalance, `Pod DAI Token equals 99`).to.be.eq( + ethers.utils.parseEther("99") + ); + + // Increase time by 11 days so we get back all DAI without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [11 * 24 * 60 * 60]); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect( + daiBalance, + `DAI balance equals 99, because of no early withdrawal fee` + ).to.be.eq(ethers.utils.parseEther("99")); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalanceAfter, `POOL Token to be greater than 0`).to.be.gt(0); + + const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); + expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq(0); + }); + + it("Should deposit and withdraw from pod, get back same amount of 99 DAI", async function() { + const amount = ethers.utils.parseEther("99"); + const maxFee = 0; // maxFee 0 since it doesn't give chance for Pod to actually deposit into PrizePool + + const spells = [ + { + connector: ptConnectorName, + method: "depositToPod", + args: [DAI_TOKEN_ADDR, DAI_POD_ADDR, amount, 0, 0], + }, + { + connector: ptConnectorName, + method: "withdrawFromPod", + args: [DAI_POD_ADDR, amount, maxFee, 0, 0], + }, + ]; + + // Before spell + let daiToken = await ethers.getContractAt( + abis.basic.erc20, + DAI_TOKEN_ADDR + ); + let daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect(daiBalance, `DAI equals 99`).to.be.eq( + ethers.utils.parseEther("99") + ); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + + // PodToken is 0 + let podToken = await ethers.getContractAt(abis.basic.erc20, DAI_POD_ADDR); + const podBalance = await podToken.balanceOf(dsaWallet0.address); + expect(podBalance, `Pod DAI Token equals 0`).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + daiBalance = await daiToken.balanceOf(dsaWallet0.address); + expect( + daiBalance, + `DAI balance to be equal to 99, because funds still in 'float` + ).to.be.eq(ethers.utils.parseEther("99")); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalanceAfter, `POOL Token same as before spell`).to.be.eq( + poolBalance + ); + + // Expect Pod Token Balance to equal 0 + const podBalanceAfter = await podToken.balanceOf(dsaWallet0.address); + expect(podBalanceAfter, `Pod DAI Token equals 0`).to.be.eq( + ethers.utils.parseEther("0") + ); + }); + }); + + describe("Main - UNISWAP POOL/ETH Prize Pool Test", function() { + it("Should use uniswap to swap ETH for POOL, deposit to POOL/ETH LP, deposit POOL/ETH LP to PrizePool", async function() { + const amount = ethers.utils.parseEther("100"); // 100 POOL + const slippage = ethers.utils.parseEther("0.03"); + const setId = "83478237"; + + const UniswapV2Router02ABI = [ + "function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts)", + ]; + + // Get amount of ETH for 100 POOL from Uniswap + const UniswapV2Router02 = await ethers.getContractAt( + UniswapV2Router02ABI, + "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D" + ); + const amounts = await UniswapV2Router02.getAmountsOut(amount, [ + POOL_TOKEN_ADDRESS, + WETH_ADDR, + ]); + const unitAmount = ethers.utils.parseEther( + ((amounts[1] * 1.03) / amounts[0]).toString() + ); + + const spells = [ + { + connector: uniswapConnectorName, + method: "buy", + args: [ + POOL_TOKEN_ADDRESS, + tokens.eth.address, + amount, + unitAmount, + 0, + setId, + ], + }, + { + connector: uniswapConnectorName, + method: "deposit", + args: [ + POOL_TOKEN_ADDRESS, + tokens.eth.address, + amount, + unitAmount, + slippage, + 0, + setId, + ], + }, + { + connector: ptConnectorName, + method: "depositTo", + args: [ + UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, + 0, + PT_UNISWAP_POOLETHLP_TICKET_ADDR, + setId, + 0, + ], + }, + ]; + + // Before Spell + let ethBalance = await ethers.provider.getBalance(dsaWallet0.address); + expect(ethBalance, `ETH Balance equals 9`).to.be.eq( + ethers.utils.parseEther("9") + ); + + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token greater than 0`).to.be.gte(0); + + let uniswapLPToken = await ethers.getContractAt( + abis.basic.erc20, + UNISWAP_POOLETHLP_TOKEN_ADDR + ); + const uniswapPoolEthBalance = await uniswapLPToken.balanceOf( + dsaWallet0.address + ); + expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); + + let ptUniswapPoolEthToken = await ethers.getContractAt( + abis.basic.erc20, + PT_UNISWAP_POOLETHLP_TICKET_ADDR + ); + const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf( + dsaWallet0.address + ); + expect( + ptUniswapPoolEthBalance, + `PoolTogether Uniswap POOL?ETH LP equals 0` + ).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + ethBalance = await ethers.provider.getBalance(dsaWallet0.address); + expect(ethBalance, `ETH Balance less than 9`).to.be.lt( + ethers.utils.parseEther("9") + ); + + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalanceAfter, `POOL Token to be same after spell`).to.be.eq( + poolBalance + ); + + const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf( + dsaWallet0.address + ); + expect( + uniswapPoolEthBalanceAfter, + `Uniswap POOL/ETH LP equals 0` + ).to.be.eq(0); + + const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf( + dsaWallet0.address + ); + expect( + ptUniswapPoolEthBalanceAfter, + `PT Uniswap POOL/ETH LP to greater than 0` + ).to.be.gt(0); + }); + + it("Should withdraw all PrizePool, get back Uniswap LP, claim POOL, deposit claimed POOL into Pool PrizePool", async function() { + let ptUniswapPoolEthToken = await ethers.getContractAt( + abis.basic.erc20, + PT_UNISWAP_POOLETHLP_TICKET_ADDR + ); + const ptUniswapPoolEthBalance = await ptUniswapPoolEthToken.balanceOf( + dsaWallet0.address + ); + const setId = "83478237"; + + let uniswapPrizePoolContract = new ethers.Contract( + UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, + prizePoolABI, + ethers.provider + ); + let earlyExitFee = await uniswapPrizePoolContract.callStatic[ + "calculateEarlyExitFee" + ]( + dsaWallet0.address, + PT_UNISWAP_POOLETHLP_TICKET_ADDR, + ptUniswapPoolEthBalance + ); + expect( + earlyExitFee.exitFee, + "Exit Fee equals 0 because no early exit fee for this prize pool" + ).to.be.eq(0); + + const spells = [ + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + UNISWAP_POOLETHLP_PRIZE_POOL_ADDR, + ptUniswapPoolEthBalance, + PT_UNISWAP_POOLETHLP_TICKET_ADDR, + earlyExitFee.exitFee, + 0, + 0, + ], + }, + { + connector: ptConnectorName, + method: "claim", + args: [UNISWAP_POOLETHLP_FAUCET_ADDR, setId], + }, + { + connector: ptConnectorName, + method: "depositTo", + args: [POOL_PRIZE_POOL_ADDR, 0, PT_POOL_TICKET_ADDR, setId, 0], + }, + ]; + + // Before spell + let poolToken = await ethers.getContractAt( + abis.basic.erc20, + POOL_TOKEN_ADDRESS + ); + const poolBalance = await poolToken.balanceOf(dsaWallet0.address); + expect(poolBalance, `POOL Token greater than 0`).to.be.gt(0); + + // Uniswap POOL/ETH LP is 0 + let uniswapLPToken = await ethers.getContractAt( + abis.basic.erc20, + UNISWAP_POOLETHLP_TOKEN_ADDR + ); + const uniswapPoolEthBalance = await uniswapLPToken.balanceOf( + dsaWallet0.address + ); + expect(uniswapPoolEthBalance, `Uniswap POOL/ETH LP equals 0`).to.be.eq(0); + + expect( + ptUniswapPoolEthBalance, + `PT Uniswap POOL/ETH LP greater than 0` + ).to.be.gt(0); + + let poolPoolTicket = await ethers.getContractAt( + abis.basic.erc20, + PT_POOL_TICKET_ADDR + ); + const poolPoolTicketBalance = await poolPoolTicket.balanceOf( + dsaWallet0.address + ); + expect( + poolPoolTicketBalance, + `PoolTogether POOL Ticket equals 0` + ).to.be.eq(0); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + const poolBalanceAfter = await poolToken.balanceOf(dsaWallet0.address); + expect( + poolBalanceAfter, + `Pool Token Balance equal to balance before spell` + ).to.be.eq(poolBalance); + + const uniswapPoolEthBalanceAfter = await uniswapLPToken.balanceOf( + dsaWallet0.address + ); + expect( + uniswapPoolEthBalanceAfter, + `Uniswap POOL/ETH LP to greater than 0` + ).to.be.gt(0); + + const ptUniswapPoolEthBalanceAfter = await ptUniswapPoolEthToken.balanceOf( + dsaWallet0.address + ); + expect( + ptUniswapPoolEthBalanceAfter, + `PT Uniswap POOL/ETH LP equal 0` + ).to.be.eq(0); + + const poolPoolTicketBalanceAfter = await poolPoolTicket.balanceOf( + dsaWallet0.address + ); + expect( + poolPoolTicketBalanceAfter, + `PoolTogether POOL Ticket greater than 0` + ).to.be.gt(0); + }); + }); + + describe("Main - WETH Prize Pool Test", function() { + it("Deposit 1 ETH into WETH Prize Pool and withdraw immediately", async function() { + const amount = ethers.utils.parseEther("1"); // 1 ETH + const setId = "83478237"; + const spells = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, setId], + }, + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + WETH_PRIZE_POOL_ADDR, + amount, + WETH_POOL_TICKET_ADDR, + amount, + setId, + 0, + ], + }, + ]; + // Before Spell + const ethBalanceBefore = await ethers.provider.getBalance( + dsaWallet0.address + ); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After spell + const ethBalanceAfter = await ethers.provider.getBalance( + dsaWallet0.address + ); + + // ETH used for transaction + expect( + ethBalanceAfter, + `ETH Balance less than before spell because of early withdrawal fee` + ).to.be.lte(ethBalanceBefore); + }); + + it("Deposit 1 ETH into WETH Prize Pool, wait 14 days, then withdraw", async function() { + const amount = ethers.utils.parseEther("1"); // 1 ETH + const depositSpell = [ + { + connector: ptConnectorName, + method: "depositTo", + args: [WETH_PRIZE_POOL_ADDR, amount, WETH_POOL_TICKET_ADDR, 0, 0], + }, + ]; + + const withdrawSpell = [ + { + connector: ptConnectorName, + method: "withdrawInstantlyFrom", + args: [ + WETH_PRIZE_POOL_ADDR, + amount, + WETH_POOL_TICKET_ADDR, + amount, + 0, + 0, + ], + }, + ]; + + // Before Deposit Spell + let ethBalanceBefore = await ethers.provider.getBalance( + dsaWallet0.address + ); + + // Run deposit spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(depositSpell), wallet1.address); + const receipt = await tx.wait(); + + // After Deposit spell + let ethBalanceAfter = await ethers.provider.getBalance( + dsaWallet0.address + ); + + expect(ethBalanceAfter, `ETH Balance less than before spell`).to.be.lte( + ethBalanceBefore + ); + + // Increase time by 11 days so we get back all ETH without early withdrawal fee + await ethers.provider.send("evm_increaseTime", [14 * 24 * 60 * 60]); + + // Run withdraw spell transaction + const tx2 = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(withdrawSpell), wallet1.address); + const receipt2 = await tx.wait(); + + // After Deposit spell + ethBalanceAfter = await ethers.provider.getBalance(dsaWallet0.address); + + expect( + ethBalanceAfter, + `ETH Balance equal to before spell because no early exit fee` + ).to.be.eq(ethBalanceBefore); + }); + }); + + describe("Main - WETH Pod Test", function() { + let podAddress: string; + it("Should deposit 1 ETH in WETH Pod and get Pod Ticket", async function() { + const amount = ethers.utils.parseEther("1"); + + // Create Pod for WETH Prize Pool (Rari) + const podFactoryContract = new ethers.Contract( + POD_FACTORY_ADDRESS, + podFactoryABI, + masterSigner + ); + podAddress = await podFactoryContract.callStatic.create( + WETH_PRIZE_POOL_ADDR, + WETH_POOL_TICKET_ADDR, + constants.address_zero, + wallet0.address, + 18 + ); + await podFactoryContract.create( + WETH_PRIZE_POOL_ADDR, + WETH_POOL_TICKET_ADDR, + constants.address_zero, + wallet0.address, + 18 + ); + + const spells = [ + { + connector: ptConnectorName, + method: "depositToPod", + args: [WETH_ADDR, podAddress, amount, 0, 0], + }, + ]; + + // Before Deposit Spell + const podContract = new ethers.Contract( + podAddress, + podABI, + ethers.provider + ); + let podBalanceBefore = await podContract.balanceOfUnderlying( + dsaWallet0.address + ); + expect(podBalanceBefore, `Pod balance equal to 0`).to.be.eq(0); + + let ethBalanceBefore = await ethers.provider.getBalance( + dsaWallet0.address + ); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After Deposit spell + let ethBalanceAfter = await ethers.provider.getBalance( + dsaWallet0.address + ); + expect(ethBalanceAfter, `ETH balance less than before`).to.be.lt( + ethBalanceBefore + ); + + let podBalanceAfter = await podContract.balanceOfUnderlying( + dsaWallet0.address + ); + expect(podBalanceAfter, `Pod balance equal to 1`).to.be.eq( + ethers.utils.parseEther("1") + ); + }); + + it("Should withdraw 1 Ticket from WETH Pod and get back ETH", async function() { + const amount = ethers.utils.parseEther("1"); + + const podContract = new ethers.Contract( + podAddress, + podABI, + ethers.provider + ); + let maxFee = await podContract.callStatic["getEarlyExitFee"](amount); + expect( + maxFee, + "Exit Fee equal to 0 DAI because token still in float" + ).to.be.eq(0); + // maxFee depends on if token has been deposited to PrizePool yet + + const spells = [ + { + connector: ptConnectorName, + method: "withdrawFromPod", + args: [podAddress, amount, maxFee, 0, 0], + }, + ]; + + // Before Deposit Spell + let podBalanceBefore = await podContract.balanceOfUnderlying( + dsaWallet0.address + ); + expect(podBalanceBefore, `Pod balance equal to 1`).to.be.eq( + ethers.utils.parseEther("1") + ); + + let ethBalanceBefore = await ethers.provider.getBalance( + dsaWallet0.address + ); + + // Run spell transaction + const tx = await dsaWallet0 + .connect(wallet0) + .cast(...encodeSpells(spells), wallet1.address); + const receipt = await tx.wait(); + + // After Deposit spell + let ethBalanceAfter = await ethers.provider.getBalance( + dsaWallet0.address + ); + expect(ethBalanceAfter, `ETH balance greater than before`).to.be.gt( + ethBalanceBefore + ); + + let podBalanceAfter = await podContract.balanceOfUnderlying( + dsaWallet0.address + ); + expect(podBalanceAfter, `Pod balance equal to 0`).to.be.eq( + ethers.utils.parseEther("0") + ); + }); + }); +}); From 292c333209decc1068379edb19d12ff226e027a6 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Mon, 6 Dec 2021 18:17:22 +0530 Subject: [PATCH 25/39] updated scripts --- scripts/tests/run-tests.ts | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/scripts/tests/run-tests.ts b/scripts/tests/run-tests.ts index de48de95..de397629 100644 --- a/scripts/tests/run-tests.ts +++ b/scripts/tests/run-tests.ts @@ -33,19 +33,29 @@ async function testRunner() { start = Date.now(); let path: string; if (testName === "all") { - path = availableTests.map((file) => join(testsPath, file)).join(" "); + for (let test of availableTests) { + path = join(testsPath, test); + path += "/*"; + await execScript({ + cmd: "npx", + args: ["hardhat", "test", path], + env: { + networkType: chain, + }, + }); + } } else { path = join(testsPath, testName); - } - path += "/*"; + path += "/*"; - await execScript({ - cmd: "npx", - args: ["hardhat", "test", path], - env: { - networkType: chain, - }, - }); + await execScript({ + cmd: "npx", + args: ["hardhat", "test", path], + env: { + networkType: chain, + }, + }); + } end = Date.now(); } From d018eb0cef45162d699dd19ab32e109085bc59eb Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Wed, 8 Dec 2021 13:11:25 +0530 Subject: [PATCH 26/39] added scripts in package.json --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 6dfdd041..2ba0d8d6 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,9 @@ "check": "node status-checks/huskyCheck.js", "check-husky": "node status-checks/huskyCheck.js", "deploy": "node scripts/deployConnectorsFromCmd.js", - "test:runner": "hardhat run scripts/tests/run-tests.ts" + "test:runner": "hardhat run scripts/tests/run-tests.ts", + "typechain": "hardhat typechain", + "compile": "hardhat compile" }, "repository": { "type": "git", From c0f7261999e0c91fefc055408d67747dafa90072 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Wed, 8 Dec 2021 13:13:27 +0530 Subject: [PATCH 27/39] added multichain constants --- scripts/constant/addresses.ts | 44 +++++++++++++++--- scripts/constant/tokens.ts | 86 +++++++++++++++++++++++++++-------- 2 files changed, 104 insertions(+), 26 deletions(-) diff --git a/scripts/constant/addresses.ts b/scripts/constant/addresses.ts index d8d6a83b..591bcb8c 100644 --- a/scripts/constant/addresses.ts +++ b/scripts/constant/addresses.ts @@ -1,11 +1,41 @@ export const addresses: Record = { - connectors: { - basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6", - auth: "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9", - "INSTAPOOL-A": "0x5806af7ab22e2916fa582ff05731bf7c682387b2", + mainnet: { + connectors: { + basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6", + auth: "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9", + "INSTAPOOL-A": "0x5806af7ab22e2916fa582ff05731bf7c682387b2", + }, + core: { + connectorsV2: "0x97b0B3A8bDeFE8cB9563a3c610019Ad10DB8aD11", + instaIndex: "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723", + }, }, - core: { - connectorsV2: "0x97b0B3A8bDeFE8cB9563a3c610019Ad10DB8aD11", - instaIndex: "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723", + polygon: { + connectors: { + basic: "0x6214f9c4F9700fc7a50B5f9aEEB819d647406Ac7", + auth: "0xD6daA927ad756a4022858dddcc4E26137b30DB4D", + "INSTAPOOL-A": "0x8f1e38c53af7bD2b2bE01b9580911b7Cca504F1b", + }, + core: { + connectorsV2: "0x2A00684bFAb9717C21271E0751BCcb7d2D763c88", + instaIndex: "0xA9B99766E6C676Cf1975c0D3166F96C0848fF5ad", + }, }, + avalanche: { + connectors: { + // basic: "0x6214f9c4F9700fc7a50B5f9aEEB819d647406Ac7", + // auth: "0xD6daA927ad756a4022858dddcc4E26137b30DB4D", + // "INSTAPOOL-A": "0x8f1e38c53af7bD2b2bE01b9580911b7Cca504F1b", + }, + core: { + connectorsV2: "0x67fCE99Dd6d8d659eea2a1ac1b8881c57eb6592B", + instaIndex: "0x1eE00C305C51Ff3bE60162456A9B533C07cD9288", + }, + }, + arbitrum: { + core: { + connectorsV2: "0x127d8cD0E2b2E0366D522DeA53A787bfE9002C14", + instaIndex: "0x6CE3e607C808b4f4C26B7F6aDAeB619e49CAbb25", + }, + } }; diff --git a/scripts/constant/tokens.ts b/scripts/constant/tokens.ts index d3c95180..d10feb48 100644 --- a/scripts/constant/tokens.ts +++ b/scripts/constant/tokens.ts @@ -1,23 +1,71 @@ export const tokens = { - eth: { - type: "token", - symbol: "ETH", - name: "Ethereum", - address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - decimals: 18, + mainnet: { + eth: { + type: "token", + symbol: "ETH", + name: "Ethereum", + address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + decimals: 18, + }, + dai: { + type: "token", + symbol: "DAI", + name: "DAI Stable", + address: "0x6B175474E89094C44Da98b954EedeAC495271d0F", + decimals: 18, + }, + usdc: { + type: "token", + symbol: "USDC", + name: "USD Coin", + address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + decimals: 6, + }, }, - dai: { - type: "token", - symbol: "DAI", - name: "DAI Stable", - address: "0x6B175474E89094C44Da98b954EedeAC495271d0F", - decimals: 18, - }, - usdc: { - type: "token", - symbol: "USDC", - name: "USD Coin", - address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - decimals: 6, + polygon: { + eth: { + type: "token", + symbol: "ETH", + name: "Ethereum", + address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + decimals: 18, + }, + dai: { + type: "token", + symbol: "DAI", + name: "DAI Stable", + address: "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", + decimals: 18, + }, + usdc: { + type: "token", + symbol: "USDC", + name: "USD Coin", + address: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + decimals: 6, + }, }, + avalanche: { + eth: { + type: "token", + symbol: "ETH", + name: "Ethereum", + address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + decimals: 18, + }, + dai: { + type: "token", + symbol: "DAI", + name: "DAI Stable", + address: "0xd586e7f844cea2f87f50152665bcbc2c279d8d70", + decimals: 18, + }, + usdc: { + type: "token", + symbol: "USDC", + name: "USD Coin", + address: "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", + decimals: 6, + }, + } }; From 46b0c02e18dd4e954a5f6ccc0d08c9b8a61486ed Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Wed, 8 Dec 2021 13:14:19 +0530 Subject: [PATCH 28/39] updated test: multichain constants --- test/mainnet/aave/v1.test.ts | 12 +++++----- test/mainnet/aave/v2.test.ts | 22 +++++++++---------- test/mainnet/b.protocol/b.compound.test.ts | 2 +- test/mainnet/b.protocol/b.liquity.test.ts | 2 +- test/mainnet/b.protocol/b.maker.test.ts | 4 ++-- .../mainnet/basic-ERC1155/ERC1155-transfer.ts | 4 ++-- test/mainnet/basic-ERC721/ERC721-transfer.ts | 4 ++-- test/mainnet/compound/compound.test.ts | 2 +- test/mainnet/instapool/instapool.test.ts | 2 +- .../mainnet/pooltogether/pooltogether.test.ts | 8 +++---- test/mainnet/uniswap/uniswap.test.ts | 2 +- .../mainnet/uniswapStake/uniswapStake.test.ts | 2 +- test/mainnet/yearn/yearn.test.ts | 2 +- .../polygon/pooltogether/pooltogether.test.ts | 16 +++++++------- 14 files changed, 42 insertions(+), 42 deletions(-) diff --git a/test/mainnet/aave/v1.test.ts b/test/mainnet/aave/v1.test.ts index 563a3410..2a82f4e4 100644 --- a/test/mainnet/aave/v1.test.ts +++ b/test/mainnet/aave/v1.test.ts @@ -41,7 +41,7 @@ describe("Aave V1", function () { masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, - addresses.core.connectorsV2 + addresses.mainnet.core.connectorsV2 ); connector = await deployAndEnableConnector({ connectorName, @@ -85,7 +85,7 @@ describe("Aave V1", function () { { connector: connectorName, method: "deposit", - args: [tokens.eth.address, amt, 0, 0], + args: [tokens.mainnet.eth.address, amt, 0, 0], }, ]; @@ -110,13 +110,13 @@ describe("Aave V1", function () { { connector: connectorName, method: "borrow", - args: [tokens.dai.address, amt, 0, 0], + args: [tokens.mainnet.dai.address, amt, 0, 0], }, { connector: connectorName, method: "payback", // FIXME: we need to pass max_value because of roundoff/shortfall errors - args: [tokens.dai.address, constants.max_value, 0, 0], + args: [tokens.mainnet.dai.address, constants.max_value, 0, 0], }, ]; @@ -134,7 +134,7 @@ describe("Aave V1", function () { { connector: connectorName, method: "deposit", - args: [tokens.eth.address, constants.max_value, 0, 0], + args: [tokens.mainnet.eth.address, constants.max_value, 0, 0], }, ]; @@ -152,7 +152,7 @@ describe("Aave V1", function () { { connector: connectorName, method: "withdraw", - args: [tokens.eth.address, constants.max_value, 0, 0], + args: [tokens.mainnet.eth.address, constants.max_value, 0, 0], }, ]; diff --git a/test/mainnet/aave/v2.test.ts b/test/mainnet/aave/v2.test.ts index 1ac4b662..c85892b6 100644 --- a/test/mainnet/aave/v2.test.ts +++ b/test/mainnet/aave/v2.test.ts @@ -39,7 +39,7 @@ describe("Aave V2", function () { masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, - addresses.core.connectorsV2 + addresses.mainnet.core.connectorsV2 ); connector = await deployAndEnableConnector({ connectorName, @@ -80,7 +80,7 @@ describe("Aave V2", function () { { connector: connectorName, method: "deposit", - args: [tokens.eth.address, amt, 0, 0], + args: [tokens.mainnet.eth.address, amt, 0, 0], }, ]; @@ -102,12 +102,12 @@ describe("Aave V2", function () { { connector: connectorName, method: "borrow", - args: [tokens.dai.address, amt, 2, 0, setId], + args: [tokens.mainnet.dai.address, amt, 2, 0, setId], }, { connector: connectorName, method: "payback", - args: [tokens.dai.address, amt, 2, setId, 0], + args: [tokens.mainnet.dai.address, amt, 2, setId, 0], }, ]; @@ -128,12 +128,12 @@ describe("Aave V2", function () { { connector: connectorName, method: "borrow", - args: [tokens.dai.address, amt, 2, 0, 0], + args: [tokens.mainnet.dai.address, amt, 2, 0, 0], }, { connector: connectorName, method: "payback", - args: [tokens.dai.address, amt.div(2), 2, 0, 0], + args: [tokens.mainnet.dai.address, amt.div(2), 2, 0, 0], }, ]; @@ -149,7 +149,7 @@ describe("Aave V2", function () { { connector: connectorName, method: "payback", - args: [tokens.dai.address, constants.max_value, 2, 0, 0], + args: [tokens.mainnet.dai.address, constants.max_value, 2, 0, 0], }, ]; @@ -167,7 +167,7 @@ describe("Aave V2", function () { { connector: connectorName, method: "deposit", - args: [tokens.eth.address, constants.max_value, 0, 0], + args: [tokens.mainnet.eth.address, constants.max_value, 0, 0], }, ]; @@ -185,7 +185,7 @@ describe("Aave V2", function () { { connector: connectorName, method: "withdraw", - args: [tokens.eth.address, constants.max_value, 0, 0], + args: [tokens.mainnet.eth.address, constants.max_value, 0, 0], }, ]; @@ -205,12 +205,12 @@ describe("Aave V2", function () { { connector: connectorName, method: "deposit", - args: [tokens.eth.address, amt, 0, setId], + args: [tokens.mainnet.eth.address, amt, 0, setId], }, { connector: connectorName, method: "withdraw", - args: [tokens.eth.address, amt, setId, 0], + args: [tokens.mainnet.eth.address, amt, setId, 0], }, ]; diff --git a/test/mainnet/b.protocol/b.compound.test.ts b/test/mainnet/b.protocol/b.compound.test.ts index 4ef6c0ba..1efa3073 100644 --- a/test/mainnet/b.protocol/b.compound.test.ts +++ b/test/mainnet/b.protocol/b.compound.test.ts @@ -37,7 +37,7 @@ describe("B.Compound", function () { ], }); masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, contractArtifact: ConnectV2BCompound__factory, diff --git a/test/mainnet/b.protocol/b.liquity.test.ts b/test/mainnet/b.protocol/b.liquity.test.ts index 65d3996c..f3469226 100644 --- a/test/mainnet/b.protocol/b.liquity.test.ts +++ b/test/mainnet/b.protocol/b.liquity.test.ts @@ -45,7 +45,7 @@ describe("B.Liquity", function () { ], }); masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, contractArtifact: ConnectV2BLiquity__factory, diff --git a/test/mainnet/b.protocol/b.maker.test.ts b/test/mainnet/b.protocol/b.maker.test.ts index 31f2c26a..c460abd3 100644 --- a/test/mainnet/b.protocol/b.maker.test.ts +++ b/test/mainnet/b.protocol/b.maker.test.ts @@ -41,7 +41,7 @@ describe("B.Maker", function () { ], }); masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, contractArtifact: ConnectV2BMakerDAO__factory, @@ -51,7 +51,7 @@ describe("B.Maker", function () { manager = await ethers.getContractAt("BManagerLike", "0x3f30c2381CD8B917Dd96EB2f1A4F96D91324BBed") vat = await ethers.getContractAt("../artifacts/contracts/mainnet/connectors/b.protocol/makerdao/interface.sol:VatLike", await manager.vat()) - dai = await ethers.getContractAt("../artifacts/contracts/mainnet/common/interfaces.sol:TokenInterface", tokens.dai.address) + dai = await ethers.getContractAt("../artifacts/contracts/mainnet/common/interfaces.sol:TokenInterface", tokens.mainnet.dai.address) console.log("Connector address", connector.address) }) diff --git a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts index 88fc918b..12324071 100644 --- a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts +++ b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts @@ -64,11 +64,11 @@ describe("BASIC-ERC1155", function () { ); nftContract = await ethers.getContractAt(IERC1155__factory.abi, TOKEN_CONTRACT_ADDR) masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); instaImplementationsMapping = await ethers.getContractAt(abi, implementationsMappingAddr); InstaAccountV2DefaultImpl = await ethers.getContractFactory("InstaDefaultImplementation") - instaAccountV2DefaultImpl = await InstaAccountV2DefaultImpl.deploy(addresses.core.instaIndex); + instaAccountV2DefaultImpl = await InstaAccountV2DefaultImpl.deploy(addresses.mainnet.core.instaIndex); await instaAccountV2DefaultImpl.deployed() connector = await deployAndEnableConnector({ connectorName, diff --git a/test/mainnet/basic-ERC721/ERC721-transfer.ts b/test/mainnet/basic-ERC721/ERC721-transfer.ts index 2fb3c24d..4f87ca90 100644 --- a/test/mainnet/basic-ERC721/ERC721-transfer.ts +++ b/test/mainnet/basic-ERC721/ERC721-transfer.ts @@ -64,11 +64,11 @@ describe("BASIC-ERC721", function () { ); nftContract = await ethers.getContractAt(IERC721__factory.abi, TOKEN_CONTRACT_ADDR) masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); instaImplementationsMapping = await ethers.getContractAt(abi, implementationsMappingAddr); InstaAccountV2DefaultImpl = await ethers.getContractFactory("InstaDefaultImplementation") - instaAccountV2DefaultImpl = await InstaAccountV2DefaultImpl.deploy(addresses.core.instaIndex); + instaAccountV2DefaultImpl = await InstaAccountV2DefaultImpl.deploy(addresses.mainnet.core.instaIndex); await instaAccountV2DefaultImpl.deployed() connector = await deployAndEnableConnector({ connectorName, diff --git a/test/mainnet/compound/compound.test.ts b/test/mainnet/compound/compound.test.ts index 042e3e93..be9b4f4e 100644 --- a/test/mainnet/compound/compound.test.ts +++ b/test/mainnet/compound/compound.test.ts @@ -38,7 +38,7 @@ describe("Compound", function () { ], }); masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, contractArtifact: ConnectV2Compound__factory, diff --git a/test/mainnet/instapool/instapool.test.ts b/test/mainnet/instapool/instapool.test.ts index 3abb59c0..36e15551 100644 --- a/test/mainnet/instapool/instapool.test.ts +++ b/test/mainnet/instapool/instapool.test.ts @@ -38,7 +38,7 @@ describe("Instapool", function () { ], }); masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, contractArtifact: ConnectV2Compound__factory, diff --git a/test/mainnet/pooltogether/pooltogether.test.ts b/test/mainnet/pooltogether/pooltogether.test.ts index 48644259..0447c75c 100644 --- a/test/mainnet/pooltogether/pooltogether.test.ts +++ b/test/mainnet/pooltogether/pooltogether.test.ts @@ -20,7 +20,7 @@ import { ConnectV2UniswapV2__factory, } from "../../../typechain"; -const DAI_TOKEN_ADDR = tokens.dai.address; // DAI Token +const DAI_TOKEN_ADDR = tokens.mainnet.dai.address; // DAI Token // PoolTogether Address: https://docs.pooltogether.com/resources/networks/ethereum const DAI_PRIZE_POOL_ADDR = "0xEBfb47A7ad0FD6e57323C8A42B2E5A6a4F68fc1a"; // DAI Prize Pool @@ -85,7 +85,7 @@ describe("PoolTogether", function() { masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, - addresses.core.connectorsV2 + addresses.mainnet.core.connectorsV2 ); // Deploy and enable Compound Connector @@ -757,7 +757,7 @@ describe("PoolTogether", function() { method: "buy", args: [ POOL_TOKEN_ADDRESS, - tokens.eth.address, + tokens.mainnet.eth.address, amount, unitAmount, 0, @@ -769,7 +769,7 @@ describe("PoolTogether", function() { method: "deposit", args: [ POOL_TOKEN_ADDRESS, - tokens.eth.address, + tokens.mainnet.eth.address, amount, unitAmount, slippage, diff --git a/test/mainnet/uniswap/uniswap.test.ts b/test/mainnet/uniswap/uniswap.test.ts index 0a5deea3..b123d87a 100644 --- a/test/mainnet/uniswap/uniswap.test.ts +++ b/test/mainnet/uniswap/uniswap.test.ts @@ -61,7 +61,7 @@ describe("UniswapV3", function() { masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, - addresses.core.connectorsV2 + addresses.mainnet.core.connectorsV2 ); nftManager = await ethers.getContractAt( abi, diff --git a/test/mainnet/uniswapStake/uniswapStake.test.ts b/test/mainnet/uniswapStake/uniswapStake.test.ts index f9352153..3d704dcb 100644 --- a/test/mainnet/uniswapStake/uniswapStake.test.ts +++ b/test/mainnet/uniswapStake/uniswapStake.test.ts @@ -62,7 +62,7 @@ describe("UniswapV3", function () { ], }); masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); nftManager = await ethers.getContractAt(abi, "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"); connector = await deployAndEnableConnector({ connectorName: connectorStaker, diff --git a/test/mainnet/yearn/yearn.test.ts b/test/mainnet/yearn/yearn.test.ts index 68757674..53a69406 100644 --- a/test/mainnet/yearn/yearn.test.ts +++ b/test/mainnet/yearn/yearn.test.ts @@ -50,7 +50,7 @@ describe("Yearn", function() { masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, - addresses.core.connectorsV2 + addresses.mainnet.core.connectorsV2 ); connector = await deployAndEnableConnector({ connectorName, diff --git a/test/polygon/pooltogether/pooltogether.test.ts b/test/polygon/pooltogether/pooltogether.test.ts index 31b645f2..0b41934f 100644 --- a/test/polygon/pooltogether/pooltogether.test.ts +++ b/test/polygon/pooltogether/pooltogether.test.ts @@ -17,7 +17,7 @@ import type { Signer, Contract } from "ethers"; import { ConnectV2AaveV2Polygon__factory, ConnectV2PoolTogetherPolygon__factory } from "../../../typechain"; -const DAI_TOKEN_ADDR = tokens.dai.address; // DAI Token +const DAI_TOKEN_ADDR = tokens.polygon.dai.address; // DAI Token // PoolTogether Address: https://docs.pooltogether.com/resources/networks/matic const USDC_PRIZE_POOL_ADDR = "0xEE06AbE9e2Af61cabcb13170e01266Af2DEFa946"; // USDC Prize Pool const PT_USDC_TICKET_ADDR = "0x473E484c722EF9ec6f63B509b07Bb9cfB258820b"; // PT USDC Ticket @@ -69,7 +69,7 @@ describe("PoolTogether", function() { masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, - addresses.core.connectorsV2 + addresses.polygon.core.connectorsV2 ); // Deploy and enable Compound Connector @@ -120,7 +120,7 @@ describe("PoolTogether", function() { { connector: connectorName, method: "deposit", - args: [tokens.eth.address, amount, 0, 0], + args: [tokens.polygon.eth.address, amount, 0, 0], }, ]; @@ -141,7 +141,7 @@ describe("PoolTogether", function() { { connector: connectorName, method: "borrow", - args: [tokens.usdc.address, amount, 2, 0, setId], + args: [tokens.polygon.usdc.address, amount, 2, 0, setId], }, { connector: ptConnectorName, @@ -158,7 +158,7 @@ describe("PoolTogether", function() { // Before Spell let usdcToken = await ethers.getContractAt( abis.basic.erc20, - tokens.usdc.address + tokens.polygon.usdc.address ); let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); expect(usdcBalance, `USDC balance is 0`).to.be.eq( @@ -239,7 +239,7 @@ describe("PoolTogether", function() { // Before spell let usdcToken = await ethers.getContractAt( abis.basic.erc20, - tokens.usdc.address + tokens.polygon.usdc.address ); let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); expect(usdcBalance, `USDC balance equals 0`).to.be.eq( @@ -330,7 +330,7 @@ describe("PoolTogether", function() { // Before spell let usdcToken = await ethers.getContractAt( abis.basic.erc20, - tokens.usdc.address + tokens.polygon.usdc.address ); let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); expect(usdcBalance, `USDC Balance equals 100`).to.be.eq( @@ -394,7 +394,7 @@ describe("PoolTogether", function() { // Before spell let usdcToken = await ethers.getContractAt( abis.basic.erc20, - tokens.usdc.address + tokens.polygon.usdc.address ); let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); expect(usdcBalance, `USDC balance less than 10`).to.be.lt( From 92b99247eadf5146a57222ed3562f7718795f2a3 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Fri, 10 Dec 2021 01:02:08 +0530 Subject: [PATCH 29/39] fixed tests --- scripts/constant/addresses.ts | 2 +- test/mainnet/aave/v1.test.ts | 2 +- test/mainnet/aave/v2.test.ts | 2 +- test/mainnet/b.protocol/b.compound.test.ts | 2 +- test/mainnet/b.protocol/b.maker.test.ts | 2 +- .../mainnet/basic-ERC1155/ERC1155-transfer.ts | 2 +- test/mainnet/basic-ERC721/ERC721-transfer.ts | 2 +- test/mainnet/compound/compound.test.ts | 2 +- test/mainnet/instapool/instapool.test.ts | 2 +- test/mainnet/liquity/liquity.contracts.ts | 2 +- test/mainnet/liquity/liquity.helpers.ts | 55 +++++----- test/mainnet/liquity/liquity.test.ts | 102 ++++++++++-------- .../mainnet/pooltogether/pooltogether.test.ts | 2 +- test/mainnet/uniswap/uniswap.test.ts | 2 +- .../mainnet/uniswapStake/uniswapStake.test.ts | 2 +- test/mainnet/yearn/yearn.test.ts | 2 +- .../polygon/pooltogether/pooltogether.test.ts | 2 +- 17 files changed, 100 insertions(+), 87 deletions(-) diff --git a/scripts/constant/addresses.ts b/scripts/constant/addresses.ts index 591bcb8c..fd69c32b 100644 --- a/scripts/constant/addresses.ts +++ b/scripts/constant/addresses.ts @@ -1,4 +1,4 @@ -export const addresses: Record = { +export default { mainnet: { connectors: { basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6", diff --git a/test/mainnet/aave/v1.test.ts b/test/mainnet/aave/v1.test.ts index 2a82f4e4..6af2ac78 100644 --- a/test/mainnet/aave/v1.test.ts +++ b/test/mainnet/aave/v1.test.ts @@ -1,7 +1,7 @@ import hre from "hardhat"; import { expect } from "chai"; import { abis } from "../../../scripts/constant/abis"; -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; diff --git a/test/mainnet/aave/v2.test.ts b/test/mainnet/aave/v2.test.ts index c85892b6..85d1fb18 100644 --- a/test/mainnet/aave/v2.test.ts +++ b/test/mainnet/aave/v2.test.ts @@ -1,7 +1,7 @@ import { expect } from "chai"; import hre from "hardhat"; import { abis } from "../../../scripts/constant/abis"; -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; diff --git a/test/mainnet/b.protocol/b.compound.test.ts b/test/mainnet/b.protocol/b.compound.test.ts index 1efa3073..d222a2d0 100644 --- a/test/mainnet/b.protocol/b.compound.test.ts +++ b/test/mainnet/b.protocol/b.compound.test.ts @@ -7,7 +7,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { ConnectV2BCompound__factory } from "../../../typechain"; diff --git a/test/mainnet/b.protocol/b.maker.test.ts b/test/mainnet/b.protocol/b.maker.test.ts index c460abd3..31e82d34 100644 --- a/test/mainnet/b.protocol/b.maker.test.ts +++ b/test/mainnet/b.protocol/b.maker.test.ts @@ -7,7 +7,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { tokens } from "../../../scripts/constant/tokens"; import { ConnectV2BMakerDAO__factory } from "../../../typechain"; diff --git a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts index 12324071..da0ab626 100644 --- a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts +++ b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts @@ -8,7 +8,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import { addresses } from "../../../scripts/constant/addresses" +import addresses from "../../../scripts/constant/addresses" import { abis } from "../../../scripts/constant/abis" import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/basic-ERC721/ERC721-transfer.ts b/test/mainnet/basic-ERC721/ERC721-transfer.ts index 4f87ca90..d4811879 100644 --- a/test/mainnet/basic-ERC721/ERC721-transfer.ts +++ b/test/mainnet/basic-ERC721/ERC721-transfer.ts @@ -8,7 +8,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import { addresses } from "../../../scripts/constant/addresses" +import addresses from "../../../scripts/constant/addresses" import { abis } from "../../../scripts/constant/abis" import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/compound/compound.test.ts b/test/mainnet/compound/compound.test.ts index be9b4f4e..ccb1c228 100644 --- a/test/mainnet/compound/compound.test.ts +++ b/test/mainnet/compound/compound.test.ts @@ -9,7 +9,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { ConnectV2Compound__factory } from "../../../typechain"; diff --git a/test/mainnet/instapool/instapool.test.ts b/test/mainnet/instapool/instapool.test.ts index 36e15551..7aab1b6c 100644 --- a/test/mainnet/instapool/instapool.test.ts +++ b/test/mainnet/instapool/instapool.test.ts @@ -9,7 +9,7 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells" import encodeFlashcastData from "../../../scripts/tests/encodeFlashcastData" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import type { Signer, Contract } from "ethers"; import { ConnectV2Compound__factory } from "../../../typechain"; diff --git a/test/mainnet/liquity/liquity.contracts.ts b/test/mainnet/liquity/liquity.contracts.ts index f6a6df74..7cee4a17 100644 --- a/test/mainnet/liquity/liquity.contracts.ts +++ b/test/mainnet/liquity/liquity.contracts.ts @@ -69,7 +69,7 @@ const COLL_SURPLUS_ABI = [ "function getCollateral(address _account) external view returns (uint)", ]; -module.exports = { +export default { TROVE_MANAGER_ADDRESS, TROVE_MANAGER_ABI, BORROWER_OPERATIONS_ADDRESS, diff --git a/test/mainnet/liquity/liquity.helpers.ts b/test/mainnet/liquity/liquity.helpers.ts index bab90124..0fd8f191 100644 --- a/test/mainnet/liquity/liquity.helpers.ts +++ b/test/mainnet/liquity/liquity.helpers.ts @@ -3,30 +3,31 @@ import { ethers } from "hardhat"; import hardhatConfig from "../../../hardhat.config"; // Instadapp deployment and testing helpers -import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector.js" +import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector" import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js" +import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" // Instadapp instadappAddresses/ABIs -import { instadappAddresses } from "../../../scripts/important/addresses"; -import { instadappAbi } from "../../../scripts/constant/abis"; +import instadappAddresses from "../../../scripts/constant/addresses"; +import { abis } from "../../../scripts/constant/abis"; // Instadapp Liquity Connector artifacts import { ConnectV2Liquity__factory, ConnectV2Basic__factory } from "../../../typechain"; // Instadapp uses a fake address to represent native ETH -import { constants } from "../../../scripts/constant/constant.js"; -import type { Signer, Contract } from "ethers"; - +import { constants } from "../../../scripts/constant/constant"; +import type { Signer, Contract, BigNumber } from "ethers"; const LIQUITY_CONNECTOR = "LIQUITY-v1-TEST"; const LUSD_GAS_COMPENSATION = hre.ethers.utils.parseUnits("200", 18); // 200 LUSD gas compensation repaid after loan repayment const LIQUIDATABLE_TROVES_BLOCK_NUMBER = 12478159; // Deterministic block number for tests to run against, if you change this, tests will break. const JUSTIN_SUN_ADDRESS = "0x903d12bf2c57a29f32365917c706ce0e1a84cce3"; // LQTY whale address const LIQUIDATABLE_TROVE_ADDRESS = "0xafbeb4cb97f3b08ec2fe07ef0dac15d37013a347"; // Trove which is liquidatable at blockNumber: LIQUIDATABLE_TROVES_BLOCK_NUMBER -// const MAX_GAS = hardhatConfig.networks.hardhat.blockGasLimit; // Maximum gas limit (12000000) +// @ts-ignore +const MAX_GAS = hardhatConfig.networks.hardhat.blockGasLimit ?? 12000000; // Maximum gas limit (12000000) const INSTADAPP_BASIC_V1_CONNECTOR = "Basic-v1"; +const ETH = constants.native_address const openTroveSpell = async ( dsa: any, @@ -121,24 +122,26 @@ const resetHardhatBlockNumber = async (blockNumber: number) => { const deployAndConnect = async (contracts: any, isDebug = false) => { // Pin Liquity tests to a particular block number to create deterministic state (Ether price etc.) await resetHardhatBlockNumber(LIQUIDATABLE_TROVES_BLOCK_NUMBER); - let liquity = { + type Liquidity = { troveManager: Contract, - borrowerOperations: null, - stabilityPool: null, - lusdToken: null, - lqtyToken: null, - activePool: null, - priceFeed: null, - hintHelpers: null, - sortedTroves: null, - staking: null, - collSurplus: null, + borrowerOperations: Contract, + stabilityPool: Contract, + lusdToken: Contract, + lqtyToken: Contract, + activePool: Contract, + priceFeed: Contract, + hintHelpers: Contract, + sortedTroves: Contract, + staking: Contract, + collSurplus: Contract, }; + const liquity = {} as Liquidity + const masterSigner = await getMasterSigner(); const instaConnectorsV2 = await ethers.getContractAt( - instadappAbi.core.connectorsV2, - instadappAddresses.core.connectorsV2 + abis.core.connectorsV2, + instadappAddresses.mainnet.core.connectorsV2 ); const connector = await deployAndEnableConnector({ connectorName: LIQUITY_CONNECTOR, @@ -225,7 +228,7 @@ const deployAndConnect = async (contracts: any, isDebug = false) => { return liquity; }; -const getTroveInsertionHints = async (depositAmount, borrowAmount, liquity: any) => { +const getTroveInsertionHints = async (depositAmount: BigNumber, borrowAmount: BigNumber, liquity: any) => { const nominalCR = await liquity.hintHelpers.computeNominalCR( depositAmount, borrowAmount @@ -259,7 +262,7 @@ const getTroveInsertionHints = async (depositAmount, borrowAmount, liquity: any) let randomSeed = 4223; -const getRedemptionHints = async (amount, liquity) => { +const getRedemptionHints = async (amount: any, liquity: any) => { const ethPrice = await liquity.priceFeed.callStatic.fetchPrice(); const [ firstRedemptionHint, @@ -299,7 +302,7 @@ const getRedemptionHints = async (amount, liquity) => { }; }; -const redeem = async (amount, from, wallet, liquity) => { +const redeem = async (amount: any, from: any, wallet: { address: any; }, liquity: any) => { await sendToken(liquity.lusdToken, amount, from, wallet.address); const { partialRedemptionHintNicr, @@ -325,7 +328,7 @@ const redeem = async (amount, from, wallet, liquity) => { ); }; -module.exports = { +export default { deployAndConnect, resetInitialState, createDsaTrove, @@ -339,5 +342,5 @@ module.exports = { LIQUIDATABLE_TROVE_ADDRESS, MAX_GAS, INSTADAPP_BASIC_V1_CONNECTOR, - ETH_ADDRESS, + ETH, }; diff --git a/test/mainnet/liquity/liquity.test.ts b/test/mainnet/liquity/liquity.test.ts index fd5ccd69..5eae01a1 100644 --- a/test/mainnet/liquity/liquity.test.ts +++ b/test/mainnet/liquity/liquity.test.ts @@ -3,13 +3,14 @@ import { expect } from "chai"; // Instadapp deployment and testing helpers import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; -import { encodeSpells } from "../../../scripts/tests/encodeSpells.js"; +import { encodeSpells } from "../../../scripts/tests/encodeSpells"; // Liquity smart contracts import contracts from "./liquity.contracts"; // Liquity helpers import helpers from "./liquity.helpers"; +import { Contract, Signer } from "ethers"; describe("Liquity", () => { const { waffle, ethers } = hre; @@ -17,8 +18,8 @@ describe("Liquity", () => { // Waffle test account 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 (holds 1000 ETH) const userWallet = provider.getWallets()[0]; - let dsa = null; - let liquity = null; + let dsa: any; + let liquity: any; before(async () => { await hre.network.provider.request({ @@ -26,6 +27,7 @@ describe("Liquity", () => { params: [ { forking: { + // @ts-ignore jsonRpcUrl: hre.config.networks.hardhat.forking.url, blockNumber: 13300000, }, @@ -143,7 +145,7 @@ describe("Liquity", () => { const depositEthSpell = { connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, method: "deposit", - args: [helpers.ETH_ADDRESS, depositAmount, 0, depositId], + args: [helpers.ETH, depositAmount, 0, depositId], }; const openTroveSpell = { @@ -321,8 +323,9 @@ describe("Liquity", () => { } ); const receipt = await openTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; expect(castLogEvent.eventNames[0]).eq( "LogOpen(address,uint256,uint256,uint256,uint256[],uint256[])" ); @@ -541,7 +544,7 @@ describe("Liquity", () => { connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, method: "withdraw", args: [ - helpers.ETH_ADDRESS, + helpers.ETH, 0, // amount comes from the previous spell's setId dsa.address, collateralWithdrawId, @@ -612,8 +615,9 @@ describe("Liquity", () => { .cast(...encodeSpells([closeTroveSpell]), userWallet.address); const receipt = await closeTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256"], [dsa.address, 0] @@ -673,7 +677,7 @@ describe("Liquity", () => { const depositEthSpell = { connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, method: "deposit", - args: [helpers.ETH_ADDRESS, topupAmount, 0, depositId], + args: [helpers.ETH, topupAmount, 0, depositId], }; const upperHint = ethers.constants.AddressZero; @@ -725,8 +729,9 @@ describe("Liquity", () => { }); const receipt = await depositTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256"], [dsa.address, topupAmount, 0, 0] @@ -796,7 +801,7 @@ describe("Liquity", () => { const withdrawEthSpell = { connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, method: "withdraw", - args: [helpers.ETH_ADDRESS, 0, userWallet.address, withdrawId, 0], + args: [helpers.ETH, 0, userWallet.address, withdrawId, 0], }; const spells = [withdrawEthFromTroveSpell, withdrawEthSpell]; await dsa @@ -844,8 +849,9 @@ describe("Liquity", () => { .cast(...encodeSpells([withdrawEthSpell]), userWallet.address); const receipt = await withdrawTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256"], [dsa.address, withdrawAmount, 0, 0] @@ -973,8 +979,9 @@ describe("Liquity", () => { .cast(...encodeSpells([borrowSpell]), userWallet.address); const receipt = await borrowTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256"], [dsa.address, borrowAmount, 0, 0] @@ -1130,8 +1137,9 @@ describe("Liquity", () => { }); const receipt = await repayTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256"], [dsa.address, repayAmount, 0, 0] @@ -1295,7 +1303,7 @@ describe("Liquity", () => { const depositEthSpell = { connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, method: "deposit", - args: [helpers.ETH_ADDRESS, depositAmount, 0, ethDepositId], + args: [helpers.ETH, depositAmount, 0, ethDepositId], }; const depositLusdSpell = { @@ -1403,13 +1411,7 @@ describe("Liquity", () => { const withdrawEthSpell = { connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, method: "withdraw", - args: [ - helpers.ETH_ADDRESS, - 0, - userWallet.address, - ethWithdrawId, - 0, - ], + args: [helpers.ETH, 0, userWallet.address, ethWithdrawId, 0], }; const withdrawLusdSpell = { @@ -1484,8 +1486,9 @@ describe("Liquity", () => { }); const receipt = await adjustTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( [ "address", @@ -1645,8 +1648,9 @@ describe("Liquity", () => { ); const receipt = await claimTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256"], [dsa.address, claimAmount, setId] @@ -1768,7 +1772,7 @@ describe("Liquity", () => { // Fast forward in time so we have an LQTY gain await provider.send("evm_increaseTime", [600]); - await provider.send("evm_mine"); + await provider.send("evm_mine", []); // Create a Stability Pool deposit with a differen DSA so that LQTY gains can be calculated // See: https://github.com/liquity/dev/#lqty-reward-events-and-payouts @@ -1796,8 +1800,9 @@ describe("Liquity", () => { .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); const receipt = await depositAgainTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( [ "address", @@ -1992,7 +1997,7 @@ describe("Liquity", () => { // Fast forward in time so we have an LQTY gain await provider.send("evm_increaseTime", [600]); - await provider.send("evm_mine"); + await provider.send("evm_mine", []); // Create another Stability Pool deposit so that LQTY gains are realized // See: https://github.com/liquity/dev/#lqty-reward-events-and-payouts @@ -2034,8 +2039,9 @@ describe("Liquity", () => { ); const receipt = await withdrawTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( [ "address", @@ -2172,8 +2178,9 @@ describe("Liquity", () => { const receipt = await moveEthGainTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256"], [dsa.address, ethGainFromLiquidation] @@ -2293,8 +2300,9 @@ describe("Liquity", () => { const receipt = await stakeTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256", "uint256", "uint256"], [ @@ -2457,8 +2465,9 @@ describe("Liquity", () => { const receipt = await unstakeTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256", "uint256", "uint256"], [ @@ -2601,7 +2610,7 @@ describe("Liquity", () => { const withdrawEthSpell = { connector: helpers.INSTADAPP_BASIC_V1_CONNECTOR, method: "withdraw", - args: [helpers.ETH_ADDRESS, 0, userWallet.address, ethGainId, 0], + args: [helpers.ETH, 0, userWallet.address, ethGainId, 0], }; const withdrawLusdSpell = { @@ -2702,8 +2711,9 @@ describe("Liquity", () => { const receipt = await claimGainsTx.wait(); - const castLogEvent = receipt.events.find((e) => e.event === "LogCast") - .args; + const castLogEvent = receipt.events.find( + (e: { event: string }) => e.event === "LogCast" + ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256", "uint256"], [stakerDsa.address, ethGain, lusdGain, setEthGainId, setLusdGainId] diff --git a/test/mainnet/pooltogether/pooltogether.test.ts b/test/mainnet/pooltogether/pooltogether.test.ts index 0447c75c..94988ad3 100644 --- a/test/mainnet/pooltogether/pooltogether.test.ts +++ b/test/mainnet/pooltogether/pooltogether.test.ts @@ -8,7 +8,7 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { tokens } from "../../../scripts/constant/tokens"; diff --git a/test/mainnet/uniswap/uniswap.test.ts b/test/mainnet/uniswap/uniswap.test.ts index b123d87a..9b6761b3 100644 --- a/test/mainnet/uniswap/uniswap.test.ts +++ b/test/mainnet/uniswap/uniswap.test.ts @@ -8,7 +8,7 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/uniswapStake/uniswapStake.test.ts b/test/mainnet/uniswapStake/uniswapStake.test.ts index 3d704dcb..0a86080d 100644 --- a/test/mainnet/uniswapStake/uniswapStake.test.ts +++ b/test/mainnet/uniswapStake/uniswapStake.test.ts @@ -9,7 +9,7 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { abi } from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json" import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/yearn/yearn.test.ts b/test/mainnet/yearn/yearn.test.ts index 53a69406..055b22c9 100644 --- a/test/mainnet/yearn/yearn.test.ts +++ b/test/mainnet/yearn/yearn.test.ts @@ -8,7 +8,7 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { tokens } from "../../../scripts/constant/tokens"; import { Signer, Contract, BigNumber } from "ethers"; diff --git a/test/polygon/pooltogether/pooltogether.test.ts b/test/polygon/pooltogether/pooltogether.test.ts index 0b41934f..52b34073 100644 --- a/test/polygon/pooltogether/pooltogether.test.ts +++ b/test/polygon/pooltogether/pooltogether.test.ts @@ -10,7 +10,7 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; -import { addresses } from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { tokens } from "../../../scripts/constant/tokens"; import type { Signer, Contract } from "ethers"; From 30a1939c424feaa531476be5b299c8683ae65910 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Fri, 10 Dec 2021 17:14:36 +0530 Subject: [PATCH 30/39] updated scripts --- ...{deployAvaxConnector.ts => deployAndVerifyOnSourcify.ts} | 2 +- scripts/deployment/deployCompoundMapping.ts | 2 +- scripts/deployment/deployConnectorsFromCmd.ts | 6 +++--- scripts/deployment/deployInstaMappingController.ts | 2 +- scripts/deployment/deployMappingContract.ts | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) rename scripts/deployment/{deployAvaxConnector.ts => deployAndVerifyOnSourcify.ts} (94%) diff --git a/scripts/deployment/deployAvaxConnector.ts b/scripts/deployment/deployAndVerifyOnSourcify.ts similarity index 94% rename from scripts/deployment/deployAvaxConnector.ts rename to scripts/deployment/deployAndVerifyOnSourcify.ts index 645a3b98..4aee27e8 100644 --- a/scripts/deployment/deployAvaxConnector.ts +++ b/scripts/deployment/deployAndVerifyOnSourcify.ts @@ -1,4 +1,4 @@ -import * as hre from "hardhat"; +import hre from "hardhat"; const { ethers, deployments, getUnnamedAccounts } = hre; const { deploy } = deployments; diff --git a/scripts/deployment/deployCompoundMapping.ts b/scripts/deployment/deployCompoundMapping.ts index 3534208d..a5c78cd8 100644 --- a/scripts/deployment/deployCompoundMapping.ts +++ b/scripts/deployment/deployCompoundMapping.ts @@ -1,4 +1,4 @@ -import * as hre from "hardhat"; +import hre from "hardhat"; const { ethers } = hre; async function main() { const CONNECTORS_V2 = "0x97b0B3A8bDeFE8cB9563a3c610019Ad10DB8aD11"; diff --git a/scripts/deployment/deployConnectorsFromCmd.ts b/scripts/deployment/deployConnectorsFromCmd.ts index 39c55bdc..f3c24f45 100644 --- a/scripts/deployment/deployConnectorsFromCmd.ts +++ b/scripts/deployment/deployConnectorsFromCmd.ts @@ -1,5 +1,5 @@ -import * as fs from "fs"; -import * as hre from "hardhat" +import fs from "fs"; +import hre from "hardhat" const { ethers, network, config } = hre; let args = process.argv; @@ -30,7 +30,7 @@ if (!params.hasOwnProperty("gasPrice")) { process.exit(-1); } -let privateKey = process.env.PRIVATE_KEY; +let privateKey = String(process.env.PRIVATE_KEY); let provider = new ethers.providers.JsonRpcProvider( config.networks[params["network"]].url ); diff --git a/scripts/deployment/deployInstaMappingController.ts b/scripts/deployment/deployInstaMappingController.ts index abdacfb8..daeed499 100644 --- a/scripts/deployment/deployInstaMappingController.ts +++ b/scripts/deployment/deployInstaMappingController.ts @@ -1,4 +1,4 @@ -import * as hre from "hardhat"; +import hre from "hardhat"; const { ethers } = hre; async function main() { diff --git a/scripts/deployment/deployMappingContract.ts b/scripts/deployment/deployMappingContract.ts index c55d9991..69a4bc4d 100644 --- a/scripts/deployment/deployMappingContract.ts +++ b/scripts/deployment/deployMappingContract.ts @@ -1,4 +1,4 @@ -import * as hre from "hardhat"; +import hre from "hardhat"; const { ethers } = hre; async function main() { From f8a812fb2fe6448dc07decfa8afbdc824f8ac3fe Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Fri, 10 Dec 2021 17:15:10 +0530 Subject: [PATCH 31/39] fixed liquidity test --- test/mainnet/b.protocol/b.liquity.test.ts | 2 +- test/mainnet/liquity/liquity.helpers.ts | 5 +- test/mainnet/liquity/liquity.test.ts | 499 +++++++++--------- .../mainnet/pooltogether/pooltogether.test.ts | 13 + 4 files changed, 276 insertions(+), 243 deletions(-) diff --git a/test/mainnet/b.protocol/b.liquity.test.ts b/test/mainnet/b.protocol/b.liquity.test.ts index f3469226..eae222f5 100644 --- a/test/mainnet/b.protocol/b.liquity.test.ts +++ b/test/mainnet/b.protocol/b.liquity.test.ts @@ -7,10 +7,10 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import { addresses } from "../../../scripts/constant/addresses"; import { abis } from "../../../scripts/constant/abis"; import { ConnectV2BLiquity__factory } from "../../../typechain"; import type { Signer, Contract } from "ethers"; +import addresses from "../../../scripts/constant/addresses"; const LUSD_WHALE = "0x66017D22b0f8556afDd19FC67041899Eb65a21bb" // stability pool const BAMM_ADDRESS = "0x0d3AbAA7E088C2c82f54B2f47613DA438ea8C598" diff --git a/test/mainnet/liquity/liquity.helpers.ts b/test/mainnet/liquity/liquity.helpers.ts index 0fd8f191..17e0b8af 100644 --- a/test/mainnet/liquity/liquity.helpers.ts +++ b/test/mainnet/liquity/liquity.helpers.ts @@ -18,7 +18,6 @@ import { ConnectV2Liquity__factory, ConnectV2Basic__factory } from "../../../typ // Instadapp uses a fake address to represent native ETH import { constants } from "../../../scripts/constant/constant"; import type { Signer, Contract, BigNumber } from "ethers"; - const LIQUITY_CONNECTOR = "LIQUITY-v1-TEST"; const LUSD_GAS_COMPENSATION = hre.ethers.utils.parseUnits("200", 18); // 200 LUSD gas compensation repaid after loan repayment const LIQUIDATABLE_TROVES_BLOCK_NUMBER = 12478159; // Deterministic block number for tests to run against, if you change this, tests will break. @@ -92,9 +91,7 @@ const sendToken = async (token: any, amount: any, from: any, to: any) => { }); const signer = hre.ethers.provider.getSigner(from); - return await token.connect(signer).transfer(to, amount, { - gasPrice: 0, - }); + return await token.connect(signer).transfer(to, amount); }; const resetInitialState = async (walletAddress: any, contracts: any, isDebug = false) => { diff --git a/test/mainnet/liquity/liquity.test.ts b/test/mainnet/liquity/liquity.test.ts index 5eae01a1..10cfe29e 100644 --- a/test/mainnet/liquity/liquity.test.ts +++ b/test/mainnet/liquity/liquity.test.ts @@ -10,15 +10,13 @@ import contracts from "./liquity.contracts"; // Liquity helpers import helpers from "./liquity.helpers"; -import { Contract, Signer } from "ethers"; describe("Liquity", () => { const { waffle, ethers } = hre; const { provider } = waffle; - + let userWallet: any; // Waffle test account 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 (holds 1000 ETH) - const userWallet = provider.getWallets()[0]; - let dsa: any; + let dsaWallet0: any; let liquity: any; before(async () => { @@ -48,9 +46,10 @@ describe("Liquity", () => { }); beforeEach(async () => { + userWallet = provider.getWallets()[0]; // Build a new DSA before each test so we start each test from the same default state - dsa = await buildDSAv2(userWallet.address); - expect(dsa.address).to.exist; + dsaWallet0 = await buildDSAv2(userWallet.address); + expect(dsaWallet0.address).to.exist; }); describe("Main (Connector)", () => { @@ -66,45 +65,50 @@ describe("Liquity", () => { userWallet.address ); const originalDsaBalance = await ethers.provider.getBalance( - dsa.address + dsaWallet0.address ); - const openTroveSpell = { - connector: helpers.LIQUITY_CONNECTOR, - method: "open", - args: [ - depositAmount, - maxFeePercentage, - borrowAmount, - upperHint, - lowerHint, - [0, 0], - [0, 0], - ], - }; + const openTroveSpell = [ + { + connector: helpers.LIQUITY_CONNECTOR, + method: "open", + args: [ + depositAmount, + maxFeePercentage, + borrowAmount, + upperHint, + lowerHint, + [0, 0], + [0, 0], + ], + }, + ]; - await dsa + await dsaWallet0 .connect(userWallet) - .cast(...encodeSpells([openTroveSpell]), userWallet.address, { + .cast(...encodeSpells(openTroveSpell), userWallet.address, { value: depositAmount, - gasPrice: 0, }); const userBalance = await ethers.provider.getBalance( userWallet.address ); - const dsaEthBalance = await ethers.provider.getBalance(dsa.address); - const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); + const dsaEthBalance = await ethers.provider.getBalance( + dsaWallet0.address + ); + const dsaLusdBalance = await liquity.lusdToken.balanceOf( + dsaWallet0.address + ); const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); - expect(userBalance).eq( + expect(userBalance).lt( originalUserBalance.sub(depositAmount), - "User's Ether balance should decrease by the amount they deposited" + "User's Ether balance should decrease" ); expect(dsaEthBalance).to.eq( @@ -138,7 +142,7 @@ describe("Liquity", () => { userWallet.address ); const originalDsaBalance = await ethers.provider.getBalance( - dsa.address + dsaWallet0.address ); const depositId = 1; // Choose an ID to store and retrieve the deposited ETH @@ -163,26 +167,29 @@ describe("Liquity", () => { }; const spells = [depositEthSpell, openTroveSpell]; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells(spells), userWallet.address, { value: depositAmount, - gasPrice: 0, }); const userBalance = await ethers.provider.getBalance( userWallet.address ); - const dsaEthBalance = await ethers.provider.getBalance(dsa.address); - const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); + const dsaEthBalance = await ethers.provider.getBalance( + dsaWallet0.address + ); + const dsaLusdBalance = await liquity.lusdToken.balanceOf( + dsaWallet0.address + ); const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); - expect(userBalance).eq( + expect(userBalance).lt( originalUserBalance.sub(depositAmount), "User's Ether balance should decrease by the amount they deposited" ); @@ -218,7 +225,7 @@ describe("Liquity", () => { userWallet.address ); const originalDsaBalance = await ethers.provider.getBalance( - dsa.address + dsaWallet0.address ); const borrowId = 1; @@ -242,33 +249,36 @@ describe("Liquity", () => { args: [ contracts.LUSD_TOKEN_ADDRESS, 0, // Amount comes from the previous spell's setId - dsa.address, + dsaWallet0.address, borrowId, 0, ], }; const spells = [openTroveSpell, withdrawLusdSpell]; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells(spells), userWallet.address, { value: depositAmount, - gasPrice: 0, }); const userBalance = await ethers.provider.getBalance( userWallet.address ); - const dsaEthBalance = await ethers.provider.getBalance(dsa.address); - const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); + const dsaEthBalance = await ethers.provider.getBalance( + dsaWallet0.address + ); + const dsaLusdBalance = await liquity.lusdToken.balanceOf( + dsaWallet0.address + ); const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); - expect(userBalance).eq( + expect(userBalance).lt( originalUserBalance.sub(depositAmount), "User's Ether balance should decrease by the amount they deposited" ); @@ -315,7 +325,7 @@ describe("Liquity", () => { ], }; - const openTx = await dsa.cast( + const openTx = await dsaWallet0.cast( ...encodeSpells([openTroveSpell]), userWallet.address, { @@ -339,7 +349,7 @@ describe("Liquity", () => { "uint256[]", ], [ - dsa.address, + dsaWallet0.address, maxFeePercentage, depositAmount, borrowAmount, @@ -357,7 +367,7 @@ describe("Liquity", () => { const borrowAmount = ethers.utils.parseUnits("2000", 18); // Create a dummy Trove await helpers.createDsaTrove( - dsa, + dsaWallet0, userWallet, liquity, depositAmount, @@ -365,11 +375,11 @@ describe("Liquity", () => { ); const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); // Send DSA account enough LUSD (from Stability Pool) to close their Trove @@ -381,11 +391,11 @@ describe("Liquity", () => { liquity.lusdToken, extraLusdRequiredToCloseTrove, contracts.STABILITY_POOL_ADDRESS, - dsa.address + dsaWallet0.address ); const originalDsaLusdBalance = await liquity.lusdToken.balanceOf( - dsa.address + dsaWallet0.address ); expect( @@ -399,17 +409,21 @@ describe("Liquity", () => { args: [0], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([closeTroveSpell]), userWallet.address); - const dsaEthBalance = await ethers.provider.getBalance(dsa.address); - const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); + const dsaEthBalance = await ethers.provider.getBalance( + dsaWallet0.address + ); + const dsaLusdBalance = await liquity.lusdToken.balanceOf( + dsaWallet0.address + ); const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); @@ -432,13 +446,13 @@ describe("Liquity", () => { it("closes a Trove using LUSD obtained from a previous spell", async () => { // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); // Send user enough LUSD to repay the loan, we'll use a deposit and withdraw spell to obtain it @@ -452,7 +466,7 @@ describe("Liquity", () => { // Allow DSA to spend user's LUSD await liquity.lusdToken .connect(userWallet) - .approve(dsa.address, troveDebtBefore); + .approve(dsaWallet0.address, troveDebtBefore); // Simulate a spell which would have pulled LUSD from somewhere (e.g. Uniswap) into InstaMemory // In this case we're simply running a deposit spell from the user's EOA @@ -469,16 +483,18 @@ describe("Liquity", () => { }; const spells = [depositLusdSpell, closeTroveSpell]; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells(spells), userWallet.address); - const dsaEthBalance = await ethers.provider.getBalance(dsa.address); + const dsaEthBalance = await ethers.provider.getBalance( + dsaWallet0.address + ); const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); @@ -499,7 +515,7 @@ describe("Liquity", () => { const borrowAmount = ethers.utils.parseUnits("2000", 18); // Create a dummy Trove await helpers.createDsaTrove( - dsa, + dsaWallet0, userWallet, liquity, depositAmount, @@ -507,10 +523,10 @@ describe("Liquity", () => { ); const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); // Send DSA account enough LUSD (from Stability Pool) to close their Trove @@ -521,10 +537,10 @@ describe("Liquity", () => { liquity.lusdToken, extraLusdRequiredToCloseTrove, contracts.STABILITY_POOL_ADDRESS, - dsa.address + dsaWallet0.address ); const originalDsaLusdBalance = await liquity.lusdToken.balanceOf( - dsa.address + dsaWallet0.address ); expect( @@ -546,26 +562,30 @@ describe("Liquity", () => { args: [ helpers.ETH, 0, // amount comes from the previous spell's setId - dsa.address, + dsaWallet0.address, collateralWithdrawId, 0, ], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast( ...encodeSpells([closeTroveSpell, withdrawEthSpell]), userWallet.address ); - const dsaEthBalance = await ethers.provider.getBalance(dsa.address); - const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); + const dsaEthBalance = await ethers.provider.getBalance( + dsaWallet0.address + ); + const dsaLusdBalance = await liquity.lusdToken.balanceOf( + dsaWallet0.address + ); const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); expect(troveDebt, "Trove debt should equal 0 after close").to.eq(0); @@ -591,7 +611,7 @@ describe("Liquity", () => { const borrowAmount = ethers.utils.parseUnits("2000", 18); // Create a dummy Trove await helpers.createDsaTrove( - dsa, + dsaWallet0, userWallet, liquity, depositAmount, @@ -601,7 +621,7 @@ describe("Liquity", () => { liquity.lusdToken, ethers.utils.parseUnits("2500", 18), contracts.STABILITY_POOL_ADDRESS, - dsa.address + dsaWallet0.address ); const closeTroveSpell = { @@ -610,7 +630,7 @@ describe("Liquity", () => { args: [0], }; - const closeTx = await dsa + const closeTx = await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([closeTroveSpell]), userWallet.address); @@ -620,7 +640,7 @@ describe("Liquity", () => { ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256"], - [dsa.address, 0] + [dsaWallet0.address, 0] ); expect(castLogEvent.eventNames[0]).eq("LogClose(address,uint256)"); expect(castLogEvent.eventParams[0]).eq(expectedEventParams); @@ -629,11 +649,10 @@ describe("Liquity", () => { describe("deposit()", () => { it("deposits ETH into a Trove", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const topupAmount = ethers.utils.parseEther("1"); @@ -645,14 +664,14 @@ describe("Liquity", () => { args: [topupAmount, upperHint, lowerHint, 0, 0], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([depositEthSpell]), userWallet.address, { value: topupAmount, }); const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const expectedTroveCollateral = troveCollateralBefore.add( @@ -666,10 +685,9 @@ describe("Liquity", () => { }); it("deposits using ETH gained from a previous spell", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const topupAmount = ethers.utils.parseEther("1"); @@ -689,14 +707,14 @@ describe("Liquity", () => { }; const spells = [depositEthSpell, depositEthToTroveSpell]; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells(spells), userWallet.address, { value: topupAmount, }); const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const expectedTroveCollateral = troveCollateralBefore.add( @@ -710,8 +728,7 @@ describe("Liquity", () => { }); it("returns Instadapp event name and data", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const topupAmount = ethers.utils.parseEther("1"); const upperHint = ethers.constants.AddressZero; @@ -722,7 +739,7 @@ describe("Liquity", () => { args: [topupAmount, upperHint, lowerHint, 0, 0], }; - const depositTx = await dsa + const depositTx = await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([depositEthSpell]), userWallet.address, { value: topupAmount, @@ -734,7 +751,7 @@ describe("Liquity", () => { ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256"], - [dsa.address, topupAmount, 0, 0] + [dsaWallet0.address, topupAmount, 0, 0] ); expect(castLogEvent.eventNames[0]).eq( "LogDeposit(address,uint256,uint256,uint256)" @@ -745,11 +762,10 @@ describe("Liquity", () => { describe("withdraw()", () => { it("withdraws ETH from a Trove", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const withdrawAmount = ethers.utils.parseEther("1"); const upperHint = ethers.constants.AddressZero; @@ -760,12 +776,12 @@ describe("Liquity", () => { args: [withdrawAmount, upperHint, lowerHint, 0, 0], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([withdrawEthSpell]), userWallet.address); const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const expectedTroveCollateral = troveCollateralBefore.sub( withdrawAmount @@ -778,11 +794,10 @@ describe("Liquity", () => { }); it("withdraws ETH from a Trove and stores the ETH for other spells to use", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const originalUserEthBalance = await ethers.provider.getBalance( userWallet.address @@ -804,14 +819,12 @@ describe("Liquity", () => { args: [helpers.ETH, 0, userWallet.address, withdrawId, 0], }; const spells = [withdrawEthFromTroveSpell, withdrawEthSpell]; - await dsa + await dsaWallet0 .connect(userWallet) - .cast(...encodeSpells(spells), userWallet.address, { - gasPrice: 0, // Remove gas costs so we can check balances have changed correctly - }); + .cast(...encodeSpells(spells), userWallet.address); const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const expectedTroveCollateral = troveCollateralBefore.sub( withdrawAmount @@ -828,12 +841,11 @@ describe("Liquity", () => { expect( userEthBalance, `User ETH balance should have increased by ${withdrawAmount} ETH` - ).to.eq(originalUserEthBalance.add(withdrawAmount)); + ).to.lt(originalUserEthBalance.add(withdrawAmount)); }); it("returns Instadapp event name and data", async () => { - // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const withdrawAmount = ethers.utils.parseEther("1"); const upperHint = ethers.constants.AddressZero; @@ -844,7 +856,7 @@ describe("Liquity", () => { args: [withdrawAmount, upperHint, lowerHint, 0, 0], }; - const withdrawTx = await dsa + const withdrawTx = await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([withdrawEthSpell]), userWallet.address); @@ -854,7 +866,7 @@ describe("Liquity", () => { ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256"], - [dsa.address, withdrawAmount, 0, 0] + [dsaWallet0.address, withdrawAmount, 0, 0] ); expect(castLogEvent.eventNames[0]).eq( "LogWithdraw(address,uint256,uint256,uint256)" @@ -866,10 +878,10 @@ describe("Liquity", () => { describe("borrow()", () => { it("borrows LUSD from a Trove", async () => { // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD @@ -883,12 +895,12 @@ describe("Liquity", () => { }; // Borrow more LUSD from the Trove - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([borrowSpell]), userWallet.address); const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const expectedTroveDebt = troveDebtBefore.add(borrowAmount); @@ -900,10 +912,10 @@ describe("Liquity", () => { it("borrows LUSD from a Trove and stores the LUSD for other spells to use", async () => { // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD @@ -937,12 +949,12 @@ describe("Liquity", () => { const spells = [borrowSpell, withdrawSpell]; // Borrow more LUSD from the Trove - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells(spells), userWallet.address); const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const expectedTroveDebt = troveDebtBefore.add(borrowAmount); const userLusdBalance = await liquity.lusdToken.balanceOf( @@ -962,7 +974,7 @@ describe("Liquity", () => { it("returns Instadapp event name and data", async () => { // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const borrowAmount = ethers.utils.parseUnits("1000", 18); // 1000 LUSD const upperHint = ethers.constants.AddressZero; @@ -974,7 +986,7 @@ describe("Liquity", () => { args: [maxFeePercentage, borrowAmount, upperHint, lowerHint, 0, 0], }; - const borrowTx = await dsa + const borrowTx = await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([borrowSpell]), userWallet.address); @@ -984,7 +996,7 @@ describe("Liquity", () => { ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256"], - [dsa.address, borrowAmount, 0, 0] + [dsaWallet0.address, borrowAmount, 0, 0] ); expect(castLogEvent.eventNames[0]).eq( "LogBorrow(address,uint256,uint256,uint256)" @@ -1000,7 +1012,7 @@ describe("Liquity", () => { // Create a dummy Trove await helpers.createDsaTrove( - dsa, + dsaWallet0, userWallet, liquity, depositAmount, @@ -1008,7 +1020,7 @@ describe("Liquity", () => { ); const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); // DSA account is holding 2500 LUSD from opening a Trove, so we use some of that to repay const repayAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD @@ -1024,12 +1036,12 @@ describe("Liquity", () => { args: [repayAmount, upperHint, lowerHint, 0, 0], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([repaySpell]), userWallet.address); const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const expectedTroveDebt = troveDebtBefore.sub(repayAmount); @@ -1045,7 +1057,7 @@ describe("Liquity", () => { // Create a dummy Trove await helpers.createDsaTrove( - dsa, + dsaWallet0, userWallet, liquity, depositAmount, @@ -1053,7 +1065,7 @@ describe("Liquity", () => { ); const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const repayAmount = ethers.utils.parseUnits("100", 18); // 100 LUSD @@ -1067,14 +1079,14 @@ describe("Liquity", () => { await helpers.sendToken( liquity.lusdToken, borrowAmount, - dsa.address, + dsaWallet0.address, userWallet.address ); // Allow DSA to spend user's LUSD await liquity.lusdToken .connect(userWallet) - .approve(dsa.address, repayAmount); + .approve(dsaWallet0.address, repayAmount); const lusdDepositId = 1; const depositSpell = { @@ -1090,12 +1102,12 @@ describe("Liquity", () => { const spells = [depositSpell, borrowSpell]; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells(spells), userWallet.address); const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const expectedTroveDebt = troveDebtBefore.sub(repayAmount); @@ -1110,7 +1122,7 @@ describe("Liquity", () => { const depositAmount = ethers.utils.parseEther("5"); const borrowAmount = ethers.utils.parseUnits("2500", 18); await helpers.createDsaTrove( - dsa, + dsaWallet0, userWallet, liquity, depositAmount, @@ -1130,7 +1142,7 @@ describe("Liquity", () => { args: [repayAmount, upperHint, lowerHint, 0, 0], }; - const repayTx = await dsa + const repayTx = await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([borrowSpell]), userWallet.address, { value: repayAmount, @@ -1142,7 +1154,7 @@ describe("Liquity", () => { ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256"], - [dsa.address, repayAmount, 0, 0] + [dsaWallet0.address, repayAmount, 0, 0] ); expect(castLogEvent.eventNames[0]).eq( "LogRepay(address,uint256,uint256,uint256)" @@ -1154,13 +1166,13 @@ describe("Liquity", () => { describe("adjust()", () => { it("adjusts a Trove: deposit ETH and borrow LUSD", async () => { // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const depositAmount = ethers.utils.parseEther("1"); // 1 ETH const borrowAmount = ethers.utils.parseUnits("500", 18); // 500 LUSD @@ -1187,7 +1199,7 @@ describe("Liquity", () => { }; // Adjust Trove by depositing ETH and borrowing LUSD - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([adjustSpell]), userWallet.address, { value: depositAmount, @@ -1195,10 +1207,10 @@ describe("Liquity", () => { }); const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const expectedTroveColl = troveCollateralBefore.add(depositAmount); const expectedTroveDebt = troveDebtBefore.add(borrowAmount); @@ -1216,13 +1228,13 @@ describe("Liquity", () => { it("adjusts a Trove: withdraw ETH and repay LUSD", async () => { // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const depositAmount = 0; const borrowAmount = 0; @@ -1252,7 +1264,7 @@ describe("Liquity", () => { }; // Adjust Trove by withdrawing ETH and repaying LUSD - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([adjustSpell]), userWallet.address, { value: depositAmount, @@ -1260,10 +1272,10 @@ describe("Liquity", () => { }); const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const expectedTroveColl = troveCollateralBefore.sub(withdrawAmount); const expectedTroveDebt = troveDebtBefore.sub(repayAmount); @@ -1281,13 +1293,13 @@ describe("Liquity", () => { it("adjusts a Trove: deposit ETH and repay LUSD using previous spells", async () => { // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const troveDebtBefore = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const depositAmount = ethers.utils.parseEther("1"); // 1 ETH const borrowAmount = 0; @@ -1340,10 +1352,10 @@ describe("Liquity", () => { // Allow DSA to spend user's LUSD await liquity.lusdToken .connect(userWallet) - .approve(dsa.address, repayAmount); + .approve(dsaWallet0.address, repayAmount); // Adjust Trove by depositing ETH and repaying LUSD - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells(spells), userWallet.address, { value: depositAmount, @@ -1351,10 +1363,10 @@ describe("Liquity", () => { }); const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const troveDebt = await liquity.troveManager.getTroveDebt( - dsa.address + dsaWallet0.address ); const expectedTroveColl = troveCollateralBefore.add(depositAmount); const expectedTroveDebt = troveDebtBefore.sub(repayAmount); @@ -1372,7 +1384,7 @@ describe("Liquity", () => { it("adjusts a Trove: withdraw ETH, borrow LUSD, and store the amounts for other spells", async () => { // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const userEthBalanceBefore = await ethers.provider.getBalance( userWallet.address @@ -1429,11 +1441,10 @@ describe("Liquity", () => { const spells = [adjustSpell, withdrawEthSpell, withdrawLusdSpell]; // Adjust Trove by withdrawing ETH and borrowing LUSD - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells(spells), userWallet.address, { gasLimit: helpers.MAX_GAS, - gasPrice: 0, }); const userEthBalanceAfter = await ethers.provider.getBalance( @@ -1442,7 +1453,7 @@ describe("Liquity", () => { const userLusdBalanceAfter = await liquity.lusdToken.balanceOf( userWallet.address ); - expect(userEthBalanceAfter).eq( + expect(userEthBalanceAfter).lt( userEthBalanceBefore.add(withdrawAmount) ); expect(userLusdBalanceAfter).eq( @@ -1452,7 +1463,7 @@ describe("Liquity", () => { it("returns Instadapp event name and data", async () => { // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const depositAmount = ethers.utils.parseEther("1"); // 1 ETH const borrowAmount = ethers.utils.parseUnits("500", 18); // 500 LUSD @@ -1478,7 +1489,7 @@ describe("Liquity", () => { ], }; - const adjustTx = await dsa + const adjustTx = await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([adjustSpell]), userWallet.address, { value: depositAmount, @@ -1501,7 +1512,7 @@ describe("Liquity", () => { "uint256[]", ], [ - dsa.address, + dsaWallet0.address, maxFeePercentage, depositAmount, withdrawAmount, @@ -1525,7 +1536,7 @@ describe("Liquity", () => { const borrowAmount = ethers.utils.parseUnits("2500", 18); await helpers.createDsaTrove( - dsa, + dsaWallet0, userWallet, liquity, depositAmount, @@ -1564,7 +1575,7 @@ describe("Liquity", () => { ); const remainingEthCollateral = await liquity.collSurplus.getCollateral( - dsa.address + dsaWallet0.address ); // Claim the remaining collateral from the redeemed Trove @@ -1574,14 +1585,16 @@ describe("Liquity", () => { args: [0], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast( ...encodeSpells([claimCollateralFromRedemptionSpell]), userWallet.address ); - const ethBalance = await ethers.provider.getBalance(dsa.address); + const ethBalance = await ethers.provider.getBalance( + dsaWallet0.address + ); expect(ethBalance).to.eq(remainingEthCollateral); }); @@ -1592,7 +1605,7 @@ describe("Liquity", () => { const borrowAmount = ethers.utils.parseUnits("2500", 18); await helpers.createDsaTrove( - dsa, + dsaWallet0, userWallet, liquity, depositAmount, @@ -1631,7 +1644,7 @@ describe("Liquity", () => { } ); const claimAmount = await liquity.collSurplus.getCollateral( - dsa.address + dsaWallet0.address ); const claimCollateralFromRedemptionSpell = { @@ -1640,7 +1653,7 @@ describe("Liquity", () => { args: [setId], }; - const claimTx = await dsa + const claimTx = await dsaWallet0 .connect(userWallet) .cast( ...encodeSpells([claimCollateralFromRedemptionSpell]), @@ -1653,7 +1666,7 @@ describe("Liquity", () => { ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256"], - [dsa.address, claimAmount, setId] + [dsaWallet0.address, claimAmount, setId] ); expect(castLogEvent.eventNames[0]).eq( "LogClaimCollateralFromRedemption(address,uint256,uint256)" @@ -1673,7 +1686,7 @@ describe("Liquity", () => { liquity.lusdToken, amount, contracts.STABILITY_POOL_ADDRESS, - dsa.address + dsaWallet0.address ); const stabilityDepositSpell = { @@ -1682,12 +1695,12 @@ describe("Liquity", () => { args: [amount, frontendTag, 0, 0, 0, 0], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( - dsa.address + dsaWallet0.address ); expect(depositedAmount).to.eq(amount); }); @@ -1719,14 +1732,14 @@ describe("Liquity", () => { // Allow DSA to spend user's LUSD await liquity.lusdToken .connect(userWallet) - .approve(dsa.address, amount); + .approve(dsaWallet0.address, amount); - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells(spells), userWallet.address); const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( - dsa.address + dsaWallet0.address ); expect(depositedAmount).to.eq(amount); }); @@ -1744,7 +1757,7 @@ describe("Liquity", () => { liquity.lusdToken, amount, contracts.STABILITY_POOL_ADDRESS, - dsa.address + dsaWallet0.address ); const stabilityDepositSpell = { @@ -1761,7 +1774,7 @@ describe("Liquity", () => { }; // Create a Stability deposit for this DSA - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); @@ -1788,14 +1801,14 @@ describe("Liquity", () => { .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); const ethGain = await liquity.stabilityPool.getDepositorETHGain( - dsa.address + dsaWallet0.address ); const lqtyGain = await liquity.stabilityPool.getDepositorLQTYGain( - dsa.address + dsaWallet0.address ); // Top up the user's deposit so that we can track their ETH and LQTY gain - const depositAgainTx = await dsa + const depositAgainTx = await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); @@ -1816,7 +1829,7 @@ describe("Liquity", () => { "uint256", ], [ - dsa.address, + dsaWallet0.address, halfAmount, ethGain, lqtyGain, @@ -1837,7 +1850,7 @@ describe("Liquity", () => { describe("stabilityWithdraw()", () => { it("withdraws from Stability Pool", async () => { // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool - [liquity, dsa] = await helpers.resetInitialState( + [liquity, dsaWallet0] = await helpers.resetInitialState( userWallet.address, contracts ); @@ -1855,7 +1868,7 @@ describe("Liquity", () => { liquity.lusdToken, amount, contracts.STABILITY_POOL_ADDRESS, - dsa.address + dsaWallet0.address ); const stabilityDepositSpell = { @@ -1872,14 +1885,16 @@ describe("Liquity", () => { }; const spells = [stabilityDepositSpell, stabilityWithdrawSpell]; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells(spells), userWallet.address); const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( - dsa.address + dsaWallet0.address + ); + const dsaLusdBalance = await liquity.lusdToken.balanceOf( + dsaWallet0.address ); - const dsaLusdBalance = await liquity.lusdToken.balanceOf(dsa.address); expect(depositedAmount).to.eq(amount.div(2)); expect(dsaLusdBalance).to.eq(amount.div(2)); @@ -1887,7 +1902,7 @@ describe("Liquity", () => { it("withdraws from Stability Pool and stores the LUSD for other spells", async () => { // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool - [liquity, dsa] = await helpers.resetInitialState( + [liquity, dsaWallet0] = await helpers.resetInitialState( userWallet.address, contracts ); @@ -1905,7 +1920,7 @@ describe("Liquity", () => { liquity.lusdToken, amount, contracts.STABILITY_POOL_ADDRESS, - dsa.address + dsaWallet0.address ); const stabilityDepositSpell = { @@ -1939,15 +1954,15 @@ describe("Liquity", () => { withdrawLusdSpell, ]; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells(spells), userWallet.address); const depositedAmount = await liquity.stabilityPool.getCompoundedLUSDDeposit( - dsa.address + dsaWallet0.address ); const walletLusdBalance = await liquity.lusdToken.balanceOf( - dsa.address + dsaWallet0.address ); expect(depositedAmount).to.eq(amount.div(2)); @@ -1956,7 +1971,7 @@ describe("Liquity", () => { it("returns Instadapp event name and data", async () => { // Start this test from scratch since we need to remove any liquidatable Troves withdrawing from Stability Pool - [liquity, dsa] = await helpers.resetInitialState( + [liquity, dsaWallet0] = await helpers.resetInitialState( userWallet.address, contracts ); @@ -1968,7 +1983,7 @@ describe("Liquity", () => { liquity.lusdToken, amount, contracts.STABILITY_POOL_ADDRESS, - dsa.address + dsaWallet0.address ); const stabilityDepositSpell = { @@ -1985,7 +2000,7 @@ describe("Liquity", () => { const setLqtyGainId = 0; // Create a Stability Pool deposit - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); @@ -2013,10 +2028,10 @@ describe("Liquity", () => { .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); const ethGain = await liquity.stabilityPool.getDepositorETHGain( - dsa.address + dsaWallet0.address ); const lqtyGain = await liquity.stabilityPool.getDepositorLQTYGain( - dsa.address + dsaWallet0.address ); const stabilityWithdrawSpell = { @@ -2031,7 +2046,7 @@ describe("Liquity", () => { ], }; - const withdrawTx = await dsa + const withdrawTx = await dsaWallet0 .connect(userWallet) .cast( ...encodeSpells([stabilityWithdrawSpell]), @@ -2054,7 +2069,7 @@ describe("Liquity", () => { "uint256", ], [ - dsa.address, + dsaWallet0.address, withdrawAmount, ethGain, lqtyGain, @@ -2074,7 +2089,7 @@ describe("Liquity", () => { describe("stabilityMoveEthGainToTrove()", () => { beforeEach(async () => { // Start these test from fresh so that we definitely have a liquidatable Trove within this block - [liquity, dsa] = await helpers.resetInitialState( + [liquity, dsaWallet0] = await helpers.resetInitialState( userWallet.address, contracts ); @@ -2083,9 +2098,9 @@ describe("Liquity", () => { it("moves ETH gain from Stability Pool to Trove", async () => { // Create a DSA owned Trove to capture ETH liquidation gains // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); const troveCollateralBefore = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); // Create a Stability Deposit using the Trove's borrowed LUSD @@ -2097,7 +2112,7 @@ describe("Liquity", () => { args: [amount, frontendTag, 0, 0, 0, 0], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); @@ -2109,7 +2124,7 @@ describe("Liquity", () => { }); const ethGainFromLiquidation = await liquity.stabilityPool.getDepositorETHGain( - dsa.address + dsaWallet0.address ); // Move ETH gain to Trove @@ -2119,15 +2134,15 @@ describe("Liquity", () => { args: [ethers.constants.AddressZero, ethers.constants.AddressZero], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([moveEthGainSpell]), userWallet.address); const ethGainAfterMove = await liquity.stabilityPool.getDepositorETHGain( - dsa.address + dsaWallet0.address ); const troveCollateral = await liquity.troveManager.getTroveColl( - dsa.address + dsaWallet0.address ); const expectedTroveCollateral = troveCollateralBefore.add( ethGainFromLiquidation @@ -2139,7 +2154,7 @@ describe("Liquity", () => { it("returns Instadapp event name and data", async () => { // Create a DSA owned Trove to capture ETH liquidation gains // Create a dummy Trove - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); // Create a Stability Deposit using the Trove's borrowed LUSD const amount = ethers.utils.parseUnits("100", 18); @@ -2150,7 +2165,7 @@ describe("Liquity", () => { args: [amount, frontendTag, 0, 0, 0, 0], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([stabilityDepositSpell]), userWallet.address); @@ -2162,7 +2177,7 @@ describe("Liquity", () => { }); const ethGainFromLiquidation = await liquity.stabilityPool.getDepositorETHGain( - dsa.address + dsaWallet0.address ); // Move ETH gain to Trove @@ -2172,7 +2187,7 @@ describe("Liquity", () => { args: [ethers.constants.AddressZero, ethers.constants.AddressZero], }; - const moveEthGainTx = await dsa + const moveEthGainTx = await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([moveEthGainSpell]), userWallet.address); @@ -2183,7 +2198,7 @@ describe("Liquity", () => { ).args; const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256"], - [dsa.address, ethGainFromLiquidation] + [dsaWallet0.address, ethGainFromLiquidation] ); expect(castLogEvent.eventNames[0]).eq( "LogStabilityMoveEthGainToTrove(address,uint256)" @@ -2205,7 +2220,7 @@ describe("Liquity", () => { liquity.lqtyToken, amount, helpers.JUSTIN_SUN_ADDRESS, - dsa.address + dsaWallet0.address ); const stakeSpell = { @@ -2214,11 +2229,13 @@ describe("Liquity", () => { args: [amount, 0, 0, 0, 0], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([stakeSpell]), userWallet.address); - const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); + const lqtyBalance = await liquity.lqtyToken.balanceOf( + dsaWallet0.address + ); expect(lqtyBalance).to.eq(0); const totalStakingBalance = await liquity.lqtyToken.balanceOf( @@ -2258,13 +2275,15 @@ describe("Liquity", () => { // Allow DSA to spend user's LQTY await liquity.lqtyToken .connect(userWallet) - .approve(dsa.address, amount); + .approve(dsaWallet0.address, amount); - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells(spells), userWallet.address); - const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); + const lqtyBalance = await liquity.lqtyToken.balanceOf( + dsaWallet0.address + ); expect(lqtyBalance).to.eq(0); const totalStakingBalance = await liquity.lqtyToken.balanceOf( @@ -2281,7 +2300,7 @@ describe("Liquity", () => { liquity.lqtyToken, amount, helpers.JUSTIN_SUN_ADDRESS, - dsa.address + dsaWallet0.address ); const getStakeId = 0; @@ -2294,7 +2313,7 @@ describe("Liquity", () => { args: [amount, getStakeId, setStakeId, setEthGainId, setLusdGainId], }; - const stakeTx = await dsa + const stakeTx = await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([stakeSpell]), userWallet.address); @@ -2306,7 +2325,7 @@ describe("Liquity", () => { const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256", "uint256", "uint256"], [ - dsa.address, + dsaWallet0.address, amount, getStakeId, setStakeId, @@ -2328,7 +2347,7 @@ describe("Liquity", () => { liquity.lqtyToken, amount, helpers.JUSTIN_SUN_ADDRESS, - dsa.address + dsaWallet0.address ); const stakeSpell = { @@ -2337,7 +2356,7 @@ describe("Liquity", () => { args: [amount, 0, 0, 0, 0], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([stakeSpell]), userWallet.address); @@ -2350,11 +2369,13 @@ describe("Liquity", () => { args: [amount, 0, 0, 0, 0], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([unstakeSpell]), userWallet.address); - const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); + const lqtyBalance = await liquity.lqtyToken.balanceOf( + dsaWallet0.address + ); expect(lqtyBalance).to.eq(amount); const totalStakingBalance = await liquity.lqtyToken.balanceOf( @@ -2371,7 +2392,7 @@ describe("Liquity", () => { liquity.lqtyToken, amount, helpers.JUSTIN_SUN_ADDRESS, - dsa.address + dsaWallet0.address ); const stakeSpell = { @@ -2380,7 +2401,7 @@ describe("Liquity", () => { args: [amount, 0, 0, 0, 0], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([stakeSpell]), userWallet.address); @@ -2406,11 +2427,13 @@ describe("Liquity", () => { ], }; const spells = [unstakeSpell, withdrawLqtySpell]; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells(spells), userWallet.address); - const lqtyBalance = await liquity.lqtyToken.balanceOf(dsa.address); + const lqtyBalance = await liquity.lqtyToken.balanceOf( + dsaWallet0.address + ); const totalStakingBalance = await liquity.lqtyToken.balanceOf( contracts.STAKING_ADDRESS ); @@ -2430,7 +2453,7 @@ describe("Liquity", () => { liquity.lqtyToken, amount, helpers.JUSTIN_SUN_ADDRESS, - dsa.address + dsaWallet0.address ); const stakeSpell = { @@ -2439,7 +2462,7 @@ describe("Liquity", () => { args: [amount, 0, 0, 0, 0], }; - await dsa + await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([stakeSpell]), userWallet.address); @@ -2459,7 +2482,7 @@ describe("Liquity", () => { ], }; - const unstakeTx = await dsa + const unstakeTx = await dsaWallet0 .connect(userWallet) .cast(...encodeSpells([unstakeSpell]), userWallet.address); @@ -2471,7 +2494,7 @@ describe("Liquity", () => { const expectedEventParams = ethers.utils.defaultAbiCoder.encode( ["address", "uint256", "uint256", "uint256", "uint256", "uint256"], [ - dsa.address, + dsaWallet0.address, amount, getUnstakeId, setUnstakeId, @@ -2508,7 +2531,7 @@ describe("Liquity", () => { .cast(...encodeSpells([stakeSpell]), userWallet.address); // Open a Trove to cause an ETH issuance gain for stakers - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); // Redeem some ETH to cause an LUSD redemption gain for stakers await helpers.redeem( @@ -2576,7 +2599,7 @@ describe("Liquity", () => { .cast(...encodeSpells([stakeSpell]), userWallet.address); // Open a Trove to cause an ETH issuance gain for stakers - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); // Redeem some ETH to cause an LUSD redemption gain for stakers await helpers.redeem( @@ -2635,7 +2658,7 @@ describe("Liquity", () => { await stakerDsa .connect(userWallet) .cast(...encodeSpells(spells), userWallet.address, { - gasPrice: 0, + ce: 0, }); const ethBalanceAfter = await ethers.provider.getBalance( @@ -2676,7 +2699,7 @@ describe("Liquity", () => { .cast(...encodeSpells([stakeSpell]), userWallet.address); // Open a Trove to cause an ETH issuance gain for stakers - await helpers.createDsaTrove(dsa, userWallet, liquity); + await helpers.createDsaTrove(dsaWallet0, userWallet, liquity); // Redeem some ETH to cause an LUSD redemption gain for stakers await helpers.redeem( diff --git a/test/mainnet/pooltogether/pooltogether.test.ts b/test/mainnet/pooltogether/pooltogether.test.ts index 94988ad3..1882a3f2 100644 --- a/test/mainnet/pooltogether/pooltogether.test.ts +++ b/test/mainnet/pooltogether/pooltogether.test.ts @@ -82,6 +82,19 @@ describe("PoolTogether", function() { const wallets = provider.getWallets(); const [wallet0, wallet1, wallet2, wallet3] = wallets; before(async () => { + await hre.network.provider.request({ + method: "hardhat_reset", + params: [ + { + forking: { + // @ts-ignore + jsonRpcUrl: hre.config.networks.hardhat.forking.url, + blockNumber: 12696000, + }, + }, + ], + }); + masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, From 06e5295533811c0f758e831e655b0fbfa36d8c93 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Fri, 10 Dec 2021 22:59:55 +0530 Subject: [PATCH 32/39] updated scripts --- scripts/constant/abis.ts | 2 +- scripts/tests/buildDSAv2.ts | 2 +- scripts/tests/deployAndEnableConnector.ts | 2 +- scripts/tests/encodeSpells.ts | 2 +- scripts/tests/getMasterSigner.ts | 2 +- test/mainnet/aave/v1.test.ts | 2 +- test/mainnet/aave/v2.test.ts | 2 +- test/mainnet/b.protocol/b.compound.test.ts | 2 +- test/mainnet/b.protocol/b.liquity.test.ts | 2 +- test/mainnet/b.protocol/b.maker.test.ts | 2 +- test/mainnet/basic-ERC1155/ERC1155-transfer.ts | 2 +- test/mainnet/basic-ERC721/ERC721-transfer.ts | 2 +- test/mainnet/compound/compound.test.ts | 2 +- test/mainnet/instapool/instapool.test.ts | 2 +- test/mainnet/liquity/liquity.helpers.ts | 2 +- test/mainnet/pooltogether/pooltogether.test.ts | 2 +- test/mainnet/uniswap/uniswap.test.ts | 2 +- test/mainnet/uniswapStake/uniswapStake.test.ts | 2 +- test/mainnet/yearn/yearn.test.ts | 2 +- test/polygon/pooltogether/pooltogether.test.ts | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/scripts/constant/abis.ts b/scripts/constant/abis.ts index 43097ba5..b63e82e8 100644 --- a/scripts/constant/abis.ts +++ b/scripts/constant/abis.ts @@ -1,4 +1,4 @@ -export const abis: Record = { +export default { core: { connectorsV2: require("./abi/core/connectorsV2.json"), instaIndex: require("./abi/core/instaIndex.json"), diff --git a/scripts/tests/buildDSAv2.ts b/scripts/tests/buildDSAv2.ts index 383d9ef1..d8a95ee1 100644 --- a/scripts/tests/buildDSAv2.ts +++ b/scripts/tests/buildDSAv2.ts @@ -2,7 +2,7 @@ import { ethers } from "hardhat"; import { addresses as addressesPolygon } from "./polygon/addresses"; import { addresses } from "./mainnet/addresses"; -import { abis } from "../constant/abis"; +import abis from "../constant/abis"; import { abi } from "../../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json"; function getAddress(network: string | undefined) { diff --git a/scripts/tests/deployAndEnableConnector.ts b/scripts/tests/deployAndEnableConnector.ts index 8e1f5d4b..324b56ec 100644 --- a/scripts/tests/deployAndEnableConnector.ts +++ b/scripts/tests/deployAndEnableConnector.ts @@ -1,6 +1,6 @@ import { addresses as addressesPolygon } from "./polygon/addresses"; import { addresses } from "./mainnet/addresses"; -import { abis } from "../constant/abis"; +import abis from "../constant/abis"; import hre from "hardhat"; import type { Signer, Contract } from "ethers"; diff --git a/scripts/tests/encodeSpells.ts b/scripts/tests/encodeSpells.ts index 62a7a8bb..81ddcb03 100644 --- a/scripts/tests/encodeSpells.ts +++ b/scripts/tests/encodeSpells.ts @@ -1,5 +1,5 @@ import { web3 } from "hardhat"; -import { abis } from "../constant/abis"; +import abis from "../constant/abis"; export function encodeSpells(spells: any[]) { const targets = spells.map((a) => a.connector); diff --git a/scripts/tests/getMasterSigner.ts b/scripts/tests/getMasterSigner.ts index 794bb4be..e0f0e0b1 100644 --- a/scripts/tests/getMasterSigner.ts +++ b/scripts/tests/getMasterSigner.ts @@ -1,7 +1,7 @@ import { ethers, network } from "hardhat"; import { addresses } from "./mainnet/addresses"; import { addresses as addressesPolygon } from "./polygon/addresses"; -import { abis } from "../constant/abis"; +import abis from "../constant/abis"; function getAddress(network: string | undefined) { if (network === "polygon") return addressesPolygon.core.instaIndex; diff --git a/test/mainnet/aave/v1.test.ts b/test/mainnet/aave/v1.test.ts index 6af2ac78..bdf7c22e 100644 --- a/test/mainnet/aave/v1.test.ts +++ b/test/mainnet/aave/v1.test.ts @@ -1,6 +1,6 @@ import hre from "hardhat"; import { expect } from "chai"; -import { abis } from "../../../scripts/constant/abis"; +import abis from "../../../scripts/constant/abis"; import addresses from "../../../scripts/constant/addresses"; import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; diff --git a/test/mainnet/aave/v2.test.ts b/test/mainnet/aave/v2.test.ts index 85d1fb18..7348555a 100644 --- a/test/mainnet/aave/v2.test.ts +++ b/test/mainnet/aave/v2.test.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; import hre from "hardhat"; -import { abis } from "../../../scripts/constant/abis"; +import abis from "../../../scripts/constant/abis"; import addresses from "../../../scripts/constant/addresses"; import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; diff --git a/test/mainnet/b.protocol/b.compound.test.ts b/test/mainnet/b.protocol/b.compound.test.ts index d222a2d0..743c8012 100644 --- a/test/mainnet/b.protocol/b.compound.test.ts +++ b/test/mainnet/b.protocol/b.compound.test.ts @@ -8,7 +8,7 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import addresses from "../../../scripts/constant/addresses"; -import { abis } from "../../../scripts/constant/abis"; +import abis from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { ConnectV2BCompound__factory } from "../../../typechain"; import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/b.protocol/b.liquity.test.ts b/test/mainnet/b.protocol/b.liquity.test.ts index eae222f5..007605a4 100644 --- a/test/mainnet/b.protocol/b.liquity.test.ts +++ b/test/mainnet/b.protocol/b.liquity.test.ts @@ -7,7 +7,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import { abis } from "../../../scripts/constant/abis"; +import abis from "../../../scripts/constant/abis"; import { ConnectV2BLiquity__factory } from "../../../typechain"; import type { Signer, Contract } from "ethers"; import addresses from "../../../scripts/constant/addresses"; diff --git a/test/mainnet/b.protocol/b.maker.test.ts b/test/mainnet/b.protocol/b.maker.test.ts index 31e82d34..84b8df36 100644 --- a/test/mainnet/b.protocol/b.maker.test.ts +++ b/test/mainnet/b.protocol/b.maker.test.ts @@ -8,7 +8,7 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import addresses from "../../../scripts/constant/addresses"; -import { abis } from "../../../scripts/constant/abis"; +import abis from "../../../scripts/constant/abis"; import { tokens } from "../../../scripts/constant/tokens"; import { ConnectV2BMakerDAO__factory } from "../../../typechain"; import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts index da0ab626..df9490a3 100644 --- a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts +++ b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts @@ -9,7 +9,7 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import addresses from "../../../scripts/constant/addresses" -import { abis } from "../../../scripts/constant/abis" +import abis from "../../../scripts/constant/abis" import type { Signer, Contract } from "ethers"; import { ConnectV2BasicERC1155__factory, IERC1155__factory } from "../../../typechain"; diff --git a/test/mainnet/basic-ERC721/ERC721-transfer.ts b/test/mainnet/basic-ERC721/ERC721-transfer.ts index d4811879..6139449d 100644 --- a/test/mainnet/basic-ERC721/ERC721-transfer.ts +++ b/test/mainnet/basic-ERC721/ERC721-transfer.ts @@ -9,7 +9,7 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import addresses from "../../../scripts/constant/addresses" -import { abis } from "../../../scripts/constant/abis" +import abis from "../../../scripts/constant/abis" import type { Signer, Contract } from "ethers"; import { ConnectV2BasicERC721__factory, IERC721__factory } from "../../../typechain"; diff --git a/test/mainnet/compound/compound.test.ts b/test/mainnet/compound/compound.test.ts index ccb1c228..0a92eb49 100644 --- a/test/mainnet/compound/compound.test.ts +++ b/test/mainnet/compound/compound.test.ts @@ -10,7 +10,7 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import addresses from "../../../scripts/constant/addresses"; -import { abis } from "../../../scripts/constant/abis"; +import abis from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { ConnectV2Compound__factory } from "../../../typechain"; diff --git a/test/mainnet/instapool/instapool.test.ts b/test/mainnet/instapool/instapool.test.ts index 7aab1b6c..a30a612e 100644 --- a/test/mainnet/instapool/instapool.test.ts +++ b/test/mainnet/instapool/instapool.test.ts @@ -10,7 +10,7 @@ import encodeFlashcastData from "../../../scripts/tests/encodeFlashcastData" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import addresses from "../../../scripts/constant/addresses"; -import { abis } from "../../../scripts/constant/abis"; +import abis from "../../../scripts/constant/abis"; import type { Signer, Contract } from "ethers"; import { ConnectV2Compound__factory } from "../../../typechain"; diff --git a/test/mainnet/liquity/liquity.helpers.ts b/test/mainnet/liquity/liquity.helpers.ts index 17e0b8af..e1cf4c54 100644 --- a/test/mainnet/liquity/liquity.helpers.ts +++ b/test/mainnet/liquity/liquity.helpers.ts @@ -10,7 +10,7 @@ import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" // Instadapp instadappAddresses/ABIs import instadappAddresses from "../../../scripts/constant/addresses"; -import { abis } from "../../../scripts/constant/abis"; +import abis from "../../../scripts/constant/abis"; // Instadapp Liquity Connector artifacts import { ConnectV2Liquity__factory, ConnectV2Basic__factory } from "../../../typechain"; diff --git a/test/mainnet/pooltogether/pooltogether.test.ts b/test/mainnet/pooltogether/pooltogether.test.ts index 1882a3f2..6482118f 100644 --- a/test/mainnet/pooltogether/pooltogether.test.ts +++ b/test/mainnet/pooltogether/pooltogether.test.ts @@ -9,7 +9,7 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import addresses from "../../../scripts/constant/addresses"; -import { abis } from "../../../scripts/constant/abis"; +import abis from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { tokens } from "../../../scripts/constant/tokens"; import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/uniswap/uniswap.test.ts b/test/mainnet/uniswap/uniswap.test.ts index 9b6761b3..92d1288a 100644 --- a/test/mainnet/uniswap/uniswap.test.ts +++ b/test/mainnet/uniswap/uniswap.test.ts @@ -9,7 +9,7 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; import addresses from "../../../scripts/constant/addresses"; -import { abis } from "../../../scripts/constant/abis"; +import abis from "../../../scripts/constant/abis"; import type { Signer, Contract } from "ethers"; import { abi } from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json"; diff --git a/test/mainnet/uniswapStake/uniswapStake.test.ts b/test/mainnet/uniswapStake/uniswapStake.test.ts index 0a86080d..8236cd0a 100644 --- a/test/mainnet/uniswapStake/uniswapStake.test.ts +++ b/test/mainnet/uniswapStake/uniswapStake.test.ts @@ -10,7 +10,7 @@ import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; import addresses from "../../../scripts/constant/addresses"; -import { abis } from "../../../scripts/constant/abis"; +import abis from "../../../scripts/constant/abis"; import { abi } from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json" import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/yearn/yearn.test.ts b/test/mainnet/yearn/yearn.test.ts index 055b22c9..624c30a6 100644 --- a/test/mainnet/yearn/yearn.test.ts +++ b/test/mainnet/yearn/yearn.test.ts @@ -9,7 +9,7 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import addresses from "../../../scripts/constant/addresses"; -import { abis } from "../../../scripts/constant/abis"; +import abis from "../../../scripts/constant/abis"; import { tokens } from "../../../scripts/constant/tokens"; import { Signer, Contract, BigNumber } from "ethers"; diff --git a/test/polygon/pooltogether/pooltogether.test.ts b/test/polygon/pooltogether/pooltogether.test.ts index 52b34073..e5bdbc24 100644 --- a/test/polygon/pooltogether/pooltogether.test.ts +++ b/test/polygon/pooltogether/pooltogether.test.ts @@ -11,7 +11,7 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import addresses from "../../../scripts/constant/addresses"; -import { abis } from "../../../scripts/constant/abis"; +import abis from "../../../scripts/constant/abis"; import { tokens } from "../../../scripts/constant/tokens"; import type { Signer, Contract } from "ethers"; From ec124db7a1dcd1113325937577e40545ac0a3a0e Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sat, 11 Dec 2021 00:40:45 +0530 Subject: [PATCH 33/39] updated scripts --- scripts/constant/addresses.ts | 41 ----------- scripts/constant/tokens.ts | 71 ------------------- .../deployment/deployAndVerifyOnSourcify.ts | 2 +- scripts/tests/arbitrum/addresses.ts | 11 +++ scripts/tests/arbitrum/tokens.ts | 23 ++++++ scripts/tests/avalanche/addresses.ts | 11 +++ scripts/tests/avalanche/tokens.ts | 23 ++++++ scripts/tests/buildDSAv2.ts | 4 +- scripts/tests/encodeFlashcastData.ts | 3 +- scripts/tests/mainnet/addresses.ts | 2 +- scripts/tests/mainnet/constant.ts | 6 -- scripts/tests/polygon/addresses.ts | 4 +- scripts/tests/polygon/constant.ts | 7 -- test/mainnet/aave/v1.test.ts | 16 ++--- test/mainnet/aave/v2.test.ts | 26 +++---- test/mainnet/b.protocol/b.compound.test.ts | 4 +- test/mainnet/b.protocol/b.liquity.test.ts | 4 +- test/mainnet/b.protocol/b.maker.test.ts | 8 +-- .../mainnet/basic-ERC1155/ERC1155-transfer.ts | 6 +- test/mainnet/basic-ERC721/ERC721-transfer.ts | 6 +- test/mainnet/compound/compound.test.ts | 4 +- test/mainnet/instapool/instapool.test.ts | 4 +- test/mainnet/liquity/liquity.helpers.ts | 4 +- .../mainnet/pooltogether/pooltogether.test.ts | 12 ++-- test/mainnet/uniswap/uniswap.test.ts | 4 +- .../mainnet/uniswapStake/uniswapStake.test.ts | 4 +- test/mainnet/yearn/yearn.test.ts | 6 +- .../polygon/pooltogether/pooltogether.test.ts | 20 +++--- 28 files changed, 139 insertions(+), 197 deletions(-) delete mode 100644 scripts/constant/addresses.ts delete mode 100644 scripts/constant/tokens.ts create mode 100644 scripts/tests/arbitrum/addresses.ts create mode 100644 scripts/tests/arbitrum/tokens.ts create mode 100644 scripts/tests/avalanche/addresses.ts create mode 100644 scripts/tests/avalanche/tokens.ts delete mode 100644 scripts/tests/mainnet/constant.ts delete mode 100644 scripts/tests/polygon/constant.ts diff --git a/scripts/constant/addresses.ts b/scripts/constant/addresses.ts deleted file mode 100644 index fd69c32b..00000000 --- a/scripts/constant/addresses.ts +++ /dev/null @@ -1,41 +0,0 @@ -export default { - mainnet: { - connectors: { - basic: "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6", - auth: "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9", - "INSTAPOOL-A": "0x5806af7ab22e2916fa582ff05731bf7c682387b2", - }, - core: { - connectorsV2: "0x97b0B3A8bDeFE8cB9563a3c610019Ad10DB8aD11", - instaIndex: "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723", - }, - }, - polygon: { - connectors: { - basic: "0x6214f9c4F9700fc7a50B5f9aEEB819d647406Ac7", - auth: "0xD6daA927ad756a4022858dddcc4E26137b30DB4D", - "INSTAPOOL-A": "0x8f1e38c53af7bD2b2bE01b9580911b7Cca504F1b", - }, - core: { - connectorsV2: "0x2A00684bFAb9717C21271E0751BCcb7d2D763c88", - instaIndex: "0xA9B99766E6C676Cf1975c0D3166F96C0848fF5ad", - }, - }, - avalanche: { - connectors: { - // basic: "0x6214f9c4F9700fc7a50B5f9aEEB819d647406Ac7", - // auth: "0xD6daA927ad756a4022858dddcc4E26137b30DB4D", - // "INSTAPOOL-A": "0x8f1e38c53af7bD2b2bE01b9580911b7Cca504F1b", - }, - core: { - connectorsV2: "0x67fCE99Dd6d8d659eea2a1ac1b8881c57eb6592B", - instaIndex: "0x1eE00C305C51Ff3bE60162456A9B533C07cD9288", - }, - }, - arbitrum: { - core: { - connectorsV2: "0x127d8cD0E2b2E0366D522DeA53A787bfE9002C14", - instaIndex: "0x6CE3e607C808b4f4C26B7F6aDAeB619e49CAbb25", - }, - } -}; diff --git a/scripts/constant/tokens.ts b/scripts/constant/tokens.ts deleted file mode 100644 index d10feb48..00000000 --- a/scripts/constant/tokens.ts +++ /dev/null @@ -1,71 +0,0 @@ -export const tokens = { - mainnet: { - eth: { - type: "token", - symbol: "ETH", - name: "Ethereum", - address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - decimals: 18, - }, - dai: { - type: "token", - symbol: "DAI", - name: "DAI Stable", - address: "0x6B175474E89094C44Da98b954EedeAC495271d0F", - decimals: 18, - }, - usdc: { - type: "token", - symbol: "USDC", - name: "USD Coin", - address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - decimals: 6, - }, - }, - polygon: { - eth: { - type: "token", - symbol: "ETH", - name: "Ethereum", - address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - decimals: 18, - }, - dai: { - type: "token", - symbol: "DAI", - name: "DAI Stable", - address: "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", - decimals: 18, - }, - usdc: { - type: "token", - symbol: "USDC", - name: "USD Coin", - address: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", - decimals: 6, - }, - }, - avalanche: { - eth: { - type: "token", - symbol: "ETH", - name: "Ethereum", - address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - decimals: 18, - }, - dai: { - type: "token", - symbol: "DAI", - name: "DAI Stable", - address: "0xd586e7f844cea2f87f50152665bcbc2c279d8d70", - decimals: 18, - }, - usdc: { - type: "token", - symbol: "USDC", - name: "USD Coin", - address: "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", - decimals: 6, - }, - } -}; diff --git a/scripts/deployment/deployAndVerifyOnSourcify.ts b/scripts/deployment/deployAndVerifyOnSourcify.ts index 4aee27e8..50e877d0 100644 --- a/scripts/deployment/deployAndVerifyOnSourcify.ts +++ b/scripts/deployment/deployAndVerifyOnSourcify.ts @@ -4,7 +4,7 @@ const { deploy } = deployments; async function main() { const deployer = (await getUnnamedAccounts())[0]; - const connector = "ConnectV2InstaPoolV3Avalanche"; + const connector = "// Add connector name over here Eg: ConnectV2InstaPoolV3Avalanche" const connectorInstance = await deploy(connector, { from: deployer, diff --git a/scripts/tests/arbitrum/addresses.ts b/scripts/tests/arbitrum/addresses.ts new file mode 100644 index 00000000..3687449b --- /dev/null +++ b/scripts/tests/arbitrum/addresses.ts @@ -0,0 +1,11 @@ +export default { + connectors: { + // basic: "0x6214f9c4F9700fc7a50B5f9aEEB819d647406Ac7", + // auth: "0xD6daA927ad756a4022858dddcc4E26137b30DB4D", + // "INSTAPOOL-A": "0x8f1e38c53af7bD2b2bE01b9580911b7Cca504F1b", + }, + core: { + connectorsV2: "0x67fCE99Dd6d8d659eea2a1ac1b8881c57eb6592B", + instaIndex: "0x1eE00C305C51Ff3bE60162456A9B533C07cD9288", + }, +}; diff --git a/scripts/tests/arbitrum/tokens.ts b/scripts/tests/arbitrum/tokens.ts new file mode 100644 index 00000000..fc679ab4 --- /dev/null +++ b/scripts/tests/arbitrum/tokens.ts @@ -0,0 +1,23 @@ +export const tokens = { + eth: { + type: "token", + symbol: "ETH", + name: "Ethereum", + address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + decimals: 18, + }, + dai: { + type: "token", + symbol: "DAI", + name: "DAI Stable", + address: "0xd586e7f844cea2f87f50152665bcbc2c279d8d70", + decimals: 18, + }, + usdc: { + type: "token", + symbol: "USDC", + name: "USD Coin", + address: "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", + decimals: 6, + }, +}; diff --git a/scripts/tests/avalanche/addresses.ts b/scripts/tests/avalanche/addresses.ts new file mode 100644 index 00000000..3687449b --- /dev/null +++ b/scripts/tests/avalanche/addresses.ts @@ -0,0 +1,11 @@ +export default { + connectors: { + // basic: "0x6214f9c4F9700fc7a50B5f9aEEB819d647406Ac7", + // auth: "0xD6daA927ad756a4022858dddcc4E26137b30DB4D", + // "INSTAPOOL-A": "0x8f1e38c53af7bD2b2bE01b9580911b7Cca504F1b", + }, + core: { + connectorsV2: "0x67fCE99Dd6d8d659eea2a1ac1b8881c57eb6592B", + instaIndex: "0x1eE00C305C51Ff3bE60162456A9B533C07cD9288", + }, +}; diff --git a/scripts/tests/avalanche/tokens.ts b/scripts/tests/avalanche/tokens.ts new file mode 100644 index 00000000..fc679ab4 --- /dev/null +++ b/scripts/tests/avalanche/tokens.ts @@ -0,0 +1,23 @@ +export const tokens = { + eth: { + type: "token", + symbol: "ETH", + name: "Ethereum", + address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + decimals: 18, + }, + dai: { + type: "token", + symbol: "DAI", + name: "DAI Stable", + address: "0xd586e7f844cea2f87f50152665bcbc2c279d8d70", + decimals: 18, + }, + usdc: { + type: "token", + symbol: "USDC", + name: "USD Coin", + address: "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", + decimals: 6, + }, +}; diff --git a/scripts/tests/buildDSAv2.ts b/scripts/tests/buildDSAv2.ts index d8a95ee1..1729b8e0 100644 --- a/scripts/tests/buildDSAv2.ts +++ b/scripts/tests/buildDSAv2.ts @@ -7,8 +7,8 @@ import { abi } from "../../deployements/mainnet/Implementation_m1.sol/InstaImple function getAddress(network: string | undefined) { if (network === "polygon") return addressesPolygon.core.instaIndex; - // else if (network === "arbitrum") return addressesPolygon.core.instaIndex; - // else if (network === "avalanche") return addressesPolygon.core.instaIndex; + else if (network === "arbitrum") return addressesPolygon.core.instaIndex; + else if (network === "avalanche") return addressesPolygon.core.instaIndex; else return addresses.core.instaIndex; } diff --git a/scripts/tests/encodeFlashcastData.ts b/scripts/tests/encodeFlashcastData.ts index 8e4b9d9f..759b9de9 100644 --- a/scripts/tests/encodeFlashcastData.ts +++ b/scripts/tests/encodeFlashcastData.ts @@ -5,8 +5,7 @@ import { encodeSpells } from "./encodeSpells"; export default function encodeFlashcastData(spells: any) { const encodeSpellsData = encodeSpells(spells); - const targetType = "string[]"; - let argTypes = [targetType, "bytes[]"]; + let argTypes = ["string[]", "bytes[]"]; return web3.eth.abi.encodeParameters(argTypes, [ encodeSpellsData[0], encodeSpellsData[1], diff --git a/scripts/tests/mainnet/addresses.ts b/scripts/tests/mainnet/addresses.ts index 9a6012ba..ec5b38f4 100644 --- a/scripts/tests/mainnet/addresses.ts +++ b/scripts/tests/mainnet/addresses.ts @@ -1,4 +1,4 @@ -export const addresses: Record = { +export default { "connectors": { "basic": "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6", "auth": "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9", diff --git a/scripts/tests/mainnet/constant.ts b/scripts/tests/mainnet/constant.ts deleted file mode 100644 index 9e659d77..00000000 --- a/scripts/tests/mainnet/constant.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const constants = { - address_zero: "0x0000000000000000000000000000000000000000", - native_address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - max_value: - "115792089237316195423570985008687907853269984665640564039457584007913129639935", -}; diff --git a/scripts/tests/polygon/addresses.ts b/scripts/tests/polygon/addresses.ts index cb4af74b..fb0de779 100644 --- a/scripts/tests/polygon/addresses.ts +++ b/scripts/tests/polygon/addresses.ts @@ -1,4 +1,4 @@ -export const addresses: Record = { +export default { connectors: { basic: "0x1cAF5EC802ca602E98139AD96A8f2B7BC524264E", auth: "0xf6474aD0dA75A0dE15D2c915e601D9f754B9e6fe", @@ -7,4 +7,4 @@ export const addresses: Record = { connectorsV2: "0x2A00684bFAb9717C21271E0751BCcb7d2D763c88", instaIndex: "0xA9B99766E6C676Cf1975c0D3166F96C0848fF5ad", }, -}; +}; \ No newline at end of file diff --git a/scripts/tests/polygon/constant.ts b/scripts/tests/polygon/constant.ts deleted file mode 100644 index 4059e9e5..00000000 --- a/scripts/tests/polygon/constant.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const constant = { - address_zero: "0x0000000000000000000000000000000000000000", - eth_addr: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - matic_addr: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", - max_value: - "115792089237316195423570985008687907853269984665640564039457584007913129639935", -}; diff --git a/test/mainnet/aave/v1.test.ts b/test/mainnet/aave/v1.test.ts index bdf7c22e..14ba5a14 100644 --- a/test/mainnet/aave/v1.test.ts +++ b/test/mainnet/aave/v1.test.ts @@ -1,14 +1,14 @@ import hre from "hardhat"; import { expect } from "chai"; import abis from "../../../scripts/constant/abis"; -import addresses from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/tests/mainnet/addresses"; import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { ConnectV2AaveV1, ConnectV2AaveV1__factory } from "../../../typechain"; import { parseEther } from "@ethersproject/units"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; -import { tokens } from "../../../scripts/constant/tokens"; +import { tokens } from "../../../scripts/tests/mainnet/tokens"; import { constants } from "../../../scripts/constant/constant"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; const { ethers } = hre; @@ -41,7 +41,7 @@ describe("Aave V1", function () { masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, - addresses.mainnet.core.connectorsV2 + addresses.core.connectorsV2 ); connector = await deployAndEnableConnector({ connectorName, @@ -85,7 +85,7 @@ describe("Aave V1", function () { { connector: connectorName, method: "deposit", - args: [tokens.mainnet.eth.address, amt, 0, 0], + args: [tokens.eth.address, amt, 0, 0], }, ]; @@ -110,13 +110,13 @@ describe("Aave V1", function () { { connector: connectorName, method: "borrow", - args: [tokens.mainnet.dai.address, amt, 0, 0], + args: [tokens.dai.address, amt, 0, 0], }, { connector: connectorName, method: "payback", // FIXME: we need to pass max_value because of roundoff/shortfall errors - args: [tokens.mainnet.dai.address, constants.max_value, 0, 0], + args: [tokens.dai.address, constants.max_value, 0, 0], }, ]; @@ -134,7 +134,7 @@ describe("Aave V1", function () { { connector: connectorName, method: "deposit", - args: [tokens.mainnet.eth.address, constants.max_value, 0, 0], + args: [tokens.eth.address, constants.max_value, 0, 0], }, ]; @@ -152,7 +152,7 @@ describe("Aave V1", function () { { connector: connectorName, method: "withdraw", - args: [tokens.mainnet.eth.address, constants.max_value, 0, 0], + args: [tokens.eth.address, constants.max_value, 0, 0], }, ]; diff --git a/test/mainnet/aave/v2.test.ts b/test/mainnet/aave/v2.test.ts index 7348555a..b04c3568 100644 --- a/test/mainnet/aave/v2.test.ts +++ b/test/mainnet/aave/v2.test.ts @@ -1,14 +1,14 @@ import { expect } from "chai"; import hre from "hardhat"; import abis from "../../../scripts/constant/abis"; -import addresses from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/tests/mainnet/addresses"; import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { ConnectV2AaveV2, ConnectV2AaveV2__factory } from "../../../typechain"; import { parseEther } from "@ethersproject/units"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; -import { tokens } from "../../../scripts/constant/tokens"; +import { tokens } from "../../../scripts/tests/mainnet/tokens"; import { constants } from "../../../scripts/constant/constant"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; const { ethers } = hre; @@ -39,7 +39,7 @@ describe("Aave V2", function () { masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, - addresses.mainnet.core.connectorsV2 + addresses.core.connectorsV2 ); connector = await deployAndEnableConnector({ connectorName, @@ -80,7 +80,7 @@ describe("Aave V2", function () { { connector: connectorName, method: "deposit", - args: [tokens.mainnet.eth.address, amt, 0, 0], + args: [tokens.eth.address, amt, 0, 0], }, ]; @@ -102,12 +102,12 @@ describe("Aave V2", function () { { connector: connectorName, method: "borrow", - args: [tokens.mainnet.dai.address, amt, 2, 0, setId], + args: [tokens.dai.address, amt, 2, 0, setId], }, { connector: connectorName, method: "payback", - args: [tokens.mainnet.dai.address, amt, 2, setId, 0], + args: [tokens.dai.address, amt, 2, setId, 0], }, ]; @@ -128,12 +128,12 @@ describe("Aave V2", function () { { connector: connectorName, method: "borrow", - args: [tokens.mainnet.dai.address, amt, 2, 0, 0], + args: [tokens.dai.address, amt, 2, 0, 0], }, { connector: connectorName, method: "payback", - args: [tokens.mainnet.dai.address, amt.div(2), 2, 0, 0], + args: [tokens.dai.address, amt.div(2), 2, 0, 0], }, ]; @@ -149,7 +149,7 @@ describe("Aave V2", function () { { connector: connectorName, method: "payback", - args: [tokens.mainnet.dai.address, constants.max_value, 2, 0, 0], + args: [tokens.dai.address, constants.max_value, 2, 0, 0], }, ]; @@ -167,7 +167,7 @@ describe("Aave V2", function () { { connector: connectorName, method: "deposit", - args: [tokens.mainnet.eth.address, constants.max_value, 0, 0], + args: [tokens.eth.address, constants.max_value, 0, 0], }, ]; @@ -185,7 +185,7 @@ describe("Aave V2", function () { { connector: connectorName, method: "withdraw", - args: [tokens.mainnet.eth.address, constants.max_value, 0, 0], + args: [tokens.eth.address, constants.max_value, 0, 0], }, ]; @@ -205,12 +205,12 @@ describe("Aave V2", function () { { connector: connectorName, method: "deposit", - args: [tokens.mainnet.eth.address, amt, 0, setId], + args: [tokens.eth.address, amt, 0, setId], }, { connector: connectorName, method: "withdraw", - args: [tokens.mainnet.eth.address, amt, setId, 0], + args: [tokens.eth.address, amt, setId, 0], }, ]; diff --git a/test/mainnet/b.protocol/b.compound.test.ts b/test/mainnet/b.protocol/b.compound.test.ts index 743c8012..8214f41d 100644 --- a/test/mainnet/b.protocol/b.compound.test.ts +++ b/test/mainnet/b.protocol/b.compound.test.ts @@ -7,7 +7,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import addresses from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/tests/mainnet/addresses"; import abis from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { ConnectV2BCompound__factory } from "../../../typechain"; @@ -37,7 +37,7 @@ describe("B.Compound", function () { ], }); masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, contractArtifact: ConnectV2BCompound__factory, diff --git a/test/mainnet/b.protocol/b.liquity.test.ts b/test/mainnet/b.protocol/b.liquity.test.ts index 007605a4..ce0e1a48 100644 --- a/test/mainnet/b.protocol/b.liquity.test.ts +++ b/test/mainnet/b.protocol/b.liquity.test.ts @@ -10,7 +10,7 @@ import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" import abis from "../../../scripts/constant/abis"; import { ConnectV2BLiquity__factory } from "../../../typechain"; import type { Signer, Contract } from "ethers"; -import addresses from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/tests/mainnet/addresses"; const LUSD_WHALE = "0x66017D22b0f8556afDd19FC67041899Eb65a21bb" // stability pool const BAMM_ADDRESS = "0x0d3AbAA7E088C2c82f54B2f47613DA438ea8C598" @@ -45,7 +45,7 @@ describe("B.Liquity", function () { ], }); masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, contractArtifact: ConnectV2BLiquity__factory, diff --git a/test/mainnet/b.protocol/b.maker.test.ts b/test/mainnet/b.protocol/b.maker.test.ts index 84b8df36..e919283a 100644 --- a/test/mainnet/b.protocol/b.maker.test.ts +++ b/test/mainnet/b.protocol/b.maker.test.ts @@ -7,9 +7,9 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import addresses from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/tests/mainnet/addresses"; import abis from "../../../scripts/constant/abis"; -import { tokens } from "../../../scripts/constant/tokens"; +import { tokens } from "../../../scripts/tests/mainnet/tokens"; import { ConnectV2BMakerDAO__factory } from "../../../typechain"; import type { Signer, Contract } from "ethers"; @@ -41,7 +41,7 @@ describe("B.Maker", function () { ], }); masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, contractArtifact: ConnectV2BMakerDAO__factory, @@ -51,7 +51,7 @@ describe("B.Maker", function () { manager = await ethers.getContractAt("BManagerLike", "0x3f30c2381CD8B917Dd96EB2f1A4F96D91324BBed") vat = await ethers.getContractAt("../artifacts/contracts/mainnet/connectors/b.protocol/makerdao/interface.sol:VatLike", await manager.vat()) - dai = await ethers.getContractAt("../artifacts/contracts/mainnet/common/interfaces.sol:TokenInterface", tokens.mainnet.dai.address) + dai = await ethers.getContractAt("../artifacts/contracts/mainnet/common/interfaces.sol:TokenInterface", tokens.dai.address) console.log("Connector address", connector.address) }) diff --git a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts index df9490a3..f8a138bc 100644 --- a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts +++ b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts @@ -8,7 +8,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import addresses from "../../../scripts/constant/addresses" +import addresses from "../../../scripts/tests/mainnet/addresses" import abis from "../../../scripts/constant/abis" import type { Signer, Contract } from "ethers"; @@ -64,11 +64,11 @@ describe("BASIC-ERC1155", function () { ); nftContract = await ethers.getContractAt(IERC1155__factory.abi, TOKEN_CONTRACT_ADDR) masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); instaImplementationsMapping = await ethers.getContractAt(abi, implementationsMappingAddr); InstaAccountV2DefaultImpl = await ethers.getContractFactory("InstaDefaultImplementation") - instaAccountV2DefaultImpl = await InstaAccountV2DefaultImpl.deploy(addresses.mainnet.core.instaIndex); + instaAccountV2DefaultImpl = await InstaAccountV2DefaultImpl.deploy(addresses.core.instaIndex); await instaAccountV2DefaultImpl.deployed() connector = await deployAndEnableConnector({ connectorName, diff --git a/test/mainnet/basic-ERC721/ERC721-transfer.ts b/test/mainnet/basic-ERC721/ERC721-transfer.ts index 6139449d..908d9f21 100644 --- a/test/mainnet/basic-ERC721/ERC721-transfer.ts +++ b/test/mainnet/basic-ERC721/ERC721-transfer.ts @@ -8,7 +8,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import addresses from "../../../scripts/constant/addresses" +import addresses from "../../../scripts/tests/mainnet/addresses" import abis from "../../../scripts/constant/abis" import type { Signer, Contract } from "ethers"; @@ -64,11 +64,11 @@ describe("BASIC-ERC721", function () { ); nftContract = await ethers.getContractAt(IERC721__factory.abi, TOKEN_CONTRACT_ADDR) masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); instaImplementationsMapping = await ethers.getContractAt(abi, implementationsMappingAddr); InstaAccountV2DefaultImpl = await ethers.getContractFactory("InstaDefaultImplementation") - instaAccountV2DefaultImpl = await InstaAccountV2DefaultImpl.deploy(addresses.mainnet.core.instaIndex); + instaAccountV2DefaultImpl = await InstaAccountV2DefaultImpl.deploy(addresses.core.instaIndex); await instaAccountV2DefaultImpl.deployed() connector = await deployAndEnableConnector({ connectorName, diff --git a/test/mainnet/compound/compound.test.ts b/test/mainnet/compound/compound.test.ts index 0a92eb49..383ee12d 100644 --- a/test/mainnet/compound/compound.test.ts +++ b/test/mainnet/compound/compound.test.ts @@ -9,7 +9,7 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import addresses from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/tests/mainnet/addresses"; import abis from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { ConnectV2Compound__factory } from "../../../typechain"; @@ -38,7 +38,7 @@ describe("Compound", function () { ], }); masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, contractArtifact: ConnectV2Compound__factory, diff --git a/test/mainnet/instapool/instapool.test.ts b/test/mainnet/instapool/instapool.test.ts index a30a612e..99fe80de 100644 --- a/test/mainnet/instapool/instapool.test.ts +++ b/test/mainnet/instapool/instapool.test.ts @@ -9,7 +9,7 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells" import encodeFlashcastData from "../../../scripts/tests/encodeFlashcastData" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import addresses from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/tests/mainnet/addresses"; import abis from "../../../scripts/constant/abis"; import type { Signer, Contract } from "ethers"; import { ConnectV2Compound__factory } from "../../../typechain"; @@ -38,7 +38,7 @@ describe("Instapool", function () { ], }); masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); connector = await deployAndEnableConnector({ connectorName, contractArtifact: ConnectV2Compound__factory, diff --git a/test/mainnet/liquity/liquity.helpers.ts b/test/mainnet/liquity/liquity.helpers.ts index e1cf4c54..14c1abaf 100644 --- a/test/mainnet/liquity/liquity.helpers.ts +++ b/test/mainnet/liquity/liquity.helpers.ts @@ -9,7 +9,7 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" // Instadapp instadappAddresses/ABIs -import instadappAddresses from "../../../scripts/constant/addresses"; +import instadappAddresses from "../../../scripts/tests/mainnet/addresses"; import abis from "../../../scripts/constant/abis"; // Instadapp Liquity Connector artifacts @@ -138,7 +138,7 @@ const deployAndConnect = async (contracts: any, isDebug = false) => { const masterSigner = await getMasterSigner(); const instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, - instadappAddresses.mainnet.core.connectorsV2 + instadappAddresses.core.connectorsV2 ); const connector = await deployAndEnableConnector({ connectorName: LIQUITY_CONNECTOR, diff --git a/test/mainnet/pooltogether/pooltogether.test.ts b/test/mainnet/pooltogether/pooltogether.test.ts index 6482118f..1bca8b79 100644 --- a/test/mainnet/pooltogether/pooltogether.test.ts +++ b/test/mainnet/pooltogether/pooltogether.test.ts @@ -8,10 +8,10 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; -import addresses from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/tests/mainnet/addresses"; import abis from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; -import { tokens } from "../../../scripts/constant/tokens"; +import { tokens } from "../../../scripts/tests/mainnet/tokens"; import type { Signer, Contract } from "ethers"; import { @@ -20,7 +20,7 @@ import { ConnectV2UniswapV2__factory, } from "../../../typechain"; -const DAI_TOKEN_ADDR = tokens.mainnet.dai.address; // DAI Token +const DAI_TOKEN_ADDR = tokens.dai.address; // DAI Token // PoolTogether Address: https://docs.pooltogether.com/resources/networks/ethereum const DAI_PRIZE_POOL_ADDR = "0xEBfb47A7ad0FD6e57323C8A42B2E5A6a4F68fc1a"; // DAI Prize Pool @@ -98,7 +98,7 @@ describe("PoolTogether", function() { masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, - addresses.mainnet.core.connectorsV2 + addresses.core.connectorsV2 ); // Deploy and enable Compound Connector @@ -770,7 +770,7 @@ describe("PoolTogether", function() { method: "buy", args: [ POOL_TOKEN_ADDRESS, - tokens.mainnet.eth.address, + tokens.eth.address, amount, unitAmount, 0, @@ -782,7 +782,7 @@ describe("PoolTogether", function() { method: "deposit", args: [ POOL_TOKEN_ADDRESS, - tokens.mainnet.eth.address, + tokens.eth.address, amount, unitAmount, slippage, diff --git a/test/mainnet/uniswap/uniswap.test.ts b/test/mainnet/uniswap/uniswap.test.ts index 92d1288a..93a87dec 100644 --- a/test/mainnet/uniswap/uniswap.test.ts +++ b/test/mainnet/uniswap/uniswap.test.ts @@ -8,7 +8,7 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; -import addresses from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/tests/mainnet/addresses"; import abis from "../../../scripts/constant/abis"; import type { Signer, Contract } from "ethers"; @@ -61,7 +61,7 @@ describe("UniswapV3", function() { masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, - addresses.mainnet.core.connectorsV2 + addresses.core.connectorsV2 ); nftManager = await ethers.getContractAt( abi, diff --git a/test/mainnet/uniswapStake/uniswapStake.test.ts b/test/mainnet/uniswapStake/uniswapStake.test.ts index 8236cd0a..67889420 100644 --- a/test/mainnet/uniswapStake/uniswapStake.test.ts +++ b/test/mainnet/uniswapStake/uniswapStake.test.ts @@ -9,7 +9,7 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; -import addresses from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/tests/mainnet/addresses"; import abis from "../../../scripts/constant/abis"; import { abi } from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json" import type { Signer, Contract } from "ethers"; @@ -62,7 +62,7 @@ describe("UniswapV3", function () { ], }); masterSigner = await getMasterSigner() - instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.mainnet.core.connectorsV2); + instaConnectorsV2 = await ethers.getContractAt(abis.core.connectorsV2, addresses.core.connectorsV2); nftManager = await ethers.getContractAt(abi, "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"); connector = await deployAndEnableConnector({ connectorName: connectorStaker, diff --git a/test/mainnet/yearn/yearn.test.ts b/test/mainnet/yearn/yearn.test.ts index 624c30a6..a7a27464 100644 --- a/test/mainnet/yearn/yearn.test.ts +++ b/test/mainnet/yearn/yearn.test.ts @@ -8,9 +8,9 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; -import addresses from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/tests/mainnet/addresses"; import abis from "../../../scripts/constant/abis"; -import { tokens } from "../../../scripts/constant/tokens"; +import { tokens } from "../../../scripts/tests/mainnet/tokens"; import { Signer, Contract, BigNumber } from "ethers"; import { ConnectV2YearnV2__factory } from "../../../typechain"; @@ -50,7 +50,7 @@ describe("Yearn", function() { masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, - addresses.mainnet.core.connectorsV2 + addresses.core.connectorsV2 ); connector = await deployAndEnableConnector({ connectorName, diff --git a/test/polygon/pooltogether/pooltogether.test.ts b/test/polygon/pooltogether/pooltogether.test.ts index e5bdbc24..04b9f821 100644 --- a/test/polygon/pooltogether/pooltogether.test.ts +++ b/test/polygon/pooltogether/pooltogether.test.ts @@ -10,14 +10,14 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; -import addresses from "../../../scripts/constant/addresses"; +import addresses from "../../../scripts/tests/polygon/addresses"; import abis from "../../../scripts/constant/abis"; -import { tokens } from "../../../scripts/constant/tokens"; +import { tokens } from "../../../scripts/tests/polygon/tokens"; import type { Signer, Contract } from "ethers"; import { ConnectV2AaveV2Polygon__factory, ConnectV2PoolTogetherPolygon__factory } from "../../../typechain"; -const DAI_TOKEN_ADDR = tokens.polygon.dai.address; // DAI Token +const DAI_TOKEN_ADDR = tokens.dai.address; // DAI Token // PoolTogether Address: https://docs.pooltogether.com/resources/networks/matic const USDC_PRIZE_POOL_ADDR = "0xEE06AbE9e2Af61cabcb13170e01266Af2DEFa946"; // USDC Prize Pool const PT_USDC_TICKET_ADDR = "0x473E484c722EF9ec6f63B509b07Bb9cfB258820b"; // PT USDC Ticket @@ -69,7 +69,7 @@ describe("PoolTogether", function() { masterSigner = await getMasterSigner(); instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, - addresses.polygon.core.connectorsV2 + addresses.core.connectorsV2 ); // Deploy and enable Compound Connector @@ -120,7 +120,7 @@ describe("PoolTogether", function() { { connector: connectorName, method: "deposit", - args: [tokens.polygon.eth.address, amount, 0, 0], + args: [tokens.eth.address, amount, 0, 0], }, ]; @@ -141,7 +141,7 @@ describe("PoolTogether", function() { { connector: connectorName, method: "borrow", - args: [tokens.polygon.usdc.address, amount, 2, 0, setId], + args: [tokens.usdc.address, amount, 2, 0, setId], }, { connector: ptConnectorName, @@ -158,7 +158,7 @@ describe("PoolTogether", function() { // Before Spell let usdcToken = await ethers.getContractAt( abis.basic.erc20, - tokens.polygon.usdc.address + tokens.usdc.address ); let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); expect(usdcBalance, `USDC balance is 0`).to.be.eq( @@ -239,7 +239,7 @@ describe("PoolTogether", function() { // Before spell let usdcToken = await ethers.getContractAt( abis.basic.erc20, - tokens.polygon.usdc.address + tokens.usdc.address ); let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); expect(usdcBalance, `USDC balance equals 0`).to.be.eq( @@ -330,7 +330,7 @@ describe("PoolTogether", function() { // Before spell let usdcToken = await ethers.getContractAt( abis.basic.erc20, - tokens.polygon.usdc.address + tokens.usdc.address ); let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); expect(usdcBalance, `USDC Balance equals 100`).to.be.eq( @@ -394,7 +394,7 @@ describe("PoolTogether", function() { // Before spell let usdcToken = await ethers.getContractAt( abis.basic.erc20, - tokens.polygon.usdc.address + tokens.usdc.address ); let usdcBalance = await usdcToken.balanceOf(dsaWallet0.address); expect(usdcBalance, `USDC balance less than 10`).to.be.lt( From 6e7381056fb2afec97c348e889198cc78cb0e620 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sat, 11 Dec 2021 01:14:04 +0530 Subject: [PATCH 34/39] updated scripts --- scripts/constant/abis.ts | 2 +- scripts/tests/arbitrum/addresses.ts | 2 +- scripts/tests/avalanche/addresses.ts | 2 +- scripts/tests/buildDSAv2.ts | 8 ++++--- scripts/tests/deployAndEnableConnector.ts | 2 +- scripts/tests/encodeSpells.ts | 2 +- scripts/tests/getMasterSigner.ts | 19 +++++++++------- scripts/tests/mainnet/addresses.ts | 6 ++--- scripts/tests/polygon/addresses.ts | 2 +- .../uniswap-sell-beta/uniswap-sell-beta.ts | 2 +- test/mainnet/aave/v1.test.ts | 18 +++++++-------- test/mainnet/aave/v2.test.ts | 22 +++++++++---------- test/mainnet/b.protocol/b.compound.test.ts | 4 ++-- test/mainnet/b.protocol/b.liquity.test.ts | 18 +++++++-------- test/mainnet/b.protocol/b.maker.test.ts | 4 ++-- .../mainnet/basic-ERC1155/ERC1155-transfer.ts | 8 +++---- test/mainnet/basic-ERC721/ERC721-transfer.ts | 4 ++-- test/mainnet/compound/compound.test.ts | 4 ++-- test/mainnet/instapool/instapool.test.ts | 4 ++-- test/mainnet/liquity/liquity.helpers.ts | 8 +++---- .../mainnet/pooltogether/pooltogether.test.ts | 4 ++-- test/mainnet/uniswap/uniswap.test.ts | 4 ++-- .../mainnet/uniswapStake/uniswapStake.test.ts | 4 ++-- test/mainnet/yearn/yearn.test.ts | 4 ++-- .../polygon/pooltogether/pooltogether.test.ts | 4 ++-- 25 files changed, 83 insertions(+), 78 deletions(-) diff --git a/scripts/constant/abis.ts b/scripts/constant/abis.ts index b63e82e8..43097ba5 100644 --- a/scripts/constant/abis.ts +++ b/scripts/constant/abis.ts @@ -1,4 +1,4 @@ -export default { +export const abis: Record = { core: { connectorsV2: require("./abi/core/connectorsV2.json"), instaIndex: require("./abi/core/instaIndex.json"), diff --git a/scripts/tests/arbitrum/addresses.ts b/scripts/tests/arbitrum/addresses.ts index 3687449b..d2da378f 100644 --- a/scripts/tests/arbitrum/addresses.ts +++ b/scripts/tests/arbitrum/addresses.ts @@ -1,4 +1,4 @@ -export default { +export const addresses: Record = { connectors: { // basic: "0x6214f9c4F9700fc7a50B5f9aEEB819d647406Ac7", // auth: "0xD6daA927ad756a4022858dddcc4E26137b30DB4D", diff --git a/scripts/tests/avalanche/addresses.ts b/scripts/tests/avalanche/addresses.ts index 3687449b..d2da378f 100644 --- a/scripts/tests/avalanche/addresses.ts +++ b/scripts/tests/avalanche/addresses.ts @@ -1,4 +1,4 @@ -export default { +export const addresses: Record = { connectors: { // basic: "0x6214f9c4F9700fc7a50B5f9aEEB819d647406Ac7", // auth: "0xD6daA927ad756a4022858dddcc4E26137b30DB4D", diff --git a/scripts/tests/buildDSAv2.ts b/scripts/tests/buildDSAv2.ts index 1729b8e0..163db741 100644 --- a/scripts/tests/buildDSAv2.ts +++ b/scripts/tests/buildDSAv2.ts @@ -1,14 +1,16 @@ import { ethers } from "hardhat"; import { addresses as addressesPolygon } from "./polygon/addresses"; +import { addresses as addressesArbitrum } from "./arbitrum/addresses"; +import { addresses as addressesAvalanche } from "./avalanche/addresses"; import { addresses } from "./mainnet/addresses"; -import abis from "../constant/abis"; +import { abis } from "../constant/abis"; import { abi } from "../../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json"; function getAddress(network: string | undefined) { if (network === "polygon") return addressesPolygon.core.instaIndex; - else if (network === "arbitrum") return addressesPolygon.core.instaIndex; - else if (network === "avalanche") return addressesPolygon.core.instaIndex; + else if (network === "arbitrum") return addressesArbitrum.core.instaIndex; + else if (network === "avalanche") return addressesAvalanche.core.instaIndex; else return addresses.core.instaIndex; } diff --git a/scripts/tests/deployAndEnableConnector.ts b/scripts/tests/deployAndEnableConnector.ts index 324b56ec..8e1f5d4b 100644 --- a/scripts/tests/deployAndEnableConnector.ts +++ b/scripts/tests/deployAndEnableConnector.ts @@ -1,6 +1,6 @@ import { addresses as addressesPolygon } from "./polygon/addresses"; import { addresses } from "./mainnet/addresses"; -import abis from "../constant/abis"; +import { abis } from "../constant/abis"; import hre from "hardhat"; import type { Signer, Contract } from "ethers"; diff --git a/scripts/tests/encodeSpells.ts b/scripts/tests/encodeSpells.ts index 81ddcb03..62a7a8bb 100644 --- a/scripts/tests/encodeSpells.ts +++ b/scripts/tests/encodeSpells.ts @@ -1,5 +1,5 @@ import { web3 } from "hardhat"; -import abis from "../constant/abis"; +import { abis } from "../constant/abis"; export function encodeSpells(spells: any[]) { const targets = spells.map((a) => a.connector); diff --git a/scripts/tests/getMasterSigner.ts b/scripts/tests/getMasterSigner.ts index e0f0e0b1..c09fec74 100644 --- a/scripts/tests/getMasterSigner.ts +++ b/scripts/tests/getMasterSigner.ts @@ -1,12 +1,14 @@ import { ethers, network } from "hardhat"; import { addresses } from "./mainnet/addresses"; import { addresses as addressesPolygon } from "./polygon/addresses"; -import abis from "../constant/abis"; +import { addresses as addressesArbitrum } from "./arbitrum/addresses"; +import { addresses as addressesAvalanche } from "./avalanche/addresses"; +import { abis } from "../constant/abis"; function getAddress(network: string | undefined) { if (network === "polygon") return addressesPolygon.core.instaIndex; - // else if (network === "arbitrum") return addressesPolygon.core.instaIndex; - // else if (network === "avalanche") return addressesPolygon.core.instaIndex; + else if (network === "arbitrum") return addressesArbitrum.core.instaIndex; + else if (network === "avalanche") return addressesAvalanche.core.instaIndex; else return addresses.core.instaIndex; } @@ -18,15 +20,16 @@ export async function getMasterSigner() { wallet3 ); - const masterAddress = await instaIndex.master(); // TODO: make it constant? + const masterAddress = await instaIndex.master(); await network.provider.request({ method: "hardhat_impersonateAccount", params: [masterAddress], }); - await wallet3.sendTransaction({ - to: masterAddress, - value: ethers.utils.parseEther("10"), - }); + + await network.provider.send("hardhat_setBalance", [ + masterAddress, + "0x8ac7230489e80000", // 1e19 wei + ]); return await ethers.getSigner(masterAddress); } diff --git a/scripts/tests/mainnet/addresses.ts b/scripts/tests/mainnet/addresses.ts index ec5b38f4..f3e74d20 100644 --- a/scripts/tests/mainnet/addresses.ts +++ b/scripts/tests/mainnet/addresses.ts @@ -1,10 +1,10 @@ -export default { - "connectors": { +export const addresses: Record = { + connectors: { "basic": "0xe5398f279175962E56fE4c5E0b62dc7208EF36c6", "auth": "0xd1aff9f2acf800c876c409100d6f39aea93fc3d9", "INSTAPOOL-A": "0x5806af7ab22e2916fa582ff05731bf7c682387b2", }, - "core": { + core: { "connectorsV2": "0x97b0B3A8bDeFE8cB9563a3c610019Ad10DB8aD11", "instaIndex": "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723", }, diff --git a/scripts/tests/polygon/addresses.ts b/scripts/tests/polygon/addresses.ts index fb0de779..7c13c34c 100644 --- a/scripts/tests/polygon/addresses.ts +++ b/scripts/tests/polygon/addresses.ts @@ -1,4 +1,4 @@ -export default { +export const addresses: Record = { connectors: { basic: "0x1cAF5EC802ca602E98139AD96A8f2B7BC524264E", auth: "0xf6474aD0dA75A0dE15D2c915e601D9f754B9e6fe", diff --git a/test/arbitrum/uniswap-sell-beta/uniswap-sell-beta.ts b/test/arbitrum/uniswap-sell-beta/uniswap-sell-beta.ts index dc3ad518..c4cf12ac 100644 --- a/test/arbitrum/uniswap-sell-beta/uniswap-sell-beta.ts +++ b/test/arbitrum/uniswap-sell-beta/uniswap-sell-beta.ts @@ -10,7 +10,7 @@ const WETH_ADDR = "0x82af49447d8a07e3bd95bd0d56f35241523fbab1"; describe("Uniswap-sell-beta", function () { let UniswapSellBeta, uniswapSellBeta: Contract; - async function setBalance(address: any) { + async function setBalance(address: string) { await hre.network.provider.send("hardhat_setBalance", [ address, ethers.utils.parseEther("10.0").toHexString(), diff --git a/test/mainnet/aave/v1.test.ts b/test/mainnet/aave/v1.test.ts index 14ba5a14..a65c3a24 100644 --- a/test/mainnet/aave/v1.test.ts +++ b/test/mainnet/aave/v1.test.ts @@ -1,7 +1,7 @@ import hre from "hardhat"; import { expect } from "chai"; -import abis from "../../../scripts/constant/abis"; -import addresses from "../../../scripts/tests/mainnet/addresses"; +import { abis } from "../../../scripts/constant/abis"; +import { addresses } from "../../../scripts/tests/mainnet/addresses"; import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; @@ -17,8 +17,8 @@ import type { Signer, Contract } from "ethers"; describe("Aave V1", function () { const connectorName = "AAVEV1-TEST-A"; - let wallet0: any, wallet1: any; - let dsaWallet0: any; + let wallet0: Signer, wallet1: Signer; + let dsaWallet0: Contract; let instaConnectorsV2: Contract; let connector: any; let masterSigner: Signer; @@ -63,7 +63,7 @@ describe("Aave V1", function () { describe("DSA wallet setup", function () { it("Should build DSA v2", async function () { - dsaWallet0 = await buildDSAv2(wallet0.address); + dsaWallet0 = await buildDSAv2(wallet0.getAddress()); expect(!!dsaWallet0.address).to.be.true; }); @@ -91,7 +91,7 @@ describe("Aave V1", function () { const tx = await dsaWallet0 .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); + .cast(...encodeSpells(spells), wallet1.getAddress()); await tx.wait(); @@ -122,7 +122,7 @@ describe("Aave V1", function () { const tx = await dsaWallet0 .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); + .cast(...encodeSpells(spells), wallet1.getAddress()); await tx.wait(); expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( ethers.utils.parseEther("9") @@ -140,7 +140,7 @@ describe("Aave V1", function () { const tx = await dsaWallet0 .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); + .cast(...encodeSpells(spells), wallet1.getAddress()); await tx.wait(); expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( ethers.utils.parseEther("0") @@ -158,7 +158,7 @@ describe("Aave V1", function () { const tx = await dsaWallet0 .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); + .cast(...encodeSpells(spells), wallet1.getAddress()); await tx.wait(); expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte( ethers.utils.parseEther("10") diff --git a/test/mainnet/aave/v2.test.ts b/test/mainnet/aave/v2.test.ts index b04c3568..6752e6a6 100644 --- a/test/mainnet/aave/v2.test.ts +++ b/test/mainnet/aave/v2.test.ts @@ -1,7 +1,7 @@ import { expect } from "chai"; import hre from "hardhat"; -import abis from "../../../scripts/constant/abis"; -import addresses from "../../../scripts/tests/mainnet/addresses"; +import { abis } from "../../../scripts/constant/abis"; +import { addresses } from "../../../scripts/tests/mainnet/addresses"; import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnableConnector"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; @@ -18,7 +18,7 @@ describe("Aave V2", function () { const connectorName = "AAVEV2-TEST-A"; let connector: any; - let wallet0: any, wallet1:any; + let wallet0: Signer, wallet1:Signer; let dsaWallet0: any; let instaConnectorsV2: Contract; let masterSigner: Signer; @@ -58,7 +58,7 @@ describe("Aave V2", function () { describe("DSA wallet setup", function () { it("Should build DSA v2", async function () { - dsaWallet0 = await buildDSAv2(wallet0.address); + dsaWallet0 = await buildDSAv2(wallet0.getAddress()); expect(!!dsaWallet0.address).to.be.true; }); @@ -86,7 +86,7 @@ describe("Aave V2", function () { const tx = await dsaWallet0 .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); + .cast(...encodeSpells(spells), wallet1.getAddress()); await tx.wait(); @@ -113,7 +113,7 @@ describe("Aave V2", function () { const tx = await dsaWallet0 .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); + .cast(...encodeSpells(spells), wallet1.getAddress()); await tx.wait(); expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( ethers.utils.parseEther("9") @@ -139,7 +139,7 @@ describe("Aave V2", function () { let tx = await dsaWallet0 .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); + .cast(...encodeSpells(spells), wallet1.getAddress()); await tx.wait(); expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( ethers.utils.parseEther("9") @@ -155,7 +155,7 @@ describe("Aave V2", function () { tx = await dsaWallet0 .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); + .cast(...encodeSpells(spells), wallet1.getAddress()); await tx.wait(); expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( ethers.utils.parseEther("9") @@ -173,7 +173,7 @@ describe("Aave V2", function () { const tx = await dsaWallet0 .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); + .cast(...encodeSpells(spells), wallet1.getAddress()); await tx.wait(); expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.lte( ethers.utils.parseEther("0") @@ -191,7 +191,7 @@ describe("Aave V2", function () { const tx = await dsaWallet0 .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); + .cast(...encodeSpells(spells), wallet1.getAddress()); await tx.wait(); expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte( ethers.utils.parseEther("10") @@ -216,7 +216,7 @@ describe("Aave V2", function () { const tx = await dsaWallet0 .connect(wallet0) - .cast(...encodeSpells(spells), wallet1.address); + .cast(...encodeSpells(spells), wallet1.getAddress()); await tx.wait(); expect(await ethers.provider.getBalance(dsaWallet0.address)).to.be.gte( ethers.utils.parseEther("10") diff --git a/test/mainnet/b.protocol/b.compound.test.ts b/test/mainnet/b.protocol/b.compound.test.ts index 8214f41d..3402321a 100644 --- a/test/mainnet/b.protocol/b.compound.test.ts +++ b/test/mainnet/b.protocol/b.compound.test.ts @@ -7,8 +7,8 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import addresses from "../../../scripts/tests/mainnet/addresses"; -import abis from "../../../scripts/constant/abis"; +import { addresses } from "../../../scripts/tests/mainnet/addresses"; +import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { ConnectV2BCompound__factory } from "../../../typechain"; import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/b.protocol/b.liquity.test.ts b/test/mainnet/b.protocol/b.liquity.test.ts index ce0e1a48..88e5f7c6 100644 --- a/test/mainnet/b.protocol/b.liquity.test.ts +++ b/test/mainnet/b.protocol/b.liquity.test.ts @@ -7,10 +7,10 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import abis from "../../../scripts/constant/abis"; +import { abis } from "../../../scripts/constant/abis"; import { ConnectV2BLiquity__factory } from "../../../typechain"; import type { Signer, Contract } from "ethers"; -import addresses from "../../../scripts/tests/mainnet/addresses"; +import { addresses } from "../../../scripts/tests/mainnet/addresses"; const LUSD_WHALE = "0x66017D22b0f8556afDd19FC67041899Eb65a21bb" // stability pool const BAMM_ADDRESS = "0x0d3AbAA7E088C2c82f54B2f47613DA438ea8C598" @@ -19,15 +19,15 @@ describe("B.Liquity", function () { const connectorName = "B.LIQUITY-TEST-A" let dsaWallet0: any; - let dsaWallet1: any + let dsaWallet1: any; let masterSigner: Signer; let instaConnectorsV2: Contract; - let connector: any; - let manager: any; - let vat: any; - let lusd: any; - let bammToken: any; - let stabilityPool: any; + let connector: Contract; + let manager: Contract; + let vat: Contract; + let lusd: Contract; + let bammToken: Contract; + let stabilityPool: Contract; const wallets = provider.getWallets() const [wallet0, wallet1, wallet2, wallet3] = wallets diff --git a/test/mainnet/b.protocol/b.maker.test.ts b/test/mainnet/b.protocol/b.maker.test.ts index e919283a..53bcd8bd 100644 --- a/test/mainnet/b.protocol/b.maker.test.ts +++ b/test/mainnet/b.protocol/b.maker.test.ts @@ -7,8 +7,8 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import addresses from "../../../scripts/tests/mainnet/addresses"; -import abis from "../../../scripts/constant/abis"; +import { addresses } from "../../../scripts/tests/mainnet/addresses"; +import { abis } from "../../../scripts/constant/abis"; import { tokens } from "../../../scripts/tests/mainnet/tokens"; import { ConnectV2BMakerDAO__factory } from "../../../typechain"; import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts index f8a138bc..ceffc1cd 100644 --- a/test/mainnet/basic-ERC1155/ERC1155-transfer.ts +++ b/test/mainnet/basic-ERC1155/ERC1155-transfer.ts @@ -8,8 +8,8 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import addresses from "../../../scripts/tests/mainnet/addresses" -import abis from "../../../scripts/constant/abis" +import { addresses } from "../../../scripts/tests/mainnet/addresses" +import { abis } from "../../../scripts/constant/abis" import type { Signer, Contract } from "ethers"; import { ConnectV2BasicERC1155__factory, IERC1155__factory } from "../../../typechain"; @@ -26,8 +26,8 @@ describe("BASIC-ERC1155", function () { let dsaWallet0: any; let masterSigner: Signer; let instaConnectorsV2: Contract; - let connector: any; - let nftContract: any; + let connector: Contract; + let nftContract: Contract; let tokenOwner: any; let instaImplementationsMapping: any; let InstaAccountV2DefaultImpl: any; diff --git a/test/mainnet/basic-ERC721/ERC721-transfer.ts b/test/mainnet/basic-ERC721/ERC721-transfer.ts index 908d9f21..1ed72c0c 100644 --- a/test/mainnet/basic-ERC721/ERC721-transfer.ts +++ b/test/mainnet/basic-ERC721/ERC721-transfer.ts @@ -8,8 +8,8 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import addresses from "../../../scripts/tests/mainnet/addresses" -import abis from "../../../scripts/constant/abis" +import { addresses } from "../../../scripts/tests/mainnet/addresses" +import { abis } from "../../../scripts/constant/abis" import type { Signer, Contract } from "ethers"; import { ConnectV2BasicERC721__factory, IERC721__factory } from "../../../typechain"; diff --git a/test/mainnet/compound/compound.test.ts b/test/mainnet/compound/compound.test.ts index 383ee12d..89c582ff 100644 --- a/test/mainnet/compound/compound.test.ts +++ b/test/mainnet/compound/compound.test.ts @@ -9,8 +9,8 @@ import { deployAndEnableConnector } from "../../../scripts/tests/deployAndEnable import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import addresses from "../../../scripts/tests/mainnet/addresses"; -import abis from "../../../scripts/constant/abis"; +import { addresses } from "../../../scripts/tests/mainnet/addresses"; +import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { ConnectV2Compound__factory } from "../../../typechain"; diff --git a/test/mainnet/instapool/instapool.test.ts b/test/mainnet/instapool/instapool.test.ts index 99fe80de..59f8d13d 100644 --- a/test/mainnet/instapool/instapool.test.ts +++ b/test/mainnet/instapool/instapool.test.ts @@ -9,8 +9,8 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells" import encodeFlashcastData from "../../../scripts/tests/encodeFlashcastData" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -import addresses from "../../../scripts/tests/mainnet/addresses"; -import abis from "../../../scripts/constant/abis"; +import { addresses } from "../../../scripts/tests/mainnet/addresses"; +import { abis } from "../../../scripts/constant/abis"; import type { Signer, Contract } from "ethers"; import { ConnectV2Compound__factory } from "../../../typechain"; diff --git a/test/mainnet/liquity/liquity.helpers.ts b/test/mainnet/liquity/liquity.helpers.ts index 14c1abaf..97814e71 100644 --- a/test/mainnet/liquity/liquity.helpers.ts +++ b/test/mainnet/liquity/liquity.helpers.ts @@ -8,9 +8,9 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2" import { encodeSpells } from "../../../scripts/tests/encodeSpells" import { getMasterSigner } from "../../../scripts/tests/getMasterSigner" -// Instadapp instadappAddresses/ABIs -import instadappAddresses from "../../../scripts/tests/mainnet/addresses"; -import abis from "../../../scripts/constant/abis"; +// Instadapp addresses/ABIs +import { addresses } from "../../../scripts/tests/mainnet/addresses"; +import { abis } from "../../../scripts/constant/abis"; // Instadapp Liquity Connector artifacts import { ConnectV2Liquity__factory, ConnectV2Basic__factory } from "../../../typechain"; @@ -138,7 +138,7 @@ const deployAndConnect = async (contracts: any, isDebug = false) => { const masterSigner = await getMasterSigner(); const instaConnectorsV2 = await ethers.getContractAt( abis.core.connectorsV2, - instadappAddresses.core.connectorsV2 + addresses.core.connectorsV2 ); const connector = await deployAndEnableConnector({ connectorName: LIQUITY_CONNECTOR, diff --git a/test/mainnet/pooltogether/pooltogether.test.ts b/test/mainnet/pooltogether/pooltogether.test.ts index 1bca8b79..e300ec25 100644 --- a/test/mainnet/pooltogether/pooltogether.test.ts +++ b/test/mainnet/pooltogether/pooltogether.test.ts @@ -8,8 +8,8 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; -import addresses from "../../../scripts/tests/mainnet/addresses"; -import abis from "../../../scripts/constant/abis"; +import { addresses } from "../../../scripts/tests/mainnet/addresses"; +import { abis } from "../../../scripts/constant/abis"; import { constants } from "../../../scripts/constant/constant"; import { tokens } from "../../../scripts/tests/mainnet/tokens"; import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/uniswap/uniswap.test.ts b/test/mainnet/uniswap/uniswap.test.ts index 93a87dec..4049d5de 100644 --- a/test/mainnet/uniswap/uniswap.test.ts +++ b/test/mainnet/uniswap/uniswap.test.ts @@ -8,8 +8,8 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; -import addresses from "../../../scripts/tests/mainnet/addresses"; -import abis from "../../../scripts/constant/abis"; +import { addresses } from "../../../scripts/tests/mainnet/addresses"; +import { abis } from "../../../scripts/constant/abis"; import type { Signer, Contract } from "ethers"; import { abi } from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json"; diff --git a/test/mainnet/uniswapStake/uniswapStake.test.ts b/test/mainnet/uniswapStake/uniswapStake.test.ts index 67889420..e2d15288 100644 --- a/test/mainnet/uniswapStake/uniswapStake.test.ts +++ b/test/mainnet/uniswapStake/uniswapStake.test.ts @@ -9,8 +9,8 @@ import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; import { addLiquidity } from "../../../scripts/tests/addLiquidity"; -import addresses from "../../../scripts/tests/mainnet/addresses"; -import abis from "../../../scripts/constant/abis"; +import { addresses } from "../../../scripts/tests/mainnet/addresses"; +import { abis } from "../../../scripts/constant/abis"; import { abi } from "@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json" import type { Signer, Contract } from "ethers"; diff --git a/test/mainnet/yearn/yearn.test.ts b/test/mainnet/yearn/yearn.test.ts index a7a27464..5c7bedc9 100644 --- a/test/mainnet/yearn/yearn.test.ts +++ b/test/mainnet/yearn/yearn.test.ts @@ -8,8 +8,8 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; -import addresses from "../../../scripts/tests/mainnet/addresses"; -import abis from "../../../scripts/constant/abis"; +import { addresses } from "../../../scripts/tests/mainnet/addresses"; +import { abis } from "../../../scripts/constant/abis"; import { tokens } from "../../../scripts/tests/mainnet/tokens"; import { Signer, Contract, BigNumber } from "ethers"; diff --git a/test/polygon/pooltogether/pooltogether.test.ts b/test/polygon/pooltogether/pooltogether.test.ts index 04b9f821..4d77dbf7 100644 --- a/test/polygon/pooltogether/pooltogether.test.ts +++ b/test/polygon/pooltogether/pooltogether.test.ts @@ -10,8 +10,8 @@ import { buildDSAv2 } from "../../../scripts/tests/buildDSAv2"; import { encodeSpells } from "../../../scripts/tests/encodeSpells"; import { getMasterSigner } from "../../../scripts/tests/getMasterSigner"; -import addresses from "../../../scripts/tests/polygon/addresses"; -import abis from "../../../scripts/constant/abis"; +import { addresses } from "../../../scripts/tests/polygon/addresses"; +import { abis } from "../../../scripts/constant/abis"; import { tokens } from "../../../scripts/tests/polygon/tokens"; import type { Signer, Contract } from "ethers"; From 399853859880b1bc7de041a4d46f1bba4919725e Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sat, 11 Dec 2021 03:42:05 +0530 Subject: [PATCH 35/39] update --- hardhat.config.ts | 6 +++++- scripts/tests/deployAndEnableConnector.ts | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 94eaa311..fa9c282e 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -34,13 +34,17 @@ if (!alchemyApiKey) { throw new Error("Please set your ALCHEMY_API_KEY in a .env file"); } -const PRIVATE_KEY = process.env.PRIVATE_KEY; +let PRIVATE_KEY; const ETHERSCAN_API = process.env.ETHERSCAN_API_KEY; const POLYGONSCAN_API = process.env.POLYGON_API_KEY; const ARBISCAN_API = process.env.ARBISCAN_API_KEY; const SNOWTRACE_API = process.env.SNOWTRACE_API_KEY; const mnemonic = process.env.MNEMONIC; +if(!mnemonic) { + PRIVATE_KEY = process.env.PRIVATE_KEY +} + function createTestnetConfig( network: keyof typeof chainIds ): NetworkUserConfig { diff --git a/scripts/tests/deployAndEnableConnector.ts b/scripts/tests/deployAndEnableConnector.ts index 8e1f5d4b..e08142e4 100644 --- a/scripts/tests/deployAndEnableConnector.ts +++ b/scripts/tests/deployAndEnableConnector.ts @@ -1,6 +1,8 @@ import { addresses as addressesPolygon } from "./polygon/addresses"; import { addresses } from "./mainnet/addresses"; import { abis } from "../constant/abis"; +import { addresses as addressesArbitrum } from "./arbitrum/addresses"; +import { addresses as addressesAvalanche } from "./avalanche/addresses"; import hre from "hardhat"; import type { Signer, Contract } from "ethers"; @@ -18,8 +20,8 @@ interface DeployInterface { function getAddress(network: string | undefined) { if (network === "polygon") return addressesPolygon; - // else if (network === "arbitrum") return addressesPolygon; - // else if (network === "avalanche") return addressesPolygon; + else if (network === "arbitrum") return addressesArbitrum; + else if (network === "avalanche") return addressesAvalanche; else return addresses; } From 21a2dd0e10877b01485b73c48b0164a2ce08e498 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sat, 11 Dec 2021 04:16:46 +0530 Subject: [PATCH 36/39] added dummy mnemonic --- hardhat.config.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index fa9c282e..0ee20be7 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -34,16 +34,13 @@ if (!alchemyApiKey) { throw new Error("Please set your ALCHEMY_API_KEY in a .env file"); } -let PRIVATE_KEY; +const PRIVATE_KEY = process.env.PRIVATE_KEY; +const test = "test test test test test test test test test test test junk"; const ETHERSCAN_API = process.env.ETHERSCAN_API_KEY; const POLYGONSCAN_API = process.env.POLYGON_API_KEY; const ARBISCAN_API = process.env.ARBISCAN_API_KEY; const SNOWTRACE_API = process.env.SNOWTRACE_API_KEY; -const mnemonic = process.env.MNEMONIC; - -if(!mnemonic) { - PRIVATE_KEY = process.env.PRIVATE_KEY -} +const mnemonic = process.env.MNEMONIC ?? test; function createTestnetConfig( network: keyof typeof chainIds @@ -122,15 +119,19 @@ const config: HardhatUserConfig = { ropsten: createTestnetConfig("ropsten"), mainnet: { url: getNetworkUrl("mainnet"), + accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic }, }, polygon: { url: getNetworkUrl("polygon"), + accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic }, }, avalanche: { url: getNetworkUrl("avalanche"), + accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic }, }, arbitrum: { url: getNetworkUrl("arbiturm"), + accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic }, }, }, paths: { From 66030dc0bbc14fdbb8cc1a2f0926fb048f76ec5d Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sat, 11 Dec 2021 04:25:13 +0530 Subject: [PATCH 37/39] updated config --- hardhat.config.ts | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 0ee20be7..b2fb6b17 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -35,12 +35,13 @@ if (!alchemyApiKey) { } const PRIVATE_KEY = process.env.PRIVATE_KEY; -const test = "test test test test test test test test test test test junk"; const ETHERSCAN_API = process.env.ETHERSCAN_API_KEY; const POLYGONSCAN_API = process.env.POLYGON_API_KEY; const ARBISCAN_API = process.env.ARBISCAN_API_KEY; const SNOWTRACE_API = process.env.SNOWTRACE_API_KEY; -const mnemonic = process.env.MNEMONIC ?? test; +const mnemonic = + process.env.MNEMONIC ?? + "test test test test test test test test test test test junk"; function createTestnetConfig( network: keyof typeof chainIds @@ -59,6 +60,13 @@ function createTestnetConfig( }; } +function createCofig(network: string) { + return { + url: getNetworkUrl(network), + accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic }, + }; +} + function getNetworkUrl(networkType: string) { //console.log(process.env); if (networkType === "avalanche") @@ -113,26 +121,14 @@ const config: HardhatUserConfig = { url: String(getNetworkUrl(String(process.env.networkType))), }, }, + mainnet: createCofig("mainnet"), + polygon: createCofig("polygon"), + avalanche: createCofig("avalanche"), + arbitrum: createCofig("arbitrum"), goerli: createTestnetConfig("goerli"), kovan: createTestnetConfig("kovan"), rinkeby: createTestnetConfig("rinkeby"), ropsten: createTestnetConfig("ropsten"), - mainnet: { - url: getNetworkUrl("mainnet"), - accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic }, - }, - polygon: { - url: getNetworkUrl("polygon"), - accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic }, - }, - avalanche: { - url: getNetworkUrl("avalanche"), - accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic }, - }, - arbitrum: { - url: getNetworkUrl("arbiturm"), - accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic }, - }, }, paths: { artifacts: "./artifacts", From 764098f2faad28fe4b840960a65a5b50d7ea8845 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sat, 11 Dec 2021 04:29:04 +0530 Subject: [PATCH 38/39] removed testnetwork support --- hardhat.config.ts | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index b2fb6b17..97debbd1 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -43,24 +43,7 @@ const mnemonic = process.env.MNEMONIC ?? "test test test test test test test test test test test junk"; -function createTestnetConfig( - network: keyof typeof chainIds -): NetworkUserConfig { - const url: string = - "https://eth-" + network + ".alchemyapi.io/v2/" + alchemyApiKey; - return { - accounts: { - count: 10, - initialIndex: 0, - mnemonic, - path: "m/44'/60'/0'/0", - }, - chainId: chainIds[network], - url, - }; -} - -function createCofig(network: string) { +function createConfig(network: string) { return { url: getNetworkUrl(network), accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic }, @@ -121,14 +104,10 @@ const config: HardhatUserConfig = { url: String(getNetworkUrl(String(process.env.networkType))), }, }, - mainnet: createCofig("mainnet"), - polygon: createCofig("polygon"), - avalanche: createCofig("avalanche"), - arbitrum: createCofig("arbitrum"), - goerli: createTestnetConfig("goerli"), - kovan: createTestnetConfig("kovan"), - rinkeby: createTestnetConfig("rinkeby"), - ropsten: createTestnetConfig("ropsten"), + mainnet: createConfig("mainnet"), + polygon: createConfig("polygon"), + avalanche: createConfig("avalanche"), + arbitrum: createConfig("arbitrum"), }, paths: { artifacts: "./artifacts", From 4339ea5d956b119ba3ad145e65fe1c6ddd1e1224 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sat, 11 Dec 2021 04:30:08 +0530 Subject: [PATCH 39/39] removed testnet chainIDs --- hardhat.config.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 97debbd1..1c102759 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -18,12 +18,8 @@ dotenvConfig({ path: resolve(__dirname, "./.env") }); const chainIds = { ganache: 1337, - goerli: 5, hardhat: 31337, - kovan: 42, mainnet: 1, - rinkeby: 4, - ropsten: 3, avalanche: 43114, polygon: 137, arbitrum: 42161,