2024-07-10 21:06:56 +00:00
package router
import (
2024-07-25 12:15:30 +00:00
"fmt"
2024-07-10 21:06:56 +00:00
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/google/uuid"
"github.com/status-im/status-go/errors"
"github.com/status-im/status-go/params"
walletCommon "github.com/status-im/status-go/services/wallet/common"
2024-08-28 11:17:59 +00:00
"github.com/status-im/status-go/services/wallet/requests"
"github.com/status-im/status-go/services/wallet/router/fees"
2024-11-20 07:28:18 +00:00
pathProcessorCommon "github.com/status-im/status-go/services/wallet/router/pathprocessor/common"
2024-08-28 12:06:50 +00:00
"github.com/status-im/status-go/services/wallet/router/routes"
2024-08-28 11:17:59 +00:00
"github.com/status-im/status-go/services/wallet/router/sendtype"
2024-07-10 21:06:56 +00:00
"github.com/status-im/status-go/services/wallet/token"
)
const (
testBaseFee = 50000000000
testGasPrice = 10000000000
testPriorityFeeLow = 1000000000
testPriorityFeeMedium = 2000000000
testPriorityFeeHigh = 3000000000
testBonderFeeETH = 150000000000000
testBonderFeeUSDC = 10000
testAmount0Point1ETHInWei = 100000000000000000
testAmount0Point2ETHInWei = 200000000000000000
testAmount0Point3ETHInWei = 300000000000000000
testAmount0Point4ETHInWei = 400000000000000000
testAmount0Point5ETHInWei = 500000000000000000
testAmount0Point6ETHInWei = 600000000000000000
testAmount0Point8ETHInWei = 800000000000000000
testAmount1ETHInWei = 1000000000000000000
testAmount2ETHInWei = 2000000000000000000
testAmount3ETHInWei = 3000000000000000000
testAmount5ETHInWei = 5000000000000000000
testAmount1USDC = 1000000
testAmount100USDC = 100000000
testApprovalGasEstimation = 1000
testApprovalL1Fee = 100000000000
2024-10-14 14:39:37 +00:00
stageName = "test"
2024-07-10 21:06:56 +00:00
)
var (
2024-11-05 21:20:27 +00:00
testEstimationMap = map [ string ] requests . Estimation {
2024-11-20 07:28:18 +00:00
pathProcessorCommon . ProcessorTransferName : { Value : uint64 ( 1000 ) , Err : nil } ,
pathProcessorCommon . ProcessorBridgeHopName : { Value : uint64 ( 5000 ) , Err : nil } ,
2024-07-10 21:06:56 +00:00
}
2024-08-28 11:17:59 +00:00
testBBonderFeeMap = map [ string ] * big . Int {
2024-11-05 21:20:27 +00:00
walletCommon . EthSymbol : big . NewInt ( testBonderFeeETH ) ,
walletCommon . UsdcSymbol : big . NewInt ( testBonderFeeUSDC ) ,
2024-07-10 21:06:56 +00:00
}
testTokenPrices = map [ string ] float64 {
2024-11-05 21:20:27 +00:00
walletCommon . EthSymbol : 2000 ,
walletCommon . UsdcSymbol : 1 ,
2024-07-10 21:06:56 +00:00
}
2024-08-28 11:17:59 +00:00
testSuggestedFees = & fees . SuggestedFees {
2024-07-10 21:06:56 +00:00
GasPrice : big . NewInt ( testGasPrice ) ,
BaseFee : big . NewInt ( testBaseFee ) ,
MaxPriorityFeePerGas : big . NewInt ( testPriorityFeeLow ) ,
2024-08-28 11:17:59 +00:00
MaxFeesLevels : & fees . MaxFeesLevels {
2024-07-10 21:06:56 +00:00
Low : ( * hexutil . Big ) ( big . NewInt ( testPriorityFeeLow ) ) ,
Medium : ( * hexutil . Big ) ( big . NewInt ( testPriorityFeeMedium ) ) ,
High : ( * hexutil . Big ) ( big . NewInt ( testPriorityFeeHigh ) ) ,
} ,
EIP1559Enabled : false ,
}
testBalanceMapPerChain = map [ string ] * big . Int {
2024-11-05 21:20:27 +00:00
makeBalanceKey ( walletCommon . EthereumMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount2ETHInWei ) ,
makeBalanceKey ( walletCommon . EthereumMainnet , walletCommon . UsdcSymbol ) : big . NewInt ( testAmount100USDC ) ,
makeBalanceKey ( walletCommon . OptimismMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount2ETHInWei ) ,
makeBalanceKey ( walletCommon . OptimismMainnet , walletCommon . UsdcSymbol ) : big . NewInt ( testAmount100USDC ) ,
makeBalanceKey ( walletCommon . ArbitrumMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount2ETHInWei ) ,
makeBalanceKey ( walletCommon . ArbitrumMainnet , walletCommon . UsdcSymbol ) : big . NewInt ( testAmount100USDC ) ,
2024-07-10 21:06:56 +00:00
}
)
var mainnet = params . Network {
ChainID : walletCommon . EthereumMainnet ,
ChainName : "Mainnet" ,
2024-10-14 14:39:37 +00:00
DefaultRPCURL : fmt . Sprintf ( "https://%s.api.status.im/nodefleet/ethereum/mainnet/" , stageName ) ,
DefaultFallbackURL : fmt . Sprintf ( "https://%s.api.status.im/infura/ethereum/mainnet/" , stageName ) ,
DefaultFallbackURL2 : "https://mainnet.infura.io/v3/" ,
RPCURL : fmt . Sprintf ( "https://%s.api.status.im/grove/ethereum/mainnet/" , stageName ) ,
FallbackURL : "https://eth-archival.rpc.grove.city/v1/" ,
2024-07-10 21:06:56 +00:00
BlockExplorerURL : "https://etherscan.io/" ,
IconURL : "network/Network=Ethereum" ,
ChainColor : "#627EEA" ,
ShortName : "eth" ,
NativeCurrencyName : "Ether" ,
NativeCurrencySymbol : "ETH" ,
NativeCurrencyDecimals : 18 ,
IsTest : false ,
Layer : 1 ,
Enabled : true ,
RelatedChainID : walletCommon . EthereumMainnet ,
}
var optimism = params . Network {
ChainID : walletCommon . OptimismMainnet ,
ChainName : "Optimism" ,
2024-10-14 14:39:37 +00:00
DefaultRPCURL : fmt . Sprintf ( "https://%s.api.status.im/nodefleet/optimism/mainnet/" , stageName ) ,
DefaultFallbackURL : fmt . Sprintf ( "https://%s.api.status.im/infura/optimism/mainnet/" , stageName ) ,
DefaultFallbackURL2 : "https://optimism-mainnet.infura.io/v3/" ,
RPCURL : fmt . Sprintf ( "https://%s.api.status.im/grove/optimism/mainnet/" , stageName ) ,
FallbackURL : "https://optimism-archival.rpc.grove.city/v1/" ,
2024-07-10 21:06:56 +00:00
BlockExplorerURL : "https://optimistic.etherscan.io" ,
IconURL : "network/Network=Optimism" ,
ChainColor : "#E90101" ,
ShortName : "oeth" ,
NativeCurrencyName : "Ether" ,
NativeCurrencySymbol : "ETH" ,
NativeCurrencyDecimals : 18 ,
IsTest : false ,
Layer : 2 ,
Enabled : true ,
RelatedChainID : walletCommon . OptimismMainnet ,
}
var arbitrum = params . Network {
ChainID : walletCommon . ArbitrumMainnet ,
ChainName : "Arbitrum" ,
2024-10-14 14:39:37 +00:00
DefaultRPCURL : fmt . Sprintf ( "https://%s.api.status.im/nodefleet/arbitrum/mainnet/" , stageName ) ,
DefaultFallbackURL : fmt . Sprintf ( "https://%s.api.status.im/infura/arbitrum/mainnet/" , stageName ) ,
DefaultFallbackURL2 : "https://arbitrum-mainnet.infura.io/v3/" ,
RPCURL : fmt . Sprintf ( "https://%s.api.status.im/grove/arbitrum/mainnet/" , stageName ) ,
FallbackURL : "https://arbitrum-one.rpc.grove.city/v1/" ,
2024-07-10 21:06:56 +00:00
IconURL : "network/Network=Arbitrum" ,
ChainColor : "#51D0F0" ,
ShortName : "arb1" ,
NativeCurrencyName : "Ether" ,
NativeCurrencySymbol : "ETH" ,
NativeCurrencyDecimals : 18 ,
IsTest : false ,
Layer : 2 ,
Enabled : true ,
RelatedChainID : walletCommon . ArbitrumMainnet ,
}
var defaultNetworks = [ ] params . Network {
mainnet ,
optimism ,
arbitrum ,
}
type normalTestParams struct {
name string
2024-08-28 11:17:59 +00:00
input * requests . RouteInputParams
2024-08-28 12:06:50 +00:00
expectedCandidates routes . Route
2024-07-10 21:06:56 +00:00
expectedError * errors . ErrorResponse
}
func getNormalTestParamsList ( ) [ ] normalTestParams {
return [ ] normalTestParams {
2024-08-23 14:01:49 +00:00
{
name : "ETH transfer - Insufficient Funds" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-08-23 14:01:49 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-08-23 14:01:49 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-08-23 14:01:49 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-08-23 14:01:49 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-08-23 14:01:49 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
2024-11-05 21:20:27 +00:00
EstimationMap : map [ string ] requests . Estimation {
2024-11-20 07:28:18 +00:00
pathProcessorCommon . ProcessorTransferName : {
2024-08-23 14:01:49 +00:00
Value : uint64 ( 0 ) ,
Err : fmt . Errorf ( "failed with 50000000 gas: insufficient funds for gas * price + value: address %s have 68251537427723 want 100000000000000" , common . HexToAddress ( "0x1" ) ) ,
} ,
} ,
2024-08-28 11:17:59 +00:00
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-08-23 14:01:49 +00:00
} ,
} ,
expectedError : & errors . ErrorResponse {
Code : errors . GenericErrorCode ,
Details : fmt . Sprintf ( "failed with 50000000 gas: insufficient funds for gas * price + value: address %s" , common . HexToAddress ( "0x1" ) ) ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route { } ,
2024-08-23 14:01:49 +00:00
} ,
2024-07-23 10:15:29 +00:00
{
name : "ETH transfer - No Specific FromChain - No Specific ToChain - 0 AmountIn" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-23 10:15:29 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-23 10:15:29 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( 0 ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-23 10:15:29 +00:00
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-23 10:15:29 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-23 10:15:29 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-23 10:15:29 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-23 10:15:29 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-23 10:15:29 +00:00
FromChain : & mainnet ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-23 10:15:29 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-23 10:15:29 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
} ,
} ,
2024-07-10 21:06:56 +00:00
{
name : "ETH transfer - No Specific FromChain - No Specific ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - No Specific FromChain - Specific Single ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledToChainIDs : [ ] uint64 { walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - No Specific FromChain - Specific Multiple ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - Specific Single FromChain - No Specific ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
2024-07-10 21:06:56 +00:00
2024-08-28 11:17:59 +00:00
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - Specific Multiple FromChain - No Specific ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - Specific Single FromChain - Specific Single ToChain - Same Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - Specific Single FromChain - Specific Single ToChain - Different Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - Specific Multiple FromChain - Specific Multiple ToChain - Single Common Chain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - Specific Multiple FromChain - Specific Multiple ToChain - Multiple Common Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . OptimismMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - Specific Multiple FromChain - Specific Multiple ToChain - No Common Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - All FromChains Disabled - All ToChains Disabled" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
2024-07-10 21:06:56 +00:00
2024-08-28 11:17:59 +00:00
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-07-18 12:20:54 +00:00
expectedError : ErrNoBestRouteFound ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route { } ,
2024-07-10 21:06:56 +00:00
} ,
{
name : "ETH transfer - No Specific FromChain - No Specific ToChain - Single Chain LockedAmount" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
FromLockedAmount : map [ uint64 ] * hexutil . Big {
walletCommon . EthereumMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei ) ) ,
} ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point8ETHInWei ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point8ETHInWei ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point8ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point8ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point8ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point8ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - No Specific FromChain - Specific ToChain - Single Chain LockedAmount" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . ArbitrumMainnet } ,
FromLockedAmount : map [ uint64 ] * hexutil . Big {
walletCommon . EthereumMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei ) ) ,
walletCommon . ArbitrumMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point3ETHInWei ) ) ,
} ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei - testAmount0Point2ETHInWei - testAmount0Point3ETHInWei ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei - testBonderFeeETH ) ) , //(*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei)), //(big.NewInt(testAmount0Point2ETHInWei - testBonderFeeETH)),
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point3ETHInWei - testBonderFeeETH ) ) , //(*hexutil.Big)(big.NewInt(testAmount0Point3ETHInWei)),
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - No Specific FromChain - No Specific ToChain - Multiple Chains LockedAmount" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
FromLockedAmount : map [ uint64 ] * hexutil . Big {
walletCommon . EthereumMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei ) ) ,
walletCommon . OptimismMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point3ETHInWei ) ) ,
} ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point3ETHInWei ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point5ETHInWei ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point3ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point3ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point5ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point5ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - No Specific FromChain - No Specific ToChain - All Chains LockedAmount" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
FromLockedAmount : map [ uint64 ] * hexutil . Big {
walletCommon . EthereumMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei ) ) ,
walletCommon . OptimismMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point3ETHInWei ) ) ,
walletCommon . ArbitrumMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point5ETHInWei ) ) ,
} ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point3ETHInWei ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point5ETHInWei ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point3ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point3ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point5ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point5ETHInWei - testBonderFeeETH ) ) ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - No Specific FromChain - No Specific ToChain - All Chains LockedAmount with insufficient amount" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
FromLockedAmount : map [ uint64 ] * hexutil . Big {
walletCommon . EthereumMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point2ETHInWei ) ) ,
walletCommon . OptimismMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point3ETHInWei ) ) ,
walletCommon . ArbitrumMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point4ETHInWei ) ) ,
} ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 11:17:59 +00:00
expectedError : requests . ErrLockedAmountLessThanSendAmountAllNetworks ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route { } ,
2024-07-10 21:06:56 +00:00
} ,
{
name : "ETH transfer - No Specific FromChain - No Specific ToChain - LockedAmount exceeds sending amount" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
FromLockedAmount : map [ uint64 ] * hexutil . Big {
walletCommon . OptimismMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point3ETHInWei ) ) ,
walletCommon . ArbitrumMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point8ETHInWei ) ) ,
} ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 11:17:59 +00:00
expectedError : requests . ErrLockedAmountExceedsTotalSendAmount ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route { } ,
2024-07-10 21:06:56 +00:00
} ,
{
name : "ERC20 transfer - No Specific FromChain - No Specific ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & arbitrum ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "ERC20 transfer - No Specific FromChain - Specific Single ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledToChainIDs : [ ] uint64 { walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "ERC20 transfer - No Specific FromChain - Specific Multiple ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & arbitrum ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "ERC20 transfer - Specific Single FromChain - No Specific ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "ERC20 transfer - Specific Multiple FromChain - No Specific ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "ERC20 transfer - Specific Single FromChain - Specific Single ToChain - Same Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ERC20 transfer - Specific Single FromChain - Specific Single ToChain - Different Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "ERC20 transfer - Specific Multiple FromChain - Specific Multiple ToChain - Single Common Chain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ERC20 transfer - Specific Multiple FromChain - Specific Multiple ToChain - Multiple Common Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . OptimismMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & mainnet ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & arbitrum ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "ERC20 transfer - Specific Multiple FromChain - Specific Multiple ToChain - No Common Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "ERC20 transfer - All FromChains Disabled - All ToChains Disabled" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-07-18 12:20:54 +00:00
expectedError : ErrNoBestRouteFound ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route { } ,
2024-07-10 21:06:56 +00:00
} ,
{
name : "ERC20 transfer - All FromChains - No Locked Amount - Enough Token Balance Across All Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( 2.5 * testAmount100USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 2.5 * testAmount100USDC ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount100USDC ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 2.5 * testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 2.5 * testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 0.5 * testAmount100USDC ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount100USDC ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 2.5 * testAmount100USDC ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 0.5 * testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 2.5 * testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 0.5 * testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 2.5 * testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 0.5 * testAmount100USDC ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount100USDC ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & arbitrum ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 2.5 * testAmount100USDC ) ) ,
ApprovalRequired : false ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 0.5 * testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 2.5 * testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 0.5 * testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
AmountOut : ( * hexutil . Big ) ( big . NewInt ( 2.5 * testAmount100USDC - testBonderFeeUSDC ) ) ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "Bridge - No Specific FromChain - No Specific ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Bridge ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & arbitrum ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "Bridge - No Specific FromChain - Specific Single ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Bridge ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledToChainIDs : [ ] uint64 { walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "Bridge - No Specific FromChain - Specific Multiple ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Bridge ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & arbitrum ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "Bridge - Specific Single FromChain - No Specific ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Bridge ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "Bridge - Specific Multiple FromChain - No Specific ToChain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Bridge ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & arbitrum ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "Bridge - Specific Single FromChain - Specific Single ToChain - Same Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Bridge ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-07-18 12:20:54 +00:00
expectedError : ErrNoBestRouteFound ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route { } ,
2024-07-10 21:06:56 +00:00
} ,
{
name : "Bridge - Specific Single FromChain - Specific Single ToChain - Different Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Bridge ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "Bridge - Specific Multiple FromChain - Specific Multiple ToChain - Single Common Chain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Bridge ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-07-18 12:20:54 +00:00
expectedError : ErrNoBestRouteFound ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route { } ,
2024-07-10 21:06:56 +00:00
} ,
{
name : "Bridge - Specific Multiple FromChain - Specific Multiple ToChain - Multiple Common Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Bridge ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . OptimismMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & arbitrum ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "Bridge - Specific Multiple FromChain - Specific Multiple ToChain - No Common Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Bridge ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "Bridge - All FromChains Disabled - All ToChains Disabled" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Bridge ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-07-18 12:20:54 +00:00
expectedError : ErrNoBestRouteFound ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route { } ,
2024-07-10 21:06:56 +00:00
} ,
2024-07-25 12:15:30 +00:00
{
name : "ETH transfer - Not Enough Native Balance" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-25 12:15:30 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-25 12:15:30 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount3ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-25 12:15:30 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-25 12:15:30 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-25 12:15:30 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-25 12:15:30 +00:00
} ,
} ,
expectedError : & errors . ErrorResponse {
Code : ErrNotEnoughNativeBalance . Code ,
2024-11-05 21:20:27 +00:00
Details : fmt . Sprintf ( ErrNotEnoughNativeBalance . Details , walletCommon . EthSymbol , walletCommon . EthereumMainnet ) ,
2024-07-25 12:15:30 +00:00
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-25 12:15:30 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-25 12:15:30 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
ApprovalRequired : false ,
} ,
} ,
} ,
{
name : "ETH transfer - Not Enough Native Balance" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-25 12:15:30 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-25 12:15:30 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( 5 * testAmount100USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-25 12:15:30 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-25 12:15:30 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-25 12:15:30 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-25 12:15:30 +00:00
} ,
} ,
expectedError : & errors . ErrorResponse {
Code : ErrNotEnoughTokenBalance . Code ,
2024-11-05 21:20:27 +00:00
Details : fmt . Sprintf ( ErrNotEnoughTokenBalance . Details , walletCommon . UsdcSymbol , walletCommon . EthereumMainnet ) ,
2024-07-25 12:15:30 +00:00
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-25 12:15:30 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-25 12:15:30 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
ApprovalRequired : true ,
2024-07-31 12:12:57 +00:00
} ,
} ,
} ,
{
name : "Bridge - Specific Single FromChain - Specific Single ToChain - Sending Small Amount" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-31 12:12:57 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Bridge ,
2024-07-31 12:12:57 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( 0.01 * testAmount1USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-31 12:12:57 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . OptimismMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . OptimismMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-31 12:12:57 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-31 12:12:57 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
BaseFee : big . NewInt ( testBaseFee ) ,
SuggestedFees : testSuggestedFees ,
BalanceMap : testBalanceMapPerChain ,
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-31 12:12:57 +00:00
} ,
} ,
expectedError : ErrLowAmountInForHopBridge ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-31 12:12:57 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-31 12:12:57 +00:00
FromChain : & arbitrum ,
ToChain : & mainnet ,
ApprovalRequired : true ,
2024-07-25 12:15:30 +00:00
} ,
} ,
} ,
2024-07-10 21:06:56 +00:00
}
}
type noBalanceTestParams struct {
name string
2024-08-28 11:17:59 +00:00
input * requests . RouteInputParams
2024-08-28 12:06:50 +00:00
expectedCandidates routes . Route
expectedBest routes . Route
2024-07-10 21:06:56 +00:00
expectedError * errors . ErrorResponse
}
func getNoBalanceTestParamsList ( ) [ ] noBalanceTestParams {
return [ ] noBalanceTestParams {
{
name : "ERC20 transfer - Specific FromChain - Specific ToChain - Not Enough Token Balance" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount100USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . ArbitrumMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
SuggestedFees : testSuggestedFees ,
BalanceMap : map [ string ] * big . Int {
2024-11-05 21:20:27 +00:00
makeBalanceKey ( walletCommon . OptimismMainnet , walletCommon . UsdcSymbol ) : big . NewInt ( 0 ) ,
2024-07-10 21:06:56 +00:00
} ,
2024-08-28 11:17:59 +00:00
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-23 14:01:49 +00:00
expectedError : ErrNoPositiveBalance ,
2024-07-10 21:06:56 +00:00
} ,
{
name : "ERC20 transfer - Specific FromChain - Specific ToChain - Not Enough Native Balance" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount100USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . ArbitrumMainnet } ,
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
SuggestedFees : testSuggestedFees ,
BalanceMap : map [ string ] * big . Int {
2024-11-05 21:20:27 +00:00
makeBalanceKey ( walletCommon . OptimismMainnet , walletCommon . UsdcSymbol ) : big . NewInt ( testAmount100USDC ) ,
makeBalanceKey ( walletCommon . OptimismMainnet , walletCommon . EthSymbol ) : big . NewInt ( 0 ) ,
2024-07-10 21:06:56 +00:00
} ,
2024-08-28 11:17:59 +00:00
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-07-25 22:27:12 +00:00
expectedError : & errors . ErrorResponse {
Code : ErrNotEnoughNativeBalance . Code ,
2024-11-05 21:20:27 +00:00
Details : fmt . Sprintf ( ErrNotEnoughNativeBalance . Details , walletCommon . EthSymbol , walletCommon . OptimismMainnet ) ,
2024-07-25 22:27:12 +00:00
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
ApprovalRequired : false ,
2024-08-28 12:06:50 +00:00
RequiredTokenBalance : big . NewInt ( testAmount100USDC ) ,
RequiredNativeBalance : big . NewInt ( ( testBaseFee + testPriorityFeeLow ) * testApprovalGasEstimation ) ,
2024-07-10 21:06:56 +00:00
} ,
} ,
} ,
{
name : "ERC20 transfer - No Specific FromChain - Specific ToChain - Not Enough Token Balance Across All Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount100USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
SuggestedFees : testSuggestedFees ,
BalanceMap : map [ string ] * big . Int {
2024-11-05 21:20:27 +00:00
makeBalanceKey ( walletCommon . EthereumMainnet , walletCommon . UsdcSymbol ) : big . NewInt ( 0 ) ,
makeBalanceKey ( walletCommon . EthereumMainnet , walletCommon . EthSymbol ) : big . NewInt ( 0 ) ,
makeBalanceKey ( walletCommon . OptimismMainnet , walletCommon . UsdcSymbol ) : big . NewInt ( 0 ) ,
makeBalanceKey ( walletCommon . OptimismMainnet , walletCommon . EthSymbol ) : big . NewInt ( 0 ) ,
makeBalanceKey ( walletCommon . ArbitrumMainnet , walletCommon . UsdcSymbol ) : big . NewInt ( 0 ) ,
makeBalanceKey ( walletCommon . ArbitrumMainnet , walletCommon . EthSymbol ) : big . NewInt ( 0 ) ,
2024-07-10 21:06:56 +00:00
} ,
2024-08-28 11:17:59 +00:00
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-23 14:01:49 +00:00
expectedError : ErrNoPositiveBalance ,
2024-07-10 21:06:56 +00:00
} ,
{
name : "ERC20 transfer - No Specific FromChain - Specific ToChain - Enough Token Balance On Arbitrum Chain But Not Enough Native Balance" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount100USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
SuggestedFees : testSuggestedFees ,
BalanceMap : map [ string ] * big . Int {
2024-11-05 21:20:27 +00:00
makeBalanceKey ( walletCommon . ArbitrumMainnet , walletCommon . UsdcSymbol ) : big . NewInt ( testAmount100USDC + testAmount100USDC ) ,
makeBalanceKey ( walletCommon . EthereumMainnet , walletCommon . UsdcSymbol ) : big . NewInt ( testAmount100USDC + testAmount100USDC ) ,
makeBalanceKey ( walletCommon . OptimismMainnet , walletCommon . UsdcSymbol ) : big . NewInt ( testAmount100USDC + testAmount100USDC ) ,
makeBalanceKey ( walletCommon . ArbitrumMainnet , walletCommon . EthSymbol ) : big . NewInt ( 0 ) ,
makeBalanceKey ( walletCommon . EthereumMainnet , walletCommon . EthSymbol ) : big . NewInt ( 0 ) ,
makeBalanceKey ( walletCommon . OptimismMainnet , walletCommon . EthSymbol ) : big . NewInt ( 0 ) ,
2024-07-10 21:06:56 +00:00
} ,
2024-08-28 11:17:59 +00:00
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-07-25 22:27:12 +00:00
expectedError : & errors . ErrorResponse {
Code : ErrNotEnoughNativeBalance . Code ,
2024-11-05 21:20:27 +00:00
Details : fmt . Sprintf ( ErrNotEnoughNativeBalance . Details , walletCommon . EthSymbol , walletCommon . ArbitrumMainnet ) ,
2024-07-25 22:27:12 +00:00
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
ApprovalRequired : false ,
2024-08-28 12:06:50 +00:00
RequiredTokenBalance : big . NewInt ( testAmount100USDC ) ,
RequiredNativeBalance : big . NewInt ( ( testBaseFee + testPriorityFeeLow ) * testApprovalGasEstimation ) ,
2024-07-10 21:06:56 +00:00
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
} ,
} ,
{
name : "ERC20 transfer - No Specific FromChain - Specific ToChain - Enough Token Balance On Arbitrum Chain And Enough Native Balance On Arbitrum Chain" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AddrFrom : common . HexToAddress ( "0x1" ) ,
AddrTo : common . HexToAddress ( "0x2" ) ,
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount100USDC ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
DisabledToChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . UsdcSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 6 ,
} ,
2024-08-28 11:17:59 +00:00
TokenPrices : testTokenPrices ,
SuggestedFees : testSuggestedFees ,
BalanceMap : map [ string ] * big . Int {
2024-11-05 21:20:27 +00:00
makeBalanceKey ( walletCommon . ArbitrumMainnet , walletCommon . UsdcSymbol ) : big . NewInt ( testAmount100USDC + testAmount100USDC ) ,
makeBalanceKey ( walletCommon . ArbitrumMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount1ETHInWei ) ,
2024-07-10 21:06:56 +00:00
} ,
2024-08-28 11:17:59 +00:00
EstimationMap : testEstimationMap ,
BonderFeeMap : testBBonderFeeMap ,
ApprovalGasEstimation : testApprovalGasEstimation ,
ApprovalL1Fee : testApprovalL1Fee ,
2024-07-10 21:06:56 +00:00
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedCandidates : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & mainnet ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorTransferName ,
2024-07-10 21:06:56 +00:00
FromChain : & optimism ,
ToChain : & optimism ,
ApprovalRequired : false ,
2024-08-28 12:06:50 +00:00
RequiredTokenBalance : big . NewInt ( testAmount100USDC ) ,
RequiredNativeBalance : big . NewInt ( ( testBaseFee + testPriorityFeeLow ) * testApprovalGasEstimation ) ,
2024-07-10 21:06:56 +00:00
} ,
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
} ,
2024-08-28 12:06:50 +00:00
expectedBest : routes . Route {
2024-07-10 21:06:56 +00:00
{
2024-11-20 07:28:18 +00:00
ProcessorName : pathProcessorCommon . ProcessorBridgeHopName ,
2024-07-10 21:06:56 +00:00
FromChain : & arbitrum ,
ToChain : & optimism ,
ApprovalRequired : true ,
} ,
} ,
} ,
}
}
type amountOptionsTestParams struct {
name string
2024-08-28 11:17:59 +00:00
input * requests . RouteInputParams
2024-07-10 21:06:56 +00:00
expectedAmountOptions map [ uint64 ] [ ] amountOption
}
func getAmountOptionsTestParamsList ( ) [ ] amountOptionsTestParams {
return [ ] amountOptionsTestParams {
{
name : "Transfer - Single From Chain - No Locked Amount" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . ArbitrumMainnet } ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
BalanceMap : map [ string ] * big . Int { } ,
2024-07-10 21:06:56 +00:00
} ,
} ,
expectedAmountOptions : map [ uint64 ] [ ] amountOption {
walletCommon . OptimismMainnet : {
{
amount : big . NewInt ( testAmount1ETHInWei ) ,
locked : false ,
} ,
} ,
} ,
} ,
{
name : "Transfer - Single From Chain - Locked Amount To Single Chain Equal Total Amount" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet , walletCommon . ArbitrumMainnet } ,
FromLockedAmount : map [ uint64 ] * hexutil . Big {
walletCommon . OptimismMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
} ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
BalanceMap : map [ string ] * big . Int { } ,
2024-07-10 21:06:56 +00:00
} ,
} ,
expectedAmountOptions : map [ uint64 ] [ ] amountOption {
walletCommon . OptimismMainnet : {
{
amount : big . NewInt ( testAmount1ETHInWei ) ,
locked : true ,
} ,
} ,
} ,
} ,
{
name : "Transfer - Multiple From Chains - Locked Amount To Single Chain Is Less Than Total Amount" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount2ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet } ,
FromLockedAmount : map [ uint64 ] * hexutil . Big {
walletCommon . OptimismMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
} ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
BalanceMap : map [ string ] * big . Int { } ,
2024-07-10 21:06:56 +00:00
} ,
} ,
expectedAmountOptions : map [ uint64 ] [ ] amountOption {
walletCommon . OptimismMainnet : {
{
amount : big . NewInt ( testAmount1ETHInWei ) ,
locked : true ,
} ,
} ,
walletCommon . ArbitrumMainnet : {
{
amount : big . NewInt ( testAmount1ETHInWei ) ,
locked : false ,
} ,
} ,
} ,
} ,
{
name : "Transfer - Multiple From Chains - Locked Amount To Multiple Chains" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount2ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
DisabledFromChainIDs : [ ] uint64 { walletCommon . EthereumMainnet } ,
FromLockedAmount : map [ uint64 ] * hexutil . Big {
walletCommon . OptimismMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
walletCommon . ArbitrumMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
} ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
BalanceMap : map [ string ] * big . Int { } ,
2024-07-10 21:06:56 +00:00
} ,
} ,
expectedAmountOptions : map [ uint64 ] [ ] amountOption {
walletCommon . OptimismMainnet : {
{
amount : big . NewInt ( testAmount1ETHInWei ) ,
locked : true ,
} ,
} ,
walletCommon . ArbitrumMainnet : {
{
amount : big . NewInt ( testAmount1ETHInWei ) ,
locked : true ,
} ,
} ,
} ,
} ,
{
name : "Transfer - All From Chains - Locked Amount To Multiple Chains Equal Total Amount" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount2ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
FromLockedAmount : map [ uint64 ] * hexutil . Big {
walletCommon . OptimismMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
walletCommon . ArbitrumMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
} ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
BalanceMap : map [ string ] * big . Int { } ,
2024-07-10 21:06:56 +00:00
} ,
} ,
expectedAmountOptions : map [ uint64 ] [ ] amountOption {
walletCommon . OptimismMainnet : {
{
amount : big . NewInt ( testAmount1ETHInWei ) ,
locked : true ,
} ,
} ,
walletCommon . ArbitrumMainnet : {
{
amount : big . NewInt ( testAmount1ETHInWei ) ,
locked : true ,
} ,
} ,
} ,
} ,
{
name : "Transfer - All From Chains - Locked Amount To Multiple Chains Is Less Than Total Amount" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount5ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
FromLockedAmount : map [ uint64 ] * hexutil . Big {
walletCommon . OptimismMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
walletCommon . ArbitrumMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
} ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
BalanceMap : map [ string ] * big . Int { } ,
2024-07-10 21:06:56 +00:00
} ,
} ,
expectedAmountOptions : map [ uint64 ] [ ] amountOption {
walletCommon . OptimismMainnet : {
{
amount : big . NewInt ( testAmount1ETHInWei ) ,
locked : true ,
} ,
} ,
walletCommon . ArbitrumMainnet : {
{
amount : big . NewInt ( testAmount1ETHInWei ) ,
locked : true ,
} ,
} ,
walletCommon . EthereumMainnet : {
{
amount : big . NewInt ( testAmount3ETHInWei ) ,
locked : false ,
} ,
} ,
} ,
} ,
{
name : "Transfer - All From Chain - No Locked Amount - Enough Token Balance If All Chains Are Used" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount3ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
BalanceMap : map [ string ] * big . Int {
2024-11-05 21:20:27 +00:00
makeBalanceKey ( walletCommon . EthereumMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount1ETHInWei ) ,
makeBalanceKey ( walletCommon . OptimismMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount1ETHInWei ) ,
makeBalanceKey ( walletCommon . ArbitrumMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount1ETHInWei ) ,
2024-07-10 21:06:56 +00:00
} ,
} ,
} ,
expectedAmountOptions : map [ uint64 ] [ ] amountOption {
walletCommon . OptimismMainnet : {
{
amount : big . NewInt ( testAmount3ETHInWei ) ,
locked : false ,
} ,
{
amount : big . NewInt ( testAmount1ETHInWei ) ,
locked : false ,
} ,
} ,
walletCommon . ArbitrumMainnet : {
{
amount : big . NewInt ( testAmount3ETHInWei ) ,
locked : false ,
} ,
{
amount : big . NewInt ( testAmount1ETHInWei ) ,
locked : false ,
} ,
} ,
walletCommon . EthereumMainnet : {
{
amount : big . NewInt ( testAmount3ETHInWei ) ,
locked : false ,
} ,
{
amount : big . NewInt ( testAmount1ETHInWei ) ,
locked : false ,
} ,
} ,
} ,
} ,
{
name : "Transfer - All From Chain - Locked Amount To Single Chain - Enough Token Balance If All Chains Are Used" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount3ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
FromLockedAmount : map [ uint64 ] * hexutil . Big {
walletCommon . OptimismMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point5ETHInWei ) ) ,
} ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
BalanceMap : map [ string ] * big . Int {
2024-11-05 21:20:27 +00:00
makeBalanceKey ( walletCommon . EthereumMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount2ETHInWei ) ,
makeBalanceKey ( walletCommon . OptimismMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount1ETHInWei ) ,
makeBalanceKey ( walletCommon . ArbitrumMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount3ETHInWei ) ,
2024-07-10 21:06:56 +00:00
} ,
} ,
} ,
expectedAmountOptions : map [ uint64 ] [ ] amountOption {
walletCommon . OptimismMainnet : {
{
amount : big . NewInt ( testAmount0Point5ETHInWei ) ,
locked : true ,
} ,
} ,
walletCommon . ArbitrumMainnet : {
{
amount : big . NewInt ( testAmount2ETHInWei + testAmount0Point5ETHInWei ) ,
locked : false ,
} ,
{
amount : big . NewInt ( testAmount0Point5ETHInWei ) ,
locked : false ,
} ,
} ,
walletCommon . EthereumMainnet : {
{
amount : big . NewInt ( testAmount2ETHInWei + testAmount0Point5ETHInWei ) ,
locked : false ,
} ,
{
amount : big . NewInt ( testAmount2ETHInWei ) ,
locked : false ,
} ,
} ,
} ,
} ,
{
name : "Transfer - All From Chain - Locked Amount To Multiple Chains - Enough Token Balance If All Chains Are Used" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount3ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
FromLockedAmount : map [ uint64 ] * hexutil . Big {
walletCommon . OptimismMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount0Point5ETHInWei ) ) ,
walletCommon . EthereumMainnet : ( * hexutil . Big ) ( big . NewInt ( testAmount1ETHInWei ) ) ,
} ,
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
BalanceMap : map [ string ] * big . Int {
2024-11-05 21:20:27 +00:00
makeBalanceKey ( walletCommon . EthereumMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount2ETHInWei ) ,
makeBalanceKey ( walletCommon . OptimismMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount1ETHInWei ) ,
makeBalanceKey ( walletCommon . ArbitrumMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount3ETHInWei ) ,
2024-07-10 21:06:56 +00:00
} ,
} ,
} ,
expectedAmountOptions : map [ uint64 ] [ ] amountOption {
walletCommon . OptimismMainnet : {
{
amount : big . NewInt ( testAmount0Point5ETHInWei ) ,
locked : true ,
} ,
} ,
walletCommon . ArbitrumMainnet : {
{
amount : big . NewInt ( testAmount1ETHInWei + testAmount0Point5ETHInWei ) ,
locked : false ,
} ,
} ,
walletCommon . EthereumMainnet : {
{
amount : big . NewInt ( testAmount1ETHInWei ) ,
locked : true ,
} ,
} ,
} ,
} ,
{
name : "Transfer - All From Chain - No Locked Amount - Not Enough Token Balance" ,
2024-08-28 11:17:59 +00:00
input : & requests . RouteInputParams {
TestnetMode : false ,
2024-07-10 21:06:56 +00:00
Uuid : uuid . NewString ( ) ,
2024-08-28 11:17:59 +00:00
SendType : sendtype . Transfer ,
2024-07-10 21:06:56 +00:00
AmountIn : ( * hexutil . Big ) ( big . NewInt ( testAmount5ETHInWei ) ) ,
2024-11-05 21:20:27 +00:00
TokenID : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
2024-08-28 11:17:59 +00:00
TestsMode : true ,
TestParams : & requests . RouterTestParams {
TokenFrom : & token . Token {
2024-07-10 21:06:56 +00:00
ChainID : 1 ,
2024-11-05 21:20:27 +00:00
Symbol : walletCommon . EthSymbol ,
2024-07-10 21:06:56 +00:00
Decimals : 18 ,
} ,
2024-08-28 11:17:59 +00:00
BalanceMap : map [ string ] * big . Int {
2024-11-05 21:20:27 +00:00
makeBalanceKey ( walletCommon . EthereumMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount1ETHInWei ) ,
makeBalanceKey ( walletCommon . OptimismMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount1ETHInWei ) ,
makeBalanceKey ( walletCommon . ArbitrumMainnet , walletCommon . EthSymbol ) : big . NewInt ( testAmount1ETHInWei ) ,
2024-07-10 21:06:56 +00:00
} ,
} ,
} ,
expectedAmountOptions : map [ uint64 ] [ ] amountOption {
walletCommon . OptimismMainnet : {
{
amount : big . NewInt ( testAmount5ETHInWei ) ,
locked : false ,
} ,
} ,
walletCommon . ArbitrumMainnet : {
{
amount : big . NewInt ( testAmount5ETHInWei ) ,
locked : false ,
} ,
} ,
walletCommon . EthereumMainnet : {
{
amount : big . NewInt ( testAmount5ETHInWei ) ,
locked : false ,
} ,
} ,
} ,
} ,
}
}