Skip to content

Commit

Permalink
Merge pull request #15 from blooo-io/feat/INCH-5-create-fillorderrfq-…
Browse files Browse the repository at this point in the history
…method

feat(fillOrderRFQ): Create the method, added tests on ethereum and po…
  • Loading branch information
GuilaneDen authored May 5, 2022
2 parents dca50fa + 4a6c35f commit 317d342
Show file tree
Hide file tree
Showing 46 changed files with 17 additions and 49 deletions.
2 changes: 1 addition & 1 deletion src/handle_init_contract.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void handle_init_contract(void *parameters) {
context->next_param = DST_RECEIVER;
break;
case FILL_ORDER_RFQ:
context->skip = 2;
context->skip = 5;
context->next_param = AMOUNT_SENT;
break;
case FILL_ORDER_RFQ_TO_WITH_PERMIT:
Expand Down
4 changes: 4 additions & 0 deletions src/handle_provide_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,14 @@ static void handle_fill_order_rfq(ethPluginProvideParameter_t *msg,
switch (context->next_param) {
case AMOUNT_SENT: // fromAmount
handle_amount_sent(msg, context);
// We call the handle_token_sent method to print "Unknown Token"
handle_token_sent(msg, context);
context->next_param = AMOUNT_RECEIVED;
break;
case AMOUNT_RECEIVED: // toAmount
handle_amount_received(msg, context);
// We call the handle_token_received method to print "Unknown Token"
handle_token_received(msg, context);
context->next_param = NONE;
break;
case NONE:
Expand Down
Binary file modified tests/elfs/1inch_nanos.elf
Binary file not shown.
Binary file modified tests/elfs/1inch_nanox.elf
Binary file not shown.
43 changes: 3 additions & 40 deletions tests/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,46 +26,9 @@ module.exports = {

// The glob patterns Jest uses to detect test files
testMatch: [
// '**/__tests__/**/*.[jt]s?(x)',
// '**/?(*.)+(spec|test).[tj]s?(x)',
// '**/?(*.)+(ispec|test).[tj]s?(x)',
'**/V3/unoswap_known_ethereum.test*',
'**/V3/unoswap_native_ethereum.test*',
'**/V3/unoswap_unknown_ethereum.test*',
'**/V3/unoswap_known_polygon.test*',
'**/V3/unoswap_unknown_polygon.test*',
'**/V3/unoswap_native_polygon.test*',
'**/V3/swap_unknown_to_native_ethereum.test*',
'**/V3/swap_known_to_known_polygon.test*',
'**/V3/swap_native_to_known_polygon.test*',
'**/V3/swap_unknown_to_known_polygon.test*',
'**/V3/swap_known_to_unknown_ethereum.test*',
'**/V3/swap_known_to_known_ethereum.test*',
'**/V4/uniswap_v3_swap_polygon.test*',
'**/V4/uniswap_v3_swap_ethereum.test*',
'**/V4/unoswap_with_permit_ethereum.test*',
'**/V4/unoswap_with_permit_polygon.test*',
'**/V4/clipper_swap_ethereum.test*',
'**/V4/clipper_swap_to_with_permit_ethereum.test*',
'**/V4/uniswap_v3_swap_to_polygon.test*',
'**/V4/uniswap_v3_swap_to_ethereum.test*',
'**/V4/uniswap_v3_swap_to_with_permit_ethereum.test*',
'**/V4/uniswap_v3_swap_to_with_permit_polygon.test*',
'**/V4/fill_order_rfq_to_with_permit_ethereum.test*',
'**/V4/fill_order_rfq_to_with_permit_polygon.test*',
'**/V4/unoswap_native_ethereum.test*',
'**/V4/unoswap_known_ethereum.test*',
'**/V4/unoswap_unknown_ethereum.test*',
'**/V4/unoswap_known_polygon.test*',
'**/V4/unoswap_native_polygon.test*',
'**/V4/unoswap_unknown_polygon.test*',
'**/V4/swap_unknown_to_native_ethereum.test*',
'**/V4/swap_known_to_unknown_polygon.test*',
'**/V4/swap_known_to_known_polygon.test*',
'**/V4/swap_known_to_native_polygon.test*',
'**/V4/swap_known_to_known_ethereum.test*',
// '**/V4/fill_order_rfq_polygon.test*',
// '**/V4/fill_order_rfq_ethereum.test*',
'**/__tests__/**/*.[jt]s?(x)',
'**/?(*.)+(spec|test).[tj]s?(x)',
'**/?(*.)+(ispec|test).[tj]s?(x)',
],

// Stop immediatly when a test fails
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions tests/src/V4/fill_order_rfq_ethereum.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ const signedPlugin = false;
const testNetwork = "ethereum";

const contractAddr = "0x1111111254fb6c44bac0bed2854e76f90643097d";

// // From : https://etherscan.io/tx/0x55812ebbf71e6659d31ec4391faaa9a0f043b9a147f75d82382352dfffb3a342
const chainID = 1;
const inputData = "0x7c0252000000000000000000000000002057cfb9fd11837d61b294d514c5bd03e5e7189a00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000180000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd52000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000002057cfb9fd11837d61b294d514c5bd03e5e7189a0000000000000000000000004e484b661d183d4281f09288f492747ee5647a53000000000000000000000000000000000000000000000659ea2ab0a63fcfc000000000000000000000000000000000000000000000000000000000111e33076300000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013c02fe7988acb2d73bee05f6a2c598360532edec2c49f9574c981076a3508ce492ed68d9678536f33d842a40753b2fd37e9f510823a5cd894947c251bcd9e20e2590000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000e4000000000000000000000000000000000000000000000000000000000000011208000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064eb5625d9000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd520000000000000000000000008301ae4fc9c624d1d396cbdaa1ed877821d7c511000000000000000000000000000000000000000000000659ea2ab0a63fcfc000000000000000000000000000000000000000000000000000000000008000000000000000000000008301ae4fc9c624d1d396cbdaa1ed877821d7c5110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a4394747c500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000659ea2ab0a63fcfc000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000004c4ad0e7b1a00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000460000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000032000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001408000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064eb5625d9000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000800000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e452bbbe2900000000000000000000000000000000000000000000000000000000000000e00000000000000000000000002057cfb9fd11837d61b294d514c5bd03e5e7189a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000002057cfb9fd11837d61b294d514c5bd03e5e7189a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000626c01ca0b09dea16768f0799065c475be02919503cb2a3500020000000000000000001a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000448000000000000000000000000000000000000000000000000000000000000164000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000544df92bd08000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000004400000000000000000000000002057cfb9fd11837d61b294d514c5bd03e5e7189a00000000000000000000000000000000000000000000000000000000000004a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001408000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064eb5625d90000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000001111111254fb6c44bac0bed2854e76f90643097d0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000008000000000000000000000001111111254fb6c44bac0bed2854e76f90643097d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c4d0a3b6650000000000000000000000000000000000000000626ab0c20000018070c0a2e3000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000945bcf562085de2d5875b9e2012ed5fd5cfab9270000000000000000000000002057cfb9fd11837d61b294d514c5bd03e5e7189a000000000000000000000000000000000000000000000000000000113446fca7000000000000000000000000000000000000000000000fa5c815e662eb9ae2720000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000041a0abb9f3a6b68e6cb84275a0180a2135ea42ea29f5fad483754b70dc66f94eaa09077c88bef9c07aade0967aefcd6da2b47d08ea21f93fba4fdcd829af1609d71b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000004480000000000000000000000000000000000000000000000000000000000001240000000000000000000000000000000000000000000000000000000000000064ec77bbdb0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000003200000000000000000000000000000032000000000000000000000000000000000000000000000fa5c815e662eb9ae2720000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000024432ce0a7c000000000000000000000000000000000000000000000000000000000000008080000000000000000000000000000000000000000000000000000000000000440000000000000000000000002057cfb9fd11837d61b294d514c5bd03e5e7189a00000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a405971224000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000246bb95dcfdb5fdb79261eba615c23bdc79d1bed0000000000000000000000000000000000000000000000000000000000000001000000000000000002c1689c7a8ddce900000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004470bdb947000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000000000000000000000000000000000001134386e570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018414284aab00000000000000000000000000000000000000000000000000000000000000808000000000000000000000000000000000000000000000000000000000000044000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064d1660f99000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000001111111254fb6c44bac0bed2854e76f90643097d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e26b9977";

// // From : https://etherscan.io/tx/0x384d3265e101249d91ebe97bf76f15e16ccc7779f1b26de017651663a7aa34ac
const inputData = "0xd0a3b665800000000000000000000000000000000000000062739df3000000000002d085000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000b3c839dbde6b96d37c56ee4f9dad3390d49310aa000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004beb82204416940000000000000000000000000000000000000000000000000000000003baa0c4000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000000451c33d2f4ab40499da64da1075e76f61f5b7164f787bbe854902125bd09794cc09f09c64ae8c8ea0c03f7be8aa4befe109f511845560ae9e2b2c0ba3037975982ff62739d7b000000000000000000000000000000000000000000000000000000e26b9977";

const serializedTx = populateTransaction(contractAddr, inputData, chainID);

const devices = [
{
name: "nanos",
label: "Nano S",
steps: 13, // <= Define the number of steps for this test case and this device
steps: 7, // <= Define the number of steps for this test case and this device
},
{
name: "nanox",
Expand Down
Loading

0 comments on commit 317d342

Please sign in to comment.