Skip to content

Commit

Permalink
Merge pull request #13 from blooo-io/test/INCH-17-create-the-unoswap-…
Browse files Browse the repository at this point in the history
…test-on-polygon

test(unoswap): created the test on unoswap for polygon blockchain
  • Loading branch information
GuilaneDen authored May 5, 2022
2 parents 93e7d8b + ebca1f5 commit b77cd00
Show file tree
Hide file tree
Showing 133 changed files with 248 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ module.exports = {
'**/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*',
Expand All @@ -51,6 +54,9 @@ module.exports = {
'**/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*',
Expand Down
24 changes: 24 additions & 0 deletions tests/networks/polygon/1inch/b2c.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
],
"method": "swap",
"plugin": "1inch"
},
"0x2e95b6c8": {
"erc20OfInterest": [
"srcToken"
],
"method": "unoswap",
"plugin": "1inch"
}
}
},
Expand All @@ -27,6 +34,18 @@
"method": "swap",
"plugin": "1inch"
},
"0x2e95b6c8": {
"erc20OfInterest": [
"srcToken"
],
"method": "unoswap",
"plugin": "1inch"
},
"0xa1251d75": {
"erc20OfInterest": ["srcToken"],
"method": "unoswapWithPermit",
"plugin": "1inch"
},
"0xe449022e": {
"erc20OfInterest": [],
"method": "uniswapV3Swap",
Expand All @@ -48,6 +67,11 @@
"erc20OfInterest": [],
"method": "fillOrderRFQ",
"plugin": "1inch"
},
"0x4cc4a27b": {
"erc20OfInterest": [],
"method": "fillOrderRFQToWithPermit",
"plugin": "1inch"
}
}
}
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.
34 changes: 34 additions & 0 deletions tests/src/V3/unoswap_known_polygon.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { processTest, populateTransaction } from "../test.fixture";

const contractName = "AggregationRouterV3";

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

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

// From : https://polygonscan.com/tx/0xdbc7c46bb0ef3f312d28f7e4b0ff06a89dfba7a0a41ede5d7ee7b7c9d0dfe006
const inputData = "0x2e95b6c80000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000000000000000000000000000000319f0d23587ff690000000000000000000000000000000000000000000000000319f0d23587ff690000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000300000000000000003b6d0340fc2fc983a411c4b1e238f7eb949308cf0218c75080000000000000003b6d0340addc9c73f3cbad4e647eaff691715898825ac20c00000000000000003b8b87c0173e90f2a94af3b075deec7e64df4d70efb4ac3d";

// Create serializedTx and remove the "0x" prefix
const serializedTx = populateTransaction(contractAddr, inputData, chainID);

const devices = [
{
name: "nanos",
label: "Nano S",
steps: 10, // <= 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)
);
34 changes: 34 additions & 0 deletions tests/src/V3/unoswap_native_polygon.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { processTest, populateTransaction } from "../test.fixture";

const contractName = "AggregationRouterV3";

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

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

// From : https://polygonscan.com/tx/0xbf0bcced72e9a7d3827ff4466bd653d986cfa1d8893ab2c4780523b22a2982bc
const inputData = "0x2e95b6c80000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf127000000000000000000000000000000000000000000000001f7a15b31aeaf0516a00000000000000000000000000000000000000000000001f7a15b31aeaf0516a0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000003b6d0340289cf2b63c5edeeeab89663639674d9233e8668e00000000000000003b6d03409e2fbb31fbd68472f6cd54a1635b8cd64d78fc1c";

// Create serializedTx and remove the "0x" prefix
const serializedTx = populateTransaction(contractAddr, inputData, chainID);

const devices = [
{
name: "nanos",
label: "Nano S",
steps: 10, // <= 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)
);
34 changes: 34 additions & 0 deletions tests/src/V3/unoswap_unknown_polygon.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { processTest, populateTransaction } from "../test.fixture";

const contractName = "AggregationRouterV3";

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

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

// From : https://polygonscan.com/tx/0xae22ab349dc90c1cb1fa7f13049d7590a611441c7201d3e558556d2ed1fde1ba
const inputData = "0x2e95b6c80000000000000000000000004c28f48448720e9000907bc2611f73022fdce1fa00000000000000000000000000000000000000000000000cd359a2e18f2911ba00000000000000000000000000000000000000000000000cd359a2e18f2911ba0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000300000000000000003b6d034080b3902afc046e6c41dba93bedb1872f78e541a100000000000000003b6d0340e88e24f49338f974b528ace10350ac4576c5c8a180000000000000003b6d03409b5c71936670e9f1f36e63f03384de7e06e60d2a";

// Create serializedTx and remove the "0x" prefix
const serializedTx = populateTransaction(contractAddr, inputData, chainID);

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

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

const contractName = "AggregationRouterV4";

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

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

const selector = "0x2e95b6c8";
const srcToken = "0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270";
const amount = "00000000000000000000000000000000000000000000001f7a15b31aeaf0516a";
const minReturn = "00000000000000000000000000000000000000000000001f7a15b31aeaf0516a";
const pools = "0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000280000000000000003b6d034006da0fd433c1a5d7a4faa01111c044910a18455380000000000000003b6d0340336ef4e633b1117dca08c1a57f4139c62c32c935e26b9977";

const inputData = selector + srcToken + amount + minReturn + pools;
// Create serializedTx and remove the "0x" prefix
const serializedTx = populateTransaction(contractAddr, inputData, chainID);

const devices = [
{
name: "nanos",
label: "Nano S",
steps: 10, // <= 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)
);
39 changes: 39 additions & 0 deletions tests/src/V4/unoswap_native_polygon.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { processTest, populateTransaction } from "../test.fixture";

const contractName = "AggregationRouterV4";

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

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


const selector = "0x2e95b6c8";
const srcToken = "0000000000000000000000000000000000000000000000000000000000000000";
const amount = "00000000000000000000000000000000000000000000000000b1a2bc2ec50000";
const minReturn = "00000000000000000000000000000000000000000000048c48c63f0944606781";
const pools = "0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000180000000000000003b6d0340c06dadbfde48c0bdeb4608ddc7f232fd07a02da1cfee7c08";

const inputData = selector + srcToken + amount + minReturn + pools;
// Create serializedTx and remove the "0x" prefix
const serializedTx = populateTransaction(contractAddr, inputData, chainID);

const devices = [
{
name: "nanos",
label: "Nano S",
steps: 8, // <= 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)
);
39 changes: 39 additions & 0 deletions tests/src/V4/unoswap_unknown_polygon.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { processTest, populateTransaction } from "../test.fixture";

const contractName = "AggregationRouterV4";

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

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


const selector = "0x2e95b6c8";
const srcToken = "0000000000000000000000003f1421cb90d26b28e7495cb952f6f4eb1b8681fa";
const amount = "00000000000000000000000000000000000000000000000000b1a2bc2ec50000";
const minReturn = "00000000000000000000000000000000000000000000048c48c63f0944606781";
const pools = "0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000180000000000000003b6d0340c06dadbfde48c0bdeb4608ddc7f232fd07a02da1cfee7c08";

const inputData = selector + srcToken + amount + minReturn + pools;;
// Create serializedTx and remove the "0x" prefix
const serializedTx = populateTransaction(contractAddr, inputData, chainID);

const devices = [
{
name: "nanos",
label: "Nano S",
steps: 9, // <= Define the number of steps for this test case and this device
},
{
name: "nanox",
label: "Nano X",
steps: 8, // <= 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 b77cd00

Please sign in to comment.