Skip to content

Commit cc3a188

Browse files
committed
remove duplicated workflow_dispatch trigger from CD workflows for package publishing
1 parent ce1a60e commit cc3a188

File tree

11 files changed

+229
-85
lines changed

11 files changed

+229
-85
lines changed

packages/apps/job-launcher/server/src/common/config/env-schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const envValidator = Joi.object({
2727
WEB3_ENV: Joi.string(),
2828
WEB3_PRIVATE_KEY: Joi.string().required(),
2929
GAS_PRICE_MULTIPLIER: Joi.number(),
30-
APPROVE_AMOUNT: Joi.number(),
30+
APPROVE_AMOUNT_USD: Joi.number(),
3131
REPUTATION_ORACLE_ADDRESS: Joi.string().required(),
3232
REPUTATION_ORACLES: Joi.string().required(),
3333
CVAT_EXCHANGE_ORACLE_ADDRESS: Joi.string().required(),

packages/apps/job-launcher/server/src/common/config/web3-config.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export class Web3ConfigService {
111111
);
112112
}
113113

114-
get approveAmount(): number {
115-
return this.configService.get<number>('APPROVE_AMOUNT', 100);
114+
get approveAmountUsd(): number {
115+
return this.configService.get<number>('APPROVE_AMOUNT_USD', 100);
116116
}
117117
}

packages/apps/job-launcher/server/src/common/constants/tokens.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,44 +11,53 @@ export const TOKEN_ADDRESSES: {
1111
[EscrowFundToken.HMT]: {
1212
address: NETWORKS[ChainId.MAINNET]!.hmtAddress,
1313
decimals: 18,
14+
symbol: EscrowFundToken.HMT,
1415
},
1516
[EscrowFundToken.USDT]: {
1617
address: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
1718
decimals: 6,
19+
symbol: EscrowFundToken.USDT,
1820
},
1921
[EscrowFundToken.USDC]: {
2022
address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
2123
decimals: 6,
24+
symbol: EscrowFundToken.USDC,
2225
},
2326
},
2427
[ChainId.SEPOLIA]: {
2528
[EscrowFundToken.HMT]: {
2629
address: NETWORKS[ChainId.SEPOLIA]!.hmtAddress,
2730
decimals: 18,
31+
symbol: EscrowFundToken.HMT,
2832
},
2933
[EscrowFundToken.USDT]: {
3034
address: '0xaA8E23Fb1079EA71e0a56F48a2aA51851D8433D0',
3135
decimals: 6,
36+
symbol: EscrowFundToken.USDT,
3237
},
3338
[EscrowFundToken.USDC]: {
3439
address: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238',
3540
decimals: 6,
41+
symbol: EscrowFundToken.USDC,
3642
},
3743
},
3844
[ChainId.BSC_MAINNET]: {
3945
[EscrowFundToken.HMT]: {
4046
address: NETWORKS[ChainId.BSC_MAINNET]!.hmtAddress,
4147
decimals: 18,
48+
symbol: EscrowFundToken.HMT,
4249
},
4350
},
4451
[ChainId.POLYGON]: {
4552
[EscrowFundToken.HMT]: {
4653
address: NETWORKS[ChainId.POLYGON]!.hmtAddress,
4754
decimals: 18,
55+
symbol: EscrowFundToken.HMT,
4856
},
4957
[EscrowFundToken.USDT0]: {
5058
address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F',
5159
decimals: 6,
60+
symbol: EscrowFundToken.USDT0,
5261
},
5362
// Disabled
5463
// [EscrowFundToken.USDC]: {
@@ -60,22 +69,26 @@ export const TOKEN_ADDRESSES: {
6069
[EscrowFundToken.HMT]: {
6170
address: NETWORKS[ChainId.POLYGON_AMOY]!.hmtAddress,
6271
decimals: 18,
72+
symbol: EscrowFundToken.HMT,
6373
},
6474
[EscrowFundToken.USDC]: {
6575
address: '0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582',
6676
decimals: 6,
77+
symbol: EscrowFundToken.USDC,
6778
},
6879
},
6980
[ChainId.LOCALHOST]: {
7081
[EscrowFundToken.HMT]: {
7182
address: NETWORKS[ChainId.LOCALHOST]!.hmtAddress,
7283
decimals: 18,
84+
symbol: EscrowFundToken.HMT,
7385
},
7486
},
7587
[ChainId.BSC_TESTNET]: {
7688
[EscrowFundToken.HMT]: {
7789
address: NETWORKS[ChainId.BSC_TESTNET]!.hmtAddress,
7890
decimals: 18,
91+
symbol: EscrowFundToken.HMT,
7992
},
8093
},
8194
};

packages/apps/job-launcher/server/src/common/enums/cron-job.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
export enum CronJobType {
22
ContentModeration = 'content-moderation',
33
CreateEscrow = 'create-escrow',
4-
SetupEscrow = 'setup-escrow',
5-
FundEscrow = 'fund-escrow',
64
CancelEscrow = 'cancel-escrow',
75
ProcessPendingWebhook = 'process-pending-webhook',
86
SyncJobStatuses = 'sync-job-statuses',
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import { EscrowFundToken } from '../enums/job';
2+
13
export interface IERC20Token {
24
address: string;
35
decimals: number;
6+
symbol: EscrowFundToken;
47
}

packages/apps/job-launcher/server/src/database/migrations/1762941180729-removeUnusedEscrowStatuses.ts

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
import { MigrationInterface, QueryRunner } from 'typeorm';
2+
3+
export class RemoveUnusedTypes1763628908882 implements MigrationInterface {
4+
name = 'RemoveUnusedTypes1763628908882';
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
await queryRunner.query(`
8+
DELETE FROM "hmt"."cron-jobs"
9+
WHERE "cron_job_type" IN ('setup-escrow', 'fund-escrow')
10+
`);
11+
await queryRunner.query(`
12+
ALTER TYPE "hmt"."jobs_status_enum"
13+
RENAME TO "jobs_status_enum_old"
14+
`);
15+
await queryRunner.query(`
16+
CREATE TYPE "hmt"."jobs_status_enum" AS ENUM(
17+
'paid',
18+
'under_moderation',
19+
'moderation_passed',
20+
'possible_abuse_in_review',
21+
'launched',
22+
'partial',
23+
'completed',
24+
'failed',
25+
'to_cancel',
26+
'canceling',
27+
'canceled'
28+
)
29+
`);
30+
await queryRunner.query(`
31+
ALTER TABLE "hmt"."jobs"
32+
ALTER COLUMN "status" TYPE "hmt"."jobs_status_enum" USING "status"::"text"::"hmt"."jobs_status_enum"
33+
`);
34+
await queryRunner.query(`
35+
DROP TYPE "hmt"."jobs_status_enum_old"
36+
`);
37+
await queryRunner.query(`
38+
ALTER TYPE "hmt"."cron-jobs_cron_job_type_enum"
39+
RENAME TO "cron-jobs_cron_job_type_enum_old"
40+
`);
41+
await queryRunner.query(`
42+
CREATE TYPE "hmt"."cron-jobs_cron_job_type_enum" AS ENUM(
43+
'content-moderation',
44+
'create-escrow',
45+
'cancel-escrow',
46+
'process-pending-webhook',
47+
'sync-job-statuses',
48+
'abuse'
49+
)
50+
`);
51+
await queryRunner.query(`
52+
ALTER TABLE "hmt"."cron-jobs"
53+
ALTER COLUMN "cron_job_type" TYPE "hmt"."cron-jobs_cron_job_type_enum" USING "cron_job_type"::"text"::"hmt"."cron-jobs_cron_job_type_enum"
54+
`);
55+
await queryRunner.query(`
56+
DROP TYPE "hmt"."cron-jobs_cron_job_type_enum_old"
57+
`);
58+
}
59+
60+
public async down(queryRunner: QueryRunner): Promise<void> {
61+
await queryRunner.query(`
62+
CREATE TYPE "hmt"."cron-jobs_cron_job_type_enum_old" AS ENUM(
63+
'abuse',
64+
'cancel-escrow',
65+
'content-moderation',
66+
'create-escrow',
67+
'fund-escrow',
68+
'process-pending-webhook',
69+
'setup-escrow',
70+
'sync-job-statuses'
71+
)
72+
`);
73+
await queryRunner.query(`
74+
ALTER TABLE "hmt"."cron-jobs"
75+
ALTER COLUMN "cron_job_type" TYPE "hmt"."cron-jobs_cron_job_type_enum_old" USING "cron_job_type"::"text"::"hmt"."cron-jobs_cron_job_type_enum_old"
76+
`);
77+
await queryRunner.query(`
78+
DROP TYPE "hmt"."cron-jobs_cron_job_type_enum"
79+
`);
80+
await queryRunner.query(`
81+
ALTER TYPE "hmt"."cron-jobs_cron_job_type_enum_old"
82+
RENAME TO "cron-jobs_cron_job_type_enum"
83+
`);
84+
await queryRunner.query(`
85+
CREATE TYPE "hmt"."jobs_status_enum_old" AS ENUM(
86+
'canceled',
87+
'canceling',
88+
'completed',
89+
'created',
90+
'failed',
91+
'funded',
92+
'launched',
93+
'moderation_passed',
94+
'paid',
95+
'partial',
96+
'possible_abuse_in_review',
97+
'to_cancel',
98+
'under_moderation'
99+
)
100+
`);
101+
await queryRunner.query(`
102+
ALTER TABLE "hmt"."jobs"
103+
ALTER COLUMN "status" TYPE "hmt"."jobs_status_enum_old" USING "status"::"text"::"hmt"."jobs_status_enum_old"
104+
`);
105+
await queryRunner.query(`
106+
DROP TYPE "hmt"."jobs_status_enum"
107+
`);
108+
await queryRunner.query(`
109+
ALTER TYPE "hmt"."jobs_status_enum_old"
110+
RENAME TO "jobs_status_enum"
111+
`);
112+
}
113+
}

packages/apps/job-launcher/server/src/modules/qualification/qualification.service.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ import { ErrorQualification, ErrorWeb3 } from '../../common/constants/errors';
2121
import { ServerError, ValidationError } from '../../common/errors';
2222
import { Web3Service } from '../web3/web3.service';
2323
import { QualificationService } from './qualification.service';
24+
import { RateService } from '../rate/rate.service';
25+
import { createMock } from '@golevelup/ts-jest';
26+
27+
const mockRateService = createMock<RateService>();
2428

2529
describe.only('QualificationService', () => {
2630
let qualificationService: QualificationService, httpService: HttpService;
@@ -50,6 +54,10 @@ describe.only('QualificationService', () => {
5054
get: jest.fn(),
5155
},
5256
},
57+
{
58+
provide: RateService,
59+
useValue: mockRateService,
60+
},
5361
],
5462
})
5563
.overrideProvider(NetworkConfigService)

packages/apps/job-launcher/server/src/modules/web3/web3.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import { Module } from '@nestjs/common';
22
import { Web3Service } from './web3.service';
33
import { ConfigModule } from '@nestjs/config';
44
import { Web3Controller } from './web3.controller';
5+
import { RateModule } from '../rate/rate.module';
56

67
@Module({
7-
imports: [ConfigModule],
8+
imports: [ConfigModule, RateModule],
89
providers: [Web3Service],
910
exports: [Web3Service],
1011
controllers: [Web3Controller],

0 commit comments

Comments
 (0)