Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spablob/bsc-deployment #300

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
21f0500
adjust .env.example
Spablob Jan 24, 2023
d4f6202
Added BSC mainnet and testnet related addresses
Spablob Jan 24, 2023
faff013
Add BSC mainnet and testnet to hardhat.config.ts
Spablob Jan 24, 2023
1d22d20
Add BNB STRIKE_STEP to utils
Spablob Jan 24, 2023
fd37ecb
Add BSC mainnet to "getDeltaStep"
Spablob Jan 24, 2023
59d67a4
Add BSC mainnet and testnet to TEST_URI
Spablob Jan 24, 2023
208a4e8
(wip) partial adjustments for bsc mainnet test
Spablob Jan 24, 2023
043531c
remove bsc-testnet
Spablob Jan 27, 2023
8cf61fe
adjustments for bsc mainnet test
Spablob Jan 27, 2023
f097ee4
adjust for new opyn deployment+remove bsc-testnet
Spablob Jan 27, 2023
87e66b4
Merge 'master' into this branch+resolve conflicts
Spablob Jan 30, 2023
c7978a4
add bsc test to package.json
Spablob Jan 30, 2023
2f2665b
remove PREMIUM_DISCOUNT | BNB vault deploy script
Spablob Jan 30, 2023
fba2082
adjust gas amount on test file
Spablob Jan 30, 2023
2acfe62
add BSC for github CI tests
Spablob Jan 30, 2023
1e43abd
Merge branch 'master' into spablob/bsc-deployment
chudnov Feb 3, 2023
e2ac4dd
Address comment-change to manual strike selection
Spablob Feb 3, 2023
e11a3cd
Address comment-addresses in hardhat.config.ts
Spablob Feb 3, 2023
bc17ccb
Merge branch 'master' into spablob/bsc-deployment
Spablob Feb 3, 2023
9fc929f
deploy swap proxy and swap logic on BSC (#307)
Spablob Feb 9, 2023
5ab2649
add BNB call on script 21.
Spablob Mar 8, 2023
3571c1b
run selected deployment scripts | vault deployment
Spablob Mar 8, 2023
59215fc
fix owner and keeper
Spablob Mar 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
MAINNET_MNEMONIC=
KOVAN_MNEMONIC=
AVAX_MNEMONIC=
FUJI_MNEMONIC=
MAINNET_URI=
KOVAN_URI=
TEST_URI=
AVAX_URI="https://api.avax.network/ext/bc/C/rpc"
MAINNET_MNEMONIC=
KOVAN_MNEMONIC=
BSC_MAINNET_MNEMONIC=
AVAX_MNEMONIC=
FUJI_MNEMONIC=
MAINNET_URI=
KOVAN_URI=
BSC_MAINNET_URI="https://bsc-mainnet.public.blastapi.io"
TEST_URI=
AVAX_URI="https://api.avax.network/ext/bc/C/rpc"
FUJI_URI="https://api.avax-test.network/ext/bc/C/rpc"
184 changes: 94 additions & 90 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,90 +1,94 @@
name: Node.js CI

on: ["push"]

jobs:
unit-test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.17.0]

steps:
- run: git config --global url."https://".insteadOf git://
- run: git config --global url."https://github.com/".insteadOf [email protected]
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Node.js modules
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.OS }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Compile Solidity contracts
run: yarn compile
env:
TEST_URI: ${{ secrets.TEST_URI }}
KOVAN_URI: ${{ secrets.TEST_URI }}
KOVAN_MNEMONIC: ${{ secrets.KOVAN_MNEMONIC }}
MAINNET_URI: ${{ secrets.MAINNET_URI }}
MAINNET_MNEMONIC: ${{ secrets.MAINNET_MNEMONIC }}
AVAX_URI: "https://api.avax.network/ext/bc/C/rpc"
AVAX_MNEMONIC: ${{ secrets.AVAX_MNEMONIC }}
FUJI_URI: "https://api.avax-test.network/ext/bc/C/rpc"
FUJI_MNEMONIC: ${{ secrets.FUJI_MNEMONIC }}
CI: true
- run: yarn test
env:
TEST_URI: ${{ secrets.TEST_URI }}
KOVAN_URI: ${{ secrets.TEST_URI }}
KOVAN_MNEMONIC: ${{ secrets.KOVAN_MNEMONIC }}
MAINNET_URI: ${{ secrets.MAINNET_URI }}
MAINNET_MNEMONIC: ${{ secrets.MAINNET_MNEMONIC }}
AVAX_URI: "https://api.avax.network/ext/bc/C/rpc"
AVAX_MNEMONIC: ${{ secrets.AVAX_MNEMONIC }}
FUJI_URI: "https://api.avax-test.network/ext/bc/C/rpc"
FUJI_MNEMONIC: ${{ secrets.FUJI_MNEMONIC }}
CI: true
lint:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.17.0]

steps:
- run: git config --global url."https://".insteadOf git://
- run: git config --global url."https://github.com/".insteadOf [email protected]
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Node.js modules
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.OS }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint contracts
run: yarn lint:sol
- name: Lint typescript
run: yarn lint:ts
name: Node.js CI

on: ["push"]

jobs:
unit-test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.17.0]

steps:
- run: git config --global url."https://".insteadOf git://
- run: git config --global url."https://github.com/".insteadOf [email protected]
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Node.js modules
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.OS }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Compile Solidity contracts
run: yarn compile
env:
TEST_URI: ${{ secrets.TEST_URI }}
KOVAN_URI: ${{ secrets.TEST_URI }}
KOVAN_MNEMONIC: ${{ secrets.KOVAN_MNEMONIC }}
MAINNET_URI: ${{ secrets.MAINNET_URI }}
MAINNET_MNEMONIC: ${{ secrets.MAINNET_MNEMONIC }}
BSC_MAINNET_URI: "https://bsc-mainnet.public.blastapi.io"
BSC_MAINNET_MNEMONIC: ${{ secrets.BSC_MAINNET_MNEMONIC }}
AVAX_URI: "https://api.avax.network/ext/bc/C/rpc"
AVAX_MNEMONIC: ${{ secrets.AVAX_MNEMONIC }}
FUJI_URI: "https://api.avax-test.network/ext/bc/C/rpc"
FUJI_MNEMONIC: ${{ secrets.FUJI_MNEMONIC }}
CI: true
- run: yarn test
env:
TEST_URI: ${{ secrets.TEST_URI }}
KOVAN_URI: ${{ secrets.TEST_URI }}
KOVAN_MNEMONIC: ${{ secrets.KOVAN_MNEMONIC }}
MAINNET_URI: ${{ secrets.MAINNET_URI }}
MAINNET_MNEMONIC: ${{ secrets.MAINNET_MNEMONIC }}
BSC_MAINNET_URI: "https://bsc-mainnet.public.blastapi.io"
BSC_MAINNET_MNEMONIC: ${{ secrets.BSC_MAINNET_MNEMONIC }}
AVAX_URI: "https://api.avax.network/ext/bc/C/rpc"
AVAX_MNEMONIC: ${{ secrets.AVAX_MNEMONIC }}
FUJI_URI: "https://api.avax-test.network/ext/bc/C/rpc"
FUJI_MNEMONIC: ${{ secrets.FUJI_MNEMONIC }}
CI: true
lint:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.17.0]

steps:
- run: git config --global url."https://".insteadOf git://
- run: git config --global url."https://github.com/".insteadOf [email protected]
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Node.js modules
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.OS }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint contracts
run: yarn lint:sol
- name: Lint typescript
run: yarn lint:ts
16 changes: 16 additions & 0 deletions constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
export enum CHAINID {
ETH_MAINNET = 1, // eslint-disable-line no-unused-vars
ETH_KOVAN = 42, // eslint-disable-line no-unused-vars
BSC_MAINNET = 56, // eslint-disable-line no-unused-vars
AVAX_MAINNET = 43114, // eslint-disable-line no-unused-vars
AVAX_FUJI = 43113, // eslint-disable-line no-unused-vars
}
Expand All @@ -13,6 +14,7 @@ export enum CHAINID {
// Must be 1 day from current time
export const BLOCK_NUMBER = {
[CHAINID.ETH_MAINNET]: 14448950,
[CHAINID.BSC_MAINNET]: 25147759,
[CHAINID.AVAX_MAINNET]: 11518500,
[CHAINID.AVAX_FUJI]: 2823963,
};
Expand All @@ -31,6 +33,7 @@ export const PLACEHOLDER_ADDR = "0x0000000000000000000000000000000000000001";
export const WETH_ADDRESS = {
[CHAINID.ETH_MAINNET]: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
[CHAINID.ETH_KOVAN]: "0xd0A1E359811322d97991E03f863a0C30C2cF029C",
[CHAINID.BSC_MAINNET]: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", // NOTE: Wrapped BNB token address, not ETH
[CHAINID.AVAX_MAINNET]: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", // NOTE: Wrapped AVAX token address, not ETH
[CHAINID.AVAX_FUJI]: "0xD9D01A9F7C810EC035C0e42cB9E80Ef44D7f8692", // NOTE: Wrapped AVAX token address, not ETH
};
Expand All @@ -52,13 +55,15 @@ export const WBTC_OWNER_ADDRESS = {
export const USDC_ADDRESS = {
[CHAINID.ETH_MAINNET]: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
[CHAINID.ETH_KOVAN]: "0x7e6edA50d1c833bE936492BF42C1BF376239E9e2",
[CHAINID.BSC_MAINNET]: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
[CHAINID.AVAX_MAINNET]: "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664",
[CHAINID.AVAX_FUJI]: "0x6275B63A4eE560004c34431e573314426906cee9",
};

export const USDC_OWNER_ADDRESS = {
[CHAINID.ETH_MAINNET]: "0x47ac0fb4f2d84898e4d9e7b4dab3c24507a6d503",
[CHAINID.ETH_KOVAN]: "0xf668606B896389066a39B132741763e1ca6d76a2",
[CHAINID.BSC_MAINNET]: "0xf68a4b64162906eff0ff6ae34e2bb1cd42fef62d",
[CHAINID.AVAX_MAINNET]: "0x50ff3b278fcc70ec7a9465063d68029ab460ea04",
[CHAINID.AVAX_FUJI]: "0x61a74365315d57a79a9c72a8394a8a959a29b9c1",
};
Expand Down Expand Up @@ -177,6 +182,7 @@ export const SAMB_OWNER_ADDRESS = {
export const ETH_PRICE_ORACLE = {
[CHAINID.ETH_MAINNET]: "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419",
[CHAINID.ETH_KOVAN]: "0x9326BFA02ADD2366b30bacB125260Af641031331",
[CHAINID.BSC_MAINNET]: "0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE", // NOTE: BNB/USD Chainlink Oracle
[CHAINID.AVAX_MAINNET]: "0x0A77230d17318075983913bC2145DB16C7366156", // NOTE: AVAX/USD Chainlink Oracle
[CHAINID.AVAX_FUJI]: "0x5498BB86BC934c8D34FDA08E81D444153d0D06aD", // NOTE: AVAX/USD Chainlink Oracle
};
Expand All @@ -191,6 +197,7 @@ export const BTC_PRICE_ORACLE = {
export const USDC_PRICE_ORACLE = {
[CHAINID.ETH_MAINNET]: "0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6",
[CHAINID.ETH_KOVAN]: "0x9211c6b3BF41A10F78539810Cf5c64e1BB78Ec60",
[CHAINID.BSC_MAINNET]: "0x51597f405303C4377E36123cBc172b13269EA163",
[CHAINID.AVAX_MAINNET]: "0xF096872672F44d6EBA71458D74fe67F9a77a23B9",
[CHAINID.AVAX_FUJI]: "0x7898AcCC83587C3C55116c5230C17a6Cd9C71bad", // NOTE: This is the USDT oracle, no USDC oracle is on avax testnet
};
Expand Down Expand Up @@ -261,40 +268,46 @@ export const ORACLE_LOCKING_PERIOD = 300;
export const OTOKEN_FACTORY = {
[CHAINID.ETH_MAINNET]: "0x7C06792Af1632E77cb27a558Dc0885338F4Bdf8E",
[CHAINID.ETH_KOVAN]: "0xb9D17Ab06e27f63d0FD75099d5874a194eE623e2",
[CHAINID.BSC_MAINNET]: "0x944740e4432e48429520cED81a750d9CA666F8eF",
[CHAINID.AVAX_MAINNET]: "0x25bC1cD298512885F0e452833198BCBb149f66a5",
[CHAINID.AVAX_FUJI]: "0x3aB375D57EbB733E735a17eDFd3F973f6BC5de21",
};

export const MARGIN_POOL = {
[CHAINID.ETH_MAINNET]: "0x5934807cC0654d46755eBd2848840b616256C6Ef",
[CHAINID.ETH_KOVAN]: "0x8c7C60d766951c5C570bBb7065C993070061b795",
[CHAINID.BSC_MAINNET]: "0x3Be589d20881315AF1a1dA02F432d5214B763d6f",
[CHAINID.AVAX_MAINNET]: "0xCCF6629aEaB734E621Cc59EBb0297196774fDb9D",
[CHAINID.AVAX_FUJI]: "0x9EBC603bBf8309E1715a1678B5C13A4aE6c26452",
};

export const GAMMA_ORACLE = {
[CHAINID.ETH_MAINNET]: "0x789cD7AB3742e23Ce0952F6Bc3Eb3A73A0E08833",
[CHAINID.ETH_KOVAN]: "0x32724C61e948892A906f5EB8892B1E7e6583ba1f",
[CHAINID.BSC_MAINNET]: "0x107412A5fa2DFd630ca8b5546F5649e7363f40Cd",
[CHAINID.AVAX_MAINNET]: "0x108abfBa5AD61bd61A930BFe73394558d60f0b10",
[CHAINID.AVAX_FUJI]: "0x380bB2d01DC2783AB8e98f86DFaBe35DcEF0c066",
};

export const GAMMA_WHITELIST = {
[CHAINID.ETH_MAINNET]: "0xa5EA18ac6865f315ff5dD9f1a7fb1d41A30a6779",
[CHAINID.ETH_KOVAN]: "0x9164eB40a1b59512F1803aB4C2d1dE4B89627A93",
[CHAINID.BSC_MAINNET]: "0xe4F23fa9067068063a5190fdc41e47AaA4ab6A5E",
[CHAINID.AVAX_MAINNET]: "0xe9963AFfc9a53e293c9bB547c52902071e6087c9",
[CHAINID.AVAX_FUJI]: "0xDE24B2364eF695586cAFF591FB24d1576F69894a",
};

export const GAMMA_WHITELIST_OWNER = {
[CHAINID.ETH_MAINNET]: "0x2FCb2fc8dD68c48F406825255B4446EDFbD3e140",
[CHAINID.BSC_MAINNET]: "0xf8368119bb1073cf01b841848725d81b542a4c19",
[CHAINID.AVAX_MAINNET]: "0x5e99297289c4a4afe26bc94702458a86e51c8d53",
[CHAINID.AVAX_FUJI]: "0x004fcf8052d3c7ecb7558ac0068882425a055528",
};

export const GAMMA_CONTROLLER = {
[CHAINID.ETH_MAINNET]: "0x4ccc2339F87F6c59c6893E1A678c2266cA58dC72",
[CHAINID.ETH_KOVAN]: "0xdEE7D0f8CcC0f7AC7e45Af454e5e7ec1552E8e4e",
[CHAINID.BSC_MAINNET]: "0xE2a65c4CCD295524080ea9fd2F00Aed038c55e8F",
// NOTE: We need to use the Gamma Controller Proxy, I found it in the snowtrace logs
// https://testnet.snowtrace.io/tx/0x512a8d6e7121546a2347bc87e540e344ae750cef1ef0ba58966f48e49c4bcdfb#eventlog
[CHAINID.AVAX_MAINNET]: "0x9e3b94819aaF6de606C4Aa844E3215725b997064",
Expand All @@ -304,6 +317,7 @@ export const GAMMA_CONTROLLER = {
export const ORACLE_OWNER = {
[CHAINID.ETH_MAINNET]: "0x2FCb2fc8dD68c48F406825255B4446EDFbD3e140",
[CHAINID.ETH_KOVAN]: "0x5599b4EAdDd319e2F462b27fC8378B0BFaD309CA",
[CHAINID.BSC_MAINNET]: "0xf8368119bb1073cf01b841848725d81b542a4c19",
[CHAINID.AVAX_MAINNET]: "0xce560126fcfae6757071d80ca68a1f6760b68fd2",
[CHAINID.AVAX_FUJI]: "0x004fcf8052d3c7ecb7558ac0068882425a055528",
};
Expand Down Expand Up @@ -352,6 +366,7 @@ export const CHAINLINK_WETH_PRICER_STETH =

export const CHAINLINK_WETH_PRICER = {
[CHAINID.ETH_MAINNET]: "0x128cE9B4D97A6550905dE7d9Abc2b8C747b0996C",
[CHAINID.BSC_MAINNET]: "0xE407429d4c1f25ee37E119343Bd7B48Da26ab33B",
[CHAINID.AVAX_MAINNET]: "0x1E5e27df661323fba0068028a8d1110A3030f34E",
[CHAINID.AVAX_FUJI]: "0x1fAEa5e3429DBabE04Bbb36D1f0A0D918640a2e9",
};
Expand Down Expand Up @@ -483,6 +498,7 @@ export const APE_OPTION_ID = {
export const NETWORK_NAMES = {
[CHAINID.ETH_MAINNET]: "ETH",
[CHAINID.AVAX_MAINNET]: "AVAX",
[CHAINID.BSC_MAINNET]: "BSC",
};

/**
Expand Down
1 change: 1 addition & 0 deletions deployments/bsc_mainnet/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
56
Loading