diff --git a/src/cross-chain-order/hash-lock/hash-lock.spec.ts b/src/cross-chain-order/hash-lock/hash-lock.spec.ts index 42fca3f..01f82f9 100644 --- a/src/cross-chain-order/hash-lock/hash-lock.spec.ts +++ b/src/cross-chain-order/hash-lock/hash-lock.spec.ts @@ -21,7 +21,7 @@ describe('HashLock', () => { const leaves = HashLock.getMerkleLeaves(secrets) expect(HashLock.forMultipleFills(leaves).toString()).toEqual( - '0x0004450ad51097012ff74f91e1ff6fb3f5bd8e8e2cd6a91a513f03bcb89a76f7' + '0x000592766d9172e4b4983ee4d4b6d511cdbcbef175c7e3e1b1554d513e1ab724' ) }) @@ -49,8 +49,7 @@ describe('HashLock', () => { const leaves = HashLock.getMerkleLeaves(secrets) expect(HashLock.getProof(leaves, 0)).toEqual([ - '0x3009d711fa0454e4a4f0d553fcfa67f20e0d67571d7e06f2105814c6b123ba55', - '0x70e897a17a55b03df83541f6420507b3482da14f2489ef7ea4d9a94cf30d1c06' + '0x540daf363747246d40b31da95b3ef1c1497e22e9a56b70d117c835839822c95f' ]) }) }) diff --git a/src/cross-chain-order/hash-lock/hash-lock.ts b/src/cross-chain-order/hash-lock/hash-lock.ts index 3192acf..1e456c9 100644 --- a/src/cross-chain-order/hash-lock/hash-lock.ts +++ b/src/cross-chain-order/hash-lock/hash-lock.ts @@ -25,7 +25,7 @@ export class HashLock { return secrets.map( (s, idx) => solidityPackedKeccak256( - ['uint256', 'bytes32'], + ['uint64', 'bytes32'], [idx, HashLock.hashSecret(s)] ) as MerkleLeaf ) diff --git a/src/escrow-factory/escrow-factory.ts b/src/escrow-factory/escrow-factory.ts index 7c4656a..72a61e4 100644 --- a/src/escrow-factory/escrow-factory.ts +++ b/src/escrow-factory/escrow-factory.ts @@ -1,6 +1,6 @@ import {Address, Interaction} from '@1inch/fusion-sdk' import {AbiCoder, getCreate2Address, keccak256} from 'ethers' -import {getBytesCount, isHexBytes, trim0x} from '@1inch/byte-utils' +import {add0x, getBytesCount, isHexBytes, trim0x} from '@1inch/byte-utils' import assert from 'assert' import {Immutables, DstImmutablesComplement} from '../immutables' import {MerkleLeaf} from '../cross-chain-order/hash-lock/hash-lock' @@ -109,18 +109,19 @@ export class EscrowFactory { idx: number, secretHash: string ): Interaction { - return new Interaction( - this.address, - AbiCoder.defaultAbiCoder().encode( - [ - `( + const data = AbiCoder.defaultAbiCoder().encode( + [ + `( bytes32[] proof, uint256 idx, bytes32 secretHash, )` - ], - [{proof, idx, secretHash}] - ) + ], + [{proof, idx, secretHash}] ) + + const dataNoOffset = add0x(data.slice(66)) + + return new Interaction(this.address, dataNoOffset) } }