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
174import {
185 Address ,
@@ -39,10 +26,6 @@ import {
3926
4027import {
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
4831export 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-
345215export const ADDRESS_ZERO = "0x0000000000000000000000000000000000000000" ;
0 commit comments