From 363b6d4714da4397e5bbf8917d8ccf2b03f028f5 Mon Sep 17 00:00:00 2001 From: hacpy Date: Mon, 15 Apr 2024 08:57:37 +0800 Subject: [PATCH] Add linea stargate (#124) * Add linea stargate config * Export linea stargate info * Add linea endpoints * Add lynex swap for linea * Fix correct lynex swap * Deploy swap for linea --------- Co-authored-by: AAweidai --- ethereum/brownie-config.yaml | 25 ++ .../Interfaces/Lynex/ILynexRouter.sol | 38 ++ .../contracts/Libraries/LibCorrectSwapV2.sol | 126 ++++++ ethereum/export/mainnet/ContractDeployed.json | 2 + ethereum/export/mainnet/OmniSwapInfo.json | 411 ++++++++++-------- ethereum/scripts/deploy_libcorrectswapv2.py | 4 +- ethereum/scripts/export.py | 2 +- ethereum/scripts/initialize.py | 32 +- 8 files changed, 452 insertions(+), 188 deletions(-) create mode 100644 ethereum/contracts/Interfaces/Lynex/ILynexRouter.sol diff --git a/ethereum/brownie-config.yaml b/ethereum/brownie-config.yaml index 80e31e32..5e0f6048 100644 --- a/ethereum/brownie-config.yaml +++ b/ethereum/brownie-config.yaml @@ -2353,8 +2353,33 @@ networks: router: "0x6352a56caadC4F1E25CD6c75970Fa768A3304e64" token_list: "" linea-main: + omnibtc_chainid: 59144 + chainid: 59144 + SoDiamond: "" basic_beneficiary: "0xD4c56833A6D4C83A81972dA7e0eDA924F0729989" + StargateHelper: "" + endpoints: + [ + "https://linea.blockpi.network/v1/rpc/public", + "https://1rpc.io/linea", + "https://linea.drpc.org", + "https://linea.decubate.com", + "https://rpc.linea.build", + ] + stargate: + router: "0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590" + chainid: 183 + poolid: + weth: 13 + tokens: + sgeth: + address: "0x224D8Fd7aB6AD4c6eb4611Ce56EF35Dec2277F03" + decimal: 18 swap: + - ILynexRouter: + name: Lynex + router: "0x610D2f07b7EdC67565160F587F37636194C34E74" + token_list: "" - IMetaAggregationRouterV2: name: KyberSwap router: "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5" diff --git a/ethereum/contracts/Interfaces/Lynex/ILynexRouter.sol b/ethereum/contracts/Interfaces/Lynex/ILynexRouter.sol new file mode 100644 index 00000000..97d2535b --- /dev/null +++ b/ethereum/contracts/Interfaces/Lynex/ILynexRouter.sol @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.13; + +interface ILynexRouter { + struct route { + address from; + address to; + bool stable; + } + + function getAmountsOut( + uint amountIn, + route[] memory routes + ) external view returns (uint[] memory amounts); + + function swapExactTokensForTokens( + uint amountIn, + uint amountOutMin, + route[] calldata routes, + address to, + uint deadline + ) external returns (uint[] memory amounts); + + function swapExactETHForTokens( + uint amountOutMin, + route[] calldata routes, + address to, + uint deadline + ) external payable returns (uint[] memory amounts); + + function swapExactTokensForETH( + uint amountIn, + uint amountOutMin, + route[] calldata routes, + address to, + uint deadline + ) external returns (uint[] memory amounts); +} diff --git a/ethereum/contracts/Libraries/LibCorrectSwapV2.sol b/ethereum/contracts/Libraries/LibCorrectSwapV2.sol index 2461041d..08e70df4 100644 --- a/ethereum/contracts/Libraries/LibCorrectSwapV2.sol +++ b/ethereum/contracts/Libraries/LibCorrectSwapV2.sol @@ -24,6 +24,7 @@ import {ICamelotRouter} from "../Interfaces/Camelot/ICamelotRouter.sol"; import {IMetaAggregationRouterV2} from "../Interfaces/Kyberswap/IMetaAggregationRouterV2.sol"; import {IOneInchGenericRouter, IOneInchClipperRouter, IOneInchUnoswapRouter, IOneInchUnoswapV3Router} from "../Interfaces/OneInch/IAggregationRouterV5.sol"; import {IOpenOceanExchange, IOpenOceanCaller, IUniswapV2Exchange} from "../Interfaces/OpenOcean/IOpenOceanExchange.sol"; +import {ILynexRouter} from "../Interfaces/Lynex/ILynexRouter.sol"; contract LibCorrectSwapV2 is ICorrectSwap { address public owner; @@ -239,6 +240,14 @@ library LibSwapFuncSigs { IMoeRouter.swapExactNativeForTokens.selector; bytes4 internal constant _FUNC56 = IMoeRouter.swapExactTokensForNative.selector; + + // Lynex + bytes4 internal constant _FUNC57 = + ILynexRouter.swapExactETHForTokens.selector; + bytes4 internal constant _FUNC58 = + ILynexRouter.swapExactTokensForETH.selector; + bytes4 internal constant _FUNC59 = + ILynexRouter.swapExactTokensForTokens.selector; } contract CorrectUniswapV2Factory { @@ -2722,3 +2731,120 @@ contract CorrectOpenOcean is ICorrectSwap { ); } } + +contract CorrectLynexFactory { + constructor(LibCorrectSwapV2 libCorrectSwapV2) { + // Lynex + bytes4[] memory sigs = new bytes4[](3); + sigs[0] = LibSwapFuncSigs._FUNC57; + sigs[1] = LibSwapFuncSigs._FUNC58; + sigs[2] = LibSwapFuncSigs._FUNC59; + address correctLynex = address(new CorrectLynex()); + libCorrectSwapV2.setCorrectSwap(sigs, correctLynex); + } +} + +contract CorrectLynex is ICorrectSwap { + // Lynex + bytes4 internal constant _FUNC57 = + ILynexRouter.swapExactETHForTokens.selector; + bytes4 internal constant _FUNC58 = + ILynexRouter.swapExactTokensForETH.selector; + bytes4 internal constant _FUNC59 = + ILynexRouter.swapExactTokensForTokens.selector; + + // @dev Correct input of destination chain swapData + function correctSwap( + bytes calldata _data, + uint256 _amount + ) external returns (bytes memory) { + bytes4 sig = bytes4(_data[:4]); + + if (sig == _FUNC57) { + return _data; + } else if (sig == _FUNC58 || sig == _FUNC59) { + return basicCorrectSwap(_data, _amount); + } else { + revert("correctLynex error"); + } + } + + // @dev Fix min amount + function fixMinAmount( + bytes calldata _data, + uint256 _deltaMinAmount + ) external view returns (uint256, bytes memory) { + bytes4 sig = bytes4(_data[:4]); + if (sig == _FUNC57) { + ( + uint256 _amountOutMin, + ILynexRouter.route[] memory _path, + address _to, + uint256 _deadline + ) = abi.decode( + _data[4:], + (uint256, ILynexRouter.route[], address, uint256) + ); + return ( + _amountOutMin, + abi.encodeWithSelector( + sig, + _amountOutMin + _deltaMinAmount, + _path, + _to, + _deadline + ) + ); + } else if (sig == _FUNC58 || sig == _FUNC59) { + ( + uint256 _amount, + uint256 _amountOutMin, + ILynexRouter.route[] memory _path, + address _to, + uint256 _deadline + ) = abi.decode( + _data[4:], + (uint256, uint256, ILynexRouter.route[], address, uint256) + ); + return ( + _amountOutMin, + abi.encodeWithSelector( + sig, + _amount, + _amountOutMin + _deltaMinAmount, + _path, + _to, + _deadline + ) + ); + } + + revert("fix lynex swap amount fail!"); + } + + function basicCorrectSwap( + bytes calldata _data, + uint256 _amount + ) internal pure returns (bytes memory) { + ( + , + uint256 _amountOutMin, + ILynexRouter.route[] memory _path, + address _to, + uint256 _deadline + ) = abi.decode( + _data[4:], + (uint256, uint256, ILynexRouter.route[], address, uint256) + ); + + return + abi.encodeWithSelector( + bytes4(_data[:4]), + _amount, + _amountOutMin, + _path, + _to, + _deadline + ); + } +} diff --git a/ethereum/export/mainnet/ContractDeployed.json b/ethereum/export/mainnet/ContractDeployed.json index 2e06214d..16fde0bc 100644 --- a/ethereum/export/mainnet/ContractDeployed.json +++ b/ethereum/export/mainnet/ContractDeployed.json @@ -242,6 +242,8 @@ "BulkTransfer": "0xbb9220B732f5028607838447a67d937C6a6a099f" }, "linea-main": { + "LibSoFeeStargateV2": "0x933Ce99df42035f25511aaeecCfE8B03175A6b0e", + "StargateFacet": "0x6205053c3a7Fc339338a63FeB3f0A801eC180FBE", "CorrectKyberswapFactory": "0x62435173203A235c7336FA640DcDE6c20D857630", "DiamondCutFacet": "0x1f0d7E0C10Adf20ae9621431a53151ed6F4361E3", "DiamondLoupeFacet": "0x7857E0Ca2b63Ffcaba9c3c92c1553B8DA3492096", diff --git a/ethereum/export/mainnet/OmniSwapInfo.json b/ethereum/export/mainnet/OmniSwapInfo.json index 16c1832f..8c3f6bad 100644 --- a/ethereum/export/mainnet/OmniSwapInfo.json +++ b/ethereum/export/mainnet/OmniSwapInfo.json @@ -271,9 +271,6 @@ }, "arbitrum-main": { "ChainId": 42161, - "OmniBtcChainId": 6, - "SoDiamond": "0x2967E7Bb9DaA5711Ac332cAF874BD47ef99B3820", - "StargateChainId": 110, "CoreBridgeChainId": 110, "CoreBridgeContract": "0x29d096cd18c0da7500295f082da73316d704031a", "CoreBridgeSupportToken": [ @@ -322,6 +319,9 @@ "TokenName": "BTC.b" } ], + "OmniBtcChainId": 6, + "SoDiamond": "0x2967E7Bb9DaA5711Ac332cAF874BD47ef99B3820", + "StargateChainId": 110, "StargatePool": [ { "ChainPath": [ @@ -440,6 +440,10 @@ [ 111, 13 + ], + [ + 183, + 13 ] ], "Decimal": 18, @@ -589,9 +593,6 @@ }, "avax-main": { "ChainId": 43114, - "OmniBtcChainId": 4, - "SoDiamond": "0x2967E7Bb9DaA5711Ac332cAF874BD47ef99B3820", - "StargateChainId": 106, "CoreBridgeChainId": 106, "CoreBridgeContract": "0x29d096cd18c0da7500295f082da73316d704031a", "CoreBridgeSupportToken": [ @@ -618,6 +619,9 @@ "TokenName": "BTC.b" } ], + "OmniBtcChainId": 4, + "SoDiamond": "0x2967E7Bb9DaA5711Ac332cAF874BD47ef99B3820", + "StargateChainId": 106, "StargatePool": [ { "ChainPath": [ @@ -1342,6 +1346,10 @@ [ 111, 13 + ], + [ + 183, + 13 ] ], "Decimal": 18, @@ -1423,9 +1431,6 @@ }, "bsc-main": { "ChainId": 56, - "OmniBtcChainId": 3, - "SoDiamond": "0x2967E7Bb9DaA5711Ac332cAF874BD47ef99B3820", - "StargateChainId": 102, "CoreBridgeChainId": 102, "CoreBridgeContract": "0x52e75D318cFB31f9A2EdFa2DFee26B161255B233", "CoreBridgeSupportToken": [ @@ -1474,6 +1479,9 @@ "TokenName": "BTCB" } ], + "OmniBtcChainId": 3, + "SoDiamond": "0x2967E7Bb9DaA5711Ac332cAF874BD47ef99B3820", + "StargateChainId": 102, "StargatePool": [ { "ChainPath": [ @@ -2174,11 +2182,215 @@ } ] }, + "core-main": { + "ChainId": 1116, + "CoreBridgeChainId": 153, + "CoreBridgeContract": "0xA4218e1F39DA4AaDaC971066458Db56e901bcbdE", + "CoreBridgeSupportToken": [ + { + "ChainPath": [ + { + "RemoteChainId": 101, + "RemoteTokenAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" + }, + { + "RemoteChainId": 110, + "RemoteTokenAddress": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831" + }, + { + "RemoteChainId": 111, + "RemoteTokenAddress": "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85" + }, + { + "RemoteChainId": 102, + "RemoteTokenAddress": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d" + }, + { + "RemoteChainId": 109, + "RemoteTokenAddress": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" + }, + { + "RemoteChainId": 106, + "RemoteTokenAddress": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E" + } + ], + "Decimal": 6, + "TokenAddress": "0xa4151B2B3e269645181dCcF2D426cE75fcbDeca9", + "TokenName": "USDC" + }, + { + "ChainPath": [ + { + "RemoteChainId": 101, + "RemoteTokenAddress": "0xdAC17F958D2ee523a2206206994597C13D831ec7" + }, + { + "RemoteChainId": 110, + "RemoteTokenAddress": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9" + }, + { + "RemoteChainId": 111, + "RemoteTokenAddress": "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58" + }, + { + "RemoteChainId": 102, + "RemoteTokenAddress": "0x55d398326f99059fF775485246999027B3197955" + }, + { + "RemoteChainId": 109, + "RemoteTokenAddress": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F" + } + ], + "Decimal": 6, + "TokenAddress": "0x900101d06A7426441Ae63e9AB3B9b0F63Be145F1", + "TokenName": "USDT" + }, + { + "ChainPath": [ + { + "RemoteChainId": 101, + "RemoteTokenAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" + } + ], + "Decimal": 18, + "TokenAddress": "0xeAB3aC417c4d6dF6b143346a46fEe1B847B50296", + "TokenName": "WETH" + }, + { + "ChainPath": [ + { + "RemoteChainId": 101, + "RemoteTokenAddress": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" + }, + { + "RemoteChainId": 110, + "RemoteTokenAddress": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f" + }, + { + "RemoteChainId": 111, + "RemoteTokenAddress": "0x68f180fcCe6836688e9084f035309E29Bf0A2095" + }, + { + "RemoteChainId": 109, + "RemoteTokenAddress": "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6" + } + ], + "Decimal": 8, + "TokenAddress": "0x5832f53d147b3d6Cd4578B9CBD62425C7ea9d0Bd", + "TokenName": "WBTC" + }, + { + "ChainPath": [ + { + "RemoteChainId": 101, + "RemoteTokenAddress": "0x2297aEbD383787A160DD0d9F71508148769342E3" + }, + { + "RemoteChainId": 110, + "RemoteTokenAddress": "0x2297aEbD383787A160DD0d9F71508148769342E3" + }, + { + "RemoteChainId": 111, + "RemoteTokenAddress": "0x2297aEbD383787A160DD0d9F71508148769342E3" + }, + { + "RemoteChainId": 102, + "RemoteTokenAddress": "0x2297aEbD383787A160DD0d9F71508148769342E3" + }, + { + "RemoteChainId": 109, + "RemoteTokenAddress": "0x2297aEbD383787A160DD0d9F71508148769342E3" + }, + { + "RemoteChainId": 106, + "RemoteTokenAddress": "0x152b9d0FdC40C096757F570A51E494bd4b943E50" + } + ], + "Decimal": 8, + "TokenAddress": "0x2297aEbD383787A160DD0d9F71508148769342E3", + "TokenName": "BTC.b" + }, + { + "ChainPath": [ + { + "RemoteChainId": 102, + "RemoteTokenAddress": "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c" + } + ], + "Decimal": 18, + "TokenAddress": "0x7A6888c85eDBA8E38F6C7E0485212da602761C08", + "TokenName": "BTCB" + } + ], + "OmniBtcChainId": 1116, + "SoDiamond": "0x0B77E63db1cd9F4f7cdAfb4a1C39f6ABEB764B66", + "UniswapRouter": [ + { + "Name": "GlyphExchange", + "QuoterAddressForUniswapV3": "", + "RouterAddress": "0x4ddDD324F205e5989bAF8aD0FFCa41f4E5d9841D", + "TokenList": "", + "Type": "IUniswapV2Router02" + } + ] + }, + "linea-main": { + "ChainId": 59144, + "SoDiamond": "", + "StargateChainId": 183, + "StargatePool": [ + { + "ChainPath": [ + [ + 110, + 13 + ], + [ + 184, + 13 + ], + [ + 101, + 13 + ], + [ + 111, + 13 + ] + ], + "Decimal": 18, + "PoolId": 13, + "TokenAddress": "0x224D8Fd7aB6AD4c6eb4611Ce56EF35Dec2277F03", + "TokenName": "SGETH" + } + ], + "StargateRouter": "0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590", + "UniswapRouter": [ + { + "Name": "Lynex", + "QuoterAddressForUniswapV3": "", + "RouterAddress": "0x610D2f07b7EdC67565160F587F37636194C34E74", + "TokenList": "", + "Type": "ILynexRouter" + }, + { + "Name": "KyberSwap", + "QuoterAddressForUniswapV3": "", + "RouterAddress": "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", + "TokenList": "", + "Type": "IMetaAggregationRouterV2" + }, + { + "Name": "OpenOcean", + "QuoterAddressForUniswapV3": "", + "RouterAddress": "0x6352a56caadC4F1E25CD6c75970Fa768A3304e64", + "TokenList": "", + "Type": "IOpenOceanExchange" + } + ] + }, "mainnet": { "ChainId": 1, - "OmniBtcChainId": 2, - "SoDiamond": "0x2967E7Bb9DaA5711Ac332cAF874BD47ef99B3820", - "StargateChainId": 101, "CoreBridgeChainId": 101, "CoreBridgeContract": "0x52e75D318cFB31f9A2EdFa2DFee26B161255B233", "CoreBridgeSupportToken": [ @@ -2238,6 +2450,9 @@ "TokenName": "BTC.b" } ], + "OmniBtcChainId": 2, + "SoDiamond": "0x2967E7Bb9DaA5711Ac332cAF874BD47ef99B3820", + "StargateChainId": 101, "StargatePool": [ { "ChainPath": [ @@ -2368,6 +2583,10 @@ [ 111, 13 + ], + [ + 183, + 13 ] ], "Decimal": 18, @@ -3172,9 +3391,6 @@ }, "optimism-main": { "ChainId": 10, - "OmniBtcChainId": 7, - "SoDiamond": "0x2967E7Bb9DaA5711Ac332cAF874BD47ef99B3820", - "StargateChainId": 111, "CoreBridgeChainId": 111, "CoreBridgeContract": "0x29d096cd18c0da7500295f082da73316d704031a", "CoreBridgeSupportToken": [ @@ -3223,6 +3439,9 @@ "TokenName": "BTC.b" } ], + "OmniBtcChainId": 7, + "SoDiamond": "0x2967E7Bb9DaA5711Ac332cAF874BD47ef99B3820", + "StargateChainId": 111, "StargatePool": [ { "ChainPath": [ @@ -3293,6 +3512,10 @@ [ 101, 13 + ], + [ + 183, + 13 ] ], "Decimal": 18, @@ -3456,9 +3679,6 @@ }, "polygon-main": { "ChainId": 137, - "OmniBtcChainId": 5, - "SoDiamond": "0x2967E7Bb9DaA5711Ac332cAF874BD47ef99B3820", - "StargateChainId": 109, "CoreBridgeChainId": 109, "CoreBridgeContract": "0x52e75D318cFB31f9A2EdFa2DFee26B161255B233", "CoreBridgeSupportToken": [ @@ -3507,6 +3727,9 @@ "TokenName": "BTC.b" } ], + "OmniBtcChainId": 5, + "SoDiamond": "0x2967E7Bb9DaA5711Ac332cAF874BD47ef99B3820", + "StargateChainId": 109, "StargatePool": [ { "ChainPath": [ @@ -4649,157 +4872,5 @@ } ], "WETH": "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91" - }, - "core-main": { - "ChainId": 1116, - "OmniBtcChainId": 1116, - "SoDiamond": "0x0B77E63db1cd9F4f7cdAfb4a1C39f6ABEB764B66", - "CoreBridgeChainId": 153, - "CoreBridgeContract": "0xA4218e1F39DA4AaDaC971066458Db56e901bcbdE", - "CoreBridgeSupportToken": [ - { - "ChainPath": [ - { - "RemoteChainId": 101, - "RemoteTokenAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" - }, - { - "RemoteChainId": 110, - "RemoteTokenAddress": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831" - }, - { - "RemoteChainId": 111, - "RemoteTokenAddress": "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85" - }, - { - "RemoteChainId": 102, - "RemoteTokenAddress": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d" - }, - { - "RemoteChainId": 109, - "RemoteTokenAddress": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" - }, - { - "RemoteChainId": 106, - "RemoteTokenAddress": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E" - } - ], - "Decimal": 6, - "TokenAddress": "0xa4151B2B3e269645181dCcF2D426cE75fcbDeca9", - "TokenName": "USDC" - }, - { - "ChainPath": [ - { - "RemoteChainId": 101, - "RemoteTokenAddress": "0xdAC17F958D2ee523a2206206994597C13D831ec7" - }, - { - "RemoteChainId": 110, - "RemoteTokenAddress": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9" - }, - { - "RemoteChainId": 111, - "RemoteTokenAddress": "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58" - }, - { - "RemoteChainId": 102, - "RemoteTokenAddress": "0x55d398326f99059fF775485246999027B3197955" - }, - { - "RemoteChainId": 109, - "RemoteTokenAddress": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F" - } - ], - "Decimal": 6, - "TokenAddress": "0x900101d06A7426441Ae63e9AB3B9b0F63Be145F1", - "TokenName": "USDT" - }, - { - "ChainPath": [ - { - "RemoteChainId": 101, - "RemoteTokenAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" - } - ], - "Decimal": 18, - "TokenAddress": "0xeAB3aC417c4d6dF6b143346a46fEe1B847B50296", - "TokenName": "WETH" - }, - { - "ChainPath": [ - { - "RemoteChainId": 101, - "RemoteTokenAddress": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" - }, - { - "RemoteChainId": 110, - "RemoteTokenAddress": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f" - }, - { - "RemoteChainId": 111, - "RemoteTokenAddress": "0x68f180fcCe6836688e9084f035309E29Bf0A2095" - }, - { - "RemoteChainId": 109, - "RemoteTokenAddress": "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6" - } - ], - "Decimal": 8, - "TokenAddress": "0x5832f53d147b3d6Cd4578B9CBD62425C7ea9d0Bd", - "TokenName": "WBTC" - }, - { - "ChainPath": [ - { - "RemoteChainId": 101, - "RemoteTokenAddress": "0x2297aEbD383787A160DD0d9F71508148769342E3" - }, - { - "RemoteChainId": 110, - "RemoteTokenAddress": "0x2297aEbD383787A160DD0d9F71508148769342E3" - }, - { - "RemoteChainId": 111, - "RemoteTokenAddress": "0x2297aEbD383787A160DD0d9F71508148769342E3" - }, - { - "RemoteChainId": 102, - "RemoteTokenAddress": "0x2297aEbD383787A160DD0d9F71508148769342E3" - }, - { - "RemoteChainId": 109, - "RemoteTokenAddress": "0x2297aEbD383787A160DD0d9F71508148769342E3" - }, - { - "RemoteChainId": 106, - "RemoteTokenAddress": "0x152b9d0FdC40C096757F570A51E494bd4b943E50" - } - ], - "Decimal": 8, - "TokenAddress": "0x2297aEbD383787A160DD0d9F71508148769342E3", - "TokenName": "BTC.b" - }, - { - "ChainPath": [ - { - "RemoteChainId": 102, - "RemoteTokenAddress": "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c" - } - ], - "Decimal": 18, - "TokenAddress": "0x7A6888c85eDBA8E38F6C7E0485212da602761C08", - "TokenName": "BTCB" - } - ], - "UniswapRouter": [ - { - "Name": "GlyphExchange", - "QuoterAddressForUniswapV3": "", - "RouterAddress": "0x4ddDD324F205e5989bAF8aD0FFCa41f4E5d9841D", - "TokenList": "", - "Type": "IUniswapV2Router02" - } - ] } } \ No newline at end of file diff --git a/ethereum/scripts/deploy_libcorrectswapv2.py b/ethereum/scripts/deploy_libcorrectswapv2.py index 7f34f6cd..b3289607 100644 --- a/ethereum/scripts/deploy_libcorrectswapv2.py +++ b/ethereum/scripts/deploy_libcorrectswapv2.py @@ -19,7 +19,8 @@ CorrectOpenOceanFactory, Contract, SoDiamond, - DexManagerFacet + DexManagerFacet, + CorrectLynexFactory ) from scripts.helpful_scripts import get_account @@ -32,6 +33,7 @@ def deploy_correct_swaps(account=get_account()): factorys = [ CorrectUniswapV2Factory, CorrectUniswapV3Factory, + # CorrectLynexFactory # CorrectSyncswapFactory, # CorrectMuteswapFactory, # CorrectQuickswapV3Factory, diff --git a/ethereum/scripts/export.py b/ethereum/scripts/export.py index 0a570fd5..4613adee 100644 --- a/ethereum/scripts/export.py +++ b/ethereum/scripts/export.py @@ -102,7 +102,7 @@ def get_stragate_pool_infos(): stargate_router = Contract.from_abi( "IStargate", stargate_router_address, interface.IStargate.abi ) - bridge_address = stargate_router.stargateBridge() + bridge_address = stargate_router.bridge() bridge = Contract.from_abi( "IStargateBridge", bridge_address, interface.IStargateBridge.abi ) diff --git a/ethereum/scripts/initialize.py b/ethereum/scripts/initialize.py index aca162dd..fb664e64 100644 --- a/ethereum/scripts/initialize.py +++ b/ethereum/scripts/initialize.py @@ -630,22 +630,22 @@ def redeploy_generic_swap(): def redeploy_stargate(): account = get_account() - # print("deploy LibSoFeeStargateV2.sol...") - # so_fee = 1e-3 - # transfer_for_gas = 40000 - # basic_beneficiary = config["networks"][network.show_active()]["basic_beneficiary"] - # basic_fee = 0 - # LibSoFeeStargateV2.deploy(int(so_fee * 1e18), transfer_for_gas, - # basic_fee, basic_beneficiary, - # {"from": account}) - # - # proxy_dex = Contract.from_abi( - # "DexManagerFacet", SoDiamond[-1].address, DexManagerFacet.abi - # ) - # print("addFee...") - # proxy_dex.addFee( - # get_stargate_router(), LibSoFeeStargateV2[-1].address, {"from": account} - # ) + print("deploy LibSoFeeStargateV2.sol...") + so_fee = 0 + transfer_for_gas = 40000 + basic_beneficiary = config["networks"][network.show_active()]["basic_beneficiary"] + basic_fee = 0.0002 + LibSoFeeStargateV2.deploy(int(so_fee * 1e18), transfer_for_gas, + basic_fee, basic_beneficiary, + {"from": account}) + + proxy_dex = Contract.from_abi( + "DexManagerFacet", SoDiamond[-1].address, DexManagerFacet.abi + ) + print("addFee...") + proxy_dex.addFee( + get_stargate_router(), LibSoFeeStargateV2[-1].address, {"from": account} + ) try: print("Remove cut...")