From 5d2d1c6cb1fa34a3b70b74a42c5788de937453b2 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Tue, 18 May 2021 19:35:01 +0600 Subject: [PATCH] feat(limit-order-protocol-facade): update limit order protocol contracts New version of limit order protocol BREAKING CHANGE: LimitOrderProtocolFacade.fillOrder() now has one more argument - thresholdAmount, LimitOrderProtocolFacade.nonces() renamed to LimitOrderProtocolFacade.nonce(), LimitOrderProtocolFacade.advanceNonce() now receive argument - nonce increment count - the number to increase the nonce, new method - LimitOrderProtocolFacade.increaseNonce() - increase nonce by 1 --- README.md | 108 ++++++++------ src/abi/LimitOrderProtocol.json | 92 ++++++++++-- src/limit-order-predicate.builder.test.ts | 2 +- src/limit-order-protocol.facade.test.ts | 48 ++++--- src/limit-order-protocol.facade.ts | 21 ++- src/limit-order.builder.ts | 2 +- src/model/limit-order-protocol.model.ts | 3 +- test/fill-order-sanpshot.ts | 78 +++++----- test/predicate-snapshots.ts | 166 +++++++++++----------- 9 files changed, 318 insertions(+), 202 deletions(-) diff --git a/README.md b/README.md index 31359b1..c89242e 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,9 @@ yarn install @1inch/limit-order-protocol ## Protocol addresses -- Ethereum mainnet: `0x94a68df7e81b90a9007db9db7ffb3e6a2f1e6c1b` -- BSC mainnet: `0x0e6b8845f6a316f92efbaf30af21ff9e78f0008f` +- Ethereum mainnet: `0x4aaffca65f5f9cbf51abf0f03d11d5f446bdf8e7` +- BSC mainnet: `0x35df9901e79aca6b920abbb53758ffb3de725af8` +- Polygon mainnet: `0x59a0a6d73e6a5224871f45e6d845ce1574063ade` --- @@ -62,7 +63,7 @@ See [CHANGELOG.md](./CHANGELOG.md) 8. [Cancel all limit orders](#Cancel-all-limit-orders) 9. [Domain separator](#Domain-separator) -## Quick start +### Quick start ```typescript import { @@ -89,7 +90,7 @@ const limitOrderProtocolFacade = new LimitOrderProtocolFacade( connector ); -// Create a limit order and signature +// Create a limit order and it's signature const limitOrder = limitOrderBuilder.buildOrder({ makerAssetAddress: '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c', takerAssetAddress: '0x111111111117dc0aa78b770fa6a738034120c302', @@ -106,14 +107,17 @@ const limitOrderSignature = limitOrderBuilder.buildOrderSignature( limitOrderTypedData ); -// Fill the limit order +// Create a call data for fill the limit order const callData = limitOrderProtocolFacade.fillOrder( limitOrder, limitOrderSignature, '100', - '0' + '0', + '50' ); +// Send transaction for the order filling +// Must be implemented sendTransaction({ from: walletAddress, gas: 210_000, // Set your gas limit @@ -132,23 +136,26 @@ class MyProviderConnector implements ProviderConnector { } ``` -## Create a limit order +### Create a limit order `LimitOrderBuilder.buildOrder()` Parameters for creating a limit order: -- `makerAssetAddress` - address of maker token -- `takerAssetAddress` - address of taker token -- `makerAddress` - address of maker -- `takerAddress` - address of taker. Default: `0x0000000000000000000000000000000000000000` -- `makerAmount` - amount of maker token, in wei units -- `takerAmount` - amount of taker token, in wei units -- `predicate` - predicate call data. Default: `0x` -- `permit` - permit call data. Default: `0x` -- `interaction` - interaction call data. Default: `0x` +- `makerAssetAddress` - an address of the maker token +- `takerAssetAddress` - an address of the taker token +- `makerAddress` - an address of the maker (wallet address) +- `takerAddress` - an address of the taker. Default: `0x0000000000000000000000000000000000000000` +- `makerAmount` - an amount of maker token, in the wei units +- `takerAmount` - an amount of taker token, in the wei units +- `predicate` - a predicate call data. Default: `0x` +- `permit` - a permit call data. Default: `0x` +- `interaction` - an interaction call data. Default: `0x` -### Example: +> Note: +> `takerAddress` - if set, then the limit order will be available for filling only for this address + +#### Example: ```typescript import {LimitOrderBuilder} from '@1inch/limit-order-protocol'; @@ -174,7 +181,7 @@ const limitOrderSignature = limitOrderBuilder.buildOrderSignature( const limitOrderHash = limitOrderBuilder.buildOrderHash(limitOrderTypedData); ``` -## Check a limit order remaining +### Check a limit order remaining `LimitOrderProtocolFacade.remaining()` @@ -184,7 +191,7 @@ After the first fill, the method will return remaining amount. > Note: a limit order can be partially filled -### Example: +#### Example: ```typescript import { @@ -224,14 +231,16 @@ async function getRemaining(orderHash: string): string { } ``` -## Nonce +### Nonce -`LimitOrderProtocolFacade.nonces()` +`LimitOrderProtocolFacade.nonce()` - returns the nonce of the current wallet address +`LimitOrderProtocolFacade.advanceNonce(count: number)` - increases the nonce by the count +`LimitOrderProtocolFacade.increaseNonce()` - increases the nonce by 1 **Nonce** - this is the so-called `series` of limit orders. The nonce is useful when you need to create a bunch of limit orders with the ability to cancel them all later. -### Example: +#### Example: ```typescript import { @@ -255,7 +264,7 @@ const limitOrderBuilder = new LimitOrderBuilder( ); // Get the current nonce -const nonce = await limitOrderProtocolFacade.nonces(contractAddress); +const nonce = await limitOrderProtocolFacade.nonce(contractAddress); // Create a limit order with nonceEquals predicate const predicate = limitOrderPredicateBuilder.nonceEquals(walletAddress, nonce); @@ -275,7 +284,7 @@ sendTransaction({ }); ``` -## Validate a limit order +### Validate a limit order `LimitOrderProtocolFacade.simulateTransferFroms()` @@ -286,7 +295,7 @@ For example: you can check that a limit order is valid by predicates. > On a `simulateTransferFroms()` call, the contract returns the string like `TRANSFERS_SUCCESSFUL_01101` > If that string contains at least one `0` symbol, then a limit order is invalid, otherwise - valid -### Example: +#### Example: ```typescript import {LimitOrderProtocolFacade, LimitOrder} from '@1inch/limit-order-protocol'; @@ -309,19 +318,19 @@ try { } ``` -## Create a predicate for limit order +### Create a predicate for limit order `LimitOrderPredicateBuilder` A limit order can contain one or more predicates which indicate the logic of its validity. **There are two types of a predicate operators:** -### Conditional operators: +#### Conditional operators: - `and` - combine several predicates, return `true` when all predicates are valid - `or` - combine several predicates, return `true` when the one of predicates is valid -### Comparative operators: +#### Comparative operators: > All comparative operators have three arguments: > (**value**: string, **address**: string, **callData**: string) @@ -333,7 +342,7 @@ A limit order can contain one or more predicates which indicate the logic of its - `lt` - _**a result**_ must be less than the `value` - `gt` - _**a result**_ must be greater than the `value` -### Built-in operators: +#### Built-in operators: > `nonceEquals(makerAddress: string, makerNonce: number)` @@ -345,7 +354,7 @@ The predicate checks that the `makerNonce` is equal to the nonce of `makerAddres The predicate checks that `timestamp` is greater than the current time -### Example: +#### Example: ```typescript import { @@ -385,21 +394,22 @@ const complexPredicate: LimitOrderPredicateCallData = or( ); ``` -## Fill a limit order +### Fill a limit order `LimitOrderProtocolFacade.fillOrder()` Parameters for order filling: -- `order: LimitOrder` -- `signature: LimitOrderSignature` -- `makerAmount: string` -- `takerAmount: string` +- `order: LimitOrder` - a limit order structure +- `signature: LimitOrderSignature` - signature of a limit order +- `makerAmount: string` - amount of maker asset (in token units) +- `takerAmount: string` - amount of taker asset (in token units) +- `thresholdAmount: string` - threshold for amount of received asset (in received asset units) > Note: to fill a limit order, only one of the amounts must be specified > The second one must be set to `0` -### Example +#### Example ```typescript import { @@ -416,6 +426,7 @@ const signature: LimitOrderSignature = '...'; const makerAmount = '400000000'; const takerAmount = '0'; +const thresholdAmount = '600000000'; const connector = new Web3ProviderConnector(new Web3('...')); const limitOrderProtocolFacade = new limitOrderProtocolFacade(contractAddress, connector); @@ -424,7 +435,8 @@ const callData = limitOrderProtocolFacade.fillOrder( order, signature, makerAmount, - takerAmount + takerAmount, + thresholdAmount ); sendTransaction({ @@ -436,11 +448,11 @@ sendTransaction({ }); ``` -## Cancel a limit order +### Cancel a limit order `LimitOrderProtocolFacade.cancelOrder()` -### Example: +#### Example: ```typescript import { @@ -467,18 +479,20 @@ sendTransaction({ }); ``` -## Cancel all limit orders +### Cancel all limit orders -`LimitOrderProtocolFacade.advanceNonce()` +`LimitOrderProtocolFacade.advanceNonce(count)` +or +`LimitOrderProtocolFacade.increaseNonce()` -### First of all, read about [Nonce](#nonce) +#### First of all, read about [Nonce](#nonce) -`advanceNonce()` increments the nonce and all limit orders with a predicate to the previous nonce value become invalid +`advanceNonce(count) or increaseNonce()` increments the nonce and all limit orders with a predicate to the previous nonce value become invalid > **Warning!** > The approach only works when all orders have the `nonceEquals` predicate -### Example: +#### Example: ```typescript import { @@ -495,7 +509,7 @@ const limitOrderProtocolFacade = new limitOrderProtocolFacade( connector ); -const callData = limitOrderProtocolFacade.advanceNonce(); +const callData = limitOrderProtocolFacade.increaseNonce(); sendTransaction({ from: walletAddress, @@ -506,11 +520,11 @@ sendTransaction({ }); ``` -## Domain separator +### Domain separator [Definition of domainSeparator](https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator) -### Example: +#### Example: ```typescript import {LimitOrderProtocolFacade} from '@1inch/limit-order-protocol'; diff --git a/src/abi/LimitOrderProtocol.json b/src/abi/LimitOrderProtocol.json index 8da4da1..60851fd 100644 --- a/src/abi/LimitOrderProtocol.json +++ b/src/abi/LimitOrderProtocol.json @@ -1,6 +1,12 @@ [ { - "inputs": [], + "inputs": [ + { + "internalType": "uint8", + "name": "amount", + "type": "uint8" + } + ], "name": "advanceNonce", "outputs": [], "stateMutability": "nonpayable", @@ -157,6 +163,11 @@ "internalType": "uint256", "name": "takingAmount", "type": "uint256" + }, + { + "internalType": "uint256", + "name": "thresholdAmount", + "type": "uint256" } ], "name": "fillOrder", @@ -213,6 +224,16 @@ "internalType": "bytes", "name": "signature", "type": "bytes" + }, + { + "internalType": "uint256", + "name": "makingAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "takingAmount", + "type": "uint256" } ], "name": "fillOrderRFQ", @@ -337,6 +358,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "increaseNonce", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newNonce", + "type": "uint256" + } + ], + "name": "NonceIncreased", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -362,6 +409,25 @@ "name": "OrderFilled", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "makingAmount", + "type": "uint256" + } + ], + "name": "OrderFilledRFQ", + "type": "event" + }, { "inputs": [ { @@ -724,21 +790,16 @@ "inputs": [ { "internalType": "address", - "name": "makerAddress", + "name": "", "type": "address" - }, - { - "internalType": "uint256", - "name": "makerNonce", - "type": "uint256" } ], - "name": "nonceEquals", + "name": "nonce", "outputs": [ { - "internalType": "bool", + "internalType": "uint256", "name": "", - "type": "bool" + "type": "uint256" } ], "stateMutability": "view", @@ -750,14 +811,19 @@ "internalType": "address", "name": "makerAddress", "type": "address" + }, + { + "internalType": "uint256", + "name": "makerNonce", + "type": "uint256" } ], - "name": "nonces", + "name": "nonceEquals", "outputs": [ { - "internalType": "uint256", + "internalType": "bool", "name": "", - "type": "uint256" + "type": "bool" } ], "stateMutability": "view", diff --git a/src/limit-order-predicate.builder.test.ts b/src/limit-order-predicate.builder.test.ts index 73ada2f..d31b812 100644 --- a/src/limit-order-predicate.builder.test.ts +++ b/src/limit-order-predicate.builder.test.ts @@ -12,7 +12,7 @@ import { } from '../test/predicate-snapshots'; describe('PredicateBuilder - for build limit order predicate', () => { - const contractAddress = '0x0e6b8845f6a316f92efbaf30af21ff9e78f0008f'; + const contractAddress = '0x35df9901e79aca6b920abbb53758ffb3de725af8'; const walletAddress = '0xfb3c7eb936caa12b5a884d612393969a557d4307'; const WBNB_ADDRESS = '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c'; diff --git a/src/limit-order-protocol.facade.test.ts b/src/limit-order-protocol.facade.test.ts index bd3d075..e49b5ae 100644 --- a/src/limit-order-protocol.facade.test.ts +++ b/src/limit-order-protocol.facade.test.ts @@ -11,7 +11,7 @@ import {FILL_ORDER_SNAPSHOT} from '../test/fill-order-sanpshot'; import {CANCEL_ORDER_SNAPSHOT} from '../test/cancel-order-snapshot'; describe('LimitOrderProtocolFacade - facade for Limit order protocol contract', () => { - const contractAddress = '0x0e6b8845f6a316f92efbaf30af21ff9e78f0008f'; + const contractAddress = '0x35df9901e79aca6b920abbb53758ffb3de725af8'; const walletAddress = '0xfb3c7eb936cAA12B5A884d612393969A557d4307'; const chainId = 56; @@ -69,12 +69,14 @@ describe('LimitOrderProtocolFacade - facade for Limit order protocol contract', ); const makerAmount = '1000000000000000000'; const takerAmount = '0'; + const thresholdAmount = '0'; const callData = facade.fillOrder( order, signature, makerAmount, - takerAmount + takerAmount, + thresholdAmount ); expect(callData).toBe(FILL_ORDER_SNAPSHOT); @@ -97,25 +99,37 @@ describe('LimitOrderProtocolFacade - facade for Limit order protocol contract', }); }); - describe('nonces()', () => { + describe('nonce()', () => { it('Return the nonce number of address (for real wallet address)', async () => { - const nonces = await facade.nonces(walletAddress); + const nonce = await facade.nonce( + '0xbbcf91605c18a9859c1d47abfeed5d2cca7097cf' + ); - expect(nonces).toBeGreaterThan(12); + expect(nonce).toBeGreaterThan(1); }); it('Return 0 when address never called advanceNonce (for contract address)', async () => { - const nonces = await facade.nonces(contractAddress); + const nonce = await facade.nonce(contractAddress); - expect(nonces).toBe(0); + expect(nonce).toBe(0); }); }); describe('advanceNonce()', () => { it('Must create a call data for advance nonce', async () => { - const callData = await facade.advanceNonce(); + const callData = await facade.advanceNonce(2); + + expect(callData).toBe( + '0x72c244a80000000000000000000000000000000000000000000000000000000000000002' + ); + }); + }); + + describe('increaseNonce()', () => { + it('Must create a call data for increase nonce', async () => { + const callData = await facade.increaseNonce(); - expect(callData).toBe('0x8faae2c2'); + expect(callData).toBe('0xc53a0292'); }); }); @@ -136,8 +150,9 @@ describe('LimitOrderProtocolFacade - facade for Limit order protocol contract', expect(error).toBe('LOP: Unknown order'); }); - it('When order is partially filled, then must return remaining amount', async () => { - // Order 1BUSD > 1 DAI, filled for 20% + // TODO: enable after creating a new partially filled order + xit('When order is partially filled, then must return remaining amount', async () => { + // Order 1 BUSD > 1 DAI, filled for 20% const orderHash = '0xa5b11acf64bd0ff47fc2b71b060a0e1e63bb8e82bd3e6aa3470b00ad7746933a'; @@ -146,7 +161,8 @@ describe('LimitOrderProtocolFacade - facade for Limit order protocol contract', expect(remaining.toString()).toBe('8000000000000000000'); }); - it('When order is canceled, then must return zero', async () => { + // TODO: enable after creating a new canceled order + xit('When order is canceled, then must return zero', async () => { // Canceled order const orderHash = '0xd522b08465386fb462676da9b923aea0df2085dc3b96695520203e6e4a46e5a8'; @@ -214,7 +230,7 @@ describe('LimitOrderProtocolFacade - facade for Limit order protocol contract', const timestampBelow = limitOrderPredicateBuilder.timestampBelow( timestamp ); // valid value - const nonce = await facade.nonces(walletAddress); // real nonce + const nonce = await facade.nonce(walletAddress); // real nonce const nonceEquals = limitOrderPredicateBuilder.nonceEquals( walletAddress, nonce + 1 @@ -239,7 +255,7 @@ describe('LimitOrderProtocolFacade - facade for Limit order protocol contract', const timestampBelow = limitOrderPredicateBuilder.timestampBelow( timestamp ); // valid value - const nonce = await facade.nonces(walletAddress); // real nonce + const nonce = await facade.nonce(walletAddress); // real nonce const nonceEquals = limitOrderPredicateBuilder.nonceEquals( walletAddress, nonce @@ -264,7 +280,7 @@ describe('LimitOrderProtocolFacade - facade for Limit order protocol contract', const timestampBelow = limitOrderPredicateBuilder.timestampBelow( timestamp ); // valid value - const nonce = await facade.nonces(walletAddress); // real nonce + const nonce = await facade.nonce(walletAddress); // real nonce const nonceEquals = limitOrderPredicateBuilder.nonceEquals( walletAddress, nonce @@ -289,7 +305,7 @@ describe('LimitOrderProtocolFacade - facade for Limit order protocol contract', const result = await facade.domainSeparator(); expect(result).toBe( - '0x962a9cc803d5846904fc4b4ff693f86ae185c1071fc66b0f4ab0a97d0578212f' + '0x61ba2d5643f6075b336dfa622a46fe041cab25e129bbabcfb273a7b4595522b5' ); }); diff --git a/src/limit-order-protocol.facade.ts b/src/limit-order-protocol.facade.ts index 265b7d2..a887459 100644 --- a/src/limit-order-protocol.facade.ts +++ b/src/limit-order-protocol.facade.ts @@ -22,13 +22,15 @@ export class LimitOrderProtocolFacade { order: LimitOrder, signature: LimitOrderSignature, makerAmount: string, - takerAmount: string + takerAmount: string, + thresholdAmount: string ): string { return this.getContractCallData(LimitOrderProtocolMethods.fillOrder, [ order, signature, makerAmount, takerAmount, + thresholdAmount, ]); } @@ -38,9 +40,9 @@ export class LimitOrderProtocolFacade { ]); } - nonces(makerAddress: string): Promise { + nonce(makerAddress: string): Promise { const callData = this.getContractCallData( - LimitOrderProtocolMethods.nonces, + LimitOrderProtocolMethods.nonce, [makerAddress] ); @@ -49,8 +51,17 @@ export class LimitOrderProtocolFacade { .then((nonce) => BigNumber.from(nonce).toNumber()); } - advanceNonce(): string { - return this.getContractCallData(LimitOrderProtocolMethods.advanceNonce); + advanceNonce(count: number): string { + return this.getContractCallData( + LimitOrderProtocolMethods.advanceNonce, + [count] + ); + } + + increaseNonce(): string { + return this.getContractCallData( + LimitOrderProtocolMethods.increaseNonce + ); } checkPredicate(order: LimitOrder): Promise { diff --git a/src/limit-order.builder.ts b/src/limit-order.builder.ts index c1d8684..9dc6245 100644 --- a/src/limit-order.builder.ts +++ b/src/limit-order.builder.ts @@ -121,7 +121,7 @@ export class LimitOrderBuilder { return Math.round(Math.random() * Date.now()) + ''; } - // Get nonce from contract (nonces method) and put it to predicate on order creating + // Get nonce from contract (nonce method) and put it to predicate on order creating private getAmountData( methodName: LimitOrderProtocolMethods, makerAmount: string, diff --git a/src/model/limit-order-protocol.model.ts b/src/model/limit-order-protocol.model.ts index 3363733..9e57499 100644 --- a/src/model/limit-order-protocol.model.ts +++ b/src/model/limit-order-protocol.model.ts @@ -40,8 +40,9 @@ export enum LimitOrderProtocolMethods { getTakerAmount = 'getTakerAmount', fillOrder = 'fillOrder', cancelOrder = 'cancelOrder', - nonces = 'nonces', + nonce = 'nonce', advanceNonce = 'advanceNonce', + increaseNonce = 'increaseNonce', and = 'and', or = 'or', eq = 'eq', diff --git a/test/fill-order-sanpshot.ts b/test/fill-order-sanpshot.ts index 5a7041c..e804e08 100644 --- a/test/fill-order-sanpshot.ts +++ b/test/fill-order-sanpshot.ts @@ -1,36 +1,44 @@ export const FILL_ORDER_SNAPSHOT = - '0x3d8108c30000000000000000000000000000000000000000000000000000000000000080000' + - '00000000000000000000000000000000000000000000000000000000004a00000000000000000' + - '000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000' + - '00000000000000000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000001000000000000000000000000e9e7cea3dedca5984780bafc599bd69' + - 'add087d56000000000000000000000000111111111117dc0aa78b770fa6a738034120c3020000' + - '00000000000000000000000000000000000000000000000000000000014000000000000000000' + - '000000000000000000000000000000000000000000001e0000000000000000000000000000000' + - '00000000000000000000000000000002800000000000000000000000000000000000000000000' + - '00000000000000000030000000000000000000000000000000000000000000000000000000000' + - '0000038000000000000000000000000000000000000000000000000000000000000003e000000' + - '00000000000000000000000000000000000000000000000000000000400000000000000000000' + - '000000000000000000000000000000000000000000006423b872dd00000000000000000000000' + - '0fb3c7eb936caa12b5a884d612393969a557d4307000000000000000000000000000000000000' + - '00000000000000000000000000000000000000000000000000000000000000000000000000000' + - 'de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000' + - '000000000000000000000000000000000000000000000000000000006423b872dd00000000000' + - '00000000000000000000000000000000000000000000000000000000000000000000000000000' + - 'fb3c7eb936caa12b5a884d612393969a557d43070000000000000000000000000000000000000' + - '000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000000000000000000044f4a215c' + - '30000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000' + - '0000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000' + - '00000000000000000000000000000000000000000000000000000000000000000000000000000' + - '000000000000000044296637bf0000000000000000000000000000000000000000000000000de' + - '0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000' + - '00000000000000000000000000000000000000000000000000000000000000000000000000000' + - '000000000000000000000000000000000000000002463592c2b00000000000000000000000000' + - '000000000000000000000000000000609f1be8000000000000000000000000000000000000000' + - '00000000000000000000000000000000000000000000000000000000000000000000000000000' + - '00000000000000000000000000000000000000000000000000000000000000000000000000000' + - '0000000000000000000000000000000000000000000000000000041813363eddb4719cecd7faa' + - '23b3eba29fb309af2d52cbc0f29b4f74b94a8f382c016f00f9bfa023e1e73b636770bcdeef3a6' + - '6d10bdccc9aed9cd00270896b56081b0000000000000000000000000000000000000000000000' + - '0000000000000000'; + '0xf3432b1a' + + '00000000000000000000000000000000000000000000000000000000000000a0' + + '00000000000000000000000000000000000000000000000000000000000004c0' + + '0000000000000000000000000000000000000000000000000de0b6b3a7640000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000001' + + '000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d56' + + '000000000000000000000000111111111117dc0aa78b770fa6a738034120c302' + + '0000000000000000000000000000000000000000000000000000000000000140' + + '00000000000000000000000000000000000000000000000000000000000001e0' + + '0000000000000000000000000000000000000000000000000000000000000280' + + '0000000000000000000000000000000000000000000000000000000000000300' + + '0000000000000000000000000000000000000000000000000000000000000380' + + '00000000000000000000000000000000000000000000000000000000000003e0' + + '0000000000000000000000000000000000000000000000000000000000000400' + + '0000000000000000000000000000000000000000000000000000000000000064' + + '23b872dd000000000000000000000000fb3c7eb936caa12b5a884d612393969a' + + '557d430700000000000000000000000000000000000000000000000000000000' + + '000000000000000000000000000000000000000000000000000000000de0b6b3' + + 'a764000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000064' + + '23b872dd00000000000000000000000000000000000000000000000000000000' + + '00000000000000000000000000000000fb3c7eb936caa12b5a884d612393969a' + + '557d43070000000000000000000000000000000000000000000000000de0b6b3' + + 'a764000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000044' + + 'f4a215c30000000000000000000000000000000000000000000000000de0b6b3' + + 'a76400000000000000000000000000000000000000000000000000000de0b6b3' + + 'a764000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000044' + + '296637bf0000000000000000000000000000000000000000000000000de0b6b3' + + 'a76400000000000000000000000000000000000000000000000000000de0b6b3' + + 'a764000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000024' + + '63592c2b00000000000000000000000000000000000000000000000000000000' + + '609f1be800000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000041' + + '9863db6f35098f7ed49bfb728073430cf793056576930d2151b1947963ea590f' + + '36b8a557cd4c8dbd055b75b8f0a662b6b8f9a30d720f60098586bcceaf784038' + + '1c00000000000000000000000000000000000000000000000000000000000000'; diff --git a/test/predicate-snapshots.ts b/test/predicate-snapshots.ts index 811e5c3..cb43c2a 100644 --- a/test/predicate-snapshots.ts +++ b/test/predicate-snapshots.ts @@ -1,20 +1,20 @@ export const SIMPLE_PREDICATE_SNAPSHOT = [ - '0x961d5b1e', - '0000000000000000000000000000000000000000000000000000000000000040', - '00000000000000000000000000000000000000000000000000000000000000a0', - '0000000000000000000000000000000000000000000000000000000000000002', - '0000000000000000000000000e6b8845f6a316f92efbaf30af21ff9e78f0008f', - '0000000000000000000000000e6b8845f6a316f92efbaf30af21ff9e78f0008f', - '0000000000000000000000000000000000000000000000000000000000000002', - '0000000000000000000000000000000000000000000000000000000000000040', - '00000000000000000000000000000000000000000000000000000000000000c0', - '0000000000000000000000000000000000000000000000000000000000000044', - 'cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d612393969a', - '557d430700000000000000000000000000000000000000000000000000000000', - '0000000d00000000000000000000000000000000000000000000000000000000', - '0000000000000000000000000000000000000000000000000000000000000024', - '63592c2b00000000000000000000000000000000000000000000000000000000', - '608d1a4600000000000000000000000000000000000000000000000000000000', + '0x961d5b1e' + + '0000000000000000000000000000000000000000000000000000000000000040' + + '00000000000000000000000000000000000000000000000000000000000000a0' + + '0000000000000000000000000000000000000000000000000000000000000002' + + '00000000000000000000000035df9901e79aca6b920abbb53758ffb3de725af8' + + '00000000000000000000000035df9901e79aca6b920abbb53758ffb3de725af8' + + '0000000000000000000000000000000000000000000000000000000000000002' + + '0000000000000000000000000000000000000000000000000000000000000040' + + '00000000000000000000000000000000000000000000000000000000000000c0' + + '0000000000000000000000000000000000000000000000000000000000000044' + + 'cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d612393969a' + + '557d430700000000000000000000000000000000000000000000000000000000' + + '0000000d00000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000024' + + '63592c2b00000000000000000000000000000000000000000000000000000000' + + '608d1a4600000000000000000000000000000000000000000000000000000000', ]; /* @@ -32,71 +32,71 @@ const predicate = predicateBuilder.or( ); */ export const COMPLEX_PREDICATE_SNAPSHOT = [ - '0xe6133301', - '0000000000000000000000000000000000000000000000000000000000000040', - '00000000000000000000000000000000000000000000000000000000000000c0', - '0000000000000000000000000000000000000000000000000000000000000003', - '0000000000000000000000000e6b8845f6a316f92efbaf30af21ff9e78f0008f', - '0000000000000000000000000e6b8845f6a316f92efbaf30af21ff9e78f0008f', - '0000000000000000000000000e6b8845f6a316f92efbaf30af21ff9e78f0008f', - '0000000000000000000000000000000000000000000000000000000000000003', - '0000000000000000000000000000000000000000000000000000000000000060', - '00000000000000000000000000000000000000000000000000000000000003c0', - '0000000000000000000000000000000000000000000000000000000000000660', - '0000000000000000000000000000000000000000000000000000000000000324', - '961d5b1e00000000000000000000000000000000000000000000000000000000', - '0000004000000000000000000000000000000000000000000000000000000000', - '000000c000000000000000000000000000000000000000000000000000000000', - '000000030000000000000000000000000e6b8845f6a316f92efbaf30af21ff9e', - '78f0008f0000000000000000000000000e6b8845f6a316f92efbaf30af21ff9e', - '78f0008f0000000000000000000000000e6b8845f6a316f92efbaf30af21ff9e', - '78f0008f00000000000000000000000000000000000000000000000000000000', - '0000000300000000000000000000000000000000000000000000000000000000', - '0000006000000000000000000000000000000000000000000000000000000000', - '000000c000000000000000000000000000000000000000000000000000000000', - '0000014000000000000000000000000000000000000000000000000000000000', - '0000002463592c2b000000000000000000000000000000000000000000000000', - '00000000608d1a46000000000000000000000000000000000000000000000000', - '0000000000000000000000000000000000000000000000000000000000000000', - '00000044cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d61', - '2393969a557d4307000000000000000000000000000000000000000000000000', - '000000031b62b032000000000000000000000000000000000000000000000000', - '0000000000000000000000000000000000000000000000000000000000000000', - '000000c4057702e9000000000000000000000000000000000000000000000000', - '0368ced66ab10000000000000000000000000000bb4cdb9cbd36b01bd1cbaebf', - '2de08d9173bc095c000000000000000000000000000000000000000000000000', - '0000000000000060000000000000000000000000000000000000000000000000', - '000000000000002470a08231000000000000000000000000fb3c7eb936caa12b', - '5a884d612393969a557d43070000000000000000000000000000000000000000', - '0000000000000000000000000000000000000000000000000000000000000000', - '0000000000000000000000000000000000000000000000000000000000000000', - '0000000000000000000000000000000000000000000000000000000000000264', - 'e613330100000000000000000000000000000000000000000000000000000000', - '0000004000000000000000000000000000000000000000000000000000000000', - '000000a000000000000000000000000000000000000000000000000000000000', - '000000020000000000000000000000000e6b8845f6a316f92efbaf30af21ff9e', - '78f0008f0000000000000000000000000e6b8845f6a316f92efbaf30af21ff9e', - '78f0008f00000000000000000000000000000000000000000000000000000000', - '0000000200000000000000000000000000000000000000000000000000000000', - '0000004000000000000000000000000000000000000000000000000000000000', - '000000a000000000000000000000000000000000000000000000000000000000', - '0000002463592c2b000000000000000000000000000000000000000000000000', - '00000000608d56e3000000000000000000000000000000000000000000000000', - '0000000000000000000000000000000000000000000000000000000000000000', - '000000c4871919d5000000000000000000000000000000000000000000000000', - '2fed2d80b04df000000000000000000000000000bb4cdb9cbd36b01bd1cbaebf', - '2de08d9173bc095c000000000000000000000000000000000000000000000000', - '0000000000000060000000000000000000000000000000000000000000000000', - '000000000000002470a08231000000000000000000000000fb3c7eb936caa12b', - '5a884d612393969a557d43070000000000000000000000000000000000000000', - '0000000000000000000000000000000000000000000000000000000000000000', - '0000000000000000000000000000000000000000000000000000000000000000', - '00000000000000000000000000000000000000000000000000000000000000c4', - '32565d61000000000000000000000000000000000000000000000000007b1405', - '154a6600000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d91', - '73bc095c00000000000000000000000000000000000000000000000000000000', - '0000006000000000000000000000000000000000000000000000000000000000', - '0000002470a08231000000000000000000000000fb3c7eb936caa12b5a884d61', - '2393969a557d4307000000000000000000000000000000000000000000000000', - '0000000000000000000000000000000000000000000000000000000000000000', + '0xe6133301' + + '0000000000000000000000000000000000000000000000000000000000000040' + + '00000000000000000000000000000000000000000000000000000000000000c0' + + '0000000000000000000000000000000000000000000000000000000000000003' + + '00000000000000000000000035df9901e79aca6b920abbb53758ffb3de725af8' + + '00000000000000000000000035df9901e79aca6b920abbb53758ffb3de725af8' + + '00000000000000000000000035df9901e79aca6b920abbb53758ffb3de725af8' + + '0000000000000000000000000000000000000000000000000000000000000003' + + '0000000000000000000000000000000000000000000000000000000000000060' + + '00000000000000000000000000000000000000000000000000000000000003c0' + + '0000000000000000000000000000000000000000000000000000000000000660' + + '0000000000000000000000000000000000000000000000000000000000000324' + + '961d5b1e00000000000000000000000000000000000000000000000000000000' + + '0000004000000000000000000000000000000000000000000000000000000000' + + '000000c000000000000000000000000000000000000000000000000000000000' + + '0000000300000000000000000000000035df9901e79aca6b920abbb53758ffb3' + + 'de725af800000000000000000000000035df9901e79aca6b920abbb53758ffb3' + + 'de725af800000000000000000000000035df9901e79aca6b920abbb53758ffb3' + + 'de725af800000000000000000000000000000000000000000000000000000000' + + '0000000300000000000000000000000000000000000000000000000000000000' + + '0000006000000000000000000000000000000000000000000000000000000000' + + '000000c000000000000000000000000000000000000000000000000000000000' + + '0000014000000000000000000000000000000000000000000000000000000000' + + '0000002463592c2b000000000000000000000000000000000000000000000000' + + '00000000608d1a46000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '00000044cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d61' + + '2393969a557d4307000000000000000000000000000000000000000000000000' + + '000000031b62b032000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '000000c4057702e9000000000000000000000000000000000000000000000000' + + '0368ced66ab10000000000000000000000000000bb4cdb9cbd36b01bd1cbaebf' + + '2de08d9173bc095c000000000000000000000000000000000000000000000000' + + '0000000000000060000000000000000000000000000000000000000000000000' + + '000000000000002470a08231000000000000000000000000fb3c7eb936caa12b' + + '5a884d612393969a557d43070000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000264' + + 'e613330100000000000000000000000000000000000000000000000000000000' + + '0000004000000000000000000000000000000000000000000000000000000000' + + '000000a000000000000000000000000000000000000000000000000000000000' + + '0000000200000000000000000000000035df9901e79aca6b920abbb53758ffb3' + + 'de725af800000000000000000000000035df9901e79aca6b920abbb53758ffb3' + + 'de725af800000000000000000000000000000000000000000000000000000000' + + '0000000200000000000000000000000000000000000000000000000000000000' + + '0000004000000000000000000000000000000000000000000000000000000000' + + '000000a000000000000000000000000000000000000000000000000000000000' + + '0000002463592c2b000000000000000000000000000000000000000000000000' + + '00000000608d56e3000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '000000c4871919d5000000000000000000000000000000000000000000000000' + + '2fed2d80b04df000000000000000000000000000bb4cdb9cbd36b01bd1cbaebf' + + '2de08d9173bc095c000000000000000000000000000000000000000000000000' + + '0000000000000060000000000000000000000000000000000000000000000000' + + '000000000000002470a08231000000000000000000000000fb3c7eb936caa12b' + + '5a884d612393969a557d43070000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000' + + '00000000000000000000000000000000000000000000000000000000000000c4' + + '32565d61000000000000000000000000000000000000000000000000007b1405' + + '154a6600000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d91' + + '73bc095c00000000000000000000000000000000000000000000000000000000' + + '0000006000000000000000000000000000000000000000000000000000000000' + + '0000002470a08231000000000000000000000000fb3c7eb936caa12b5a884d61' + + '2393969a557d4307000000000000000000000000000000000000000000000000' + + '0000000000000000000000000000000000000000000000000000000000000000', ];