Skip to content

Commit 8c8a1f1

Browse files
authored
Feature/remove dead handler (#45)
1 parent 876ea82 commit 8c8a1f1

File tree

3 files changed

+4
-211
lines changed

3 files changed

+4
-211
lines changed

src/Modules/IexecPoco.ts

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2020-2024 IEXEC BLOCKCHAIN TECH <[email protected]>
1+
// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH <[email protected]>
22
// SPDX-License-Identifier: Apache-2.0
33

44
import { Address, BigInt, dataSource } from '@graphprotocol/graph-ts';
@@ -8,7 +8,6 @@ import {
88
AccurateContribution as AccurateContributionEvent,
99
FaultyContribution as FaultyContributionEvent,
1010
IexecInterfaceToken as IexecInterfaceTokenContract,
11-
MatchOrdersCall,
1211
OrdersMatched as OrdersMatchedEvent,
1312
SchedulerNotice as SchedulerNoticeEvent,
1413
TaskClaimed as TaskClaimedEvent,
@@ -35,7 +34,6 @@ import {
3534
} from '../../generated/schema';
3635

3736
import {
38-
ADDRESS_ZERO,
3937
createContributionID,
4038
createEventID,
4139
fetchAccount,
@@ -47,84 +45,10 @@ import {
4745
fetchRequestorder,
4846
fetchTask,
4947
fetchWorkerpoolorder,
50-
hashApporder,
51-
hashDatasetorder,
52-
hashRequestorder,
53-
hashWorkerpoolorder,
5448
logTransaction,
5549
toRLC,
5650
} from '../utils';
5751

58-
export function handleMatchOrders(call: MatchOrdersCall): void {
59-
const contract = IexecInterfaceTokenContract.bind(call.to);
60-
const domain = contract.domain();
61-
62-
const apporderInput = call.inputs.value0;
63-
const apporder = fetchApporder(hashApporder(domain, apporderInput).toHex());
64-
apporder.app = apporderInput.app.toHex();
65-
apporder.appprice = toRLC(apporderInput.appprice);
66-
apporder.volume = apporderInput.volume;
67-
apporder.tag = apporderInput.tag;
68-
apporder.datasetrestrict = apporderInput.datasetrestrict;
69-
apporder.workerpoolrestrict = apporderInput.workerpoolrestrict;
70-
apporder.requesterrestrict = apporderInput.requesterrestrict;
71-
apporder.salt = apporderInput.salt;
72-
apporder.sign = apporderInput.sign;
73-
apporder.save();
74-
75-
const datasetorderInput = call.inputs.value1;
76-
if (datasetorderInput.dataset.toString() != ADDRESS_ZERO) {
77-
const datasetorder = fetchDatasetorder(hashDatasetorder(domain, datasetorderInput).toHex());
78-
datasetorder.dataset = datasetorderInput.dataset.toHex();
79-
datasetorder.datasetprice = toRLC(datasetorderInput.datasetprice);
80-
datasetorder.volume = datasetorderInput.volume;
81-
datasetorder.tag = datasetorderInput.tag;
82-
datasetorder.apprestrict = datasetorderInput.apprestrict;
83-
datasetorder.workerpoolrestrict = datasetorderInput.workerpoolrestrict;
84-
datasetorder.requesterrestrict = datasetorderInput.requesterrestrict;
85-
datasetorder.salt = datasetorderInput.salt;
86-
datasetorder.sign = datasetorderInput.sign;
87-
datasetorder.save();
88-
}
89-
90-
const workerpoolorderInput = call.inputs.value2;
91-
const workerpoolorder = fetchWorkerpoolorder(
92-
hashWorkerpoolorder(domain, workerpoolorderInput).toHex(),
93-
);
94-
workerpoolorder.workerpool = workerpoolorderInput.workerpool.toHex();
95-
workerpoolorder.workerpoolprice = toRLC(workerpoolorderInput.workerpoolprice);
96-
workerpoolorder.volume = workerpoolorderInput.volume;
97-
workerpoolorder.tag = workerpoolorderInput.tag;
98-
workerpoolorder.category = workerpoolorderInput.category.toString();
99-
workerpoolorder.trust = workerpoolorderInput.trust;
100-
workerpoolorder.apprestrict = workerpoolorderInput.apprestrict;
101-
workerpoolorder.datasetrestrict = workerpoolorderInput.datasetrestrict;
102-
workerpoolorder.requesterrestrict = workerpoolorderInput.requesterrestrict;
103-
workerpoolorder.salt = workerpoolorderInput.salt;
104-
workerpoolorder.sign = workerpoolorderInput.sign;
105-
workerpoolorder.save();
106-
107-
const requestorderInput = call.inputs.value3;
108-
const requestorder = fetchRequestorder(hashRequestorder(domain, requestorderInput).toHex());
109-
requestorder.app = requestorderInput.app.toHex();
110-
requestorder.appmaxprice = toRLC(requestorderInput.appmaxprice);
111-
requestorder.dataset = requestorderInput.dataset.toHex();
112-
requestorder.datasetmaxprice = toRLC(requestorderInput.datasetmaxprice);
113-
requestorder.workerpool = requestorderInput.workerpool.toHex();
114-
requestorder.workerpoolmaxprice = toRLC(requestorderInput.workerpoolmaxprice);
115-
requestorder.requester = requestorderInput.requester.toHex();
116-
requestorder.volume = requestorderInput.volume;
117-
requestorder.tag = requestorderInput.tag;
118-
requestorder.category = requestorderInput.category.toString();
119-
requestorder.trust = requestorderInput.trust;
120-
requestorder.beneficiary = requestorderInput.beneficiary.toHex();
121-
requestorder.callback = requestorderInput.callback.toHex();
122-
requestorder.params = requestorderInput.params;
123-
requestorder.salt = requestorderInput.salt;
124-
requestorder.sign = requestorderInput.sign;
125-
requestorder.save();
126-
}
127-
12852
export function handleOrdersMatched(event: OrdersMatchedEvent): void {
12953
let contract = IexecInterfaceTokenContract.bind(event.address);
13054
let viewedDeal = contract.viewDeal(event.params.dealid);

src/Modules/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2020-2024 IEXEC BLOCKCHAIN TECH <[email protected]>
1+
// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH <[email protected]>
22
// SPDX-License-Identifier: Apache-2.0
33

44
export { handleCreateCategory } from './IexecCategoryManager';
@@ -8,7 +8,6 @@ export { handleLock, handleReward, handleSeize, handleTransfer, handleUnlock } f
88
export {
99
handleAccurateContribution,
1010
handleFaultyContribution,
11-
handleMatchOrders,
1211
handleOrdersMatched,
1312
handleSchedulerNotice,
1413
handleTaskClaimed,

src/utils.ts

Lines changed: 2 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
1-
/******************************************************************************
2-
* Copyright 2020 IEXEC BLOCKCHAIN TECH *
3-
* *
4-
* Licensed under the Apache License, Version 2.0 (the "License"); *
5-
* you may not use this file except in compliance with the License. *
6-
* You may obtain a copy of the License at *
7-
* *
8-
* http://www.apache.org/licenses/LICENSE-2.0 *
9-
* *
10-
* Unless required by applicable law or agreed to in writing, software *
11-
* distributed under the License is distributed on an "AS IS" BASIS, *
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13-
* See the License for the specific language governing permissions and *
14-
* limitations under the License. *
15-
******************************************************************************/
1+
// SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH <[email protected]>
2+
// SPDX-License-Identifier: Apache-2.0
163

174
import {
185
Address,
@@ -39,10 +26,6 @@ import {
3926

4027
import {
4128
IexecInterfaceToken__domainResultValue0Struct as IEIP712Domain,
42-
MatchOrdersCallValue0Struct as IAppOrder,
43-
MatchOrdersCallValue1Struct as IDatasetOrder,
44-
MatchOrdersCallValue2Struct as IWorkerpoolOrder,
45-
MatchOrdersCallValue3Struct as IRequestOrder,
4629
} from "../generated/Core/IexecInterfaceToken";
4730

4831
export function createEventID(event: ethereum.Event): string {
@@ -229,117 +212,4 @@ function hashDomain(domain: IEIP712Domain): ByteArray {
229212
);
230213
}
231214

232-
export function hashApporder(
233-
domain: IEIP712Domain,
234-
apporder: IAppOrder
235-
): ByteArray {
236-
const structHash = crypto.keccak256(
237-
ethereum.encode(
238-
ethereum.Value.fromTuple(
239-
changetype<ethereum.Tuple>([
240-
encodeStringValue(
241-
"AppOrder(address app,uint256 appprice,uint256 volume,bytes32 tag,address datasetrestrict,address workerpoolrestrict,address requesterrestrict,bytes32 salt)"
242-
),
243-
ethereum.Value.fromAddress(apporder.app),
244-
ethereum.Value.fromUnsignedBigInt(apporder.appprice),
245-
ethereum.Value.fromUnsignedBigInt(apporder.volume),
246-
ethereum.Value.fromFixedBytes(apporder.tag),
247-
ethereum.Value.fromAddress(apporder.datasetrestrict),
248-
ethereum.Value.fromAddress(apporder.workerpoolrestrict),
249-
ethereum.Value.fromAddress(apporder.requesterrestrict),
250-
ethereum.Value.fromFixedBytes(apporder.salt),
251-
]) // Change from 'as T' to 'changetype<T>'
252-
)
253-
)!
254-
);
255-
return hashEIP712(hashDomain(domain), structHash);
256-
}
257-
258-
export function hashDatasetorder(
259-
domain: IEIP712Domain,
260-
datasetorder: IDatasetOrder
261-
): ByteArray {
262-
const structHash = crypto.keccak256(
263-
ethereum.encode(
264-
ethereum.Value.fromTuple(
265-
changetype<ethereum.Tuple>([
266-
encodeStringValue(
267-
"DatasetOrder(address dataset,uint256 datasetprice,uint256 volume,bytes32 tag,address apprestrict,address workerpoolrestrict,address requesterrestrict,bytes32 salt)"
268-
),
269-
ethereum.Value.fromAddress(datasetorder.dataset),
270-
ethereum.Value.fromUnsignedBigInt(datasetorder.datasetprice),
271-
ethereum.Value.fromUnsignedBigInt(datasetorder.volume),
272-
ethereum.Value.fromFixedBytes(datasetorder.tag),
273-
ethereum.Value.fromAddress(datasetorder.apprestrict),
274-
ethereum.Value.fromAddress(datasetorder.workerpoolrestrict),
275-
ethereum.Value.fromAddress(datasetorder.requesterrestrict),
276-
ethereum.Value.fromFixedBytes(datasetorder.salt),
277-
]) // Change from 'as T' to 'changetype<T>'
278-
)
279-
)!
280-
);
281-
return hashEIP712(hashDomain(domain), structHash);
282-
}
283-
284-
export function hashWorkerpoolorder(
285-
domain: IEIP712Domain,
286-
workerpoolorder: IWorkerpoolOrder
287-
): ByteArray {
288-
const structHash = crypto.keccak256(
289-
ethereum.encode(
290-
ethereum.Value.fromTuple(
291-
changetype<ethereum.Tuple>([
292-
encodeStringValue(
293-
"WorkerpoolOrder(address workerpool,uint256 workerpoolprice,uint256 volume,bytes32 tag,uint256 category,uint256 trust,address apprestrict,address datasetrestrict,address requesterrestrict,bytes32 salt)"
294-
),
295-
ethereum.Value.fromAddress(workerpoolorder.workerpool),
296-
ethereum.Value.fromUnsignedBigInt(workerpoolorder.workerpoolprice),
297-
ethereum.Value.fromUnsignedBigInt(workerpoolorder.volume),
298-
ethereum.Value.fromFixedBytes(workerpoolorder.tag),
299-
ethereum.Value.fromUnsignedBigInt(workerpoolorder.category),
300-
ethereum.Value.fromUnsignedBigInt(workerpoolorder.trust),
301-
ethereum.Value.fromAddress(workerpoolorder.apprestrict),
302-
ethereum.Value.fromAddress(workerpoolorder.datasetrestrict),
303-
ethereum.Value.fromAddress(workerpoolorder.requesterrestrict),
304-
ethereum.Value.fromFixedBytes(workerpoolorder.salt),
305-
]) // Change from 'as T' to 'changetype<T>'
306-
)
307-
)!
308-
);
309-
return hashEIP712(hashDomain(domain), structHash);
310-
}
311-
312-
export function hashRequestorder(
313-
domain: IEIP712Domain,
314-
requestorder: IRequestOrder
315-
): ByteArray {
316-
const structHash = crypto.keccak256(
317-
ethereum.encode(
318-
ethereum.Value.fromTuple(
319-
changetype<ethereum.Tuple>([
320-
encodeStringValue(
321-
"RequestOrder(address app,uint256 appmaxprice,address dataset,uint256 datasetmaxprice,address workerpool,uint256 workerpoolmaxprice,address requester,uint256 volume,bytes32 tag,uint256 category,uint256 trust,address beneficiary,address callback,string params,bytes32 salt)"
322-
),
323-
ethereum.Value.fromAddress(requestorder.app),
324-
ethereum.Value.fromUnsignedBigInt(requestorder.appmaxprice),
325-
ethereum.Value.fromAddress(requestorder.dataset),
326-
ethereum.Value.fromUnsignedBigInt(requestorder.datasetmaxprice),
327-
ethereum.Value.fromAddress(requestorder.workerpool),
328-
ethereum.Value.fromUnsignedBigInt(requestorder.workerpoolmaxprice),
329-
ethereum.Value.fromAddress(requestorder.requester),
330-
ethereum.Value.fromUnsignedBigInt(requestorder.volume),
331-
ethereum.Value.fromFixedBytes(requestorder.tag),
332-
ethereum.Value.fromUnsignedBigInt(requestorder.category),
333-
ethereum.Value.fromUnsignedBigInt(requestorder.trust),
334-
ethereum.Value.fromAddress(requestorder.beneficiary),
335-
ethereum.Value.fromAddress(requestorder.callback),
336-
encodeStringValue(requestorder.params),
337-
ethereum.Value.fromFixedBytes(requestorder.salt),
338-
]) // Change from 'as T' to 'changetype<T>'
339-
)
340-
)!
341-
);
342-
return hashEIP712(hashDomain(domain), structHash);
343-
}
344-
345215
export const ADDRESS_ZERO = "0x0000000000000000000000000000000000000000";

0 commit comments

Comments
 (0)