Skip to content

Commit

Permalink
Merge pull request #304 from Opty-Fi/eth/deployment
Browse files Browse the repository at this point in the history
Eth/deployment
  • Loading branch information
dhruvinparikh authored Mar 25, 2022
2 parents 83883a9 + 6c51fb5 commit ce01ef8
Show file tree
Hide file tree
Showing 62 changed files with 22,227 additions and 399 deletions.
99 changes: 8 additions & 91 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Earn protocol Install, lint, test and deploy pipeline
name: Earn protocol Install, lint and test pipeline

on:
push:
branches:
- master

jobs:
lint:
lint-compile-test:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -15,8 +15,12 @@ jobs:
env:
MAINNET_NODE_URL: ${{ secrets.MAINNET_NODE_URL}}
COINMARKETCAP_API: ${{ secrets.COINMARKETCAP_API}}
REPORT_GAS: true
MNEMONIC: ${{ secrets.MNEMONIC}}
STAGING_NETWORK_URL: ${{secrets.STAGING_NETWORK_URL}}
STRATEGY_DIVISOR: 2
MORALIS_APP_ID: ${{ secrets.MORALIS_APP_ID}}
MORALIS_SERVER_URL: ${{ secrets.MORALIS_SERVER_URL}}

steps:
- name: Checkout Use Node.js ${{ matrix.node-version}}
Expand All @@ -34,107 +38,20 @@ jobs:
- name: Lint
run: |
yarn lint
- name: Google Chat Notification
uses: Co-qn/google-chat-notification@releases/v1
if: always()
with:
name: Lint
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}
compile:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]

env:
MAINNET_NODE_URL: ${{ secrets.MAINNET_NODE_URL}}
COINMARKETCAP_API: ${{ secrets.COINMARKETCAP_API}}
MNEMONIC: ${{ secrets.MNEMONIC}}

steps:
- name: Checkout Use Node.js ${{ matrix.node-version}}
uses: actions/checkout@v2
with:
token: ${{secrets.PAT}}
submodules: recursive
- name: Cache node modules
uses: actions/cache@v2
id: cache
with:
path: '**/node_modules'
key: npm-v2-${{ hashFiles('**/yarn.lock') }}
restore-keys: npm-v2-
- name: Install
run: |
yarn install --frozen-lockfile
- name: Compile
run: |
yarn compile
- name: Google Chat Notification
uses: Co-qn/google-chat-notification@releases/v1
if: always()
with:
name: Compile
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}
test-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]

env:
MAINNET_NODE_URL: ${{ secrets.MAINNET_NODE_URL}}
COINMARKETCAP_API: ${{ secrets.COINMARKETCAP_API}}
REPORT_GAS: true
MNEMONIC: ${{ secrets.MNEMONIC}}
STAGING_NETWORK_URL: ${{secrets.STAGING_NETWORK_URL}}
STRATEGY_DIVISOR: 2
MORALIS_APP_ID: ${{ secrets.MORALIS_APP_ID}}
MORALIS_SERVER_URL: ${{ secrets.MORALIS_SERVER_URL}}

steps:
- name: Checkout Use Node.js ${{ matrix.node-version}}
uses: actions/checkout@v2
with:
token: ${{secrets.PAT}}
submodules: recursive
- name: Cache node modules
uses: actions/cache@v2
id: cache
with:
path: '**/node_modules'
key: npm-v2-${{ hashFiles('**/yarn.lock') }}
restore-keys: npm-v2-
- name: Install
run: |
yarn install --frozen-lockfile
- name: Optyfi-SDK Mainnet
run: |
yarn typechain && yarn optyfi-sdk:mainnet
- name: Test
run: |
yarn test-fast:mainnet
yarn test-fast:vaultv2-upgrade-test:mainnet
- name: Add public IP to AWS security group
uses: sohelamin/aws-security-group-add-ip-action@master
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: 'us-east-1'
aws-security-group-id: ${{ secrets.AWS_SECURITY_GROUP_ID }}
port: '8545'
to-port: ''
protocol: 'tcp'
description: 'GitHub Action'
- name: Deploy
run: |
yarn setup:staging
- name: Google Chat Notification
uses: Co-qn/google-chat-notification@releases/v1
if: always()
with:
name: Test & Deploy
name: Lint-Compile-Test
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}
status: ${{ job.status }}
60 changes: 0 additions & 60 deletions .github/workflows/manual-deploy.yml

This file was deleted.

59 changes: 0 additions & 59 deletions .github/workflows/manual-test-coverage.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,3 @@ jobs:
run: |
yarn test-fast:mainnet
yarn test-fast:vaultv2-upgrade-test:mainnet
- name: Add public IP to AWS security group
uses: sohelamin/aws-security-group-add-ip-action@master
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: 'us-east-1'
aws-security-group-id: ${{ secrets.AWS_SECURITY_GROUP_ID }}
port: '8545'
to-port: ''
protocol: 'tcp'
description: 'GitHub Action'
- name: Deploy
run: |
yarn setup:staging
- name: Google Chat Notification
uses: Co-qn/google-chat-notification@releases/v1
if: always()
with:
name: Test & Deploy
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}
40 changes: 40 additions & 0 deletions cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -551,3 +551,43 @@ yarn hardhat get-action \
--functionabi 'balanceOf(address)' \
--params 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1
```

### get-price-per-full-share

```
Usage: get price per full share of the vault
Options:
--vault required <address> the address of vault
--block-number <number> block number
--network optional <string> name of the network provider (default: hardhat)
```

- Example:

```
yarn hardhat get-price-per-full-share \
--network localhost \
--vault 0x0000000000000000000000000000000000000000 \
--block-number 1234567
```

### get-total-supply

```
Usage: get total supply of the vault
Options:
--vault required <address> the address of vault
--block-number <number> block number
--network optional <string> name of the network provider (default: hardhat)
```

- Example:

```
yarn hardhat get-price-per-full-share \
--network localhost \
--vault 0x0000000000000000000000000000000000000000 \
--block-number 1234567
```
7 changes: 3 additions & 4 deletions deploy/000_kovan_001_set_zero_strategy.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { getAddress } from "ethers/lib/utils";
import hre from "hardhat";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { ESSENTIAL_CONTRACTS } from "../helpers/constants/essential-contracts-name";
import { oldAbis } from "../helpers/data/oldAbis";

const FORK = process.env.FORK;

const func: DeployFunction = async ({ ethers, getChainId }: HardhatRuntimeEnvironment) => {
const func: DeployFunction = async ({ ethers, getChainId, network }: HardhatRuntimeEnvironment) => {
const chainId = await getChainId();
const networkName = hre.network.name;
const networkName = network.name;
const { getAddress } = ethers.utils;

if (chainId == "42" || FORK == "kovan" || networkName == "kovan") {
const registryProxyAddress = "0xf710F75418353B36F2624784c290B80e7a5C892A";
Expand Down
10 changes: 5 additions & 5 deletions deploy/000_kovan_002_usdc_rebalance.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { getAddress } from "ethers/lib/utils";
import hre from "hardhat";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { ESSENTIAL_CONTRACTS } from "../helpers/constants/essential-contracts-name";
import { oldAbis } from "../helpers/data/oldAbis";

const FORK = process.env.FORK;

const func: DeployFunction = async ({ ethers, getChainId }: HardhatRuntimeEnvironment) => {
const func: DeployFunction = async ({ ethers, getChainId, network }: HardhatRuntimeEnvironment) => {
const chainId = await getChainId();
const networkName = hre.network.name;
const networkName = network.name;
const { getAddress } = ethers.utils;

if (chainId == "42" || FORK == "kovan" || networkName == "kovan") {
const opAVUSDCintProxyAddress = "0x118194e96b2d4b08957ba9a05508fb6d14a37a0d";
Expand All @@ -23,7 +22,8 @@ const func: DeployFunction = async ({ ethers, getChainId }: HardhatRuntimeEnviro
console.log("\n");
console.log("USDC vault...");
console.log("\n");
const opAVUSDCintInstance = await ethers.getContractAt(oldAbis.oldVault, opAVUSDCintProxyAddress);
const signers = await ethers.getSigners();
const opAVUSDCintInstance = await ethers.getContractAt(oldAbis.oldVault, opAVUSDCintProxyAddress, signers[0]);

const usdcCurrentStrategyHash = await opAVUSDCintInstance.investStrategyHash();
console.log("USDC current strategy ", usdcCurrentStrategyHash);
Expand Down
Loading

0 comments on commit ce01ef8

Please sign in to comment.