Skip to content

Commit 1038ad5

Browse files
add workerpool address to chain_config
1 parent 54a2cda commit 1038ad5

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

packages/sdk/src/config/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface ChainConfig {
88
ipfsGateway: string;
99
ipfsNode: string;
1010
smsDebugURL: string;
11+
workerpoolAddress: string;
1112
}
1213

1314
export const CHAIN_CONFIG: Record<ChainId, ChainConfig> = {
@@ -20,6 +21,7 @@ export const CHAIN_CONFIG: Record<ChainId, ChainConfig> = {
2021
ipfsGateway: 'https://ipfs-gateway.v8-bellecour.iex.ec',
2122
ipfsNode: 'https://ipfs-upload.v8-bellecour.iex.ec',
2223
smsDebugURL: 'https://sms-debug.iex.ec',
24+
workerpoolAddress:'prod-v8-bellecour.main.pools.iexec.eth'
2325
},
2426

2527
// Arbitrum
@@ -31,6 +33,7 @@ export const CHAIN_CONFIG: Record<ChainId, ChainConfig> = {
3133
ipfsGateway: 'https://your-arbitrum-ipfs-gateway',
3234
ipfsNode: 'https://your-arbitrum-ipfs-node',
3335
smsDebugURL: 'https://your-arbitrum-sms-url',
36+
workerpoolAddress:'WorkerpoolAddress'
3437
},
3538

3639
// Avalanche
@@ -42,12 +45,12 @@ export const CHAIN_CONFIG: Record<ChainId, ChainConfig> = {
4245
ipfsGateway: 'https://your-avalanche-ipfs-gateway',
4346
ipfsNode: 'https://your-avalanche-ipfs-node',
4447
smsDebugURL: 'https://your-avalanche-sms-url',
48+
workerpoolAddress:'WorkerpoolAddress'
4549
},
4650
};
4751

4852
export const DEFAULT_CHAIN_ID = 134;
4953
export const DEFAULT_DATA_NAME = '';
50-
export const WORKERPOOL_ADDRESS = 'prod-v8-bellecour.main.pools.iexec.eth';
5154
export const SCONE_TAG = ['tee', 'scone'];
5255
export const DEFAULT_MAX_PRICE = 0;
5356
export const MAX_DESIRED_DATA_ORDER_PRICE = 0;

packages/sdk/src/lib/dataProtectorCore/processProtectedData.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { ethers } from 'ethers';
22
import {
3+
CHAIN_CONFIG,
34
MAX_DESIRED_APP_ORDER_PRICE,
45
MAX_DESIRED_DATA_ORDER_PRICE,
56
MAX_DESIRED_WORKERPOOL_ORDER_PRICE,
67
SCONE_TAG,
7-
WORKERPOOL_ADDRESS,
88
} from '../../config/config.js';
99
import {
1010
WorkflowError,
@@ -60,6 +60,7 @@ export const processProtectedData = async ({
6060
onStatusUpdate = () => {},
6161
}: IExecConsumer &
6262
ProcessProtectedDataParams): Promise<ProcessProtectedDataResponse> => {
63+
const { chainId } = await iexec.network.getNetwork();
6364
const vProtectedData = addressOrEnsSchema()
6465
.required()
6566
.label('protectedData')
@@ -87,7 +88,7 @@ export const processProtectedData = async ({
8788
const vArgs = stringSchema().label('args').validateSync(args);
8889
const vSecrets = secretsSchema().label('secrets').validateSync(secrets);
8990
const vWorkerpool = addressOrEnsSchema()
90-
.default(WORKERPOOL_ADDRESS) // Default workerpool if none is specified
91+
.default(CHAIN_CONFIG[chainId].workerpoolAddress) // Default workerpool if none is specified
9192
.label('workerpool')
9293
.validateSync(workerpool);
9394
const vUseVoucher = booleanSchema()
@@ -101,7 +102,7 @@ export const processProtectedData = async ({
101102
validateOnStatusUpdateCallback<
102103
OnStatusUpdateFn<ProcessProtectedDataStatuses>
103104
>(onStatusUpdate);
104-
105+
105106
let requester = await iexec.wallet.getAddress();
106107
if (vUserWhitelist) {
107108
const isValidWhitelist = await isERC734(iexec, vUserWhitelist);

packages/sdk/src/lib/dataProtectorSharing/consumeProtectedData.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { string } from 'yup';
22
import {
33
SCONE_TAG,
4-
WORKERPOOL_ADDRESS,
54
DEFAULT_MAX_PRICE,
5+
CHAIN_CONFIG,
66
} from '../../config/config.js';
77
import {
88
WorkflowError,
@@ -109,8 +109,9 @@ export const consumeProtectedData = async ({
109109
isDone: false,
110110
});
111111
try {
112+
const { chainId } = await iexec.network.getNetwork();
112113
const workerpoolOrderbook = await iexec.orderbook.fetchWorkerpoolOrderbook({
113-
workerpool: vWorkerpool || WORKERPOOL_ADDRESS,
114+
workerpool: vWorkerpool || CHAIN_CONFIG[chainId].workerpoolAddress,
114115
app: vApp,
115116
dataset: vProtectedData,
116117
minTag: SCONE_TAG,

0 commit comments

Comments
 (0)