From 964aab8215d030898268c641a3bfdd889cc4c4a5 Mon Sep 17 00:00:00 2001 From: Hoang Trinh Date: Thu, 22 Jun 2023 09:47:48 +0700 Subject: [PATCH] feat: support saddle-like dexes (#39) --- pkg/source/saddle/embed.go | 58 +++++++++++++++--- pkg/source/saddle/pools/axial/avalanche.json | 61 +++++++++++++++++++ .../saddle/pools/{ => saddle}/arbitrum.json | 0 .../saddle/pools/{ => saddle}/ethereum.json | 0 .../saddle/pools/{ => saddle}/fantom.json | 0 pkg/source/saddle/pools/synapse/arbitrum.json | 56 +++++++++++++++++ .../saddle/pools/synapse/avalanche.json | 38 ++++++++++++ pkg/source/saddle/pools/synapse/bsc.json | 24 ++++++++ pkg/source/saddle/pools/synapse/ethereum.json | 20 ++++++ pkg/source/saddle/pools/synapse/fantom.json | 56 +++++++++++++++++ pkg/source/saddle/pools/synapse/optimism.json | 30 +++++++++ pkg/source/saddle/pools/synapse/polygon.json | 24 ++++++++ 12 files changed, 358 insertions(+), 9 deletions(-) create mode 100644 pkg/source/saddle/pools/axial/avalanche.json rename pkg/source/saddle/pools/{ => saddle}/arbitrum.json (100%) rename pkg/source/saddle/pools/{ => saddle}/ethereum.json (100%) rename pkg/source/saddle/pools/{ => saddle}/fantom.json (100%) create mode 100644 pkg/source/saddle/pools/synapse/arbitrum.json create mode 100644 pkg/source/saddle/pools/synapse/avalanche.json create mode 100644 pkg/source/saddle/pools/synapse/bsc.json create mode 100644 pkg/source/saddle/pools/synapse/ethereum.json create mode 100644 pkg/source/saddle/pools/synapse/fantom.json create mode 100644 pkg/source/saddle/pools/synapse/optimism.json create mode 100644 pkg/source/saddle/pools/synapse/polygon.json diff --git a/pkg/source/saddle/embed.go b/pkg/source/saddle/embed.go index 3033c6663..ea8dc0abe 100644 --- a/pkg/source/saddle/embed.go +++ b/pkg/source/saddle/embed.go @@ -8,17 +8,57 @@ var swapFlashLoanData []byte //go:embed abi/ERC20.json var erc20Data []byte -//go:embed pools/arbitrum.json -var arbitrumPoolData []byte +// Saddle pool data -//go:embed pools/ethereum.json -var ethereumPoolData []byte +//go:embed pools/saddle/arbitrum.json +var saddleArbitrumPoolData []byte -//go:embed pools/fantom.json -var fantomPoolData []byte +//go:embed pools/saddle/ethereum.json +var saddleEthereumPoolData []byte + +//go:embed pools/saddle/fantom.json +var saddleFantomPoolData []byte + +// Synapse pool data + +//go:embed pools/synapse/arbitrum.json +var synapseArbitrumPoolData []byte + +//go:embed pools/synapse/avalanche.json +var synapseAvalanchePoolData []byte + +//go:embed pools/synapse/bsc.json +var synapseBSCPoolData []byte + +//go:embed pools/synapse/ethereum.json +var synapseEthereumPoolData []byte + +//go:embed pools/synapse/fantom.json +var synapseFantomPoolData []byte + +//go:embed pools/synapse/optimism.json +var synapseOptimismPoolData []byte + +//go:embed pools/synapse/polygon.json +var synapsePolygonPoolData []byte + +// Axial pool data + +//go:embed pools/axial/avalanche.json +var axialAvalanchePoolData []byte var bytesByPath = map[string][]byte{ - "pools/arbitrum.json": arbitrumPoolData, - "pools/ethereum.json": ethereumPoolData, - "pools/fantom.json": fantomPoolData, + "pools/saddle/arbitrum.json": saddleArbitrumPoolData, + "pools/saddle/ethereum.json": saddleEthereumPoolData, + "pools/saddle/fantom.json": saddleFantomPoolData, + + "pools/synapse/arbitrum.json": synapseArbitrumPoolData, + "pools/synapse/avalanche.json": synapseAvalanchePoolData, + "pools/synapse/bsc.json": synapseBSCPoolData, + "pools/synapse/ethereum.json": synapseEthereumPoolData, + "pools/synapse/fantom.json": synapseFantomPoolData, + "pools/synapse/optimism.json": synapseOptimismPoolData, + "pools/synapse/polygon.json": synapsePolygonPoolData, + + "pools/axial/avalanche.json": axialAvalanchePoolData, } diff --git a/pkg/source/saddle/pools/axial/avalanche.json b/pkg/source/saddle/pools/axial/avalanche.json new file mode 100644 index 000000000..82a363064 --- /dev/null +++ b/pkg/source/saddle/pools/axial/avalanche.json @@ -0,0 +1,61 @@ +[ + { + "id": "0x90c7b96ad2142166d001b27b5fbc128494cdfbc8", + "tokens": [ + { + "address": "0x130966628846bfd36ff31a822705796e8cb8c18d", + "precision": "1" + }, + { + "address": "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", + "precision": "1000000000000" + }, + { + "address": "0xd586e7f844cea2f87f50152665bcbc2c279d8d70", + "precision": "1" + } + ] + }, + { + "id": "0x8c3c1c6f971c01481150ca7942bd2bbb9bc27bc7", + "tokens": [ + { + "address": "0x4fbf0429599460d327bd5f55625e30e4fc066095", + "precision": "1" + }, + { + "address": "0x130966628846bfd36ff31a822705796e8cb8c18d", + "precision": "1" + }, + { + "address": "0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64", + "precision": "1" + }, + { + "address": "0xd586e7f844cea2f87f50152665bcbc2c279d8d70", + "precision": "1" + } + ] + }, + { + "id": "0x2a716c4933a20cd8b9f9d9c39ae7196a85c24228", + "tokens": [ + { + "address": "0x1c20e891bab6b1727d14da358fae2984ed9b59eb", + "precision": "1" + }, + { + "address": "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", + "precision": "1000000000000" + }, + { + "address": "0xd586e7f844cea2f87f50152665bcbc2c279d8d70", + "precision": "1" + }, + { + "address": "0xc7198437980c041c805a1edcba50c1ce5db95118", + "precision": "1000000000000" + } + ] + } +] \ No newline at end of file diff --git a/pkg/source/saddle/pools/arbitrum.json b/pkg/source/saddle/pools/saddle/arbitrum.json similarity index 100% rename from pkg/source/saddle/pools/arbitrum.json rename to pkg/source/saddle/pools/saddle/arbitrum.json diff --git a/pkg/source/saddle/pools/ethereum.json b/pkg/source/saddle/pools/saddle/ethereum.json similarity index 100% rename from pkg/source/saddle/pools/ethereum.json rename to pkg/source/saddle/pools/saddle/ethereum.json diff --git a/pkg/source/saddle/pools/fantom.json b/pkg/source/saddle/pools/saddle/fantom.json similarity index 100% rename from pkg/source/saddle/pools/fantom.json rename to pkg/source/saddle/pools/saddle/fantom.json diff --git a/pkg/source/saddle/pools/synapse/arbitrum.json b/pkg/source/saddle/pools/synapse/arbitrum.json new file mode 100644 index 000000000..67afbfc79 --- /dev/null +++ b/pkg/source/saddle/pools/synapse/arbitrum.json @@ -0,0 +1,56 @@ +[ + { + "id": "0xa067668661c84476afcdc6fa5d758c4c01c34352", + "tokens": [ + { + "address": "0x3ea9b0ab55f34fb188824ee288ceaefc63cf908e", + "precision": "1" + }, + { + "address": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", + "precision": "1" + } + ], + "swapFee": 0.0002 + }, + { + "id": "0x9dd329f5411466d9e0c488ff72519ca9fef0cb40", + "tokens": [ + { + "address": "0x2913e812cf0dcca30fb28e6cac3d2dcff4497688", + "precision": "1" + }, + { + "address": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", + "precision": "1000000000000" + }, + { + "address": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", + "precision": "1000000000000" + } + ], + "swapFee": 0.0002 + }, + { + "id": "0x0Db3FE3B770c95A0B99D1Ed6F2627933466c0Dd8", + "tokens": [ + { + "address": "0x2913e812cf0dcca30fb28e6cac3d2dcff4497688", + "precision": "1" + }, + { + "address": "0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a", + "precision": "1" + }, + { + "address": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", + "precision": "1000000000000" + }, + { + "address": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", + "precision": "1000000000000" + } + ], + "swapFee": 0.0002 + } +] diff --git a/pkg/source/saddle/pools/synapse/avalanche.json b/pkg/source/saddle/pools/synapse/avalanche.json new file mode 100644 index 000000000..a85dbcf96 --- /dev/null +++ b/pkg/source/saddle/pools/synapse/avalanche.json @@ -0,0 +1,38 @@ +[ + { + "id": "0x77a7e60555bc18b4be44c181b2575eee46212d44", + "tokens": [ + { + "address": "0x19e1ae0ee35c0404f835521146206595d37981ae", + "precision": "1" + }, + { + "address": "0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab", + "precision": "1" + } + ], + "swapFee": 0.00015 + }, + { + "id": "0xed2a7edd7413021d440b09d654f3b87712abab66", + "tokens": [ + { + "address": "0xcfc37a6ab183dd4aed08c204d1c2773c0b1bdf46", + "precision": "1" + }, + { + "address": "0xd586e7f844cea2f87f50152665bcbc2c279d8d70", + "precision": "1" + }, + { + "address": "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", + "precision": "1000000000000" + }, + { + "address": "0xc7198437980c041c805a1edcba50c1ce5db95118", + "precision": "1000000000000" + } + ], + "swapFee": 0.00015 + } +] diff --git a/pkg/source/saddle/pools/synapse/bsc.json b/pkg/source/saddle/pools/synapse/bsc.json new file mode 100644 index 000000000..89db8fe9d --- /dev/null +++ b/pkg/source/saddle/pools/synapse/bsc.json @@ -0,0 +1,24 @@ +[ + { + "id": "0x28ec0b36f0819ecb5005cab836f4ed5a2eca4d13", + "tokens": [ + { + "address": "0x23b891e5c62e0955ae2bd185990103928ab817b3", + "precision": "1" + }, + { + "address": "0xe9e7cea3dedca5984780bafc599bd69add087d56", + "precision": "1" + }, + { + "address": "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", + "precision": "1" + }, + { + "address": "0x55d398326f99059ff775485246999027b3197955", + "precision": "1" + } + ], + "swapFee": 0.00015 + } +] diff --git a/pkg/source/saddle/pools/synapse/ethereum.json b/pkg/source/saddle/pools/synapse/ethereum.json new file mode 100644 index 000000000..3c60328f3 --- /dev/null +++ b/pkg/source/saddle/pools/synapse/ethereum.json @@ -0,0 +1,20 @@ +[ + { + "id": "0x1116898dda4015ed8ddefb84b6e8bc24528af2d8", + "tokens": [ + { + "address": "0x6b175474e89094c44da98b954eedeac495271d0f", + "precision": "1" + }, + { + "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "precision": "1000000000000" + }, + { + "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "precision": "1000000000000" + } + ], + "swapFee": 0.0001 + } +] diff --git a/pkg/source/saddle/pools/synapse/fantom.json b/pkg/source/saddle/pools/synapse/fantom.json new file mode 100644 index 000000000..08064d6a4 --- /dev/null +++ b/pkg/source/saddle/pools/synapse/fantom.json @@ -0,0 +1,56 @@ +[ + { + "id": "0x2913e812cf0dcca30fb28e6cac3d2dcff4497688", + "tokens": [ + { + "address": "0xed2a7edd7413021d440b09d654f3b87712abab66", + "precision": "1" + }, + { + "address": "0x82f0b8b456c1a451378467398982d4834b6829c1", + "precision": "1" + }, + { + "address": "0x04068da6c83afcfa0e13ba15a6696662335d5b75", + "precision": "1000000000000" + }, + { + "address": "0x049d68029688eabf473097a2fc38ef61633a3c7a", + "precision": "1000000000000" + } + ], + "swapFee": 0.0002 + }, + { + "id": "0x85662fd123280827e11c59973ac9fcbe838dc3b4", + "tokens": [ + { + "address": "0xed2a7edd7413021d440b09d654f3b87712abab66", + "precision": "1" + }, + { + "address": "0x04068da6c83afcfa0e13ba15a6696662335d5b75", + "precision": "1000000000000" + }, + { + "address": "0x049d68029688eabf473097a2fc38ef61633a3c7a", + "precision": "1000000000000" + } + ], + "swapFee": 0.0002 + }, + { + "id": "0x8d9ba570d6cb60c7e3e0f31343efe75ab8e65fb1", + "tokens": [ + { + "address": "0x67c10c397dd0ba417329543c1a40eb48aaa7cd00", + "precision": "1" + }, + { + "address": "0x74b23882a30290451a17c44f4f05243b6b58c76d", + "precision": "1" + } + ], + "swapFee": 0.0002 + } +] diff --git a/pkg/source/saddle/pools/synapse/optimism.json b/pkg/source/saddle/pools/synapse/optimism.json new file mode 100644 index 000000000..89d28b3d6 --- /dev/null +++ b/pkg/source/saddle/pools/synapse/optimism.json @@ -0,0 +1,30 @@ +[ + { + "id": "0xf44938b0125a6662f9536281ad2cd6c499f22004", + "tokens": [ + { + "address": "0x67c10c397dd0ba417329543c1a40eb48aaa7cd00", + "precision": "1" + }, + { + "address": "0x7f5c764cbc14f9669b88837ca1490cca17c31607", + "precision": "1000000000000" + } + ], + "swapFee": 0.0001 + }, + { + "id": "0xe27bff97ce92c3e1ff7aa9f86781fdd6d48f5ee9", + "tokens": [ + { + "address": "0x809dc529f07651bd43a172e8db6f4a7a0d771036", + "precision": "1" + }, + { + "address": "0x121ab82b49b2bc4c7901ca46b8277962b4350204", + "precision": "1" + } + ], + "swapFee": 0.0001 + } +] diff --git a/pkg/source/saddle/pools/synapse/polygon.json b/pkg/source/saddle/pools/synapse/polygon.json new file mode 100644 index 000000000..146cc7c9a --- /dev/null +++ b/pkg/source/saddle/pools/synapse/polygon.json @@ -0,0 +1,24 @@ +[ + { + "id": "0x85fcd7dd0a1e1a9fcd5fd886ed522de8221c3ee5", + "tokens": [ + { + "address": "0xb6c473756050de474286bed418b77aeac39b02af", + "precision": "1" + }, + { + "address": "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", + "precision": "1" + }, + { + "address": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + "precision": "1000000000000" + }, + { + "address": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", + "precision": "1000000000000" + } + ], + "swapFee": 0.00015 + } +]