diff --git a/.github/actions/deploy_contract/action.yml b/.github/actions/deploy_contract/action.yml new file mode 100644 index 0000000..385ded4 --- /dev/null +++ b/.github/actions/deploy_contract/action.yml @@ -0,0 +1,36 @@ +name: 'Deploy Contract' +description: 'Deploy contract with Hardhat' + +inputs: + network: + description: 'The network to deploy the contract on' + required: true + stage: + description: 'The stage for deployment' + required: true + task: + description: 'The task to execute' + required: true + +runs: + using: 'composite' + steps: + - name: Install dependencies + run: yarn install --frozen-lockfile + shell: bash + - name: Compile contract + run: yarn compile + shell: bash + - name: Deploy contract + run: npx hardhat deploy --network ${{ inputs.network }} --stage ${{ inputs.stage }} --task '${{ inputs.task }}' + shell: bash + - name: Commit and push changes + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "github-actions@position.exchange" + git add -A + git commit -m "Update contract deployment artifacts [ci/cd]" + git push + shell: bash + + diff --git a/.github/workflows/deploy_arb.yml b/.github/workflows/deploy_arb.yml new file mode 100644 index 0000000..1358886 --- /dev/null +++ b/.github/workflows/deploy_arb.yml @@ -0,0 +1,54 @@ +name: Deploy Futures Adapter to Arbitrum Goerli + +on: + push: + branches: [ "develop" ] + pull_request: + branches: [ "develop" ] + workflow_dispatch: +permissions: + contents: write +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Deploy Futures Adapter + uses: ./.github/actions/deploy_contract + with: + network: arbitrumGoerli + stage: arbitrumGoerli + task: 'deploy futures adapter' + env: + PRIV_TESTNET_ACCOUNT: ${{ secrets.PRIV_TESTNET_ACCOUNT }} + BSC_TESTNET_URL: ${{ secrets.BSC_TESTNET_URL }} + PRIV_MAINNET_ACCOUNT: ${{ secrets.PRIV_MAINNET_ACCOUNT }} + DEFENDER_TEAM_API_KEY: ${{ secrets.DEFENDER_TEAM_API_KEY }} + DEFENDER_TEAM_API_SECRET_KEY: ${{ secrets.DEFENDER_TEAM_API_SECRET_KEY }} + ARB_API_KEY: ${{ secrets.ARB_API_KEY }} + - name: Deploy dptp futures gateway + uses: ./.github/actions/deploy_contract + with: + network: arbitrumGoerli + stage: arbitrumGoerli + task: 'deploy dptp futures gateway' + env: + PRIV_TESTNET_ACCOUNT: ${{ secrets.PRIV_TESTNET_ACCOUNT }} + BSC_TESTNET_URL: ${{ secrets.BSC_TESTNET_URL }} + PRIV_MAINNET_ACCOUNT: ${{ secrets.PRIV_MAINNET_ACCOUNT }} + DEFENDER_TEAM_API_KEY: ${{ secrets.DEFENDER_TEAM_API_KEY }} + DEFENDER_TEAM_API_SECRET_KEY: ${{ secrets.DEFENDER_TEAM_API_SECRET_KEY }} + ARB_API_KEY: ${{ secrets.ARB_API_KEY }} + + + + # Add more migration + diff --git a/contracts/protocol/DptpFuturesGateway.sol b/contracts/protocol/DptpFuturesGateway.sol index 6f2e139..a198439 100644 --- a/contracts/protocol/DptpFuturesGateway.sol +++ b/contracts/protocol/DptpFuturesGateway.sol @@ -1454,7 +1454,8 @@ contract DptpFuturesGateway is pscCrossChainGateway, uint8(Method.EXECUTE_STORE_POSITION), abi.encode( - _requestKey + _requestKey, + uint8(0) ) ); }