github.com/status-im/status-go@v1.1.0/services/wallet/router/router_test_data.go (about) 1 package router 2 3 import ( 4 "fmt" 5 "math/big" 6 7 "github.com/ethereum/go-ethereum/common" 8 "github.com/ethereum/go-ethereum/common/hexutil" 9 10 "github.com/google/uuid" 11 12 "github.com/status-im/status-go/errors" 13 "github.com/status-im/status-go/params" 14 walletCommon "github.com/status-im/status-go/services/wallet/common" 15 "github.com/status-im/status-go/services/wallet/requests" 16 "github.com/status-im/status-go/services/wallet/router/fees" 17 "github.com/status-im/status-go/services/wallet/router/pathprocessor" 18 "github.com/status-im/status-go/services/wallet/router/routes" 19 "github.com/status-im/status-go/services/wallet/router/sendtype" 20 "github.com/status-im/status-go/services/wallet/token" 21 ) 22 23 const ( 24 testBaseFee = 50000000000 25 testGasPrice = 10000000000 26 testPriorityFeeLow = 1000000000 27 testPriorityFeeMedium = 2000000000 28 testPriorityFeeHigh = 3000000000 29 testBonderFeeETH = 150000000000000 30 testBonderFeeUSDC = 10000 31 32 testAmount0Point1ETHInWei = 100000000000000000 33 testAmount0Point2ETHInWei = 200000000000000000 34 testAmount0Point3ETHInWei = 300000000000000000 35 testAmount0Point4ETHInWei = 400000000000000000 36 testAmount0Point5ETHInWei = 500000000000000000 37 testAmount0Point6ETHInWei = 600000000000000000 38 testAmount0Point8ETHInWei = 800000000000000000 39 testAmount1ETHInWei = 1000000000000000000 40 testAmount2ETHInWei = 2000000000000000000 41 testAmount3ETHInWei = 3000000000000000000 42 testAmount5ETHInWei = 5000000000000000000 43 44 testAmount1USDC = 1000000 45 testAmount100USDC = 100000000 46 47 testApprovalGasEstimation = 1000 48 testApprovalL1Fee = 100000000000 49 ) 50 51 var ( 52 testEstimationMap = map[string]pathprocessor.Estimation{ 53 pathprocessor.ProcessorTransferName: {Value: uint64(1000), Err: nil}, 54 pathprocessor.ProcessorBridgeHopName: {Value: uint64(5000), Err: nil}, 55 } 56 57 testBBonderFeeMap = map[string]*big.Int{ 58 pathprocessor.EthSymbol: big.NewInt(testBonderFeeETH), 59 pathprocessor.UsdcSymbol: big.NewInt(testBonderFeeUSDC), 60 } 61 62 testTokenPrices = map[string]float64{ 63 pathprocessor.EthSymbol: 2000, 64 pathprocessor.UsdcSymbol: 1, 65 } 66 67 testSuggestedFees = &fees.SuggestedFees{ 68 GasPrice: big.NewInt(testGasPrice), 69 BaseFee: big.NewInt(testBaseFee), 70 MaxPriorityFeePerGas: big.NewInt(testPriorityFeeLow), 71 MaxFeesLevels: &fees.MaxFeesLevels{ 72 Low: (*hexutil.Big)(big.NewInt(testPriorityFeeLow)), 73 Medium: (*hexutil.Big)(big.NewInt(testPriorityFeeMedium)), 74 High: (*hexutil.Big)(big.NewInt(testPriorityFeeHigh)), 75 }, 76 EIP1559Enabled: false, 77 } 78 79 testBalanceMapPerChain = map[string]*big.Int{ 80 makeBalanceKey(walletCommon.EthereumMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount2ETHInWei), 81 makeBalanceKey(walletCommon.EthereumMainnet, pathprocessor.UsdcSymbol): big.NewInt(testAmount100USDC), 82 makeBalanceKey(walletCommon.OptimismMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount2ETHInWei), 83 makeBalanceKey(walletCommon.OptimismMainnet, pathprocessor.UsdcSymbol): big.NewInt(testAmount100USDC), 84 makeBalanceKey(walletCommon.ArbitrumMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount2ETHInWei), 85 makeBalanceKey(walletCommon.ArbitrumMainnet, pathprocessor.UsdcSymbol): big.NewInt(testAmount100USDC), 86 } 87 ) 88 89 var mainnet = params.Network{ 90 ChainID: walletCommon.EthereumMainnet, 91 ChainName: "Mainnet", 92 RPCURL: "https://eth-archival.rpc.grove.city/v1/", 93 FallbackURL: "https://mainnet.infura.io/v3/", 94 BlockExplorerURL: "https://etherscan.io/", 95 IconURL: "network/Network=Ethereum", 96 ChainColor: "#627EEA", 97 ShortName: "eth", 98 NativeCurrencyName: "Ether", 99 NativeCurrencySymbol: "ETH", 100 NativeCurrencyDecimals: 18, 101 IsTest: false, 102 Layer: 1, 103 Enabled: true, 104 RelatedChainID: walletCommon.EthereumMainnet, 105 } 106 107 var sepolia = params.Network{ 108 ChainID: walletCommon.EthereumSepolia, 109 ChainName: "Mainnet", 110 RPCURL: "https://sepolia-archival.rpc.grove.city/v1/", 111 FallbackURL: "https://sepolia.infura.io/v3/", 112 BlockExplorerURL: "https://sepolia.etherscan.io/", 113 IconURL: "network/Network=Ethereum", 114 ChainColor: "#627EEA", 115 ShortName: "eth", 116 NativeCurrencyName: "Ether", 117 NativeCurrencySymbol: "ETH", 118 NativeCurrencyDecimals: 18, 119 IsTest: true, 120 Layer: 1, 121 Enabled: true, 122 RelatedChainID: walletCommon.EthereumMainnet, 123 } 124 125 var optimism = params.Network{ 126 ChainID: walletCommon.OptimismMainnet, 127 ChainName: "Optimism", 128 RPCURL: "https://optimism-mainnet.rpc.grove.city/v1/", 129 FallbackURL: "https://optimism-mainnet.infura.io/v3/", 130 BlockExplorerURL: "https://optimistic.etherscan.io", 131 IconURL: "network/Network=Optimism", 132 ChainColor: "#E90101", 133 ShortName: "oeth", 134 NativeCurrencyName: "Ether", 135 NativeCurrencySymbol: "ETH", 136 NativeCurrencyDecimals: 18, 137 IsTest: false, 138 Layer: 2, 139 Enabled: true, 140 RelatedChainID: walletCommon.OptimismMainnet, 141 } 142 143 var optimismSepolia = params.Network{ 144 ChainID: walletCommon.OptimismSepolia, 145 ChainName: "Optimism", 146 RPCURL: "https://optimism-sepolia-archival.rpc.grove.city/v1/", 147 FallbackURL: "https://optimism-sepolia.infura.io/v3/", 148 BlockExplorerURL: "https://sepolia-optimism.etherscan.io/", 149 IconURL: "network/Network=Optimism", 150 ChainColor: "#E90101", 151 ShortName: "oeth", 152 NativeCurrencyName: "Ether", 153 NativeCurrencySymbol: "ETH", 154 NativeCurrencyDecimals: 18, 155 IsTest: true, 156 Layer: 2, 157 Enabled: false, 158 RelatedChainID: walletCommon.OptimismMainnet, 159 } 160 161 var arbitrum = params.Network{ 162 ChainID: walletCommon.ArbitrumMainnet, 163 ChainName: "Arbitrum", 164 RPCURL: "https://arbitrum-one.rpc.grove.city/v1/", 165 FallbackURL: "https://arbitrum-mainnet.infura.io/v3/", 166 BlockExplorerURL: "https://arbiscan.io/", 167 IconURL: "network/Network=Arbitrum", 168 ChainColor: "#51D0F0", 169 ShortName: "arb1", 170 NativeCurrencyName: "Ether", 171 NativeCurrencySymbol: "ETH", 172 NativeCurrencyDecimals: 18, 173 IsTest: false, 174 Layer: 2, 175 Enabled: true, 176 RelatedChainID: walletCommon.ArbitrumMainnet, 177 } 178 179 var arbitrumSepolia = params.Network{ 180 ChainID: walletCommon.ArbitrumSepolia, 181 ChainName: "Arbitrum", 182 RPCURL: "https://arbitrum-sepolia-archival.rpc.grove.city/v1/", 183 FallbackURL: "https://arbitrum-sepolia.infura.io/v3/", 184 BlockExplorerURL: "https://sepolia-explorer.arbitrum.io/", 185 IconURL: "network/Network=Arbitrum", 186 ChainColor: "#51D0F0", 187 ShortName: "arb1", 188 NativeCurrencyName: "Ether", 189 NativeCurrencySymbol: "ETH", 190 NativeCurrencyDecimals: 18, 191 IsTest: true, 192 Layer: 2, 193 Enabled: false, 194 RelatedChainID: walletCommon.ArbitrumMainnet, 195 } 196 197 var defaultNetworks = []params.Network{ 198 mainnet, 199 sepolia, 200 optimism, 201 optimismSepolia, 202 arbitrum, 203 arbitrumSepolia, 204 } 205 206 type normalTestParams struct { 207 name string 208 input *requests.RouteInputParams 209 expectedCandidates routes.Route 210 expectedError *errors.ErrorResponse 211 } 212 213 func getNormalTestParamsList() []normalTestParams { 214 return []normalTestParams{ 215 { 216 name: "ETH transfer - Insufficient Funds", 217 input: &requests.RouteInputParams{ 218 TestnetMode: false, 219 Uuid: uuid.NewString(), 220 SendType: sendtype.Transfer, 221 AddrFrom: common.HexToAddress("0x1"), 222 AddrTo: common.HexToAddress("0x2"), 223 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 224 TokenID: pathprocessor.EthSymbol, 225 DisabledFromChainIDs: []uint64{walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 226 DisabledToChainIDs: []uint64{walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 227 228 TestsMode: true, 229 TestParams: &requests.RouterTestParams{ 230 TokenFrom: &token.Token{ 231 ChainID: 1, 232 Symbol: pathprocessor.EthSymbol, 233 Decimals: 18, 234 }, 235 TokenPrices: testTokenPrices, 236 SuggestedFees: testSuggestedFees, 237 BalanceMap: testBalanceMapPerChain, 238 EstimationMap: map[string]pathprocessor.Estimation{ 239 pathprocessor.ProcessorTransferName: { 240 Value: uint64(0), 241 Err: fmt.Errorf("failed with 50000000 gas: insufficient funds for gas * price + value: address %s have 68251537427723 want 100000000000000", common.HexToAddress("0x1")), 242 }, 243 }, 244 BonderFeeMap: testBBonderFeeMap, 245 ApprovalGasEstimation: testApprovalGasEstimation, 246 ApprovalL1Fee: testApprovalL1Fee, 247 }, 248 }, 249 expectedError: &errors.ErrorResponse{ 250 Code: errors.GenericErrorCode, 251 Details: fmt.Sprintf("failed with 50000000 gas: insufficient funds for gas * price + value: address %s", common.HexToAddress("0x1")), 252 }, 253 expectedCandidates: routes.Route{}, 254 }, 255 { 256 name: "ETH transfer - No Specific FromChain - No Specific ToChain - 0 AmountIn", 257 input: &requests.RouteInputParams{ 258 TestnetMode: false, 259 Uuid: uuid.NewString(), 260 SendType: sendtype.Transfer, 261 AddrFrom: common.HexToAddress("0x1"), 262 AddrTo: common.HexToAddress("0x2"), 263 AmountIn: (*hexutil.Big)(big.NewInt(0)), 264 TokenID: pathprocessor.EthSymbol, 265 266 TestsMode: true, 267 TestParams: &requests.RouterTestParams{ 268 TokenFrom: &token.Token{ 269 ChainID: 1, 270 Symbol: pathprocessor.EthSymbol, 271 Decimals: 18, 272 }, 273 TokenPrices: testTokenPrices, 274 SuggestedFees: testSuggestedFees, 275 BalanceMap: testBalanceMapPerChain, 276 EstimationMap: testEstimationMap, 277 BonderFeeMap: testBBonderFeeMap, 278 ApprovalGasEstimation: testApprovalGasEstimation, 279 ApprovalL1Fee: testApprovalL1Fee, 280 }, 281 }, 282 expectedCandidates: routes.Route{ 283 { 284 ProcessorName: pathprocessor.ProcessorTransferName, 285 FromChain: &mainnet, 286 ToChain: &mainnet, 287 ApprovalRequired: false, 288 }, 289 { 290 ProcessorName: pathprocessor.ProcessorTransferName, 291 FromChain: &optimism, 292 ToChain: &optimism, 293 ApprovalRequired: false, 294 }, 295 { 296 ProcessorName: pathprocessor.ProcessorTransferName, 297 FromChain: &arbitrum, 298 ToChain: &arbitrum, 299 ApprovalRequired: false, 300 }, 301 }, 302 }, 303 { 304 name: "ETH transfer - No Specific FromChain - No Specific ToChain", 305 input: &requests.RouteInputParams{ 306 TestnetMode: false, 307 Uuid: uuid.NewString(), 308 SendType: sendtype.Transfer, 309 AddrFrom: common.HexToAddress("0x1"), 310 AddrTo: common.HexToAddress("0x2"), 311 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 312 TokenID: pathprocessor.EthSymbol, 313 314 TestsMode: true, 315 TestParams: &requests.RouterTestParams{ 316 TokenFrom: &token.Token{ 317 ChainID: 1, 318 Symbol: pathprocessor.EthSymbol, 319 Decimals: 18, 320 }, 321 TokenPrices: testTokenPrices, 322 SuggestedFees: testSuggestedFees, 323 BalanceMap: testBalanceMapPerChain, 324 EstimationMap: testEstimationMap, 325 BonderFeeMap: testBBonderFeeMap, 326 ApprovalGasEstimation: testApprovalGasEstimation, 327 ApprovalL1Fee: testApprovalL1Fee, 328 }, 329 }, 330 expectedCandidates: routes.Route{ 331 { 332 ProcessorName: pathprocessor.ProcessorTransferName, 333 FromChain: &mainnet, 334 ToChain: &mainnet, 335 ApprovalRequired: false, 336 }, 337 { 338 ProcessorName: pathprocessor.ProcessorTransferName, 339 FromChain: &optimism, 340 ToChain: &optimism, 341 ApprovalRequired: false, 342 }, 343 { 344 ProcessorName: pathprocessor.ProcessorTransferName, 345 FromChain: &arbitrum, 346 ToChain: &arbitrum, 347 ApprovalRequired: false, 348 }, 349 { 350 ProcessorName: pathprocessor.ProcessorBridgeHopName, 351 FromChain: &mainnet, 352 ToChain: &optimism, 353 ApprovalRequired: false, 354 }, 355 { 356 ProcessorName: pathprocessor.ProcessorBridgeHopName, 357 FromChain: &mainnet, 358 ToChain: &arbitrum, 359 ApprovalRequired: false, 360 }, 361 { 362 ProcessorName: pathprocessor.ProcessorBridgeHopName, 363 FromChain: &optimism, 364 ToChain: &mainnet, 365 ApprovalRequired: false, 366 }, 367 { 368 ProcessorName: pathprocessor.ProcessorBridgeHopName, 369 FromChain: &optimism, 370 ToChain: &arbitrum, 371 ApprovalRequired: false, 372 }, 373 { 374 ProcessorName: pathprocessor.ProcessorBridgeHopName, 375 FromChain: &arbitrum, 376 ToChain: &mainnet, 377 ApprovalRequired: false, 378 }, 379 { 380 ProcessorName: pathprocessor.ProcessorBridgeHopName, 381 FromChain: &arbitrum, 382 ToChain: &optimism, 383 ApprovalRequired: false, 384 }, 385 }, 386 }, 387 { 388 name: "ETH transfer - No Specific FromChain - Specific Single ToChain", 389 input: &requests.RouteInputParams{ 390 TestnetMode: false, 391 Uuid: uuid.NewString(), 392 SendType: sendtype.Transfer, 393 AddrFrom: common.HexToAddress("0x1"), 394 AddrTo: common.HexToAddress("0x2"), 395 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 396 TokenID: pathprocessor.EthSymbol, 397 DisabledToChainIDs: []uint64{walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 398 399 TestsMode: true, 400 TestParams: &requests.RouterTestParams{ 401 TokenFrom: &token.Token{ 402 ChainID: 1, 403 Symbol: pathprocessor.EthSymbol, 404 Decimals: 18, 405 }, 406 TokenPrices: testTokenPrices, 407 BaseFee: big.NewInt(testBaseFee), 408 SuggestedFees: testSuggestedFees, 409 BalanceMap: testBalanceMapPerChain, 410 EstimationMap: testEstimationMap, 411 BonderFeeMap: testBBonderFeeMap, 412 ApprovalGasEstimation: testApprovalGasEstimation, 413 ApprovalL1Fee: testApprovalL1Fee, 414 }, 415 }, 416 expectedCandidates: routes.Route{ 417 { 418 ProcessorName: pathprocessor.ProcessorTransferName, 419 FromChain: &mainnet, 420 ToChain: &mainnet, 421 ApprovalRequired: false, 422 }, 423 { 424 ProcessorName: pathprocessor.ProcessorBridgeHopName, 425 FromChain: &optimism, 426 ToChain: &mainnet, 427 ApprovalRequired: false, 428 }, 429 { 430 ProcessorName: pathprocessor.ProcessorBridgeHopName, 431 FromChain: &arbitrum, 432 ToChain: &mainnet, 433 ApprovalRequired: false, 434 }, 435 }, 436 }, 437 { 438 name: "ETH transfer - No Specific FromChain - Specific Multiple ToChain", 439 input: &requests.RouteInputParams{ 440 TestnetMode: false, 441 Uuid: uuid.NewString(), 442 SendType: sendtype.Transfer, 443 AddrFrom: common.HexToAddress("0x1"), 444 AddrTo: common.HexToAddress("0x2"), 445 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 446 TokenID: pathprocessor.EthSymbol, 447 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet}, 448 449 TestsMode: true, 450 TestParams: &requests.RouterTestParams{ 451 TokenFrom: &token.Token{ 452 ChainID: 1, 453 Symbol: pathprocessor.EthSymbol, 454 Decimals: 18, 455 }, 456 TokenPrices: testTokenPrices, 457 BaseFee: big.NewInt(testBaseFee), 458 SuggestedFees: testSuggestedFees, 459 BalanceMap: testBalanceMapPerChain, 460 EstimationMap: testEstimationMap, 461 BonderFeeMap: testBBonderFeeMap, 462 ApprovalGasEstimation: testApprovalGasEstimation, 463 ApprovalL1Fee: testApprovalL1Fee, 464 }, 465 }, 466 expectedCandidates: routes.Route{ 467 { 468 ProcessorName: pathprocessor.ProcessorTransferName, 469 FromChain: &optimism, 470 ToChain: &optimism, 471 ApprovalRequired: false, 472 }, 473 { 474 ProcessorName: pathprocessor.ProcessorTransferName, 475 FromChain: &arbitrum, 476 ToChain: &arbitrum, 477 ApprovalRequired: false, 478 }, 479 { 480 ProcessorName: pathprocessor.ProcessorBridgeHopName, 481 FromChain: &mainnet, 482 ToChain: &optimism, 483 ApprovalRequired: false, 484 }, 485 { 486 ProcessorName: pathprocessor.ProcessorBridgeHopName, 487 FromChain: &mainnet, 488 ToChain: &arbitrum, 489 ApprovalRequired: false, 490 }, 491 { 492 ProcessorName: pathprocessor.ProcessorBridgeHopName, 493 FromChain: &optimism, 494 ToChain: &arbitrum, 495 ApprovalRequired: false, 496 }, 497 { 498 ProcessorName: pathprocessor.ProcessorBridgeHopName, 499 FromChain: &arbitrum, 500 ToChain: &optimism, 501 ApprovalRequired: false, 502 }, 503 }, 504 }, 505 { 506 name: "ETH transfer - Specific Single FromChain - No Specific ToChain", 507 input: &requests.RouteInputParams{ 508 TestnetMode: false, 509 Uuid: uuid.NewString(), 510 SendType: sendtype.Transfer, 511 AddrFrom: common.HexToAddress("0x1"), 512 AddrTo: common.HexToAddress("0x2"), 513 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 514 TokenID: pathprocessor.EthSymbol, 515 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 516 517 TestsMode: true, 518 TestParams: &requests.RouterTestParams{ 519 TokenFrom: &token.Token{ 520 ChainID: 1, 521 Symbol: pathprocessor.EthSymbol, 522 Decimals: 18, 523 }, 524 TokenPrices: testTokenPrices, 525 BaseFee: big.NewInt(testBaseFee), 526 SuggestedFees: testSuggestedFees, 527 BalanceMap: testBalanceMapPerChain, 528 529 EstimationMap: testEstimationMap, 530 BonderFeeMap: testBBonderFeeMap, 531 ApprovalGasEstimation: testApprovalGasEstimation, 532 ApprovalL1Fee: testApprovalL1Fee, 533 }, 534 }, 535 expectedCandidates: routes.Route{ 536 { 537 ProcessorName: pathprocessor.ProcessorTransferName, 538 FromChain: &arbitrum, 539 ToChain: &arbitrum, 540 ApprovalRequired: false, 541 }, 542 { 543 ProcessorName: pathprocessor.ProcessorBridgeHopName, 544 FromChain: &arbitrum, 545 ToChain: &mainnet, 546 ApprovalRequired: false, 547 }, 548 { 549 ProcessorName: pathprocessor.ProcessorBridgeHopName, 550 FromChain: &arbitrum, 551 ToChain: &optimism, 552 ApprovalRequired: false, 553 }, 554 }, 555 }, 556 { 557 name: "ETH transfer - Specific Multiple FromChain - No Specific ToChain", 558 input: &requests.RouteInputParams{ 559 TestnetMode: false, 560 Uuid: uuid.NewString(), 561 SendType: sendtype.Transfer, 562 AddrFrom: common.HexToAddress("0x1"), 563 AddrTo: common.HexToAddress("0x2"), 564 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 565 TokenID: pathprocessor.EthSymbol, 566 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet}, 567 568 TestsMode: true, 569 TestParams: &requests.RouterTestParams{ 570 TokenFrom: &token.Token{ 571 ChainID: 1, 572 Symbol: pathprocessor.EthSymbol, 573 Decimals: 18, 574 }, 575 TokenPrices: testTokenPrices, 576 BaseFee: big.NewInt(testBaseFee), 577 SuggestedFees: testSuggestedFees, 578 BalanceMap: testBalanceMapPerChain, 579 EstimationMap: testEstimationMap, 580 BonderFeeMap: testBBonderFeeMap, 581 ApprovalGasEstimation: testApprovalGasEstimation, 582 ApprovalL1Fee: testApprovalL1Fee, 583 }, 584 }, 585 expectedCandidates: routes.Route{ 586 { 587 ProcessorName: pathprocessor.ProcessorTransferName, 588 FromChain: &optimism, 589 ToChain: &optimism, 590 ApprovalRequired: false, 591 }, 592 { 593 ProcessorName: pathprocessor.ProcessorTransferName, 594 FromChain: &arbitrum, 595 ToChain: &arbitrum, 596 ApprovalRequired: false, 597 }, 598 { 599 ProcessorName: pathprocessor.ProcessorBridgeHopName, 600 FromChain: &optimism, 601 ToChain: &mainnet, 602 ApprovalRequired: false, 603 }, 604 { 605 ProcessorName: pathprocessor.ProcessorBridgeHopName, 606 FromChain: &optimism, 607 ToChain: &arbitrum, 608 ApprovalRequired: false, 609 }, 610 { 611 ProcessorName: pathprocessor.ProcessorBridgeHopName, 612 FromChain: &arbitrum, 613 ToChain: &mainnet, 614 ApprovalRequired: false, 615 }, 616 { 617 ProcessorName: pathprocessor.ProcessorBridgeHopName, 618 FromChain: &arbitrum, 619 ToChain: &optimism, 620 ApprovalRequired: false, 621 }, 622 }, 623 }, 624 { 625 name: "ETH transfer - Specific Single FromChain - Specific Single ToChain - Same Chains", 626 input: &requests.RouteInputParams{ 627 TestnetMode: false, 628 Uuid: uuid.NewString(), 629 SendType: sendtype.Transfer, 630 AddrFrom: common.HexToAddress("0x1"), 631 AddrTo: common.HexToAddress("0x2"), 632 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 633 TokenID: pathprocessor.EthSymbol, 634 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 635 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 636 637 TestsMode: true, 638 TestParams: &requests.RouterTestParams{ 639 TokenFrom: &token.Token{ 640 ChainID: 1, 641 Symbol: pathprocessor.EthSymbol, 642 Decimals: 18, 643 }, 644 TokenPrices: testTokenPrices, 645 BaseFee: big.NewInt(testBaseFee), 646 SuggestedFees: testSuggestedFees, 647 BalanceMap: testBalanceMapPerChain, 648 EstimationMap: testEstimationMap, 649 BonderFeeMap: testBBonderFeeMap, 650 ApprovalGasEstimation: testApprovalGasEstimation, 651 ApprovalL1Fee: testApprovalL1Fee, 652 }, 653 }, 654 expectedCandidates: routes.Route{ 655 { 656 ProcessorName: pathprocessor.ProcessorTransferName, 657 FromChain: &arbitrum, 658 ToChain: &arbitrum, 659 ApprovalRequired: false, 660 }, 661 }, 662 }, 663 { 664 name: "ETH transfer - Specific Single FromChain - Specific Single ToChain - Different Chains", 665 input: &requests.RouteInputParams{ 666 TestnetMode: false, 667 Uuid: uuid.NewString(), 668 SendType: sendtype.Transfer, 669 AddrFrom: common.HexToAddress("0x1"), 670 AddrTo: common.HexToAddress("0x2"), 671 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 672 TokenID: pathprocessor.EthSymbol, 673 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 674 DisabledToChainIDs: []uint64{walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 675 676 TestsMode: true, 677 TestParams: &requests.RouterTestParams{ 678 TokenFrom: &token.Token{ 679 ChainID: 1, 680 Symbol: pathprocessor.EthSymbol, 681 Decimals: 18, 682 }, 683 TokenPrices: testTokenPrices, 684 BaseFee: big.NewInt(testBaseFee), 685 SuggestedFees: testSuggestedFees, 686 BalanceMap: testBalanceMapPerChain, 687 EstimationMap: testEstimationMap, 688 BonderFeeMap: testBBonderFeeMap, 689 ApprovalGasEstimation: testApprovalGasEstimation, 690 ApprovalL1Fee: testApprovalL1Fee, 691 }, 692 }, 693 expectedCandidates: routes.Route{ 694 { 695 ProcessorName: pathprocessor.ProcessorBridgeHopName, 696 FromChain: &arbitrum, 697 ToChain: &mainnet, 698 ApprovalRequired: false, 699 }, 700 }, 701 }, 702 { 703 name: "ETH transfer - Specific Multiple FromChain - Specific Multiple ToChain - Single Common Chain", 704 input: &requests.RouteInputParams{ 705 TestnetMode: false, 706 Uuid: uuid.NewString(), 707 SendType: sendtype.Transfer, 708 AddrFrom: common.HexToAddress("0x1"), 709 AddrTo: common.HexToAddress("0x2"), 710 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 711 TokenID: pathprocessor.EthSymbol, 712 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 713 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 714 715 TestsMode: true, 716 TestParams: &requests.RouterTestParams{ 717 TokenFrom: &token.Token{ 718 ChainID: 1, 719 Symbol: pathprocessor.EthSymbol, 720 Decimals: 18, 721 }, 722 TokenPrices: testTokenPrices, 723 BaseFee: big.NewInt(testBaseFee), 724 SuggestedFees: testSuggestedFees, 725 BalanceMap: testBalanceMapPerChain, 726 EstimationMap: testEstimationMap, 727 BonderFeeMap: testBBonderFeeMap, 728 ApprovalGasEstimation: testApprovalGasEstimation, 729 ApprovalL1Fee: testApprovalL1Fee, 730 }, 731 }, 732 expectedCandidates: routes.Route{ 733 { 734 ProcessorName: pathprocessor.ProcessorTransferName, 735 FromChain: &arbitrum, 736 ToChain: &arbitrum, 737 ApprovalRequired: false, 738 }, 739 }, 740 }, 741 { 742 name: "ETH transfer - Specific Multiple FromChain - Specific Multiple ToChain - Multiple Common Chains", 743 input: &requests.RouteInputParams{ 744 TestnetMode: false, 745 Uuid: uuid.NewString(), 746 SendType: sendtype.Transfer, 747 AddrFrom: common.HexToAddress("0x1"), 748 AddrTo: common.HexToAddress("0x2"), 749 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 750 TokenID: pathprocessor.EthSymbol, 751 DisabledFromChainIDs: []uint64{walletCommon.OptimismMainnet}, 752 DisabledToChainIDs: []uint64{walletCommon.OptimismMainnet}, 753 754 TestsMode: true, 755 TestParams: &requests.RouterTestParams{ 756 TokenFrom: &token.Token{ 757 ChainID: 1, 758 Symbol: pathprocessor.EthSymbol, 759 Decimals: 18, 760 }, 761 TokenPrices: testTokenPrices, 762 BaseFee: big.NewInt(testBaseFee), 763 SuggestedFees: testSuggestedFees, 764 BalanceMap: testBalanceMapPerChain, 765 EstimationMap: testEstimationMap, 766 BonderFeeMap: testBBonderFeeMap, 767 ApprovalGasEstimation: testApprovalGasEstimation, 768 ApprovalL1Fee: testApprovalL1Fee, 769 }, 770 }, 771 expectedCandidates: routes.Route{ 772 { 773 ProcessorName: pathprocessor.ProcessorTransferName, 774 FromChain: &mainnet, 775 ToChain: &mainnet, 776 ApprovalRequired: false, 777 }, 778 { 779 ProcessorName: pathprocessor.ProcessorTransferName, 780 FromChain: &arbitrum, 781 ToChain: &arbitrum, 782 ApprovalRequired: false, 783 }, 784 { 785 ProcessorName: pathprocessor.ProcessorBridgeHopName, 786 FromChain: &mainnet, 787 ToChain: &arbitrum, 788 ApprovalRequired: false, 789 }, 790 { 791 ProcessorName: pathprocessor.ProcessorBridgeHopName, 792 FromChain: &arbitrum, 793 ToChain: &mainnet, 794 ApprovalRequired: false, 795 }, 796 }, 797 }, 798 { 799 name: "ETH transfer - Specific Multiple FromChain - Specific Multiple ToChain - No Common Chains", 800 input: &requests.RouteInputParams{ 801 TestnetMode: false, 802 Uuid: uuid.NewString(), 803 SendType: sendtype.Transfer, 804 AddrFrom: common.HexToAddress("0x1"), 805 AddrTo: common.HexToAddress("0x2"), 806 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 807 TokenID: pathprocessor.EthSymbol, 808 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 809 DisabledToChainIDs: []uint64{walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 810 811 TestsMode: true, 812 TestParams: &requests.RouterTestParams{ 813 TokenFrom: &token.Token{ 814 ChainID: 1, 815 Symbol: pathprocessor.EthSymbol, 816 Decimals: 18, 817 }, 818 TokenPrices: testTokenPrices, 819 BaseFee: big.NewInt(testBaseFee), 820 SuggestedFees: testSuggestedFees, 821 BalanceMap: testBalanceMapPerChain, 822 EstimationMap: testEstimationMap, 823 BonderFeeMap: testBBonderFeeMap, 824 ApprovalGasEstimation: testApprovalGasEstimation, 825 ApprovalL1Fee: testApprovalL1Fee, 826 }, 827 }, 828 expectedCandidates: routes.Route{ 829 { 830 ProcessorName: pathprocessor.ProcessorBridgeHopName, 831 FromChain: &arbitrum, 832 ToChain: &mainnet, 833 ApprovalRequired: false, 834 }, 835 }, 836 }, 837 { 838 name: "ETH transfer - All FromChains Disabled - All ToChains Disabled", 839 input: &requests.RouteInputParams{ 840 TestnetMode: false, 841 Uuid: uuid.NewString(), 842 SendType: sendtype.Transfer, 843 AddrFrom: common.HexToAddress("0x1"), 844 AddrTo: common.HexToAddress("0x2"), 845 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 846 TokenID: pathprocessor.EthSymbol, 847 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 848 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 849 850 TestsMode: true, 851 TestParams: &requests.RouterTestParams{ 852 TokenFrom: &token.Token{ 853 ChainID: 1, 854 Symbol: pathprocessor.EthSymbol, 855 Decimals: 18, 856 }, 857 TokenPrices: testTokenPrices, 858 BaseFee: big.NewInt(testBaseFee), 859 SuggestedFees: testSuggestedFees, 860 BalanceMap: testBalanceMapPerChain, 861 862 EstimationMap: testEstimationMap, 863 BonderFeeMap: testBBonderFeeMap, 864 ApprovalGasEstimation: testApprovalGasEstimation, 865 ApprovalL1Fee: testApprovalL1Fee, 866 }, 867 }, 868 expectedError: ErrNoBestRouteFound, 869 expectedCandidates: routes.Route{}, 870 }, 871 { 872 name: "ETH transfer - No Specific FromChain - No Specific ToChain - Single Chain LockedAmount", 873 input: &requests.RouteInputParams{ 874 TestnetMode: false, 875 Uuid: uuid.NewString(), 876 SendType: sendtype.Transfer, 877 AddrFrom: common.HexToAddress("0x1"), 878 AddrTo: common.HexToAddress("0x2"), 879 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 880 TokenID: pathprocessor.EthSymbol, 881 FromLockedAmount: map[uint64]*hexutil.Big{ 882 walletCommon.EthereumMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei)), 883 }, 884 885 TestsMode: true, 886 TestParams: &requests.RouterTestParams{ 887 TokenFrom: &token.Token{ 888 ChainID: 1, 889 Symbol: pathprocessor.EthSymbol, 890 Decimals: 18, 891 }, 892 TokenPrices: testTokenPrices, 893 BaseFee: big.NewInt(testBaseFee), 894 SuggestedFees: testSuggestedFees, 895 BalanceMap: testBalanceMapPerChain, 896 EstimationMap: testEstimationMap, 897 BonderFeeMap: testBBonderFeeMap, 898 ApprovalGasEstimation: testApprovalGasEstimation, 899 ApprovalL1Fee: testApprovalL1Fee, 900 }, 901 }, 902 expectedCandidates: routes.Route{ 903 { 904 ProcessorName: pathprocessor.ProcessorTransferName, 905 FromChain: &mainnet, 906 ToChain: &mainnet, 907 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei)), 908 ApprovalRequired: false, 909 }, 910 { 911 ProcessorName: pathprocessor.ProcessorTransferName, 912 FromChain: &optimism, 913 ToChain: &optimism, 914 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point8ETHInWei)), 915 ApprovalRequired: false, 916 }, 917 { 918 ProcessorName: pathprocessor.ProcessorTransferName, 919 FromChain: &arbitrum, 920 ToChain: &arbitrum, 921 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point8ETHInWei)), 922 ApprovalRequired: false, 923 }, 924 { 925 ProcessorName: pathprocessor.ProcessorBridgeHopName, 926 FromChain: &mainnet, 927 ToChain: &optimism, 928 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei - testBonderFeeETH)), 929 ApprovalRequired: false, 930 }, 931 { 932 ProcessorName: pathprocessor.ProcessorBridgeHopName, 933 FromChain: &mainnet, 934 ToChain: &arbitrum, 935 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei - testBonderFeeETH)), 936 ApprovalRequired: false, 937 }, 938 { 939 ProcessorName: pathprocessor.ProcessorBridgeHopName, 940 FromChain: &optimism, 941 ToChain: &mainnet, 942 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point8ETHInWei - testBonderFeeETH)), 943 ApprovalRequired: false, 944 }, 945 { 946 ProcessorName: pathprocessor.ProcessorBridgeHopName, 947 FromChain: &optimism, 948 ToChain: &arbitrum, 949 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point8ETHInWei - testBonderFeeETH)), 950 ApprovalRequired: false, 951 }, 952 { 953 ProcessorName: pathprocessor.ProcessorBridgeHopName, 954 FromChain: &arbitrum, 955 ToChain: &mainnet, 956 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point8ETHInWei - testBonderFeeETH)), 957 ApprovalRequired: false, 958 }, 959 { 960 ProcessorName: pathprocessor.ProcessorBridgeHopName, 961 FromChain: &arbitrum, 962 ToChain: &optimism, 963 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point8ETHInWei - testBonderFeeETH)), 964 ApprovalRequired: false, 965 }, 966 }, 967 }, 968 { 969 name: "ETH transfer - No Specific FromChain - Specific ToChain - Single Chain LockedAmount", 970 input: &requests.RouteInputParams{ 971 TestnetMode: false, 972 Uuid: uuid.NewString(), 973 SendType: sendtype.Transfer, 974 AddrFrom: common.HexToAddress("0x1"), 975 AddrTo: common.HexToAddress("0x2"), 976 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 977 TokenID: pathprocessor.EthSymbol, 978 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet}, 979 FromLockedAmount: map[uint64]*hexutil.Big{ 980 walletCommon.EthereumMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei)), 981 walletCommon.ArbitrumMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point3ETHInWei)), 982 }, 983 984 TestsMode: true, 985 TestParams: &requests.RouterTestParams{ 986 TokenFrom: &token.Token{ 987 ChainID: 1, 988 Symbol: pathprocessor.EthSymbol, 989 Decimals: 18, 990 }, 991 TokenPrices: testTokenPrices, 992 BaseFee: big.NewInt(testBaseFee), 993 SuggestedFees: testSuggestedFees, 994 BalanceMap: testBalanceMapPerChain, 995 EstimationMap: testEstimationMap, 996 BonderFeeMap: testBBonderFeeMap, 997 ApprovalGasEstimation: testApprovalGasEstimation, 998 ApprovalL1Fee: testApprovalL1Fee, 999 }, 1000 }, 1001 expectedCandidates: routes.Route{ 1002 { 1003 ProcessorName: pathprocessor.ProcessorTransferName, 1004 FromChain: &optimism, 1005 ToChain: &optimism, 1006 AmountOut: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei - testAmount0Point2ETHInWei - testAmount0Point3ETHInWei)), 1007 ApprovalRequired: false, 1008 }, 1009 { 1010 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1011 FromChain: &mainnet, 1012 ToChain: &optimism, 1013 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei - testBonderFeeETH)), //(*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei)), //(big.NewInt(testAmount0Point2ETHInWei - testBonderFeeETH)), 1014 ApprovalRequired: false, 1015 }, 1016 { 1017 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1018 FromChain: &arbitrum, 1019 ToChain: &optimism, 1020 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point3ETHInWei - testBonderFeeETH)), //(*hexutil.Big)(big.NewInt(testAmount0Point3ETHInWei)), 1021 ApprovalRequired: false, 1022 }, 1023 }, 1024 }, 1025 { 1026 name: "ETH transfer - No Specific FromChain - No Specific ToChain - Multiple Chains LockedAmount", 1027 input: &requests.RouteInputParams{ 1028 TestnetMode: false, 1029 Uuid: uuid.NewString(), 1030 SendType: sendtype.Transfer, 1031 AddrFrom: common.HexToAddress("0x1"), 1032 AddrTo: common.HexToAddress("0x2"), 1033 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 1034 TokenID: pathprocessor.EthSymbol, 1035 FromLockedAmount: map[uint64]*hexutil.Big{ 1036 walletCommon.EthereumMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei)), 1037 walletCommon.OptimismMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point3ETHInWei)), 1038 }, 1039 1040 TestsMode: true, 1041 TestParams: &requests.RouterTestParams{ 1042 TokenFrom: &token.Token{ 1043 ChainID: 1, 1044 Symbol: pathprocessor.EthSymbol, 1045 Decimals: 18, 1046 }, 1047 TokenPrices: testTokenPrices, 1048 BaseFee: big.NewInt(testBaseFee), 1049 SuggestedFees: testSuggestedFees, 1050 BalanceMap: testBalanceMapPerChain, 1051 EstimationMap: testEstimationMap, 1052 BonderFeeMap: testBBonderFeeMap, 1053 ApprovalGasEstimation: testApprovalGasEstimation, 1054 ApprovalL1Fee: testApprovalL1Fee, 1055 }, 1056 }, 1057 expectedCandidates: routes.Route{ 1058 { 1059 ProcessorName: pathprocessor.ProcessorTransferName, 1060 FromChain: &mainnet, 1061 ToChain: &mainnet, 1062 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei)), 1063 ApprovalRequired: false, 1064 }, 1065 { 1066 ProcessorName: pathprocessor.ProcessorTransferName, 1067 FromChain: &optimism, 1068 ToChain: &optimism, 1069 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point3ETHInWei)), 1070 ApprovalRequired: false, 1071 }, 1072 { 1073 ProcessorName: pathprocessor.ProcessorTransferName, 1074 FromChain: &arbitrum, 1075 ToChain: &arbitrum, 1076 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point5ETHInWei)), 1077 ApprovalRequired: false, 1078 }, 1079 { 1080 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1081 FromChain: &mainnet, 1082 ToChain: &optimism, 1083 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei - testBonderFeeETH)), 1084 ApprovalRequired: false, 1085 }, 1086 { 1087 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1088 FromChain: &mainnet, 1089 ToChain: &arbitrum, 1090 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei - testBonderFeeETH)), 1091 ApprovalRequired: false, 1092 }, 1093 { 1094 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1095 FromChain: &optimism, 1096 ToChain: &mainnet, 1097 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point3ETHInWei - testBonderFeeETH)), 1098 ApprovalRequired: false, 1099 }, 1100 { 1101 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1102 FromChain: &optimism, 1103 ToChain: &arbitrum, 1104 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point3ETHInWei - testBonderFeeETH)), 1105 ApprovalRequired: false, 1106 }, 1107 { 1108 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1109 FromChain: &arbitrum, 1110 ToChain: &mainnet, 1111 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point5ETHInWei - testBonderFeeETH)), 1112 ApprovalRequired: false, 1113 }, 1114 { 1115 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1116 FromChain: &arbitrum, 1117 ToChain: &optimism, 1118 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point5ETHInWei - testBonderFeeETH)), 1119 ApprovalRequired: false, 1120 }, 1121 }, 1122 }, 1123 { 1124 name: "ETH transfer - No Specific FromChain - No Specific ToChain - All Chains LockedAmount", 1125 input: &requests.RouteInputParams{ 1126 TestnetMode: false, 1127 Uuid: uuid.NewString(), 1128 SendType: sendtype.Transfer, 1129 AddrFrom: common.HexToAddress("0x1"), 1130 AddrTo: common.HexToAddress("0x2"), 1131 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 1132 TokenID: pathprocessor.EthSymbol, 1133 FromLockedAmount: map[uint64]*hexutil.Big{ 1134 walletCommon.EthereumMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei)), 1135 walletCommon.OptimismMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point3ETHInWei)), 1136 walletCommon.ArbitrumMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point5ETHInWei)), 1137 }, 1138 1139 TestsMode: true, 1140 TestParams: &requests.RouterTestParams{ 1141 TokenFrom: &token.Token{ 1142 ChainID: 1, 1143 Symbol: pathprocessor.EthSymbol, 1144 Decimals: 18, 1145 }, 1146 TokenPrices: testTokenPrices, 1147 BaseFee: big.NewInt(testBaseFee), 1148 SuggestedFees: testSuggestedFees, 1149 BalanceMap: testBalanceMapPerChain, 1150 EstimationMap: testEstimationMap, 1151 BonderFeeMap: testBBonderFeeMap, 1152 ApprovalGasEstimation: testApprovalGasEstimation, 1153 ApprovalL1Fee: testApprovalL1Fee, 1154 }, 1155 }, 1156 expectedCandidates: routes.Route{ 1157 { 1158 ProcessorName: pathprocessor.ProcessorTransferName, 1159 FromChain: &mainnet, 1160 ToChain: &mainnet, 1161 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei)), 1162 ApprovalRequired: false, 1163 }, 1164 { 1165 ProcessorName: pathprocessor.ProcessorTransferName, 1166 FromChain: &optimism, 1167 ToChain: &optimism, 1168 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point3ETHInWei)), 1169 ApprovalRequired: false, 1170 }, 1171 { 1172 ProcessorName: pathprocessor.ProcessorTransferName, 1173 FromChain: &arbitrum, 1174 ToChain: &arbitrum, 1175 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point5ETHInWei)), 1176 ApprovalRequired: false, 1177 }, 1178 { 1179 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1180 FromChain: &mainnet, 1181 ToChain: &optimism, 1182 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei - testBonderFeeETH)), 1183 ApprovalRequired: false, 1184 }, 1185 { 1186 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1187 FromChain: &mainnet, 1188 ToChain: &arbitrum, 1189 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei - testBonderFeeETH)), 1190 ApprovalRequired: false, 1191 }, 1192 { 1193 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1194 FromChain: &optimism, 1195 ToChain: &mainnet, 1196 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point3ETHInWei - testBonderFeeETH)), 1197 ApprovalRequired: false, 1198 }, 1199 { 1200 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1201 FromChain: &optimism, 1202 ToChain: &arbitrum, 1203 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point3ETHInWei - testBonderFeeETH)), 1204 ApprovalRequired: false, 1205 }, 1206 { 1207 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1208 FromChain: &arbitrum, 1209 ToChain: &mainnet, 1210 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point5ETHInWei - testBonderFeeETH)), 1211 ApprovalRequired: false, 1212 }, 1213 { 1214 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1215 FromChain: &arbitrum, 1216 ToChain: &optimism, 1217 AmountOut: (*hexutil.Big)(big.NewInt(testAmount0Point5ETHInWei - testBonderFeeETH)), 1218 ApprovalRequired: false, 1219 }, 1220 }, 1221 }, 1222 { 1223 name: "ETH transfer - No Specific FromChain - No Specific ToChain - All Chains LockedAmount with insufficient amount", 1224 input: &requests.RouteInputParams{ 1225 TestnetMode: false, 1226 Uuid: uuid.NewString(), 1227 SendType: sendtype.Transfer, 1228 AddrFrom: common.HexToAddress("0x1"), 1229 AddrTo: common.HexToAddress("0x2"), 1230 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 1231 TokenID: pathprocessor.EthSymbol, 1232 FromLockedAmount: map[uint64]*hexutil.Big{ 1233 walletCommon.EthereumMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point2ETHInWei)), 1234 walletCommon.OptimismMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point3ETHInWei)), 1235 walletCommon.ArbitrumMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point4ETHInWei)), 1236 }, 1237 1238 TestsMode: true, 1239 TestParams: &requests.RouterTestParams{ 1240 TokenFrom: &token.Token{ 1241 ChainID: 1, 1242 Symbol: pathprocessor.EthSymbol, 1243 Decimals: 18, 1244 }, 1245 TokenPrices: testTokenPrices, 1246 BaseFee: big.NewInt(testBaseFee), 1247 SuggestedFees: testSuggestedFees, 1248 BalanceMap: testBalanceMapPerChain, 1249 EstimationMap: testEstimationMap, 1250 BonderFeeMap: testBBonderFeeMap, 1251 ApprovalGasEstimation: testApprovalGasEstimation, 1252 ApprovalL1Fee: testApprovalL1Fee, 1253 }, 1254 }, 1255 expectedError: requests.ErrLockedAmountLessThanSendAmountAllNetworks, 1256 expectedCandidates: routes.Route{}, 1257 }, 1258 { 1259 name: "ETH transfer - No Specific FromChain - No Specific ToChain - LockedAmount exceeds sending amount", 1260 input: &requests.RouteInputParams{ 1261 TestnetMode: false, 1262 Uuid: uuid.NewString(), 1263 SendType: sendtype.Transfer, 1264 AddrFrom: common.HexToAddress("0x1"), 1265 AddrTo: common.HexToAddress("0x2"), 1266 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 1267 TokenID: pathprocessor.EthSymbol, 1268 FromLockedAmount: map[uint64]*hexutil.Big{ 1269 walletCommon.OptimismMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point3ETHInWei)), 1270 walletCommon.ArbitrumMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point8ETHInWei)), 1271 }, 1272 1273 TestsMode: true, 1274 TestParams: &requests.RouterTestParams{ 1275 TokenFrom: &token.Token{ 1276 ChainID: 1, 1277 Symbol: pathprocessor.EthSymbol, 1278 Decimals: 18, 1279 }, 1280 TokenPrices: testTokenPrices, 1281 BaseFee: big.NewInt(testBaseFee), 1282 SuggestedFees: testSuggestedFees, 1283 BalanceMap: testBalanceMapPerChain, 1284 EstimationMap: testEstimationMap, 1285 BonderFeeMap: testBBonderFeeMap, 1286 ApprovalGasEstimation: testApprovalGasEstimation, 1287 ApprovalL1Fee: testApprovalL1Fee, 1288 }, 1289 }, 1290 expectedError: requests.ErrLockedAmountExceedsTotalSendAmount, 1291 expectedCandidates: routes.Route{}, 1292 }, 1293 { 1294 name: "ERC20 transfer - No Specific FromChain - No Specific ToChain", 1295 input: &requests.RouteInputParams{ 1296 TestnetMode: false, 1297 Uuid: uuid.NewString(), 1298 SendType: sendtype.Transfer, 1299 AddrFrom: common.HexToAddress("0x1"), 1300 AddrTo: common.HexToAddress("0x2"), 1301 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 1302 TokenID: pathprocessor.UsdcSymbol, 1303 1304 TestsMode: true, 1305 TestParams: &requests.RouterTestParams{ 1306 TokenFrom: &token.Token{ 1307 ChainID: 1, 1308 Symbol: pathprocessor.UsdcSymbol, 1309 Decimals: 6, 1310 }, 1311 TokenPrices: testTokenPrices, 1312 BaseFee: big.NewInt(testBaseFee), 1313 SuggestedFees: testSuggestedFees, 1314 BalanceMap: testBalanceMapPerChain, 1315 EstimationMap: testEstimationMap, 1316 BonderFeeMap: testBBonderFeeMap, 1317 ApprovalGasEstimation: testApprovalGasEstimation, 1318 ApprovalL1Fee: testApprovalL1Fee, 1319 }, 1320 }, 1321 expectedCandidates: routes.Route{ 1322 { 1323 ProcessorName: pathprocessor.ProcessorTransferName, 1324 FromChain: &mainnet, 1325 ToChain: &mainnet, 1326 ApprovalRequired: false, 1327 }, 1328 { 1329 ProcessorName: pathprocessor.ProcessorTransferName, 1330 FromChain: &optimism, 1331 ToChain: &optimism, 1332 ApprovalRequired: false, 1333 }, 1334 { 1335 ProcessorName: pathprocessor.ProcessorTransferName, 1336 FromChain: &arbitrum, 1337 ToChain: &arbitrum, 1338 ApprovalRequired: false, 1339 }, 1340 { 1341 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1342 FromChain: &mainnet, 1343 ToChain: &optimism, 1344 ApprovalRequired: true, 1345 }, 1346 { 1347 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1348 FromChain: &mainnet, 1349 ToChain: &arbitrum, 1350 ApprovalRequired: true, 1351 }, 1352 { 1353 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1354 FromChain: &optimism, 1355 ToChain: &mainnet, 1356 ApprovalRequired: true, 1357 }, 1358 { 1359 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1360 FromChain: &optimism, 1361 ToChain: &arbitrum, 1362 ApprovalRequired: true, 1363 }, 1364 { 1365 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1366 FromChain: &arbitrum, 1367 ToChain: &mainnet, 1368 ApprovalRequired: true, 1369 }, 1370 { 1371 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1372 FromChain: &arbitrum, 1373 ToChain: &optimism, 1374 ApprovalRequired: true, 1375 }, 1376 }, 1377 }, 1378 { 1379 name: "ERC20 transfer - No Specific FromChain - Specific Single ToChain", 1380 input: &requests.RouteInputParams{ 1381 TestnetMode: false, 1382 Uuid: uuid.NewString(), 1383 SendType: sendtype.Transfer, 1384 AddrFrom: common.HexToAddress("0x1"), 1385 AddrTo: common.HexToAddress("0x2"), 1386 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 1387 TokenID: pathprocessor.UsdcSymbol, 1388 DisabledToChainIDs: []uint64{walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 1389 1390 TestsMode: true, 1391 TestParams: &requests.RouterTestParams{ 1392 TokenFrom: &token.Token{ 1393 ChainID: 1, 1394 Symbol: pathprocessor.UsdcSymbol, 1395 Decimals: 6, 1396 }, 1397 TokenPrices: testTokenPrices, 1398 BaseFee: big.NewInt(testBaseFee), 1399 SuggestedFees: testSuggestedFees, 1400 BalanceMap: testBalanceMapPerChain, 1401 EstimationMap: testEstimationMap, 1402 BonderFeeMap: testBBonderFeeMap, 1403 ApprovalGasEstimation: testApprovalGasEstimation, 1404 ApprovalL1Fee: testApprovalL1Fee, 1405 }, 1406 }, 1407 expectedCandidates: routes.Route{ 1408 { 1409 ProcessorName: pathprocessor.ProcessorTransferName, 1410 FromChain: &mainnet, 1411 ToChain: &mainnet, 1412 ApprovalRequired: false, 1413 }, 1414 { 1415 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1416 FromChain: &optimism, 1417 ToChain: &mainnet, 1418 ApprovalRequired: true, 1419 }, 1420 { 1421 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1422 FromChain: &arbitrum, 1423 ToChain: &mainnet, 1424 ApprovalRequired: true, 1425 }, 1426 }, 1427 }, 1428 { 1429 name: "ERC20 transfer - No Specific FromChain - Specific Multiple ToChain", 1430 input: &requests.RouteInputParams{ 1431 TestnetMode: false, 1432 Uuid: uuid.NewString(), 1433 SendType: sendtype.Transfer, 1434 AddrFrom: common.HexToAddress("0x1"), 1435 AddrTo: common.HexToAddress("0x2"), 1436 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 1437 TokenID: pathprocessor.UsdcSymbol, 1438 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet}, 1439 1440 TestsMode: true, 1441 TestParams: &requests.RouterTestParams{ 1442 TokenFrom: &token.Token{ 1443 ChainID: 1, 1444 Symbol: pathprocessor.UsdcSymbol, 1445 Decimals: 6, 1446 }, 1447 TokenPrices: testTokenPrices, 1448 BaseFee: big.NewInt(testBaseFee), 1449 SuggestedFees: testSuggestedFees, 1450 BalanceMap: testBalanceMapPerChain, 1451 EstimationMap: testEstimationMap, 1452 BonderFeeMap: testBBonderFeeMap, 1453 ApprovalGasEstimation: testApprovalGasEstimation, 1454 ApprovalL1Fee: testApprovalL1Fee, 1455 }, 1456 }, 1457 expectedCandidates: routes.Route{ 1458 { 1459 ProcessorName: pathprocessor.ProcessorTransferName, 1460 FromChain: &optimism, 1461 ToChain: &optimism, 1462 ApprovalRequired: false, 1463 }, 1464 { 1465 ProcessorName: pathprocessor.ProcessorTransferName, 1466 FromChain: &arbitrum, 1467 ToChain: &arbitrum, 1468 ApprovalRequired: false, 1469 }, 1470 { 1471 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1472 FromChain: &mainnet, 1473 ToChain: &optimism, 1474 ApprovalRequired: true, 1475 }, 1476 { 1477 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1478 FromChain: &mainnet, 1479 ToChain: &arbitrum, 1480 ApprovalRequired: true, 1481 }, 1482 { 1483 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1484 FromChain: &optimism, 1485 ToChain: &arbitrum, 1486 ApprovalRequired: true, 1487 }, 1488 { 1489 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1490 FromChain: &arbitrum, 1491 ToChain: &optimism, 1492 ApprovalRequired: true, 1493 }, 1494 }, 1495 }, 1496 { 1497 name: "ERC20 transfer - Specific Single FromChain - No Specific ToChain", 1498 input: &requests.RouteInputParams{ 1499 TestnetMode: false, 1500 Uuid: uuid.NewString(), 1501 SendType: sendtype.Transfer, 1502 AddrFrom: common.HexToAddress("0x1"), 1503 AddrTo: common.HexToAddress("0x2"), 1504 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 1505 TokenID: pathprocessor.UsdcSymbol, 1506 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 1507 1508 TestsMode: true, 1509 TestParams: &requests.RouterTestParams{ 1510 TokenFrom: &token.Token{ 1511 ChainID: 1, 1512 Symbol: pathprocessor.UsdcSymbol, 1513 Decimals: 6, 1514 }, 1515 TokenPrices: testTokenPrices, 1516 BaseFee: big.NewInt(testBaseFee), 1517 SuggestedFees: testSuggestedFees, 1518 BalanceMap: testBalanceMapPerChain, 1519 EstimationMap: testEstimationMap, 1520 BonderFeeMap: testBBonderFeeMap, 1521 ApprovalGasEstimation: testApprovalGasEstimation, 1522 ApprovalL1Fee: testApprovalL1Fee, 1523 }, 1524 }, 1525 expectedCandidates: routes.Route{ 1526 { 1527 ProcessorName: pathprocessor.ProcessorTransferName, 1528 FromChain: &arbitrum, 1529 ToChain: &arbitrum, 1530 ApprovalRequired: false, 1531 }, 1532 { 1533 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1534 FromChain: &arbitrum, 1535 ToChain: &mainnet, 1536 ApprovalRequired: true, 1537 }, 1538 { 1539 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1540 FromChain: &arbitrum, 1541 ToChain: &optimism, 1542 ApprovalRequired: true, 1543 }, 1544 }, 1545 }, 1546 { 1547 name: "ERC20 transfer - Specific Multiple FromChain - No Specific ToChain", 1548 input: &requests.RouteInputParams{ 1549 TestnetMode: false, 1550 Uuid: uuid.NewString(), 1551 SendType: sendtype.Transfer, 1552 AddrFrom: common.HexToAddress("0x1"), 1553 AddrTo: common.HexToAddress("0x2"), 1554 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 1555 TokenID: pathprocessor.UsdcSymbol, 1556 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet}, 1557 1558 TestsMode: true, 1559 TestParams: &requests.RouterTestParams{ 1560 TokenFrom: &token.Token{ 1561 ChainID: 1, 1562 Symbol: pathprocessor.UsdcSymbol, 1563 Decimals: 6, 1564 }, 1565 TokenPrices: testTokenPrices, 1566 BaseFee: big.NewInt(testBaseFee), 1567 SuggestedFees: testSuggestedFees, 1568 BalanceMap: testBalanceMapPerChain, 1569 EstimationMap: testEstimationMap, 1570 BonderFeeMap: testBBonderFeeMap, 1571 ApprovalGasEstimation: testApprovalGasEstimation, 1572 ApprovalL1Fee: testApprovalL1Fee, 1573 }, 1574 }, 1575 expectedCandidates: routes.Route{ 1576 { 1577 ProcessorName: pathprocessor.ProcessorTransferName, 1578 FromChain: &optimism, 1579 ToChain: &optimism, 1580 ApprovalRequired: false, 1581 }, 1582 { 1583 ProcessorName: pathprocessor.ProcessorTransferName, 1584 FromChain: &arbitrum, 1585 ToChain: &arbitrum, 1586 ApprovalRequired: false, 1587 }, 1588 { 1589 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1590 FromChain: &optimism, 1591 ToChain: &mainnet, 1592 ApprovalRequired: true, 1593 }, 1594 { 1595 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1596 FromChain: &optimism, 1597 ToChain: &arbitrum, 1598 ApprovalRequired: true, 1599 }, 1600 { 1601 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1602 FromChain: &arbitrum, 1603 ToChain: &mainnet, 1604 ApprovalRequired: true, 1605 }, 1606 { 1607 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1608 FromChain: &arbitrum, 1609 ToChain: &optimism, 1610 ApprovalRequired: true, 1611 }, 1612 }, 1613 }, 1614 { 1615 name: "ERC20 transfer - Specific Single FromChain - Specific Single ToChain - Same Chains", 1616 input: &requests.RouteInputParams{ 1617 TestnetMode: false, 1618 Uuid: uuid.NewString(), 1619 SendType: sendtype.Transfer, 1620 AddrFrom: common.HexToAddress("0x1"), 1621 AddrTo: common.HexToAddress("0x2"), 1622 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 1623 TokenID: pathprocessor.UsdcSymbol, 1624 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 1625 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 1626 1627 TestsMode: true, 1628 TestParams: &requests.RouterTestParams{ 1629 TokenFrom: &token.Token{ 1630 ChainID: 1, 1631 Symbol: pathprocessor.UsdcSymbol, 1632 Decimals: 6, 1633 }, 1634 TokenPrices: testTokenPrices, 1635 BaseFee: big.NewInt(testBaseFee), 1636 SuggestedFees: testSuggestedFees, 1637 BalanceMap: testBalanceMapPerChain, 1638 EstimationMap: testEstimationMap, 1639 BonderFeeMap: testBBonderFeeMap, 1640 ApprovalGasEstimation: testApprovalGasEstimation, 1641 ApprovalL1Fee: testApprovalL1Fee, 1642 }, 1643 }, 1644 expectedCandidates: routes.Route{ 1645 { 1646 ProcessorName: pathprocessor.ProcessorTransferName, 1647 FromChain: &arbitrum, 1648 ToChain: &arbitrum, 1649 ApprovalRequired: false, 1650 }, 1651 }, 1652 }, 1653 { 1654 name: "ERC20 transfer - Specific Single FromChain - Specific Single ToChain - Different Chains", 1655 input: &requests.RouteInputParams{ 1656 TestnetMode: false, 1657 Uuid: uuid.NewString(), 1658 SendType: sendtype.Transfer, 1659 AddrFrom: common.HexToAddress("0x1"), 1660 AddrTo: common.HexToAddress("0x2"), 1661 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 1662 TokenID: pathprocessor.UsdcSymbol, 1663 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 1664 DisabledToChainIDs: []uint64{walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 1665 1666 TestsMode: true, 1667 TestParams: &requests.RouterTestParams{ 1668 TokenFrom: &token.Token{ 1669 ChainID: 1, 1670 Symbol: pathprocessor.UsdcSymbol, 1671 Decimals: 6, 1672 }, 1673 TokenPrices: testTokenPrices, 1674 BaseFee: big.NewInt(testBaseFee), 1675 SuggestedFees: testSuggestedFees, 1676 BalanceMap: testBalanceMapPerChain, 1677 EstimationMap: testEstimationMap, 1678 BonderFeeMap: testBBonderFeeMap, 1679 ApprovalGasEstimation: testApprovalGasEstimation, 1680 ApprovalL1Fee: testApprovalL1Fee, 1681 }, 1682 }, 1683 expectedCandidates: routes.Route{ 1684 { 1685 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1686 FromChain: &arbitrum, 1687 ToChain: &mainnet, 1688 ApprovalRequired: true, 1689 }, 1690 }, 1691 }, 1692 { 1693 name: "ERC20 transfer - Specific Multiple FromChain - Specific Multiple ToChain - Single Common Chain", 1694 input: &requests.RouteInputParams{ 1695 TestnetMode: false, 1696 Uuid: uuid.NewString(), 1697 SendType: sendtype.Transfer, 1698 AddrFrom: common.HexToAddress("0x1"), 1699 AddrTo: common.HexToAddress("0x2"), 1700 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 1701 TokenID: pathprocessor.UsdcSymbol, 1702 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 1703 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 1704 1705 TestsMode: true, 1706 TestParams: &requests.RouterTestParams{ 1707 TokenFrom: &token.Token{ 1708 ChainID: 1, 1709 Symbol: pathprocessor.UsdcSymbol, 1710 Decimals: 6, 1711 }, 1712 TokenPrices: testTokenPrices, 1713 BaseFee: big.NewInt(testBaseFee), 1714 SuggestedFees: testSuggestedFees, 1715 BalanceMap: testBalanceMapPerChain, 1716 EstimationMap: testEstimationMap, 1717 BonderFeeMap: testBBonderFeeMap, 1718 ApprovalGasEstimation: testApprovalGasEstimation, 1719 ApprovalL1Fee: testApprovalL1Fee, 1720 }, 1721 }, 1722 expectedCandidates: routes.Route{ 1723 { 1724 ProcessorName: pathprocessor.ProcessorTransferName, 1725 FromChain: &arbitrum, 1726 ToChain: &arbitrum, 1727 ApprovalRequired: false, 1728 }, 1729 }, 1730 }, 1731 { 1732 name: "ERC20 transfer - Specific Multiple FromChain - Specific Multiple ToChain - Multiple Common Chains", 1733 input: &requests.RouteInputParams{ 1734 TestnetMode: false, 1735 Uuid: uuid.NewString(), 1736 SendType: sendtype.Transfer, 1737 AddrFrom: common.HexToAddress("0x1"), 1738 AddrTo: common.HexToAddress("0x2"), 1739 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 1740 TokenID: pathprocessor.UsdcSymbol, 1741 DisabledFromChainIDs: []uint64{walletCommon.OptimismMainnet}, 1742 DisabledToChainIDs: []uint64{walletCommon.OptimismMainnet}, 1743 1744 TestsMode: true, 1745 TestParams: &requests.RouterTestParams{ 1746 TokenFrom: &token.Token{ 1747 ChainID: 1, 1748 Symbol: pathprocessor.UsdcSymbol, 1749 Decimals: 6, 1750 }, 1751 TokenPrices: testTokenPrices, 1752 BaseFee: big.NewInt(testBaseFee), 1753 SuggestedFees: testSuggestedFees, 1754 BalanceMap: testBalanceMapPerChain, 1755 EstimationMap: testEstimationMap, 1756 BonderFeeMap: testBBonderFeeMap, 1757 ApprovalGasEstimation: testApprovalGasEstimation, 1758 ApprovalL1Fee: testApprovalL1Fee, 1759 }, 1760 }, 1761 expectedCandidates: routes.Route{ 1762 { 1763 ProcessorName: pathprocessor.ProcessorTransferName, 1764 FromChain: &mainnet, 1765 ToChain: &mainnet, 1766 ApprovalRequired: false, 1767 }, 1768 { 1769 ProcessorName: pathprocessor.ProcessorTransferName, 1770 FromChain: &arbitrum, 1771 ToChain: &arbitrum, 1772 ApprovalRequired: false, 1773 }, 1774 { 1775 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1776 FromChain: &mainnet, 1777 ToChain: &arbitrum, 1778 ApprovalRequired: true, 1779 }, 1780 { 1781 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1782 FromChain: &arbitrum, 1783 ToChain: &mainnet, 1784 ApprovalRequired: true, 1785 }, 1786 }, 1787 }, 1788 { 1789 name: "ERC20 transfer - Specific Multiple FromChain - Specific Multiple ToChain - No Common Chains", 1790 input: &requests.RouteInputParams{ 1791 TestnetMode: false, 1792 Uuid: uuid.NewString(), 1793 SendType: sendtype.Transfer, 1794 AddrFrom: common.HexToAddress("0x1"), 1795 AddrTo: common.HexToAddress("0x2"), 1796 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 1797 TokenID: pathprocessor.UsdcSymbol, 1798 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 1799 DisabledToChainIDs: []uint64{walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 1800 1801 TestsMode: true, 1802 TestParams: &requests.RouterTestParams{ 1803 TokenFrom: &token.Token{ 1804 ChainID: 1, 1805 Symbol: pathprocessor.UsdcSymbol, 1806 Decimals: 6, 1807 }, 1808 TokenPrices: testTokenPrices, 1809 BaseFee: big.NewInt(testBaseFee), 1810 SuggestedFees: testSuggestedFees, 1811 BalanceMap: testBalanceMapPerChain, 1812 EstimationMap: testEstimationMap, 1813 BonderFeeMap: testBBonderFeeMap, 1814 ApprovalGasEstimation: testApprovalGasEstimation, 1815 ApprovalL1Fee: testApprovalL1Fee, 1816 }, 1817 }, 1818 expectedCandidates: routes.Route{ 1819 { 1820 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1821 FromChain: &arbitrum, 1822 ToChain: &mainnet, 1823 ApprovalRequired: true, 1824 }, 1825 }, 1826 }, 1827 { 1828 name: "ERC20 transfer - All FromChains Disabled - All ToChains Disabled", 1829 input: &requests.RouteInputParams{ 1830 TestnetMode: false, 1831 Uuid: uuid.NewString(), 1832 SendType: sendtype.Transfer, 1833 AddrFrom: common.HexToAddress("0x1"), 1834 AddrTo: common.HexToAddress("0x2"), 1835 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 1836 TokenID: pathprocessor.UsdcSymbol, 1837 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 1838 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 1839 1840 TestsMode: true, 1841 TestParams: &requests.RouterTestParams{ 1842 TokenFrom: &token.Token{ 1843 ChainID: 1, 1844 Symbol: pathprocessor.UsdcSymbol, 1845 Decimals: 6, 1846 }, 1847 TokenPrices: testTokenPrices, 1848 BaseFee: big.NewInt(testBaseFee), 1849 SuggestedFees: testSuggestedFees, 1850 BalanceMap: testBalanceMapPerChain, 1851 EstimationMap: testEstimationMap, 1852 BonderFeeMap: testBBonderFeeMap, 1853 ApprovalGasEstimation: testApprovalGasEstimation, 1854 ApprovalL1Fee: testApprovalL1Fee, 1855 }, 1856 }, 1857 expectedError: ErrNoBestRouteFound, 1858 expectedCandidates: routes.Route{}, 1859 }, 1860 { 1861 name: "ERC20 transfer - All FromChains - No Locked Amount - Enough Token Balance Across All Chains", 1862 input: &requests.RouteInputParams{ 1863 TestnetMode: false, 1864 Uuid: uuid.NewString(), 1865 SendType: sendtype.Transfer, 1866 AddrFrom: common.HexToAddress("0x1"), 1867 AddrTo: common.HexToAddress("0x2"), 1868 AmountIn: (*hexutil.Big)(big.NewInt(2.5 * testAmount100USDC)), 1869 TokenID: pathprocessor.UsdcSymbol, 1870 1871 TestsMode: true, 1872 TestParams: &requests.RouterTestParams{ 1873 TokenFrom: &token.Token{ 1874 ChainID: 1, 1875 Symbol: pathprocessor.UsdcSymbol, 1876 Decimals: 6, 1877 }, 1878 TokenPrices: testTokenPrices, 1879 BaseFee: big.NewInt(testBaseFee), 1880 SuggestedFees: testSuggestedFees, 1881 BalanceMap: testBalanceMapPerChain, 1882 EstimationMap: testEstimationMap, 1883 BonderFeeMap: testBBonderFeeMap, 1884 ApprovalGasEstimation: testApprovalGasEstimation, 1885 ApprovalL1Fee: testApprovalL1Fee, 1886 }, 1887 }, 1888 expectedCandidates: routes.Route{ 1889 { 1890 ProcessorName: pathprocessor.ProcessorTransferName, 1891 FromChain: &mainnet, 1892 ToChain: &mainnet, 1893 AmountOut: (*hexutil.Big)(big.NewInt(2.5 * testAmount100USDC)), 1894 ApprovalRequired: false, 1895 }, 1896 { 1897 ProcessorName: pathprocessor.ProcessorTransferName, 1898 FromChain: &mainnet, 1899 ToChain: &mainnet, 1900 AmountOut: (*hexutil.Big)(big.NewInt(testAmount100USDC)), 1901 ApprovalRequired: false, 1902 }, 1903 { 1904 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1905 FromChain: &mainnet, 1906 ToChain: &optimism, 1907 AmountOut: (*hexutil.Big)(big.NewInt(2.5*testAmount100USDC - testBonderFeeUSDC)), 1908 ApprovalRequired: true, 1909 }, 1910 { 1911 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1912 FromChain: &mainnet, 1913 ToChain: &optimism, 1914 AmountOut: (*hexutil.Big)(big.NewInt(testAmount100USDC - testBonderFeeUSDC)), 1915 ApprovalRequired: true, 1916 }, 1917 { 1918 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1919 FromChain: &mainnet, 1920 ToChain: &arbitrum, 1921 AmountOut: (*hexutil.Big)(big.NewInt(2.5*testAmount100USDC - testBonderFeeUSDC)), 1922 ApprovalRequired: true, 1923 }, 1924 { 1925 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1926 FromChain: &mainnet, 1927 ToChain: &arbitrum, 1928 AmountOut: (*hexutil.Big)(big.NewInt(testAmount100USDC - testBonderFeeUSDC)), 1929 ApprovalRequired: true, 1930 }, 1931 { 1932 ProcessorName: pathprocessor.ProcessorTransferName, 1933 FromChain: &optimism, 1934 ToChain: &optimism, 1935 AmountOut: (*hexutil.Big)(big.NewInt(0.5 * testAmount100USDC)), 1936 ApprovalRequired: false, 1937 }, 1938 { 1939 ProcessorName: pathprocessor.ProcessorTransferName, 1940 FromChain: &optimism, 1941 ToChain: &optimism, 1942 AmountOut: (*hexutil.Big)(big.NewInt(testAmount100USDC)), 1943 ApprovalRequired: false, 1944 }, 1945 { 1946 ProcessorName: pathprocessor.ProcessorTransferName, 1947 FromChain: &optimism, 1948 ToChain: &optimism, 1949 AmountOut: (*hexutil.Big)(big.NewInt(2.5 * testAmount100USDC)), 1950 ApprovalRequired: false, 1951 }, 1952 { 1953 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1954 FromChain: &optimism, 1955 ToChain: &mainnet, 1956 AmountOut: (*hexutil.Big)(big.NewInt(0.5*testAmount100USDC - testBonderFeeUSDC)), 1957 ApprovalRequired: true, 1958 }, 1959 { 1960 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1961 FromChain: &optimism, 1962 ToChain: &mainnet, 1963 AmountOut: (*hexutil.Big)(big.NewInt(testAmount100USDC - testBonderFeeUSDC)), 1964 ApprovalRequired: true, 1965 }, 1966 { 1967 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1968 FromChain: &optimism, 1969 ToChain: &mainnet, 1970 AmountOut: (*hexutil.Big)(big.NewInt(2.5*testAmount100USDC - testBonderFeeUSDC)), 1971 ApprovalRequired: true, 1972 }, 1973 { 1974 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1975 FromChain: &optimism, 1976 ToChain: &arbitrum, 1977 AmountOut: (*hexutil.Big)(big.NewInt(0.5*testAmount100USDC - testBonderFeeUSDC)), 1978 ApprovalRequired: true, 1979 }, 1980 { 1981 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1982 FromChain: &optimism, 1983 ToChain: &arbitrum, 1984 AmountOut: (*hexutil.Big)(big.NewInt(testAmount100USDC - testBonderFeeUSDC)), 1985 ApprovalRequired: true, 1986 }, 1987 { 1988 ProcessorName: pathprocessor.ProcessorBridgeHopName, 1989 FromChain: &optimism, 1990 ToChain: &arbitrum, 1991 AmountOut: (*hexutil.Big)(big.NewInt(2.5*testAmount100USDC - testBonderFeeUSDC)), 1992 ApprovalRequired: true, 1993 }, 1994 { 1995 ProcessorName: pathprocessor.ProcessorTransferName, 1996 FromChain: &arbitrum, 1997 ToChain: &arbitrum, 1998 AmountOut: (*hexutil.Big)(big.NewInt(0.5 * testAmount100USDC)), 1999 ApprovalRequired: false, 2000 }, 2001 { 2002 ProcessorName: pathprocessor.ProcessorTransferName, 2003 FromChain: &arbitrum, 2004 ToChain: &arbitrum, 2005 AmountOut: (*hexutil.Big)(big.NewInt(testAmount100USDC)), 2006 ApprovalRequired: false, 2007 }, 2008 { 2009 ProcessorName: pathprocessor.ProcessorTransferName, 2010 FromChain: &arbitrum, 2011 ToChain: &arbitrum, 2012 AmountOut: (*hexutil.Big)(big.NewInt(2.5 * testAmount100USDC)), 2013 ApprovalRequired: false, 2014 }, 2015 { 2016 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2017 FromChain: &arbitrum, 2018 ToChain: &mainnet, 2019 AmountOut: (*hexutil.Big)(big.NewInt(0.5*testAmount100USDC - testBonderFeeUSDC)), 2020 ApprovalRequired: true, 2021 }, 2022 { 2023 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2024 FromChain: &arbitrum, 2025 ToChain: &mainnet, 2026 AmountOut: (*hexutil.Big)(big.NewInt(testAmount100USDC - testBonderFeeUSDC)), 2027 ApprovalRequired: true, 2028 }, 2029 { 2030 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2031 FromChain: &arbitrum, 2032 ToChain: &mainnet, 2033 AmountOut: (*hexutil.Big)(big.NewInt(2.5*testAmount100USDC - testBonderFeeUSDC)), 2034 ApprovalRequired: true, 2035 }, 2036 { 2037 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2038 FromChain: &arbitrum, 2039 ToChain: &optimism, 2040 AmountOut: (*hexutil.Big)(big.NewInt(0.5*testAmount100USDC - testBonderFeeUSDC)), 2041 ApprovalRequired: true, 2042 }, 2043 { 2044 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2045 FromChain: &arbitrum, 2046 ToChain: &optimism, 2047 AmountOut: (*hexutil.Big)(big.NewInt(testAmount100USDC - testBonderFeeUSDC)), 2048 ApprovalRequired: true, 2049 }, 2050 { 2051 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2052 FromChain: &arbitrum, 2053 ToChain: &optimism, 2054 AmountOut: (*hexutil.Big)(big.NewInt(2.5*testAmount100USDC - testBonderFeeUSDC)), 2055 ApprovalRequired: true, 2056 }, 2057 }, 2058 }, 2059 { 2060 name: "Bridge - No Specific FromChain - No Specific ToChain", 2061 input: &requests.RouteInputParams{ 2062 TestnetMode: false, 2063 Uuid: uuid.NewString(), 2064 SendType: sendtype.Bridge, 2065 AddrFrom: common.HexToAddress("0x1"), 2066 AddrTo: common.HexToAddress("0x2"), 2067 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 2068 TokenID: pathprocessor.UsdcSymbol, 2069 2070 TestsMode: true, 2071 TestParams: &requests.RouterTestParams{ 2072 TokenFrom: &token.Token{ 2073 ChainID: 1, 2074 Symbol: pathprocessor.UsdcSymbol, 2075 Decimals: 6, 2076 }, 2077 TokenPrices: testTokenPrices, 2078 BaseFee: big.NewInt(testBaseFee), 2079 SuggestedFees: testSuggestedFees, 2080 BalanceMap: testBalanceMapPerChain, 2081 EstimationMap: testEstimationMap, 2082 BonderFeeMap: testBBonderFeeMap, 2083 ApprovalGasEstimation: testApprovalGasEstimation, 2084 ApprovalL1Fee: testApprovalL1Fee, 2085 }, 2086 }, 2087 expectedCandidates: routes.Route{ 2088 { 2089 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2090 FromChain: &mainnet, 2091 ToChain: &optimism, 2092 ApprovalRequired: true, 2093 }, 2094 { 2095 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2096 FromChain: &mainnet, 2097 ToChain: &arbitrum, 2098 ApprovalRequired: true, 2099 }, 2100 { 2101 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2102 FromChain: &optimism, 2103 ToChain: &mainnet, 2104 ApprovalRequired: true, 2105 }, 2106 { 2107 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2108 FromChain: &optimism, 2109 ToChain: &arbitrum, 2110 ApprovalRequired: true, 2111 }, 2112 { 2113 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2114 FromChain: &arbitrum, 2115 ToChain: &mainnet, 2116 ApprovalRequired: true, 2117 }, 2118 { 2119 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2120 FromChain: &arbitrum, 2121 ToChain: &optimism, 2122 ApprovalRequired: true, 2123 }, 2124 }, 2125 }, 2126 { 2127 name: "Bridge - No Specific FromChain - Specific Single ToChain", 2128 input: &requests.RouteInputParams{ 2129 TestnetMode: false, 2130 Uuid: uuid.NewString(), 2131 SendType: sendtype.Bridge, 2132 AddrFrom: common.HexToAddress("0x1"), 2133 AddrTo: common.HexToAddress("0x2"), 2134 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 2135 TokenID: pathprocessor.UsdcSymbol, 2136 DisabledToChainIDs: []uint64{walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 2137 2138 TestsMode: true, 2139 TestParams: &requests.RouterTestParams{ 2140 TokenFrom: &token.Token{ 2141 ChainID: 1, 2142 Symbol: pathprocessor.UsdcSymbol, 2143 Decimals: 6, 2144 }, 2145 TokenPrices: testTokenPrices, 2146 BaseFee: big.NewInt(testBaseFee), 2147 SuggestedFees: testSuggestedFees, 2148 BalanceMap: testBalanceMapPerChain, 2149 EstimationMap: testEstimationMap, 2150 BonderFeeMap: testBBonderFeeMap, 2151 ApprovalGasEstimation: testApprovalGasEstimation, 2152 ApprovalL1Fee: testApprovalL1Fee, 2153 }, 2154 }, 2155 expectedCandidates: routes.Route{ 2156 { 2157 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2158 FromChain: &optimism, 2159 ToChain: &mainnet, 2160 ApprovalRequired: true, 2161 }, 2162 { 2163 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2164 FromChain: &arbitrum, 2165 ToChain: &mainnet, 2166 ApprovalRequired: true, 2167 }, 2168 }, 2169 }, 2170 { 2171 name: "Bridge - No Specific FromChain - Specific Multiple ToChain", 2172 input: &requests.RouteInputParams{ 2173 TestnetMode: false, 2174 Uuid: uuid.NewString(), 2175 SendType: sendtype.Bridge, 2176 AddrFrom: common.HexToAddress("0x1"), 2177 AddrTo: common.HexToAddress("0x2"), 2178 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 2179 TokenID: pathprocessor.UsdcSymbol, 2180 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet}, 2181 2182 TestsMode: true, 2183 TestParams: &requests.RouterTestParams{ 2184 TokenFrom: &token.Token{ 2185 ChainID: 1, 2186 Symbol: pathprocessor.UsdcSymbol, 2187 Decimals: 6, 2188 }, 2189 TokenPrices: testTokenPrices, 2190 BaseFee: big.NewInt(testBaseFee), 2191 SuggestedFees: testSuggestedFees, 2192 BalanceMap: testBalanceMapPerChain, 2193 EstimationMap: testEstimationMap, 2194 BonderFeeMap: testBBonderFeeMap, 2195 ApprovalGasEstimation: testApprovalGasEstimation, 2196 ApprovalL1Fee: testApprovalL1Fee, 2197 }, 2198 }, 2199 expectedCandidates: routes.Route{ 2200 { 2201 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2202 FromChain: &mainnet, 2203 ToChain: &optimism, 2204 ApprovalRequired: true, 2205 }, 2206 { 2207 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2208 FromChain: &mainnet, 2209 ToChain: &arbitrum, 2210 ApprovalRequired: true, 2211 }, 2212 { 2213 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2214 FromChain: &optimism, 2215 ToChain: &arbitrum, 2216 ApprovalRequired: true, 2217 }, 2218 { 2219 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2220 FromChain: &arbitrum, 2221 ToChain: &optimism, 2222 ApprovalRequired: true, 2223 }, 2224 }, 2225 }, 2226 { 2227 name: "Bridge - Specific Single FromChain - No Specific ToChain", 2228 input: &requests.RouteInputParams{ 2229 TestnetMode: false, 2230 Uuid: uuid.NewString(), 2231 SendType: sendtype.Bridge, 2232 AddrFrom: common.HexToAddress("0x1"), 2233 AddrTo: common.HexToAddress("0x2"), 2234 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 2235 TokenID: pathprocessor.UsdcSymbol, 2236 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 2237 2238 TestsMode: true, 2239 TestParams: &requests.RouterTestParams{ 2240 TokenFrom: &token.Token{ 2241 ChainID: 1, 2242 Symbol: pathprocessor.UsdcSymbol, 2243 Decimals: 6, 2244 }, 2245 TokenPrices: testTokenPrices, 2246 BaseFee: big.NewInt(testBaseFee), 2247 SuggestedFees: testSuggestedFees, 2248 BalanceMap: testBalanceMapPerChain, 2249 EstimationMap: testEstimationMap, 2250 BonderFeeMap: testBBonderFeeMap, 2251 ApprovalGasEstimation: testApprovalGasEstimation, 2252 ApprovalL1Fee: testApprovalL1Fee, 2253 }, 2254 }, 2255 expectedCandidates: routes.Route{ 2256 { 2257 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2258 FromChain: &arbitrum, 2259 ToChain: &mainnet, 2260 ApprovalRequired: true, 2261 }, 2262 { 2263 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2264 FromChain: &arbitrum, 2265 ToChain: &optimism, 2266 ApprovalRequired: true, 2267 }, 2268 }, 2269 }, 2270 { 2271 name: "Bridge - Specific Multiple FromChain - No Specific ToChain", 2272 input: &requests.RouteInputParams{ 2273 TestnetMode: false, 2274 Uuid: uuid.NewString(), 2275 SendType: sendtype.Bridge, 2276 AddrFrom: common.HexToAddress("0x1"), 2277 AddrTo: common.HexToAddress("0x2"), 2278 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 2279 TokenID: pathprocessor.UsdcSymbol, 2280 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet}, 2281 2282 TestsMode: true, 2283 TestParams: &requests.RouterTestParams{ 2284 TokenFrom: &token.Token{ 2285 ChainID: 1, 2286 Symbol: pathprocessor.UsdcSymbol, 2287 Decimals: 6, 2288 }, 2289 TokenPrices: testTokenPrices, 2290 BaseFee: big.NewInt(testBaseFee), 2291 SuggestedFees: testSuggestedFees, 2292 BalanceMap: testBalanceMapPerChain, 2293 EstimationMap: testEstimationMap, 2294 BonderFeeMap: testBBonderFeeMap, 2295 ApprovalGasEstimation: testApprovalGasEstimation, 2296 ApprovalL1Fee: testApprovalL1Fee, 2297 }, 2298 }, 2299 expectedCandidates: routes.Route{ 2300 { 2301 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2302 FromChain: &optimism, 2303 ToChain: &mainnet, 2304 ApprovalRequired: true, 2305 }, 2306 { 2307 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2308 FromChain: &optimism, 2309 ToChain: &arbitrum, 2310 ApprovalRequired: true, 2311 }, 2312 { 2313 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2314 FromChain: &arbitrum, 2315 ToChain: &mainnet, 2316 ApprovalRequired: true, 2317 }, 2318 { 2319 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2320 FromChain: &arbitrum, 2321 ToChain: &optimism, 2322 ApprovalRequired: true, 2323 }, 2324 }, 2325 }, 2326 { 2327 name: "Bridge - Specific Single FromChain - Specific Single ToChain - Same Chains", 2328 input: &requests.RouteInputParams{ 2329 TestnetMode: false, 2330 Uuid: uuid.NewString(), 2331 SendType: sendtype.Bridge, 2332 AddrFrom: common.HexToAddress("0x1"), 2333 AddrTo: common.HexToAddress("0x2"), 2334 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 2335 TokenID: pathprocessor.UsdcSymbol, 2336 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 2337 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 2338 2339 TestsMode: true, 2340 TestParams: &requests.RouterTestParams{ 2341 TokenFrom: &token.Token{ 2342 ChainID: 1, 2343 Symbol: pathprocessor.UsdcSymbol, 2344 Decimals: 6, 2345 }, 2346 TokenPrices: testTokenPrices, 2347 BaseFee: big.NewInt(testBaseFee), 2348 SuggestedFees: testSuggestedFees, 2349 BalanceMap: testBalanceMapPerChain, 2350 EstimationMap: testEstimationMap, 2351 BonderFeeMap: testBBonderFeeMap, 2352 ApprovalGasEstimation: testApprovalGasEstimation, 2353 ApprovalL1Fee: testApprovalL1Fee, 2354 }, 2355 }, 2356 expectedError: ErrNoBestRouteFound, 2357 expectedCandidates: routes.Route{}, 2358 }, 2359 { 2360 name: "Bridge - Specific Single FromChain - Specific Single ToChain - Different Chains", 2361 input: &requests.RouteInputParams{ 2362 TestnetMode: false, 2363 Uuid: uuid.NewString(), 2364 SendType: sendtype.Bridge, 2365 AddrFrom: common.HexToAddress("0x1"), 2366 AddrTo: common.HexToAddress("0x2"), 2367 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 2368 TokenID: pathprocessor.UsdcSymbol, 2369 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 2370 DisabledToChainIDs: []uint64{walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 2371 2372 TestsMode: true, 2373 TestParams: &requests.RouterTestParams{ 2374 TokenFrom: &token.Token{ 2375 ChainID: 1, 2376 Symbol: pathprocessor.UsdcSymbol, 2377 Decimals: 6, 2378 }, 2379 TokenPrices: testTokenPrices, 2380 BaseFee: big.NewInt(testBaseFee), 2381 SuggestedFees: testSuggestedFees, 2382 BalanceMap: testBalanceMapPerChain, 2383 EstimationMap: testEstimationMap, 2384 BonderFeeMap: testBBonderFeeMap, 2385 ApprovalGasEstimation: testApprovalGasEstimation, 2386 ApprovalL1Fee: testApprovalL1Fee, 2387 }, 2388 }, 2389 expectedCandidates: routes.Route{ 2390 { 2391 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2392 FromChain: &arbitrum, 2393 ToChain: &mainnet, 2394 ApprovalRequired: true, 2395 }, 2396 }, 2397 }, 2398 { 2399 name: "Bridge - Specific Multiple FromChain - Specific Multiple ToChain - Single Common Chain", 2400 input: &requests.RouteInputParams{ 2401 TestnetMode: false, 2402 Uuid: uuid.NewString(), 2403 SendType: sendtype.Bridge, 2404 AddrFrom: common.HexToAddress("0x1"), 2405 AddrTo: common.HexToAddress("0x2"), 2406 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 2407 TokenID: pathprocessor.UsdcSymbol, 2408 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 2409 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 2410 2411 TestsMode: true, 2412 TestParams: &requests.RouterTestParams{ 2413 TokenFrom: &token.Token{ 2414 ChainID: 1, 2415 Symbol: pathprocessor.UsdcSymbol, 2416 Decimals: 6, 2417 }, 2418 TokenPrices: testTokenPrices, 2419 BaseFee: big.NewInt(testBaseFee), 2420 SuggestedFees: testSuggestedFees, 2421 BalanceMap: testBalanceMapPerChain, 2422 EstimationMap: testEstimationMap, 2423 BonderFeeMap: testBBonderFeeMap, 2424 ApprovalGasEstimation: testApprovalGasEstimation, 2425 ApprovalL1Fee: testApprovalL1Fee, 2426 }, 2427 }, 2428 expectedError: ErrNoBestRouteFound, 2429 expectedCandidates: routes.Route{}, 2430 }, 2431 { 2432 name: "Bridge - Specific Multiple FromChain - Specific Multiple ToChain - Multiple Common Chains", 2433 input: &requests.RouteInputParams{ 2434 TestnetMode: false, 2435 Uuid: uuid.NewString(), 2436 SendType: sendtype.Bridge, 2437 AddrFrom: common.HexToAddress("0x1"), 2438 AddrTo: common.HexToAddress("0x2"), 2439 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 2440 TokenID: pathprocessor.UsdcSymbol, 2441 DisabledFromChainIDs: []uint64{walletCommon.OptimismMainnet}, 2442 DisabledToChainIDs: []uint64{walletCommon.OptimismMainnet}, 2443 2444 TestsMode: true, 2445 TestParams: &requests.RouterTestParams{ 2446 TokenFrom: &token.Token{ 2447 ChainID: 1, 2448 Symbol: pathprocessor.UsdcSymbol, 2449 Decimals: 6, 2450 }, 2451 TokenPrices: testTokenPrices, 2452 BaseFee: big.NewInt(testBaseFee), 2453 SuggestedFees: testSuggestedFees, 2454 BalanceMap: testBalanceMapPerChain, 2455 EstimationMap: testEstimationMap, 2456 BonderFeeMap: testBBonderFeeMap, 2457 ApprovalGasEstimation: testApprovalGasEstimation, 2458 ApprovalL1Fee: testApprovalL1Fee, 2459 }, 2460 }, 2461 expectedCandidates: routes.Route{ 2462 { 2463 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2464 FromChain: &mainnet, 2465 ToChain: &arbitrum, 2466 ApprovalRequired: true, 2467 }, 2468 { 2469 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2470 FromChain: &arbitrum, 2471 ToChain: &mainnet, 2472 ApprovalRequired: true, 2473 }, 2474 }, 2475 }, 2476 { 2477 name: "Bridge - Specific Multiple FromChain - Specific Multiple ToChain - No Common Chains", 2478 input: &requests.RouteInputParams{ 2479 TestnetMode: false, 2480 Uuid: uuid.NewString(), 2481 SendType: sendtype.Bridge, 2482 AddrFrom: common.HexToAddress("0x1"), 2483 AddrTo: common.HexToAddress("0x2"), 2484 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 2485 TokenID: pathprocessor.UsdcSymbol, 2486 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 2487 DisabledToChainIDs: []uint64{walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 2488 2489 TestsMode: true, 2490 TestParams: &requests.RouterTestParams{ 2491 TokenFrom: &token.Token{ 2492 ChainID: 1, 2493 Symbol: pathprocessor.UsdcSymbol, 2494 Decimals: 6, 2495 }, 2496 TokenPrices: testTokenPrices, 2497 BaseFee: big.NewInt(testBaseFee), 2498 SuggestedFees: testSuggestedFees, 2499 BalanceMap: testBalanceMapPerChain, 2500 EstimationMap: testEstimationMap, 2501 BonderFeeMap: testBBonderFeeMap, 2502 ApprovalGasEstimation: testApprovalGasEstimation, 2503 ApprovalL1Fee: testApprovalL1Fee, 2504 }, 2505 }, 2506 expectedCandidates: routes.Route{ 2507 { 2508 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2509 FromChain: &arbitrum, 2510 ToChain: &mainnet, 2511 ApprovalRequired: true, 2512 }, 2513 }, 2514 }, 2515 { 2516 name: "Bridge - All FromChains Disabled - All ToChains Disabled", 2517 input: &requests.RouteInputParams{ 2518 TestnetMode: false, 2519 Uuid: uuid.NewString(), 2520 SendType: sendtype.Bridge, 2521 AddrFrom: common.HexToAddress("0x1"), 2522 AddrTo: common.HexToAddress("0x2"), 2523 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1USDC)), 2524 TokenID: pathprocessor.UsdcSymbol, 2525 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 2526 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 2527 2528 TestsMode: true, 2529 TestParams: &requests.RouterTestParams{ 2530 TokenFrom: &token.Token{ 2531 ChainID: 1, 2532 Symbol: pathprocessor.UsdcSymbol, 2533 Decimals: 6, 2534 }, 2535 TokenPrices: testTokenPrices, 2536 BaseFee: big.NewInt(testBaseFee), 2537 SuggestedFees: testSuggestedFees, 2538 BalanceMap: testBalanceMapPerChain, 2539 EstimationMap: testEstimationMap, 2540 BonderFeeMap: testBBonderFeeMap, 2541 ApprovalGasEstimation: testApprovalGasEstimation, 2542 ApprovalL1Fee: testApprovalL1Fee, 2543 }, 2544 }, 2545 expectedError: ErrNoBestRouteFound, 2546 expectedCandidates: routes.Route{}, 2547 }, 2548 { 2549 name: "ETH transfer - Not Enough Native Balance", 2550 input: &requests.RouteInputParams{ 2551 TestnetMode: false, 2552 Uuid: uuid.NewString(), 2553 SendType: sendtype.Transfer, 2554 AddrFrom: common.HexToAddress("0x1"), 2555 AddrTo: common.HexToAddress("0x2"), 2556 AmountIn: (*hexutil.Big)(big.NewInt(testAmount3ETHInWei)), 2557 TokenID: pathprocessor.EthSymbol, 2558 DisabledFromChainIDs: []uint64{walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 2559 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet}, 2560 2561 TestsMode: true, 2562 TestParams: &requests.RouterTestParams{ 2563 TokenFrom: &token.Token{ 2564 ChainID: 1, 2565 Symbol: pathprocessor.EthSymbol, 2566 Decimals: 18, 2567 }, 2568 TokenPrices: testTokenPrices, 2569 SuggestedFees: testSuggestedFees, 2570 BalanceMap: testBalanceMapPerChain, 2571 EstimationMap: testEstimationMap, 2572 BonderFeeMap: testBBonderFeeMap, 2573 ApprovalGasEstimation: testApprovalGasEstimation, 2574 ApprovalL1Fee: testApprovalL1Fee, 2575 }, 2576 }, 2577 expectedError: &errors.ErrorResponse{ 2578 Code: ErrNotEnoughNativeBalance.Code, 2579 Details: fmt.Sprintf(ErrNotEnoughNativeBalance.Details, pathprocessor.EthSymbol, walletCommon.EthereumMainnet), 2580 }, 2581 expectedCandidates: routes.Route{ 2582 { 2583 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2584 FromChain: &mainnet, 2585 ToChain: &optimism, 2586 ApprovalRequired: false, 2587 }, 2588 }, 2589 }, 2590 { 2591 name: "ETH transfer - Not Enough Native Balance", 2592 input: &requests.RouteInputParams{ 2593 TestnetMode: false, 2594 Uuid: uuid.NewString(), 2595 SendType: sendtype.Transfer, 2596 AddrFrom: common.HexToAddress("0x1"), 2597 AddrTo: common.HexToAddress("0x2"), 2598 AmountIn: (*hexutil.Big)(big.NewInt(5 * testAmount100USDC)), 2599 TokenID: pathprocessor.UsdcSymbol, 2600 DisabledFromChainIDs: []uint64{walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 2601 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet}, 2602 2603 TestsMode: true, 2604 TestParams: &requests.RouterTestParams{ 2605 TokenFrom: &token.Token{ 2606 ChainID: 1, 2607 Symbol: pathprocessor.UsdcSymbol, 2608 Decimals: 6, 2609 }, 2610 TokenPrices: testTokenPrices, 2611 SuggestedFees: testSuggestedFees, 2612 BalanceMap: testBalanceMapPerChain, 2613 EstimationMap: testEstimationMap, 2614 BonderFeeMap: testBBonderFeeMap, 2615 ApprovalGasEstimation: testApprovalGasEstimation, 2616 ApprovalL1Fee: testApprovalL1Fee, 2617 }, 2618 }, 2619 expectedError: &errors.ErrorResponse{ 2620 Code: ErrNotEnoughTokenBalance.Code, 2621 Details: fmt.Sprintf(ErrNotEnoughTokenBalance.Details, pathprocessor.UsdcSymbol, walletCommon.EthereumMainnet), 2622 }, 2623 expectedCandidates: routes.Route{ 2624 { 2625 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2626 FromChain: &mainnet, 2627 ToChain: &optimism, 2628 ApprovalRequired: true, 2629 }, 2630 }, 2631 }, 2632 { 2633 name: "Bridge - Specific Single FromChain - Specific Single ToChain - Sending Small Amount", 2634 input: &requests.RouteInputParams{ 2635 TestnetMode: false, 2636 Uuid: uuid.NewString(), 2637 SendType: sendtype.Bridge, 2638 AddrFrom: common.HexToAddress("0x1"), 2639 AddrTo: common.HexToAddress("0x2"), 2640 AmountIn: (*hexutil.Big)(big.NewInt(0.01 * testAmount1USDC)), 2641 TokenID: pathprocessor.UsdcSymbol, 2642 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.OptimismMainnet}, 2643 DisabledToChainIDs: []uint64{walletCommon.OptimismMainnet, walletCommon.ArbitrumMainnet}, 2644 2645 TestsMode: true, 2646 TestParams: &requests.RouterTestParams{ 2647 TokenFrom: &token.Token{ 2648 ChainID: 1, 2649 Symbol: pathprocessor.UsdcSymbol, 2650 Decimals: 6, 2651 }, 2652 TokenPrices: testTokenPrices, 2653 BaseFee: big.NewInt(testBaseFee), 2654 SuggestedFees: testSuggestedFees, 2655 BalanceMap: testBalanceMapPerChain, 2656 EstimationMap: testEstimationMap, 2657 BonderFeeMap: testBBonderFeeMap, 2658 ApprovalGasEstimation: testApprovalGasEstimation, 2659 ApprovalL1Fee: testApprovalL1Fee, 2660 }, 2661 }, 2662 expectedError: ErrLowAmountInForHopBridge, 2663 expectedCandidates: routes.Route{ 2664 { 2665 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2666 FromChain: &arbitrum, 2667 ToChain: &mainnet, 2668 ApprovalRequired: true, 2669 }, 2670 }, 2671 }, 2672 } 2673 } 2674 2675 type noBalanceTestParams struct { 2676 name string 2677 input *requests.RouteInputParams 2678 expectedCandidates routes.Route 2679 expectedBest routes.Route 2680 expectedError *errors.ErrorResponse 2681 } 2682 2683 func getNoBalanceTestParamsList() []noBalanceTestParams { 2684 return []noBalanceTestParams{ 2685 { 2686 name: "ERC20 transfer - Specific FromChain - Specific ToChain - Not Enough Token Balance", 2687 input: &requests.RouteInputParams{ 2688 TestnetMode: false, 2689 Uuid: uuid.NewString(), 2690 SendType: sendtype.Transfer, 2691 AddrFrom: common.HexToAddress("0x1"), 2692 AddrTo: common.HexToAddress("0x2"), 2693 AmountIn: (*hexutil.Big)(big.NewInt(testAmount100USDC)), 2694 TokenID: pathprocessor.UsdcSymbol, 2695 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet}, 2696 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet}, 2697 2698 TestsMode: true, 2699 TestParams: &requests.RouterTestParams{ 2700 TokenFrom: &token.Token{ 2701 ChainID: 1, 2702 Symbol: pathprocessor.UsdcSymbol, 2703 Decimals: 6, 2704 }, 2705 TokenPrices: testTokenPrices, 2706 SuggestedFees: testSuggestedFees, 2707 BalanceMap: map[string]*big.Int{ 2708 makeBalanceKey(walletCommon.OptimismMainnet, pathprocessor.UsdcSymbol): big.NewInt(0), 2709 }, 2710 EstimationMap: testEstimationMap, 2711 BonderFeeMap: testBBonderFeeMap, 2712 ApprovalGasEstimation: testApprovalGasEstimation, 2713 ApprovalL1Fee: testApprovalL1Fee, 2714 }, 2715 }, 2716 expectedError: ErrNoPositiveBalance, 2717 }, 2718 { 2719 name: "ERC20 transfer - Specific FromChain - Specific ToChain - Not Enough Native Balance", 2720 input: &requests.RouteInputParams{ 2721 TestnetMode: false, 2722 Uuid: uuid.NewString(), 2723 SendType: sendtype.Transfer, 2724 AddrFrom: common.HexToAddress("0x1"), 2725 AddrTo: common.HexToAddress("0x2"), 2726 AmountIn: (*hexutil.Big)(big.NewInt(testAmount100USDC)), 2727 TokenID: pathprocessor.UsdcSymbol, 2728 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet}, 2729 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet}, 2730 2731 TestsMode: true, 2732 TestParams: &requests.RouterTestParams{ 2733 TokenFrom: &token.Token{ 2734 ChainID: 1, 2735 Symbol: pathprocessor.UsdcSymbol, 2736 Decimals: 6, 2737 }, 2738 TokenPrices: testTokenPrices, 2739 SuggestedFees: testSuggestedFees, 2740 BalanceMap: map[string]*big.Int{ 2741 makeBalanceKey(walletCommon.OptimismMainnet, pathprocessor.UsdcSymbol): big.NewInt(testAmount100USDC), 2742 makeBalanceKey(walletCommon.OptimismMainnet, pathprocessor.EthSymbol): big.NewInt(0), 2743 }, 2744 EstimationMap: testEstimationMap, 2745 BonderFeeMap: testBBonderFeeMap, 2746 ApprovalGasEstimation: testApprovalGasEstimation, 2747 ApprovalL1Fee: testApprovalL1Fee, 2748 }, 2749 }, 2750 expectedError: &errors.ErrorResponse{ 2751 Code: ErrNotEnoughNativeBalance.Code, 2752 Details: fmt.Sprintf(ErrNotEnoughNativeBalance.Details, pathprocessor.EthSymbol, walletCommon.OptimismMainnet), 2753 }, 2754 expectedCandidates: routes.Route{ 2755 { 2756 ProcessorName: pathprocessor.ProcessorTransferName, 2757 FromChain: &optimism, 2758 ToChain: &optimism, 2759 ApprovalRequired: false, 2760 RequiredTokenBalance: big.NewInt(testAmount100USDC), 2761 RequiredNativeBalance: big.NewInt((testBaseFee + testPriorityFeeLow) * testApprovalGasEstimation), 2762 }, 2763 }, 2764 }, 2765 { 2766 name: "ERC20 transfer - No Specific FromChain - Specific ToChain - Not Enough Token Balance Across All Chains", 2767 input: &requests.RouteInputParams{ 2768 TestnetMode: false, 2769 Uuid: uuid.NewString(), 2770 SendType: sendtype.Transfer, 2771 AddrFrom: common.HexToAddress("0x1"), 2772 AddrTo: common.HexToAddress("0x2"), 2773 AmountIn: (*hexutil.Big)(big.NewInt(testAmount100USDC)), 2774 TokenID: pathprocessor.UsdcSymbol, 2775 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet}, 2776 2777 TestsMode: true, 2778 TestParams: &requests.RouterTestParams{ 2779 TokenFrom: &token.Token{ 2780 ChainID: 1, 2781 Symbol: pathprocessor.UsdcSymbol, 2782 Decimals: 6, 2783 }, 2784 TokenPrices: testTokenPrices, 2785 SuggestedFees: testSuggestedFees, 2786 BalanceMap: map[string]*big.Int{ 2787 makeBalanceKey(walletCommon.EthereumMainnet, pathprocessor.UsdcSymbol): big.NewInt(0), 2788 makeBalanceKey(walletCommon.EthereumMainnet, pathprocessor.EthSymbol): big.NewInt(0), 2789 makeBalanceKey(walletCommon.OptimismMainnet, pathprocessor.UsdcSymbol): big.NewInt(0), 2790 makeBalanceKey(walletCommon.OptimismMainnet, pathprocessor.EthSymbol): big.NewInt(0), 2791 makeBalanceKey(walletCommon.ArbitrumMainnet, pathprocessor.UsdcSymbol): big.NewInt(0), 2792 makeBalanceKey(walletCommon.ArbitrumMainnet, pathprocessor.EthSymbol): big.NewInt(0), 2793 }, 2794 EstimationMap: testEstimationMap, 2795 BonderFeeMap: testBBonderFeeMap, 2796 ApprovalGasEstimation: testApprovalGasEstimation, 2797 ApprovalL1Fee: testApprovalL1Fee, 2798 }, 2799 }, 2800 expectedError: ErrNoPositiveBalance, 2801 }, 2802 { 2803 name: "ERC20 transfer - No Specific FromChain - Specific ToChain - Enough Token Balance On Arbitrum Chain But Not Enough Native Balance", 2804 input: &requests.RouteInputParams{ 2805 TestnetMode: false, 2806 Uuid: uuid.NewString(), 2807 SendType: sendtype.Transfer, 2808 AddrFrom: common.HexToAddress("0x1"), 2809 AddrTo: common.HexToAddress("0x2"), 2810 AmountIn: (*hexutil.Big)(big.NewInt(testAmount100USDC)), 2811 TokenID: pathprocessor.UsdcSymbol, 2812 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet}, 2813 2814 TestsMode: true, 2815 TestParams: &requests.RouterTestParams{ 2816 TokenFrom: &token.Token{ 2817 ChainID: 1, 2818 Symbol: pathprocessor.UsdcSymbol, 2819 Decimals: 6, 2820 }, 2821 TokenPrices: testTokenPrices, 2822 SuggestedFees: testSuggestedFees, 2823 BalanceMap: map[string]*big.Int{ 2824 makeBalanceKey(walletCommon.ArbitrumMainnet, pathprocessor.UsdcSymbol): big.NewInt(testAmount100USDC + testAmount100USDC), 2825 makeBalanceKey(walletCommon.EthereumMainnet, pathprocessor.UsdcSymbol): big.NewInt(testAmount100USDC + testAmount100USDC), 2826 makeBalanceKey(walletCommon.OptimismMainnet, pathprocessor.UsdcSymbol): big.NewInt(testAmount100USDC + testAmount100USDC), 2827 makeBalanceKey(walletCommon.ArbitrumMainnet, pathprocessor.EthSymbol): big.NewInt(0), 2828 makeBalanceKey(walletCommon.EthereumMainnet, pathprocessor.EthSymbol): big.NewInt(0), 2829 makeBalanceKey(walletCommon.OptimismMainnet, pathprocessor.EthSymbol): big.NewInt(0), 2830 }, 2831 EstimationMap: testEstimationMap, 2832 BonderFeeMap: testBBonderFeeMap, 2833 ApprovalGasEstimation: testApprovalGasEstimation, 2834 ApprovalL1Fee: testApprovalL1Fee, 2835 }, 2836 }, 2837 expectedError: &errors.ErrorResponse{ 2838 Code: ErrNotEnoughNativeBalance.Code, 2839 Details: fmt.Sprintf(ErrNotEnoughNativeBalance.Details, pathprocessor.EthSymbol, walletCommon.ArbitrumMainnet), 2840 }, 2841 expectedCandidates: routes.Route{ 2842 { 2843 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2844 FromChain: &mainnet, 2845 ToChain: &optimism, 2846 ApprovalRequired: true, 2847 }, 2848 { 2849 ProcessorName: pathprocessor.ProcessorTransferName, 2850 FromChain: &optimism, 2851 ToChain: &optimism, 2852 ApprovalRequired: false, 2853 RequiredTokenBalance: big.NewInt(testAmount100USDC), 2854 RequiredNativeBalance: big.NewInt((testBaseFee + testPriorityFeeLow) * testApprovalGasEstimation), 2855 }, 2856 { 2857 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2858 FromChain: &arbitrum, 2859 ToChain: &optimism, 2860 ApprovalRequired: true, 2861 }, 2862 }, 2863 }, 2864 { 2865 name: "ERC20 transfer - No Specific FromChain - Specific ToChain - Enough Token Balance On Arbitrum Chain And Enough Native Balance On Arbitrum Chain", 2866 input: &requests.RouteInputParams{ 2867 TestnetMode: false, 2868 Uuid: uuid.NewString(), 2869 SendType: sendtype.Transfer, 2870 AddrFrom: common.HexToAddress("0x1"), 2871 AddrTo: common.HexToAddress("0x2"), 2872 AmountIn: (*hexutil.Big)(big.NewInt(testAmount100USDC)), 2873 TokenID: pathprocessor.UsdcSymbol, 2874 DisabledToChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet}, 2875 2876 TestsMode: true, 2877 TestParams: &requests.RouterTestParams{ 2878 TokenFrom: &token.Token{ 2879 ChainID: 1, 2880 Symbol: pathprocessor.UsdcSymbol, 2881 Decimals: 6, 2882 }, 2883 TokenPrices: testTokenPrices, 2884 SuggestedFees: testSuggestedFees, 2885 BalanceMap: map[string]*big.Int{ 2886 makeBalanceKey(walletCommon.ArbitrumMainnet, pathprocessor.UsdcSymbol): big.NewInt(testAmount100USDC + testAmount100USDC), 2887 makeBalanceKey(walletCommon.ArbitrumMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount1ETHInWei), 2888 }, 2889 EstimationMap: testEstimationMap, 2890 BonderFeeMap: testBBonderFeeMap, 2891 ApprovalGasEstimation: testApprovalGasEstimation, 2892 ApprovalL1Fee: testApprovalL1Fee, 2893 }, 2894 }, 2895 expectedCandidates: routes.Route{ 2896 { 2897 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2898 FromChain: &mainnet, 2899 ToChain: &optimism, 2900 ApprovalRequired: true, 2901 }, 2902 { 2903 ProcessorName: pathprocessor.ProcessorTransferName, 2904 FromChain: &optimism, 2905 ToChain: &optimism, 2906 ApprovalRequired: false, 2907 RequiredTokenBalance: big.NewInt(testAmount100USDC), 2908 RequiredNativeBalance: big.NewInt((testBaseFee + testPriorityFeeLow) * testApprovalGasEstimation), 2909 }, 2910 { 2911 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2912 FromChain: &arbitrum, 2913 ToChain: &optimism, 2914 ApprovalRequired: true, 2915 }, 2916 }, 2917 expectedBest: routes.Route{ 2918 { 2919 ProcessorName: pathprocessor.ProcessorBridgeHopName, 2920 FromChain: &arbitrum, 2921 ToChain: &optimism, 2922 ApprovalRequired: true, 2923 }, 2924 }, 2925 }, 2926 } 2927 } 2928 2929 type amountOptionsTestParams struct { 2930 name string 2931 input *requests.RouteInputParams 2932 expectedAmountOptions map[uint64][]amountOption 2933 } 2934 2935 func getAmountOptionsTestParamsList() []amountOptionsTestParams { 2936 return []amountOptionsTestParams{ 2937 { 2938 name: "Transfer - Single From Chain - No Locked Amount", 2939 input: &requests.RouteInputParams{ 2940 TestnetMode: false, 2941 Uuid: uuid.NewString(), 2942 SendType: sendtype.Transfer, 2943 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 2944 TokenID: pathprocessor.EthSymbol, 2945 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet}, 2946 2947 TestsMode: true, 2948 TestParams: &requests.RouterTestParams{ 2949 TokenFrom: &token.Token{ 2950 ChainID: 1, 2951 Symbol: pathprocessor.EthSymbol, 2952 Decimals: 18, 2953 }, 2954 BalanceMap: map[string]*big.Int{}, 2955 }, 2956 }, 2957 expectedAmountOptions: map[uint64][]amountOption{ 2958 walletCommon.OptimismMainnet: { 2959 { 2960 amount: big.NewInt(testAmount1ETHInWei), 2961 locked: false, 2962 }, 2963 }, 2964 }, 2965 }, 2966 { 2967 name: "Transfer - Single From Chain - Locked Amount To Single Chain Equal Total Amount", 2968 input: &requests.RouteInputParams{ 2969 TestnetMode: false, 2970 Uuid: uuid.NewString(), 2971 SendType: sendtype.Transfer, 2972 AmountIn: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 2973 TokenID: pathprocessor.EthSymbol, 2974 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet}, 2975 FromLockedAmount: map[uint64]*hexutil.Big{ 2976 walletCommon.OptimismMainnet: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 2977 }, 2978 2979 TestsMode: true, 2980 TestParams: &requests.RouterTestParams{ 2981 TokenFrom: &token.Token{ 2982 ChainID: 1, 2983 Symbol: pathprocessor.EthSymbol, 2984 Decimals: 18, 2985 }, 2986 BalanceMap: map[string]*big.Int{}, 2987 }, 2988 }, 2989 expectedAmountOptions: map[uint64][]amountOption{ 2990 walletCommon.OptimismMainnet: { 2991 { 2992 amount: big.NewInt(testAmount1ETHInWei), 2993 locked: true, 2994 }, 2995 }, 2996 }, 2997 }, 2998 { 2999 name: "Transfer - Multiple From Chains - Locked Amount To Single Chain Is Less Than Total Amount", 3000 input: &requests.RouteInputParams{ 3001 TestnetMode: false, 3002 Uuid: uuid.NewString(), 3003 SendType: sendtype.Transfer, 3004 AmountIn: (*hexutil.Big)(big.NewInt(testAmount2ETHInWei)), 3005 TokenID: pathprocessor.EthSymbol, 3006 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet}, 3007 FromLockedAmount: map[uint64]*hexutil.Big{ 3008 walletCommon.OptimismMainnet: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 3009 }, 3010 3011 TestsMode: true, 3012 TestParams: &requests.RouterTestParams{ 3013 TokenFrom: &token.Token{ 3014 ChainID: 1, 3015 Symbol: pathprocessor.EthSymbol, 3016 Decimals: 18, 3017 }, 3018 BalanceMap: map[string]*big.Int{}, 3019 }, 3020 }, 3021 expectedAmountOptions: map[uint64][]amountOption{ 3022 walletCommon.OptimismMainnet: { 3023 { 3024 amount: big.NewInt(testAmount1ETHInWei), 3025 locked: true, 3026 }, 3027 }, 3028 walletCommon.ArbitrumMainnet: { 3029 { 3030 amount: big.NewInt(testAmount1ETHInWei), 3031 locked: false, 3032 }, 3033 }, 3034 }, 3035 }, 3036 { 3037 name: "Transfer - Multiple From Chains - Locked Amount To Multiple Chains", 3038 input: &requests.RouteInputParams{ 3039 TestnetMode: false, 3040 Uuid: uuid.NewString(), 3041 SendType: sendtype.Transfer, 3042 AmountIn: (*hexutil.Big)(big.NewInt(testAmount2ETHInWei)), 3043 TokenID: pathprocessor.EthSymbol, 3044 DisabledFromChainIDs: []uint64{walletCommon.EthereumMainnet}, 3045 FromLockedAmount: map[uint64]*hexutil.Big{ 3046 walletCommon.OptimismMainnet: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 3047 walletCommon.ArbitrumMainnet: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 3048 }, 3049 3050 TestsMode: true, 3051 TestParams: &requests.RouterTestParams{ 3052 TokenFrom: &token.Token{ 3053 ChainID: 1, 3054 Symbol: pathprocessor.EthSymbol, 3055 Decimals: 18, 3056 }, 3057 BalanceMap: map[string]*big.Int{}, 3058 }, 3059 }, 3060 expectedAmountOptions: map[uint64][]amountOption{ 3061 walletCommon.OptimismMainnet: { 3062 { 3063 amount: big.NewInt(testAmount1ETHInWei), 3064 locked: true, 3065 }, 3066 }, 3067 walletCommon.ArbitrumMainnet: { 3068 { 3069 amount: big.NewInt(testAmount1ETHInWei), 3070 locked: true, 3071 }, 3072 }, 3073 }, 3074 }, 3075 { 3076 name: "Transfer - All From Chains - Locked Amount To Multiple Chains Equal Total Amount", 3077 input: &requests.RouteInputParams{ 3078 TestnetMode: false, 3079 Uuid: uuid.NewString(), 3080 SendType: sendtype.Transfer, 3081 AmountIn: (*hexutil.Big)(big.NewInt(testAmount2ETHInWei)), 3082 TokenID: pathprocessor.EthSymbol, 3083 FromLockedAmount: map[uint64]*hexutil.Big{ 3084 walletCommon.OptimismMainnet: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 3085 walletCommon.ArbitrumMainnet: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 3086 }, 3087 3088 TestsMode: true, 3089 TestParams: &requests.RouterTestParams{ 3090 TokenFrom: &token.Token{ 3091 ChainID: 1, 3092 Symbol: pathprocessor.EthSymbol, 3093 Decimals: 18, 3094 }, 3095 BalanceMap: map[string]*big.Int{}, 3096 }, 3097 }, 3098 expectedAmountOptions: map[uint64][]amountOption{ 3099 walletCommon.OptimismMainnet: { 3100 { 3101 amount: big.NewInt(testAmount1ETHInWei), 3102 locked: true, 3103 }, 3104 }, 3105 walletCommon.ArbitrumMainnet: { 3106 { 3107 amount: big.NewInt(testAmount1ETHInWei), 3108 locked: true, 3109 }, 3110 }, 3111 }, 3112 }, 3113 { 3114 name: "Transfer - All From Chains - Locked Amount To Multiple Chains Is Less Than Total Amount", 3115 input: &requests.RouteInputParams{ 3116 TestnetMode: false, 3117 Uuid: uuid.NewString(), 3118 SendType: sendtype.Transfer, 3119 AmountIn: (*hexutil.Big)(big.NewInt(testAmount5ETHInWei)), 3120 TokenID: pathprocessor.EthSymbol, 3121 FromLockedAmount: map[uint64]*hexutil.Big{ 3122 walletCommon.OptimismMainnet: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 3123 walletCommon.ArbitrumMainnet: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 3124 }, 3125 3126 TestsMode: true, 3127 TestParams: &requests.RouterTestParams{ 3128 TokenFrom: &token.Token{ 3129 ChainID: 1, 3130 Symbol: pathprocessor.EthSymbol, 3131 Decimals: 18, 3132 }, 3133 BalanceMap: map[string]*big.Int{}, 3134 }, 3135 }, 3136 expectedAmountOptions: map[uint64][]amountOption{ 3137 walletCommon.OptimismMainnet: { 3138 { 3139 amount: big.NewInt(testAmount1ETHInWei), 3140 locked: true, 3141 }, 3142 }, 3143 walletCommon.ArbitrumMainnet: { 3144 { 3145 amount: big.NewInt(testAmount1ETHInWei), 3146 locked: true, 3147 }, 3148 }, 3149 walletCommon.EthereumMainnet: { 3150 { 3151 amount: big.NewInt(testAmount3ETHInWei), 3152 locked: false, 3153 }, 3154 }, 3155 }, 3156 }, 3157 { 3158 name: "Transfer - All From Chain - No Locked Amount - Enough Token Balance If All Chains Are Used", 3159 input: &requests.RouteInputParams{ 3160 TestnetMode: false, 3161 Uuid: uuid.NewString(), 3162 SendType: sendtype.Transfer, 3163 AmountIn: (*hexutil.Big)(big.NewInt(testAmount3ETHInWei)), 3164 TokenID: pathprocessor.EthSymbol, 3165 3166 TestsMode: true, 3167 TestParams: &requests.RouterTestParams{ 3168 TokenFrom: &token.Token{ 3169 ChainID: 1, 3170 Symbol: pathprocessor.EthSymbol, 3171 Decimals: 18, 3172 }, 3173 BalanceMap: map[string]*big.Int{ 3174 makeBalanceKey(walletCommon.EthereumMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount1ETHInWei), 3175 makeBalanceKey(walletCommon.OptimismMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount1ETHInWei), 3176 makeBalanceKey(walletCommon.ArbitrumMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount1ETHInWei), 3177 }, 3178 }, 3179 }, 3180 expectedAmountOptions: map[uint64][]amountOption{ 3181 walletCommon.OptimismMainnet: { 3182 { 3183 amount: big.NewInt(testAmount3ETHInWei), 3184 locked: false, 3185 }, 3186 { 3187 amount: big.NewInt(testAmount1ETHInWei), 3188 locked: false, 3189 }, 3190 }, 3191 walletCommon.ArbitrumMainnet: { 3192 { 3193 amount: big.NewInt(testAmount3ETHInWei), 3194 locked: false, 3195 }, 3196 { 3197 amount: big.NewInt(testAmount1ETHInWei), 3198 locked: false, 3199 }, 3200 }, 3201 walletCommon.EthereumMainnet: { 3202 { 3203 amount: big.NewInt(testAmount3ETHInWei), 3204 locked: false, 3205 }, 3206 { 3207 amount: big.NewInt(testAmount1ETHInWei), 3208 locked: false, 3209 }, 3210 }, 3211 }, 3212 }, 3213 { 3214 name: "Transfer - All From Chain - Locked Amount To Single Chain - Enough Token Balance If All Chains Are Used", 3215 input: &requests.RouteInputParams{ 3216 TestnetMode: false, 3217 Uuid: uuid.NewString(), 3218 SendType: sendtype.Transfer, 3219 AmountIn: (*hexutil.Big)(big.NewInt(testAmount3ETHInWei)), 3220 TokenID: pathprocessor.EthSymbol, 3221 FromLockedAmount: map[uint64]*hexutil.Big{ 3222 walletCommon.OptimismMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point5ETHInWei)), 3223 }, 3224 3225 TestsMode: true, 3226 TestParams: &requests.RouterTestParams{ 3227 TokenFrom: &token.Token{ 3228 ChainID: 1, 3229 Symbol: pathprocessor.EthSymbol, 3230 Decimals: 18, 3231 }, 3232 BalanceMap: map[string]*big.Int{ 3233 makeBalanceKey(walletCommon.EthereumMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount2ETHInWei), 3234 makeBalanceKey(walletCommon.OptimismMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount1ETHInWei), 3235 makeBalanceKey(walletCommon.ArbitrumMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount3ETHInWei), 3236 }, 3237 }, 3238 }, 3239 expectedAmountOptions: map[uint64][]amountOption{ 3240 walletCommon.OptimismMainnet: { 3241 { 3242 amount: big.NewInt(testAmount0Point5ETHInWei), 3243 locked: true, 3244 }, 3245 }, 3246 walletCommon.ArbitrumMainnet: { 3247 { 3248 amount: big.NewInt(testAmount2ETHInWei + testAmount0Point5ETHInWei), 3249 locked: false, 3250 }, 3251 { 3252 amount: big.NewInt(testAmount0Point5ETHInWei), 3253 locked: false, 3254 }, 3255 }, 3256 walletCommon.EthereumMainnet: { 3257 { 3258 amount: big.NewInt(testAmount2ETHInWei + testAmount0Point5ETHInWei), 3259 locked: false, 3260 }, 3261 { 3262 amount: big.NewInt(testAmount2ETHInWei), 3263 locked: false, 3264 }, 3265 }, 3266 }, 3267 }, 3268 { 3269 name: "Transfer - All From Chain - Locked Amount To Multiple Chains - Enough Token Balance If All Chains Are Used", 3270 input: &requests.RouteInputParams{ 3271 TestnetMode: false, 3272 Uuid: uuid.NewString(), 3273 SendType: sendtype.Transfer, 3274 AmountIn: (*hexutil.Big)(big.NewInt(testAmount3ETHInWei)), 3275 TokenID: pathprocessor.EthSymbol, 3276 FromLockedAmount: map[uint64]*hexutil.Big{ 3277 walletCommon.OptimismMainnet: (*hexutil.Big)(big.NewInt(testAmount0Point5ETHInWei)), 3278 walletCommon.EthereumMainnet: (*hexutil.Big)(big.NewInt(testAmount1ETHInWei)), 3279 }, 3280 3281 TestsMode: true, 3282 TestParams: &requests.RouterTestParams{ 3283 TokenFrom: &token.Token{ 3284 ChainID: 1, 3285 Symbol: pathprocessor.EthSymbol, 3286 Decimals: 18, 3287 }, 3288 BalanceMap: map[string]*big.Int{ 3289 makeBalanceKey(walletCommon.EthereumMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount2ETHInWei), 3290 makeBalanceKey(walletCommon.OptimismMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount1ETHInWei), 3291 makeBalanceKey(walletCommon.ArbitrumMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount3ETHInWei), 3292 }, 3293 }, 3294 }, 3295 expectedAmountOptions: map[uint64][]amountOption{ 3296 walletCommon.OptimismMainnet: { 3297 { 3298 amount: big.NewInt(testAmount0Point5ETHInWei), 3299 locked: true, 3300 }, 3301 }, 3302 walletCommon.ArbitrumMainnet: { 3303 { 3304 amount: big.NewInt(testAmount1ETHInWei + testAmount0Point5ETHInWei), 3305 locked: false, 3306 }, 3307 }, 3308 walletCommon.EthereumMainnet: { 3309 { 3310 amount: big.NewInt(testAmount1ETHInWei), 3311 locked: true, 3312 }, 3313 }, 3314 }, 3315 }, 3316 { 3317 name: "Transfer - All From Chain - No Locked Amount - Not Enough Token Balance", 3318 input: &requests.RouteInputParams{ 3319 TestnetMode: false, 3320 Uuid: uuid.NewString(), 3321 SendType: sendtype.Transfer, 3322 AmountIn: (*hexutil.Big)(big.NewInt(testAmount5ETHInWei)), 3323 TokenID: pathprocessor.EthSymbol, 3324 3325 TestsMode: true, 3326 TestParams: &requests.RouterTestParams{ 3327 TokenFrom: &token.Token{ 3328 ChainID: 1, 3329 Symbol: pathprocessor.EthSymbol, 3330 Decimals: 18, 3331 }, 3332 BalanceMap: map[string]*big.Int{ 3333 makeBalanceKey(walletCommon.EthereumMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount1ETHInWei), 3334 makeBalanceKey(walletCommon.OptimismMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount1ETHInWei), 3335 makeBalanceKey(walletCommon.ArbitrumMainnet, pathprocessor.EthSymbol): big.NewInt(testAmount1ETHInWei), 3336 }, 3337 }, 3338 }, 3339 expectedAmountOptions: map[uint64][]amountOption{ 3340 walletCommon.OptimismMainnet: { 3341 { 3342 amount: big.NewInt(testAmount5ETHInWei), 3343 locked: false, 3344 }, 3345 }, 3346 walletCommon.ArbitrumMainnet: { 3347 { 3348 amount: big.NewInt(testAmount5ETHInWei), 3349 locked: false, 3350 }, 3351 }, 3352 walletCommon.EthereumMainnet: { 3353 { 3354 amount: big.NewInt(testAmount5ETHInWei), 3355 locked: false, 3356 }, 3357 }, 3358 }, 3359 }, 3360 } 3361 }