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

Release 20220428 #431

Merged
merged 3 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
267 changes: 107 additions & 160 deletions .github/workflows/cd-deploy-contracts.yaml
Original file line number Diff line number Diff line change
@@ -1,119 +1,29 @@
name: Deploy contracts

on:
push:
branches:
- main
paths:
- packages/core/contracts/**
- .github/workflows/cd-deploy-contracts.yaml
workflow_dispatch:
inputs:
network:
description: 'network'
required: true
escrowFactory:
description: 'deploy escrow factory'
required: true
staking:
description: 'deploy staking'
required: true
rewardPool:
description: 'deploy reward pool'
required: true
reputation:
description: 'deploy reputation'
required: true

jobs:
deploy-contracts:
name: Deploy contracts
runs-on: ubuntu-latest
environment: deploy-contracts
strategy:
matrix:
network: [
{
name: goerli,
escrow_factory: '0x87469B4f2Fcf37cBd34E54244c0BD4Fa0603664c',
staking: '0xf46B45Df3d956369726d8Bd93Ba33963Ab692920',
reward_pool: '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4',
reputation: '0x6B220A6306D8D86C9878A1FBb3F49707b3E2b405',
private_key: TESTNET_PRIVATE_KEY,
subgraph: 'goerli-v1'
},
{
name: polygon,
escrow_factory: '0xBDBfD2cC708199C5640C6ECdf3B0F4A4C67AdfcB',
staking: '0xcbAd56bE3f504E98bd70875823d3CC0242B7bB29',
reward_pool: '0xa8e32d777a3839440cc7c24D591A64B9481753B3',
# reputation:
private_key: MAINNET_PRIVATE_KEY,
subgraph: 'polygon-v1'
},
{
name: polygonMumbai,
escrow_factory: '0xA8D927C4DA17A6b71675d2D49dFda4E9eBE58f2d',
staking: '0x7Fd3dF914E7b6Bd96B4c744Df32183b51368Bfac',
reward_pool: '0xf0145eD99AC3c4f877aDa7dA4D1E059ec9116BAE',
reputation: '0xC522463d36f76b881bE66484e3068F11e7038Ace',
private_key: TESTNET_PRIVATE_KEY,
subgraph: 'mumbai-v1'
},
{
name: bsc,
escrow_factory: '0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a',
staking: '0x05398211bA2046E296fBc9a9D3EB49e3F15C3123',
reward_pool: '0x4A5963Dd6792692e9147EdC7659936b96251917a',
# reputation:
private_key: MAINNET_PRIVATE_KEY,
subgraph: 'bsc-v1'
},
{
name: bscTestnet,
escrow_factory: '0x2bfA592DBDaF434DDcbb893B1916120d181DAD18',
staking: '0x5517fE916Fe9F8dB15B0DDc76ebDf0BdDCd4ed18',
reward_pool: '0xB0A0500103eCEc431b73F6BAd923F0a2774E6e29',
reputation: '0xb8F62639aA3DD51A39d6AACD969363e7F87dcc98',
private_key: TESTNET_PRIVATE_KEY,
subgraph: 'bsctest-v1'
},
{
name: moonbeam,
escrow_factory: '0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a',
staking: '0x05398211bA2046E296fBc9a9D3EB49e3F15C3123',
reward_pool: '0x4A5963Dd6792692e9147EdC7659936b96251917a',
# reputation:
private_key: MAINNET_PRIVATE_KEY,
subgraph: 'moonbeam-v1'
},
{
name: moonbaseAlpha,
escrow_factory: '0x5e622FF522D81aa426f082bDD95210BC25fCA7Ed',
staking: '0xBFC7009F3371F93F3B54DdC8caCd02914a37495c',
reward_pool: '0xf46B45Df3d956369726d8Bd93Ba33963Ab692920',
reputation: '0x87469B4f2Fcf37cBd34E54244c0BD4Fa0603664c',
private_key: TESTNET_PRIVATE_KEY,
subgraph: 'moonbase-alpha-v1'
},
{
name: mainnet,
escrow_factory: '0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a',
staking: '0x05398211bA2046E296fBc9a9D3EB49e3F15C3123',
reward_pool: '0x4A5963Dd6792692e9147EdC7659936b96251917a',
private_key: MAINNET_PRIVATE_KEY,
subgraph: 'mainnet-v1'
}
# {
# name: avalanche,
# escrow_factory,
# staking,
# reward_pool,
# reputation,
# private_key,
# },
# {
# name: avalancheTestnet,
# escrow_factory,
# staking,
# reward_pool,
# reputation,
# private_key,
# },
# {
# name: skale,
# escrow_factory: '0x319070b49C8d1cC015915D1E7Eb5fd8e22833885',
# staking: '0x79F37FB9C210910733c16228AC4D14a8e32C11BD',
# reward_pool: '0x881218246c25C6898aE96145259584340153aDA2',
# # reputation:
# private_key: MAINNET_PRIVATE_KEY,
# },
]
fail-fast: true
max-parallel: 3
env:
PRIVATE_KEY: ${{ secrets[matrix.network.private_key] }}
ETH_GOERLI_TESTNET_URL: ${{ secrets.ETH_GOERLI_TESTNET_URL }}
Expand All @@ -124,14 +34,10 @@ jobs:
ETH_MOONBEAM_URL: ${{ secrets.ETH_MOONBEAM_URL }}
ETH_MOONBASE_ALPHA_URL: ${{ secrets.ETH_MOONBASE_ALPHA_URL }}
ETH_MAINNET_TESTNET_URL: ${{ secrets.ETH_MAINNET_TESTNET_URL }}
# ETH_SKALE_URL: ${{ secrets.ETH_SKALE_URL }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
POLYGONSCAN_API_KEY: ${{ secrets.POLYGONSCAN_API_KEY }}
BSC_API_KEY: ${{ secrets.BSC_API_KEY }}
MOONSCAN_API_KEY: ${{ secrets.MOONSCAN_API_KEY }}
# SKALE_API_KEY: ${{ secrets.SKALE_API_KEY }}
# SKALE_BROWSER_API_URL: ${{ secrets.SKALE_BROWSER_API_URL }}
# SKALE_BROWSER_URL: ${{ secrets.SKALE_BROWSER_URL }}
SUBGRAPH: ${{ matrix.network.subgraph }}
steps:
- uses: actions/checkout@v3
Expand All @@ -140,73 +46,114 @@ jobs:
node-version: 18.15
- name: Install dependencies
run: npm install --global yarn && yarn --ignore-scripts
- name: Check changes in files
uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ github.ref }}
filters: |
escrow_factory:
- 'packages/core/contracts/Escrow*.sol'
- 'packages/core/contracts/interfaces/IStaking.sol'
staking:
- 'packages/core/contracts/Staking.sol'
- 'packages/core/contracts/libs/Stakes.sol'
- 'packages/core/contracts/interfaces/IStaking.sol'
- 'packages/core/contracts/interfaces/IRewardPool.sol'
- 'packages/core/contracts/interfaces/IEscrow.sol'
reward_pool:
- 'packages/core/contracts/RewardPool.sol'
- 'packages/core/contracts/interfaces/IRewardPool.sol'
reputation:
- 'packages/core/contracts/Reputation.sol'
- name: Compile smart contracts
if: |
steps.filter.outputs.escrow_factory == 'true' ||
steps.filter.outputs.staking == 'true' ||
steps.filter.outputs.reward_pool == 'true' ||
steps.filter.outputs.reputation == 'true'
run: yarn compile
working-directory: ./packages/core
- name: Networks list
id: networks
run: |
case ${{ github.event.inputs.network }} in
"goerli")
echo "escrow_factory=0x87469B4f2Fcf37cBd34E54244c0BD4Fa0603664c" >> $GITHUB_OUTPUT
echo "staking=0xf46B45Df3d956369726d8Bd93Ba33963Ab692920" >> $GITHUB_OUTPUT
echo "reward_pool=0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4" >> $GITHUB_OUTPUT
echo "reputation=0x6B220A6306D8D86C9878A1FBb3F49707b3E2b405" >> $GITHUB_OUTPUT
echo "private_key=TESTNET_PRIVATE_KEY" >> $GITHUB_OUTPUT
echo "subgraph=goerli-v1" >> $GITHUB_OUTPUT
;;
"polygon")
echo "escrow_factory=0xBDBfD2cC708199C5640C6ECdf3B0F4A4C67AdfcB" >> $GITHUB_OUTPUT
echo "staking=0xcbAd56bE3f504E98bd70875823d3CC0242B7bB29" >> $GITHUB_OUTPUT
echo "reward_pool=0xa8e32d777a3839440cc7c24D591A64B9481753B3" >> $GITHUB_OUTPUT
echo "private_key=MAINNET_PRIVATE_KEY" >> $GITHUB_OUTPUT
echo "subgraph=polygon-v1" >> $GITHUB_OUTPUT
;;
"polygonMumbai")
echo "escrow_factory=0xA8D927C4DA17A6b71675d2D49dFda4E9eBE58f2d" >> $GITHUB_OUTPUT
echo "staking=0x7Fd3dF914E7b6Bd96B4c744Df32183b51368Bfac" >> $GITHUB_OUTPUT
echo "reward_pool=0xf0145eD99AC3c4f877aDa7dA4D1E059ec9116BAE" >> $GITHUB_OUTPUT
echo "reputation=0xC522463d36f76b881bE66484e3068F11e7038Ace" >> $GITHUB_OUTPUT
echo "private_key=TESTNET_PRIVATE_KEY" >> $GITHUB_OUTPUT
echo "subgraph=mumbai-v1" >> $GITHUB_OUTPUT
;;
"bsc")
echo "escrow_factory=0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a" >> $GITHUB_OUTPUT
echo "staking=0x05398211bA2046E296fBc9a9D3EB49e3F15C3123" >> $GITHUB_OUTPUT
echo "reward_pool=0x4A5963Dd6792692e9147EdC7659936b96251917a" >> $GITHUB_OUTPUT
echo "private_key=MAINNET_PRIVATE_KEY" >> $GITHUB_OUTPUT
echo "subgraph=bsc-v1" >> $GITHUB_OUTPUT
;;
"bscTestnet")
echo "escrow_factory=0x2bfA592DBDaF434DDcbb893B1916120d181DAD18" >> $GITHUB_OUTPUT
echo "staking=0x5517fE916Fe9F8dB15B0DDc76ebDf0BdDCd4ed18" >> $GITHUB_OUTPUT
echo "reward_pool=0xB0A0500103eCEc431b73F6BAd923F0a2774E6e29" >> $GITHUB_OUTPUT
echo "reputation=0xb8F62639aA3DD51A39d6AACD969363e7F87dcc98" >> $GITHUB_OUTPUT
echo "private_key=TESTNET_PRIVATE_KEY" >> $GITHUB_OUTPUT
echo "subgraph=bsctest-v1" >> $GITHUB_OUTPUT
;;
"moonbeam")
echo "escrow_factory=0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a" >> $GITHUB_OUTPUT
echo "staking=0x05398211bA2046E296fBc9a9D3EB49e3F15C3123" >> $GITHUB_OUTPUT
echo "reward_pool=0x4A5963Dd6792692e9147EdC7659936b96251917a" >> $GITHUB_OUTPUT
echo "private_key=MAINNET_PRIVATE_KEY" >> $GITHUB_OUTPUT
echo "subgraph=moonbeam-v1" >> $GITHUB_OUTPUT
;;
"moonbaseAlpha")
echo "escrow_factory=0x5e622FF522D81aa426f082bDD95210BC25fCA7Ed" >> $GITHUB_OUTPUT
echo "staking=0xBFC7009F3371F93F3B54DdC8caCd02914a37495c" >> $GITHUB_OUTPUT
echo "reward_pool=0xf46B45Df3d956369726d8Bd93Ba33963Ab692920" >> $GITHUB_OUTPUT
echo "reputation=0x87469B4f2Fcf37cBd34E54244c0BD4Fa0603664c" >> $GITHUB_OUTPUT
echo "private_key=TESTNET_PRIVATE_KEY" >> $GITHUB_OUTPUT
echo "subgraph=moonbase-alpha-v1" >> $GITHUB_OUTPUT
;;
"mainnet")
echo "escrow_factory=0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a" >> $GITHUB_OUTPUT
echo "staking=0x05398211bA2046E296fBc9a9D3EB49e3F15C3123" >> $GITHUB_OUTPUT
echo "reward_pool=0x4A5963Dd6792692e9147EdC7659936b96251917a" >> $GITHUB_OUTPUT
echo "private_key=MAINNET_PRIVATE_KEY" >> $GITHUB_OUTPUT
echo "subgraph=mainnet-v1" >> $GITHUB_OUTPUT
;;
*)
echo "Invalid network"
exit 1
;;
esac
- name: Upgrade Escrow Factory Proxy
if: steps.filter.outputs.escrow_factory == 'true'
run: yarn upgrade:proxy --network ${{ matrix.network.name }}
if: github.event.inputs.escrowFactory == 'true'
run: yarn upgrade:proxy --network ${{ github.event.inputs.network }}
working-directory: ./packages/core
env:
ESCROW_FACTORY_ADDRESS: ${{ matrix.network.escrow_factory }}
ESCROW_FACTORY_ADDRESS: ${{ steps.networks.outputs.escrow_factory }}
- name: Verify Escrow Factory Proxy
if: steps.filter.outputs.escrow_factory == 'true'
run: npx hardhat verify --network ${{ matrix.network.name }} ${{ matrix.network.escrow_factory }}
if: github.event.inputs.escrowFactory == 'true'
run: npx hardhat verify --network ${{ github.event.inputs.network }} ${{ steps.networks.outputs.escrow_factory }}
working-directory: ./packages/core
- name: Upgrade Staking Proxy
if: steps.filter.outputs.staking == 'true'
run: yarn upgrade:proxy --network ${{ matrix.network.name }}
if: github.event.inputs.staking == 'true'
run: yarn upgrade:proxy --network ${{ github.event.inputs.network }}
working-directory: ./packages/core
env:
STAKING_ADDRESS: ${{ matrix.network.staking }}
STAKING_ADDRESS: ${{ steps.networks.outputs.staking }}
- name: Verify Staking Proxy
if: steps.filter.outputs.staking == 'true'
run: npx hardhat verify --network ${{ matrix.network.name }} ${{ matrix.network.staking }}
if: github.event.inputs.staking == 'true'
run: npx hardhat verify --network ${{ github.event.inputs.network }} ${{ steps.networks.outputs.staking }}
working-directory: ./packages/core
- name: Upgrade Reward Pool Proxy
if: steps.filter.outputs.reward_pool == 'true'
run: yarn upgrade:proxy --network ${{ matrix.network.name }}
if: github.event.inputs.rewardPool == 'true'
run: yarn upgrade:proxy --network ${{ github.event.inputs.network }}
working-directory: ./packages/core
env:
REWARD_POOL_ADDRESS: ${{ matrix.network.reward_pool }}
REWARD_POOL_ADDRESS: ${{ steps.networks.outputs.reward_pool }}
- name: Verify Reward Pool Proxy
if: steps.filter.outputs.reward_pool == 'true'
run: npx hardhat verify --network ${{ matrix.network.name }} ${{ matrix.network.reward_pool }}
if: github.event.inputs.rewardPool== 'true'
run: npx hardhat verify --network ${{ github.event.inputs.network }} ${{ steps.networks.outputs.reward_pool }}
working-directory: ./packages/core
- name: Upgrade Reputation Proxy
if: steps.filter.outputs.reputation == 'true' && matrix.network.reputation != ''
run: yarn upgrade:proxy --network ${{ matrix.network.name }}
if: github.event.inputs.reputation == 'true' && steps.networks.outputs.reputation != ''
run: yarn upgrade:proxy --network ${{ github.event.inputs.network }}
working-directory: ./packages/core
env:
REPUTATION_ADDRESS: ${{ matrix.network.reputation }}
REPUTATION_ADDRESS: ${{ steps.networks.outputs.reputation }}
- name: Verify Reputation Proxy
if: steps.filter.outputs.reputation == 'true' && matrix.network.reputation != ''
run: npx hardhat verify --network ${{ matrix.network.name }} ${{ matrix.network.reputation }}
if: github.event.inputs.reputation == 'true' && steps.networks.outputs.reputation != ''
run: npx hardhat verify --network ${{ github.event.inputs.network }} ${{ steps.networks.outputs.reputation }}
working-directory: ./packages/core
- name: Commit changes
if: ${{ success() }}
Expand All @@ -219,4 +166,4 @@ jobs:
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Subgraph deployment
inputs: '{ "subgraph-name": "${{ matrix.network.subgraph }}" }'
inputs: '{ "subgraph-name": "${{ steps.networks.outputs.subgraph }}" }'
10 changes: 2 additions & 8 deletions .github/workflows/cd-subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:
- 'packages/core/contracts/**'
subgraph:
name: Deploy Subgraph
environment: deploy-subgraph
needs: contracts-check
runs-on: ubuntu-latest

runs-on: ubuntu-latest
strategy:
matrix:
network:
Expand All @@ -52,12 +52,6 @@ jobs:
graph: moonbase-alpha-v1
- name: mainnet
graph: mainnet-v1
# - name: avalanche
# graph: avalanche
# - name: fuji
# graph: fuji
# - name: skale
# graph: skale
fail-fast: true
max-parallel: 3
if: ${{ needs.contracts-check.outputs.contracts_updated != 'true' || github.event.inputs.subgraph-name }}
Expand Down
Loading