diff --git a/.env b/.env
index 0912eda71..3d3865004 100644
--- a/.env
+++ b/.env
@@ -3,7 +3,8 @@ REACT_APP_VERSION=$npm_package_version
REACT_APP_INFURA_KEY_V1=646dc0f33d2449878b28e0afa25267f6
REACT_APP_RPC_URL_42='https://kovan.infura.io/v3/2af222f674024a0f84b5f0aad0da72a2'
REACT_APP_RPC_URL_1='https://mainnet.infura.io/v3/2af222f674024a0f84b5f0aad0da72a2'
-REACT_APP_RPC_URL_10='https://optimism-mainnet.infura.io/v3/82c9d66897df4cf7a9e74ab44826affe'
-REACT_APP_RPC_URL_69='https://optimism-kovan.infura.io/v3/277b589655694280bcb3cd7ebf79032c'
-REACT_APP_RPC_URL_42161='https://arbitrum-mainnet.infura.io/v3/cbbe5034491045709e466f05dcd5ad5a'
-REACT_APP_RPC_URL_421611='https://arbitrum-rinkeby.infura.io/v3/9adffa99cbf64552a492081225822885'
+REACT_APP_RPC_URL_4='https://rinkeby.infura.io/v3/2af222f674024a0f84b5f0aad0da72a2'
+REACT_APP_RPC_URL_10='https://optimism-mainnet.infura.io/v3/2af222f674024a0f84b5f0aad0da72a2'
+REACT_APP_RPC_URL_69='https://optimism-kovan.infura.io/v3/2af222f674024a0f84b5f0aad0da72a2'
+REACT_APP_RPC_URL_42161='https://arbitrum-mainnet.infura.io/v3/2af222f674024a0f84b5f0aad0da72a2'
+REACT_APP_RPC_URL_421611='https://arbitrum-rinkeby.infura.io/v3/2af222f674024a0f84b5f0aad0da72a2'
diff --git a/README.md b/README.md
index a95149150..cb97640d4 100644
--- a/README.md
+++ b/README.md
@@ -1,30 +1,15 @@
-# Yield app v2
+# Basic Sample Hardhat Project
-## A. Setup Blockchain Environment
+This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, a sample script that deploys that contract, and an example of a task implementation, which simply lists the available accounts.
-### Option 1: Run development environment locally **(Recommended for now)**
+Try running some of the following tasks:
-In a new console:
-
-1. **clone** the environments-v2 repo: `git clone https://github.com/yieldprotocol/environments-v2.git`
-2. **checkout tagged release** `git checkout RC4`
-3. **install** the environment `yarn`
-4. **Start a local hardhat chain instance**: `npx hardhat node`
-5. optional: **Add your testing account** to the list of accounts to be auto-funded with test tokens:
-
- (edit `externalTestAccounts` array line 32 in file `./environments/development.ts` )
-
-In a new console
-
-1. **Run the dev environment deploy/setup** `npx hardhat run ./environments/development.ts --network localhost`
-
-### Option 2: Use Rinkeby Testnet
-
-No setup required, simply point metamask to the correct network
-
-## B. Run User Interface (this Repo):
-
-Fire up the UI locally:
-
-1. **install and run** `yarn && yarn start`
-2. In the browser, connect metamask to the localhost network, and reset the metamask account (for just in case).
+```shell
+npx hardhat accounts
+npx hardhat compile
+npx hardhat clean
+npx hardhat test
+npx hardhat node
+node scripts/sample-script.js
+npx hardhat help
+```
diff --git a/cache/solidity-files-cache.json b/cache/solidity-files-cache.json
deleted file mode 100644
index cb236ef8b..000000000
--- a/cache/solidity-files-cache.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "_format": "hh-sol-cache-2",
- "files": {}
-}
diff --git a/hardhat.config.js b/hardhat.config.js
new file mode 100644
index 000000000..cd1d32e77
--- /dev/null
+++ b/hardhat.config.js
@@ -0,0 +1,54 @@
+require("@nomiclabs/hardhat-waffle");
+
+// This is a sample Hardhat task. To learn how to create your own go to
+// https://hardhat.org/guides/create-task.html
+task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
+ const accounts = await hre.ethers.getSigners();
+ for (const account of accounts) {
+ console.log(account.address);
+ }
+});
+
+
+
+/* npx hardhat harvest --whale 0xa29332b560103d52f758b978e0661420a9d40cb5 --token 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984 */
+task("harvest", "Fund accounts by impersonating whales", async (taskArgs, hre) => {
+
+ const topupList = [ '0x1Bd3Abb6ef058408734EA01cA81D325039cd7bcA' ];
+
+ const whaleAddr = taskArgs.whale;
+ const tokenAddr = taskArgs.token;
+
+ await hre.network.provider.request({
+ method: "hardhat_impersonateAccount",
+ params: [taskArgs.whale],
+ });
+
+ const signer = await ethers.getSigner(taskArgs.whale) // UNI whale 0xa29332b560103d52f758b978e0661420a9d40cb5
+ const uniAddr = taskArgs.token; // '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984';
+ // The ERC-20 most simple Contract ABI
+ const erc20Abi = ["function transfer(address to, uint amount)","function balanceOf(address) view returns (uint)",];
+ const uni = new ethers.Contract(uniAddr, erc20Abi, signer);
+ const amount = ethers.utils.parseUnits("1000.0", 18);
+ await Promise.all( topupList.map(async (addr) => {
+ await uni.transfer( addr, amount);
+ console.log( (await uni.balanceOf(addr)).toString() )
+ }))
+})
+.addParam("whale", "The account's address")
+.addParam("token", "The account's address");
+
+/**
+ * @type import('hardhat/config').HardhatUserConfig
+ */
+module.exports = {
+ solidity: "0.8.4",
+ networks: {
+ hardhat: {
+ chainId: 1,
+ forking: {
+ url: "https://mainnet.infura.io/v3/2af222f674024a0f84b5f0aad0da72a2",
+ }
+ }
+ }
+};
diff --git a/package.json b/package.json
index 5ca5c0b4c..faf315af7 100644
--- a/package.json
+++ b/package.json
@@ -59,6 +59,8 @@
]
},
"devDependencies": {
+ "@nomiclabs/hardhat-ethers": "^2.0.0",
+ "@nomiclabs/hardhat-waffle": "^2.0.1",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^13.2.1",
@@ -85,6 +87,8 @@
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.2.0",
+ "ethereum-waffle": "^3.2.0\n",
+ "hardhat": "^2.7.0",
"prettier": "^2.4.1",
"react-test-renderer": "^17.0.2",
"source-map-explorer": "^2.5.2",
diff --git a/public/index.html b/public/index.html
index 8c30c4fb9..4dcbff281 100644
--- a/public/index.html
+++ b/public/index.html
@@ -10,12 +10,12 @@
-
+ -->