@@ -26,8 +26,6 @@ import {
2626 WorkerpoolOrder ,
2727} from '../generated/schema' ;
2828
29- import { IexecInterfaceToken__domainResultValue0Struct as IEIP712Domain } from '../generated/Core/IexecInterfaceToken' ;
30-
3129export function createEventID ( event : ethereum . Event ) : string {
3230 return event . block . number . toString ( ) . concat ( '-' ) . concat ( event . logIndex . toString ( ) ) ;
3331}
@@ -220,72 +218,6 @@ export function concatByteArrays(a: ByteArray, b: ByteArray): ByteArray {
220218 return changetype < ByteArray > ( out ) ; // Change from 'as T' to 'changetype<T>'
221219}
222220
223- function encodeStringValue ( string : string ) : ethereum . Value {
224- return ethereum . Value . fromFixedBytes (
225- changetype < Bytes > ( crypto . keccak256 ( ByteArray . fromUTF8 ( string ) ) ) , // Change from 'as T' to 'changetype<T>'
226- ) ;
227- }
228-
229- export function hashDatasetOrder (
230- dataset : Address ,
231- datasetprice : BigInt ,
232- volume : BigInt ,
233- tag : Bytes ,
234- apprestrict : Address ,
235- workerpoolrestrict : Address ,
236- requesterrestrict : Address ,
237- salt : Bytes ,
238- domainHash : ByteArray ,
239- ) : ByteArray {
240- const structHash = crypto . keccak256 (
241- ethereum . encode (
242- ethereum . Value . fromTuple (
243- changetype < ethereum . Tuple > ( [
244- encodeStringValue (
245- 'DatasetOrder(address dataset,uint256 datasetprice,uint256 volume,bytes32 tag,address apprestrict,address workerpoolrestrict,address requesterrestrict,bytes32 salt)' ,
246- ) ,
247- ethereum . Value . fromAddress ( dataset ) ,
248- ethereum . Value . fromUnsignedBigInt ( datasetprice ) ,
249- ethereum . Value . fromUnsignedBigInt ( volume ) ,
250- ethereum . Value . fromFixedBytes ( tag ) ,
251- ethereum . Value . fromAddress ( apprestrict ) ,
252- ethereum . Value . fromAddress ( workerpoolrestrict ) ,
253- ethereum . Value . fromAddress ( requesterrestrict ) ,
254- ethereum . Value . fromFixedBytes ( salt ) ,
255- ] ) ,
256- ) ,
257- ) ! ,
258- ) ;
259- return hashEIP712 ( domainHash , structHash ) ;
260- }
261-
262- function hashEIP712 ( domainHash : ByteArray , structHash : ByteArray ) : ByteArray {
263- return crypto . keccak256 (
264- concatByteArrays (
265- ByteArray . fromHexString ( '0x1901' ) ,
266- concatByteArrays ( domainHash , structHash ) ,
267- ) ,
268- ) ;
269- }
270-
271- function hashDomain ( domain : IEIP712Domain ) : ByteArray {
272- return crypto . keccak256 (
273- ethereum . encode (
274- ethereum . Value . fromTuple (
275- changetype < ethereum . Tuple > ( [
276- encodeStringValue (
277- 'EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)' ,
278- ) ,
279- encodeStringValue ( domain . name ) ,
280- encodeStringValue ( domain . version ) ,
281- ethereum . Value . fromUnsignedBigInt ( domain . chainId ) ,
282- ethereum . Value . fromAddress ( domain . verifyingContract ) ,
283- ] ) , // Change from 'as T' to 'changetype<T>'
284- ) ,
285- ) ! ,
286- ) ;
287- }
288-
289221export function isIntegerString ( str : string ) : boolean {
290222 // empty string is not valid
291223 if ( str . length == 0 ) {
@@ -352,8 +284,6 @@ export function isBytes32String(str: string): boolean {
352284
353285export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000' ;
354286
355- export const CONTEXT_REQUESTHASH = 'REQUESTHASH' ;
356- export const CONTEXT_DOMAIN_SEPARATOR_HASH = 'DOMAIN_SEPARATOR_HASH' ;
357287export const CONTEXT_DEAL = 'DEAL' ;
358288export const CONTEXT_BULK = 'BULK' ;
359289export const CONTEXT_INDEX = 'INDEX' ;
0 commit comments