Skip to content

Commit

Permalink
Merge pull request #14 from blooo-io/test/INCH-16-create-the-unoswapw…
Browse files Browse the repository at this point in the history
…ithpermit-test-on-polygon

Test/inch 16 create the unoswapwithpermit test on polygon
  • Loading branch information
GuilaneDen authored May 5, 2022
2 parents b77cd00 + 0325eaf commit dca50fa
Show file tree
Hide file tree
Showing 48 changed files with 82 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ module.exports = {
'**/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*',
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.
35 changes: 35 additions & 0 deletions tests/src/V4/fill_order_rfq_to_with_permit_polygon.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { processTest, populateTransaction } from "../test.fixture";

const contractName = "AggregationRouterV4";

const testLabel = "fillOrderRFQToWithPermit"; // <= Name of the test
const testDirSuffix = "fill_order_rfq_to_with_permit"; // <= directory to compare device snapshots to
const signedPlugin = false;
const testNetwork = "polygon";

const contractAddr = "0x1111111254fb6c44bac0bed2854e76f90643097d";
const chainID = 137;

// The input data is extracted from a transaction on the ethereum blockchain
// As the method on the smart contract take the same parameter we can take the input data of this transaction
// From : https://etherscan.io/tx/0x9e011accd8fb355f6c7d222125b56ebdae914f3f119c6f51b85e77b82a4935b9
const inputData = "0x4cc4a27b0000000000000000000000000000000000000000626b92a5a920808096ecf6a4000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000b398ffef80144095b8712c70a0c09886c8151feb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111998dab0000000000000000000000000000000000000000000000000000000111a1f59b000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111a1f59b000000000000000000000000a7ecacd4d1438c24ed13795685037abc81b4a0ad00000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000041104cb670f1925fb98c09f628803f4464d963350432296121136a1195f5bf1b7a4f4d718f6a8218f9faf48d810b901be7fa778e7b56270698e9e71427fba90b5d1c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000a7ecacd4d1438c24ed13795685037abc81b4a0ad0000000000000000000000001111111254fb6c44bac0bed2854e76f90643097dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000626c41b0000000000000000000000000000000000000000000000000000000000000001cf589d90f676dcd03cbc287e010a697a00f6369fdbe7221ff5d7a9746b68b4e092e55fb68857d54dab6c6eef60058ead2ac51606356e2623e614c6c7529633c2ae26b9977";
const serializedTx = populateTransaction(contractAddr, inputData, chainID);

const devices = [
{
name: "nanos",
label: "Nano S",
steps: 14, // <= Define the number of steps for this test case and this device
},
{
name: "nanox",
label: "Nano X",
steps: 9, // <= Define the number of steps for this test case and this device
}
];

devices.forEach((device) =>{
processTest(device, contractName, testLabel, testDirSuffix, "", signedPlugin, serializedTx, testNetwork);
}
);
45 changes: 45 additions & 0 deletions tests/src/V4/unoswap_with_permit_polygon.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { processTest, populateTransaction } from "../test.fixture";

const contractName = "AggregationRouterV4";

const testLabel = "unoswapWithPermit"; // <= Name of the test
const testDirSuffix = "unoswap_with_permit"; // <= directory to compare device snapshots to
const signedPlugin = false;
const testNetwork = "polygon";

const contractAddr = "0x1111111254fb6c44bac0bed2854e76f90643097d";
const chainID = 137;

const selector = "0xa1251d75";
const srcToken = "0000000000000000000000000000000000000000000000000000000000000000"; // Native token (MATIC)
const amount = "0000000000000000000000000000000000000000000000056bc75e2d63100000"; // 100 MATIC
const minReturn = "0000000000000000000000000000000000000000000000056bc75e2d63100000"; // 100
const offsetPools = "00000000000000000000000000000000000000000000000000000000000000a0"; // 160 in decimal
const offsetPermit = "00000000000000000000000000000000000000000000000000000000000000e0"; // 224 in decimal
const lengthPools = "0000000000000000000000000000000000000000000000000000000000000001"; // 1

// pools and permit taken from input data on a unoswapWithPermit call on ethereum transaction
// From : https://etherscan.io/tx/0xed9ee640466e2f49a6eb6d0470d33efe9a6f01ecb45913ff473f46059167e957
const pools = "40000000000000003b6d0340ccb63225a7b19dcf66717e4d40c9a72b39331d61";
const permit = "00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000531516ca59544bf8ab2451a072b6fa94adf5a88c0000000000000000000000001111111254fb6c44bac0bed2854e76f90643097dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000062615a6f000000000000000000000000000000000000000000000000000000000000001c5af1afdeb28be04bc7012d6f63f7fbdcf9dada199d257f43854814d67047a109736ed2cfe2c9857276f6bf9140ce6cb58cd7cfcd42264338bd62140b64abc39de26b9977";

const inputData = selector + srcToken + amount + minReturn + offsetPools + offsetPermit + lengthPools + pools + permit;
const serializedTx = populateTransaction(contractAddr, inputData, chainID);

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

devices.forEach((device) =>{
processTest(device, contractName, testLabel, testDirSuffix, "", signedPlugin, serializedTx, testNetwork);
}
);

0 comments on commit dca50fa

Please sign in to comment.