diff --git a/.github/workflows/cd-deploy-contracts.yaml b/.github/workflows/cd-deploy-contracts.yaml index 190e1771f5..7ab277eb0d 100644 --- a/.github/workflows/cd-deploy-contracts.yaml +++ b/.github/workflows/cd-deploy-contracts.yaml @@ -135,61 +135,4 @@ jobs: run: npx hardhat verify --network ${{ github.event.inputs.network }} ${{ steps.networks.outputs.reward_pool }} working-directory: ./packages/core - #Deploy subgraph - - run: yarn global add @graphprotocol/graph-cli - name: Install Graph CLI - - run: graph auth --product hosted-service ${API_KEY} - name: Authenticate Graph CLI - env: - API_KEY: ${{ secrets.HP_GRAPH_API_KEY }} - - run: yarn generate - name: Generate Subgraph - working-directory: ./packages/sdk/typescript/subgraph - env: - NETWORK: ${{ steps.networks.outputs.subgraph }} - - run: graph deploy --product hosted-service humanprotocol/${NETWORK} - name: Deploy Subgraph - working-directory: ./packages/sdk/typescript/subgraph - env: - NETWORK: ${{ steps.networks.outputs.subgraph }} - #Commit changes to develop - - name: Check for Changes - if: always() - id: check_changes - run: | - git fetch - if [[ -n "$(git diff --name-only)" ]]; then - echo "Changes detected." - echo "::set-output name=changes::true" - else - echo "No changes detected." - echo "::set-output name=changes::false" - fi - - - name: stash - if: always() && steps.check_changes.outputs.changes == 'true' - run: | - git status - git stash --include-untracked - - name: Checkout develop - if: always() && steps.check_changes.outputs.changes == 'true' - uses: actions/checkout@v3 - with: - ref: develop - token: ${{ secrets.GH_TOKEN_CD_CONTRACTS }} - - name: pop - if: always() && steps.check_changes.outputs.changes == 'true' - run: | - git stash pop - git status - - name: Commit changes - if: always() && steps.check_changes.outputs.changes == 'true' - uses: EndBug/add-and-commit@v9 - with: - add: "['./packages/core/.openzeppelin', './packages/sdk/typescript/subgraph/config']" - message: 'Update grafting and upgrade file from CD' - default_author: github_actions - tag_push: '--force' - github_token: ${{ secrets.GH_TOKEN_CD_CONTRACTS }} - diff --git a/packages/apps/job-launcher/server/src/modules/job/job.service.spec.ts b/packages/apps/job-launcher/server/src/modules/job/job.service.spec.ts index 3bb6bfff25..9cd7774911 100644 --- a/packages/apps/job-launcher/server/src/modules/job/job.service.spec.ts +++ b/packages/apps/job-launcher/server/src/modules/job/job.service.spec.ts @@ -555,6 +555,7 @@ describe('JobService', () => { fundAmount, status: JobStatus.PENDING, save: jest.fn().mockResolvedValue(true), + userId: 1, }; const jobEntityResult = await jobService.launchJob( diff --git a/packages/apps/job-launcher/server/src/modules/job/job.service.ts b/packages/apps/job-launcher/server/src/modules/job/job.service.ts index 6561ce7b63..38996afec6 100644 --- a/packages/apps/job-launcher/server/src/modules/job/job.service.ts +++ b/packages/apps/job-launcher/server/src/modules/job/job.service.ts @@ -269,6 +269,7 @@ export class JobService { const escrowAddress = await escrowClient.createAndSetupEscrow( NETWORKS[jobEntity.chainId as ChainId]!.hmtAddress, [], + jobEntity.userId.toString(), escrowConfig, ); diff --git a/packages/core/scripts/upgrade-proxies.ts b/packages/core/scripts/upgrade-proxies.ts index 29a42a54ad..bd8d80ee2e 100644 --- a/packages/core/scripts/upgrade-proxies.ts +++ b/packages/core/scripts/upgrade-proxies.ts @@ -1,22 +1,15 @@ /* eslint-disable no-console */ import { ethers, upgrades } from 'hardhat'; -import fs from 'fs'; -import prettier from 'prettier'; -import { ApolloClient, gql, InMemoryCache } from '@apollo/client'; async function main() { - const subgraph = process.env.SUBGRAPH; const escrowFactoryAddress = process.env.ESCROW_FACTORY_ADDRESS; const deployEscrowFactory = process.env.DEPLOY_ESCROW_FACTORY; const stakingAddress = process.env.STAKING_ADDRESS; const deployStaking = process.env.DEPLOY_STAKING; const rewardPoolAddress = process.env.REWARD_POOL_ADDRESS; const deployRewardPool = process.env.DEPLOY_REWARD_POOL; - let blockNumber = 0; - if ( - (!escrowFactoryAddress && !stakingAddress && !rewardPoolAddress) || - !subgraph - ) { + + if (!escrowFactoryAddress && !stakingAddress && !rewardPoolAddress) { console.error('Env variable missing'); return; } @@ -31,17 +24,10 @@ async function main() { EscrowFactory ); const contract = await escrowFactoryContract.deployed(); - const txReceipt = await ethers.provider.getTransactionReceipt( + await ethers.provider.getTransactionReceipt( contract.deployTransaction.hash ); - if ( - txReceipt.blockNumber && - (txReceipt.blockNumber < blockNumber || blockNumber == 0) - ) { - blockNumber = txReceipt.blockNumber; - } - console.log( 'Escrow Factory Proxy Address: ', escrowFactoryContract.address @@ -62,17 +48,10 @@ async function main() { Staking ); const contract = await stakingContract.deployed(); - const txReceipt = await ethers.provider.getTransactionReceipt( + await ethers.provider.getTransactionReceipt( contract.deployTransaction.hash ); - if ( - txReceipt.blockNumber && - (txReceipt.blockNumber < blockNumber || blockNumber == 0) - ) { - blockNumber = txReceipt.blockNumber; - } - console.log('Staking Proxy Address: ', stakingContract.address); console.log( 'New Staking Implementation Address: ', @@ -88,17 +67,10 @@ async function main() { RewardPool ); const contract = await rewardPoolContract.deployed(); - const txReceipt = await ethers.provider.getTransactionReceipt( + await ethers.provider.getTransactionReceipt( contract.deployTransaction.hash ); - if ( - txReceipt.blockNumber && - (txReceipt.blockNumber < blockNumber || blockNumber == 0) - ) { - blockNumber = txReceipt.blockNumber; - } - console.log('Reward Pool Proxy Address: ', rewardPoolContract.address); console.log( 'New Reward Pool Implementation Address: ', @@ -107,51 +79,6 @@ async function main() { ) ); } - - if (blockNumber > 0) - updateGraftingConfig(blockNumber, await getSubgraphId(subgraph), subgraph); -} - -interface JSONData { - [key: string]: any; -} - -const GET_SUBGRAPH_ID = gql` - query MyQuery { - _meta { - deployment - } - } -`; - -function getSubgraphId(subgraphName: string) { - const hostedServiceEndpoint = `https://api.thegraph.com/subgraphs/name/humanprotocol/${subgraphName}`; - const client = new ApolloClient({ - uri: hostedServiceEndpoint, - cache: new InMemoryCache(), - }); - - return client.query({ query: GET_SUBGRAPH_ID }).then((result) => { - const subgraphId: string = result.data._meta.deployment; - return subgraphId; - }); -} - -function updateGraftingConfig( - blockNumber: number, - subgraphId: string, - subgraphName: string -) { - const filename = `../sdk/typescript/subgraph/config/${subgraphName}.json`; - const data: JSONData = JSON.parse(fs.readFileSync(filename, 'utf8')); - const currentObject = data; - currentObject['graft']['block'] = blockNumber; - currentObject['graft']['base'] = subgraphId; - const formattedData = prettier.format(JSON.stringify(data), { - parser: 'json', - }); - - fs.writeFileSync(filename, formattedData); } main().catch((error) => {