feat_: integrate base chain (#6228)

* feat_: integrate base chain

Signed-off-by: Brian Sztamfater <brian@status.im>
Co-authored-by: Dario Gabriel Lipicar <dario@status.im>
This commit is contained in:
Brian Sztamfater 2025-01-20 12:12:11 -03:00 committed by GitHub
parent 40b4ae4a06
commit 27ad41ba8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
38 changed files with 4409 additions and 147 deletions

View File

@ -42,3 +42,4 @@ exclude_patterns:
- "static/" - "static/"
- "t/" - "t/"
- "images/qr-assets.go" - "images/qr-assets.go"
- "contracts/hop/l2Contracts/l2BaseBridge/l2BaseBridge.go"

View File

@ -1527,8 +1527,10 @@ func TestWalletConfigOnLoginAccount(t *testing.T) {
alchemyArbitrumSepoliaToken := "alchemy-arbitrum-sepolia-token" alchemyArbitrumSepoliaToken := "alchemy-arbitrum-sepolia-token"
alchemyOptimismMainnetToken := "alchemy-optimism-mainnet-token" alchemyOptimismMainnetToken := "alchemy-optimism-mainnet-token"
alchemyOptimismSepoliaToken := "alchemy-optimism-sepolia-token" alchemyOptimismSepoliaToken := "alchemy-optimism-sepolia-token"
raribleMainnetAPIKey := "rarible-mainnet-api-key" // nolint: gosec alchemyBaseMainnetToken := "alchemy-base-mainnet-token" // nolint: gosec
raribleTestnetAPIKey := "rarible-testnet-api-key" // nolint: gosec alchemyBaseSepoliaToken := "alchemy-base-sepolia-token" // nolint: gosec
raribleMainnetAPIKey := "rarible-mainnet-api-key" // nolint: gosec
raribleTestnetAPIKey := "rarible-testnet-api-key" // nolint: gosec
b := NewGethStatusBackend(tt.MustCreateTestLogger()) b := NewGethStatusBackend(tt.MustCreateTestLogger())
createAccountRequest := &requests.CreateAccount{ createAccountRequest := &requests.CreateAccount{
@ -1565,6 +1567,8 @@ func TestWalletConfigOnLoginAccount(t *testing.T) {
AlchemyArbitrumSepoliaToken: alchemyArbitrumSepoliaToken, AlchemyArbitrumSepoliaToken: alchemyArbitrumSepoliaToken,
AlchemyOptimismMainnetToken: alchemyOptimismMainnetToken, AlchemyOptimismMainnetToken: alchemyOptimismMainnetToken,
AlchemyOptimismSepoliaToken: alchemyOptimismSepoliaToken, AlchemyOptimismSepoliaToken: alchemyOptimismSepoliaToken,
AlchemyBaseMainnetToken: alchemyBaseMainnetToken,
AlchemyBaseSepoliaToken: alchemyBaseSepoliaToken,
RaribleMainnetAPIKey: raribleMainnetAPIKey, RaribleMainnetAPIKey: raribleMainnetAPIKey,
RaribleTestnetAPIKey: raribleTestnetAPIKey, RaribleTestnetAPIKey: raribleTestnetAPIKey,
}, },
@ -1585,6 +1589,8 @@ func TestWalletConfigOnLoginAccount(t *testing.T) {
require.Equal(t, b.config.WalletConfig.AlchemyAPIKeys[ArbitrumSepoliaChainID], alchemyArbitrumSepoliaToken) require.Equal(t, b.config.WalletConfig.AlchemyAPIKeys[ArbitrumSepoliaChainID], alchemyArbitrumSepoliaToken)
require.Equal(t, b.config.WalletConfig.AlchemyAPIKeys[OptimismChainID], alchemyOptimismMainnetToken) require.Equal(t, b.config.WalletConfig.AlchemyAPIKeys[OptimismChainID], alchemyOptimismMainnetToken)
require.Equal(t, b.config.WalletConfig.AlchemyAPIKeys[OptimismSepoliaChainID], alchemyOptimismSepoliaToken) require.Equal(t, b.config.WalletConfig.AlchemyAPIKeys[OptimismSepoliaChainID], alchemyOptimismSepoliaToken)
require.Equal(t, b.config.WalletConfig.AlchemyAPIKeys[BaseChainID], alchemyBaseMainnetToken)
require.Equal(t, b.config.WalletConfig.AlchemyAPIKeys[BaseSepoliaChainID], alchemyBaseSepoliaToken)
require.Equal(t, b.config.WalletConfig.RaribleMainnetAPIKey, raribleMainnetAPIKey) require.Equal(t, b.config.WalletConfig.RaribleMainnetAPIKey, raribleMainnetAPIKey)
require.Equal(t, b.config.WalletConfig.RaribleTestnetAPIKey, raribleTestnetAPIKey) require.Equal(t, b.config.WalletConfig.RaribleTestnetAPIKey, raribleTestnetAPIKey)
@ -1846,6 +1852,8 @@ func TestRestoreKeycardAccountAndLogin(t *testing.T) {
"alchemyArbitrumSepoliaToken": "", "alchemyArbitrumSepoliaToken": "",
"alchemyOptimismMainnetToken": "", "alchemyOptimismMainnetToken": "",
"alchemyOptimismSepoliaToken": "", "alchemyOptimismSepoliaToken": "",
"alchemyBaseMainnetToken": "",
"alchemyBaseSepoliaToken": "",
}, },
"torrentConfigEnabled": false, "torrentConfigEnabled": false,
"torrentConfigPort": 0, "torrentConfigPort": 0,

View File

@ -16,6 +16,8 @@ const (
OptimismSepoliaChainID uint64 = 11155420 OptimismSepoliaChainID uint64 = 11155420
ArbitrumChainID uint64 = 42161 ArbitrumChainID uint64 = 42161
ArbitrumSepoliaChainID uint64 = 421614 ArbitrumSepoliaChainID uint64 = 421614
BaseChainID uint64 = 8453
BaseSepoliaChainID uint64 = 84532
sntSymbol = "SNT" sntSymbol = "SNT"
sttSymbol = "STT" sttSymbol = "STT"
) )
@ -30,7 +32,7 @@ func mainnet(stageName string) params.Network {
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/ethereum/mainnet/", stageName), DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/ethereum/mainnet/", stageName),
DefaultFallbackURL2: fmt.Sprintf("https://%s.api.status.im/grove/ethereum/mainnet/", stageName), DefaultFallbackURL2: fmt.Sprintf("https://%s.api.status.im/grove/ethereum/mainnet/", stageName),
RPCURL: "https://mainnet.infura.io/v3/", RPCURL: "https://mainnet.infura.io/v3/",
FallbackURL: "https://eth-archival.rpc.grove.city/v1/", FallbackURL: "https://eth.rpc.grove.city/v1/",
BlockExplorerURL: "https://etherscan.io/", BlockExplorerURL: "https://etherscan.io/",
IconURL: "network/Network=Ethereum", IconURL: "network/Network=Ethereum",
ChainColor: "#627EEA", ChainColor: "#627EEA",
@ -53,7 +55,7 @@ func sepolia(stageName string) params.Network {
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/ethereum/sepolia/", stageName), DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/ethereum/sepolia/", stageName),
DefaultFallbackURL2: fmt.Sprintf("https://%s.api.status.im/grove/ethereum/sepolia/", stageName), DefaultFallbackURL2: fmt.Sprintf("https://%s.api.status.im/grove/ethereum/sepolia/", stageName),
RPCURL: "https://sepolia.infura.io/v3/", RPCURL: "https://sepolia.infura.io/v3/",
FallbackURL: "https://sepolia-archival.rpc.grove.city/v1/", FallbackURL: "https://eth-sepolia-testnet.rpc.grove.city/v1/",
BlockExplorerURL: "https://sepolia.etherscan.io/", BlockExplorerURL: "https://sepolia.etherscan.io/",
IconURL: "network/Network=Ethereum", IconURL: "network/Network=Ethereum",
ChainColor: "#627EEA", ChainColor: "#627EEA",
@ -76,7 +78,7 @@ func optimism(stageName string) params.Network {
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/optimism/mainnet/", stageName), DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/optimism/mainnet/", stageName),
DefaultFallbackURL2: fmt.Sprintf("https://%s.api.status.im/grove/optimism/mainnet/", stageName), DefaultFallbackURL2: fmt.Sprintf("https://%s.api.status.im/grove/optimism/mainnet/", stageName),
RPCURL: "https://optimism-mainnet.infura.io/v3/", RPCURL: "https://optimism-mainnet.infura.io/v3/",
FallbackURL: "https://optimism-archival.rpc.grove.city/v1/", FallbackURL: "https://optimism.rpc.grove.city/v1/",
BlockExplorerURL: "https://optimistic.etherscan.io", BlockExplorerURL: "https://optimistic.etherscan.io",
IconURL: "network/Network=Optimism", IconURL: "network/Network=Optimism",
ChainColor: "#E90101", ChainColor: "#E90101",
@ -99,7 +101,7 @@ func optimismSepolia(stageName string) params.Network {
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/optimism/sepolia/", stageName), DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/optimism/sepolia/", stageName),
DefaultFallbackURL2: fmt.Sprintf("https://%s.api.status.im/grove/optimism/sepolia/", stageName), DefaultFallbackURL2: fmt.Sprintf("https://%s.api.status.im/grove/optimism/sepolia/", stageName),
RPCURL: "https://optimism-sepolia.infura.io/v3/", RPCURL: "https://optimism-sepolia.infura.io/v3/",
FallbackURL: "https://optimism-sepolia-archival.rpc.grove.city/v1/", FallbackURL: "https://optimism-sepolia-testnet.rpc.grove.city/v1/",
BlockExplorerURL: "https://sepolia-optimism.etherscan.io/", BlockExplorerURL: "https://sepolia-optimism.etherscan.io/",
IconURL: "network/Network=Optimism", IconURL: "network/Network=Optimism",
ChainColor: "#E90101", ChainColor: "#E90101",
@ -114,6 +116,52 @@ func optimismSepolia(stageName string) params.Network {
} }
} }
func base(stageName string) params.Network {
return params.Network{
ChainID: BaseChainID,
ChainName: "Base",
DefaultRPCURL: fmt.Sprintf("https://%s.api.status.im/nodefleet/base/mainnet/", stageName),
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/base/mainnet/", stageName),
DefaultFallbackURL2: fmt.Sprintf("https://%s.api.status.im/grove/base/mainnet/", stageName),
RPCURL: "https://base-mainnet.infura.io/v3/",
FallbackURL: "https://base.rpc.grove.city/v1/",
BlockExplorerURL: "https://basescan.org",
IconURL: "network/Network=Base",
ChainColor: "#0052FF",
ShortName: "base",
NativeCurrencyName: "Ether",
NativeCurrencySymbol: "ETH",
NativeCurrencyDecimals: 18,
IsTest: false,
Layer: 2,
Enabled: true,
RelatedChainID: BaseSepoliaChainID,
}
}
func baseSepolia(stageName string) params.Network {
return params.Network{
ChainID: BaseSepoliaChainID,
ChainName: "Base",
DefaultRPCURL: fmt.Sprintf("https://%s.api.status.im/nodefleet/base/sepolia/", stageName),
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/base/sepolia/", stageName),
DefaultFallbackURL2: fmt.Sprintf("https://%s.api.status.im/grove/base/sepolia/", stageName),
RPCURL: "https://base-sepolia.infura.io/v3/",
FallbackURL: "https://base-testnet.rpc.grove.city/v1/",
BlockExplorerURL: "https://sepolia.basescan.org/",
IconURL: "network/Network=Base",
ChainColor: "#0052FF",
ShortName: "base",
NativeCurrencyName: "Ether",
NativeCurrencySymbol: "ETH",
NativeCurrencyDecimals: 18,
IsTest: true,
Layer: 2,
Enabled: false,
RelatedChainID: BaseChainID,
}
}
func arbitrum(stageName string) params.Network { func arbitrum(stageName string) params.Network {
return params.Network{ return params.Network{
ChainID: ArbitrumChainID, ChainID: ArbitrumChainID,
@ -145,7 +193,7 @@ func arbitrumSepolia(stageName string) params.Network {
DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/arbitrum/sepolia/", stageName), DefaultFallbackURL: fmt.Sprintf("https://%s.api.status.im/infura/arbitrum/sepolia/", stageName),
DefaultFallbackURL2: fmt.Sprintf("https://%s.api.status.im/grove/arbitrum/sepolia/", stageName), DefaultFallbackURL2: fmt.Sprintf("https://%s.api.status.im/grove/arbitrum/sepolia/", stageName),
RPCURL: "https://arbitrum-sepolia.infura.io/v3/", RPCURL: "https://arbitrum-sepolia.infura.io/v3/",
FallbackURL: "https://arbitrum-sepolia-archival.rpc.grove.city/v1/", FallbackURL: "https://arbitrum-sepolia-testnet.rpc.grove.city/v1/",
BlockExplorerURL: "https://sepolia-explorer.arbitrum.io/", BlockExplorerURL: "https://sepolia-explorer.arbitrum.io/",
IconURL: "network/Network=Arbitrum", IconURL: "network/Network=Arbitrum",
ChainColor: "#51D0F0", ChainColor: "#51D0F0",
@ -168,6 +216,8 @@ func defaultNetworks(stageName string) []params.Network {
optimismSepolia(stageName), optimismSepolia(stageName),
arbitrum(stageName), arbitrum(stageName),
arbitrumSepolia(stageName), arbitrumSepolia(stageName),
base(stageName),
baseSepolia(stageName),
} }
} }

View File

@ -23,7 +23,7 @@ func TestBuildDefaultNetworks(t *testing.T) {
actualNetworks := BuildDefaultNetworks(&request.WalletSecretsConfig) actualNetworks := BuildDefaultNetworks(&request.WalletSecretsConfig)
require.Len(t, actualNetworks, 6) require.Len(t, actualNetworks, 8)
for _, n := range actualNetworks { for _, n := range actualNetworks {
var err error var err error
@ -34,6 +34,8 @@ func TestBuildDefaultNetworks(t *testing.T) {
case OptimismSepoliaChainID: case OptimismSepoliaChainID:
case ArbitrumChainID: case ArbitrumChainID:
case ArbitrumSepoliaChainID: case ArbitrumSepoliaChainID:
case BaseChainID:
case BaseSepoliaChainID:
default: default:
err = errors.Errorf("unexpected chain id: %d", n.ChainID) err = errors.Errorf("unexpected chain id: %d", n.ChainID)
} }
@ -63,7 +65,7 @@ func TestBuildDefaultNetworksGanache(t *testing.T) {
actualNetworks := BuildDefaultNetworks(&request.WalletSecretsConfig) actualNetworks := BuildDefaultNetworks(&request.WalletSecretsConfig)
require.Len(t, actualNetworks, 6) require.Len(t, actualNetworks, 8)
for _, n := range actualNetworks { for _, n := range actualNetworks {
require.True(t, strings.Contains(n.RPCURL, ganacheURL)) require.True(t, strings.Contains(n.RPCURL, ganacheURL))

View File

@ -215,6 +215,12 @@ func buildWalletConfig(request *requests.WalletSecretsConfig, statusProxyEnabled
if request.AlchemyOptimismSepoliaToken != "" { if request.AlchemyOptimismSepoliaToken != "" {
walletConfig.AlchemyAPIKeys[OptimismSepoliaChainID] = request.AlchemyOptimismSepoliaToken walletConfig.AlchemyAPIKeys[OptimismSepoliaChainID] = request.AlchemyOptimismSepoliaToken
} }
if request.AlchemyBaseMainnetToken != "" {
walletConfig.AlchemyAPIKeys[BaseChainID] = request.AlchemyBaseMainnetToken
}
if request.AlchemyBaseSepoliaToken != "" {
walletConfig.AlchemyAPIKeys[BaseSepoliaChainID] = request.AlchemyBaseSepoliaToken
}
if request.StatusProxyMarketUser != "" { if request.StatusProxyMarketUser != "" {
walletConfig.StatusProxyMarketUser = request.StatusProxyMarketUser walletConfig.StatusProxyMarketUser = request.StatusProxyMarketUser
} }

View File

@ -12,9 +12,11 @@ var contractDataByChainID = map[uint64]common.Address{
1: common.HexToAddress("0x040EA8bFE441597849A9456182fa46D38B75BC05"), // mainnet 1: common.HexToAddress("0x040EA8bFE441597849A9456182fa46D38B75BC05"), // mainnet
10: common.HexToAddress("0x55bD303eA3D50FC982A8a5b43972d7f38D129bbF"), // optimism 10: common.HexToAddress("0x55bD303eA3D50FC982A8a5b43972d7f38D129bbF"), // optimism
42161: common.HexToAddress("0x54764eF12d29b249fDC7FC3caDc039955A396A8e"), // arbitrum 42161: common.HexToAddress("0x54764eF12d29b249fDC7FC3caDc039955A396A8e"), // arbitrum
8453: common.HexToAddress("0x84A1C94fcc5EcFA292771f6aE7Fbf24ec062D34e"), // base
11155111: common.HexToAddress("0x55bD303eA3D50FC982A8a5b43972d7f38D129bbF"), // sepolia 11155111: common.HexToAddress("0x55bD303eA3D50FC982A8a5b43972d7f38D129bbF"), // sepolia
421614: common.HexToAddress("0x54764eF12d29b249fDC7FC3caDc039955A396A8e"), // sepolia arbitrum 421614: common.HexToAddress("0x54764eF12d29b249fDC7FC3caDc039955A396A8e"), // sepolia arbitrum
11155420: common.HexToAddress("0x55bD303eA3D50FC982A8a5b43972d7f38D129bbF"), // sepolia optimism 11155420: common.HexToAddress("0x55bD303eA3D50FC982A8a5b43972d7f38D129bbF"), // sepolia optimism
84532: common.HexToAddress("0x84A1C94fcc5EcFA292771f6aE7Fbf24ec062D34e"), // sepolia base
777333: common.HexToAddress("0x0000000000000000000000000000000010777333"), // unit tests 777333: common.HexToAddress("0x0000000000000000000000000000000010777333"), // unit tests
} }

View File

@ -4,18 +4,21 @@ import (
"errors" "errors"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
walletCommon "github.com/status-im/status-go/services/wallet/common"
) )
var errorNotAvailableOnChainID = errors.New("deployer contract not available for chainID") var errorNotAvailableOnChainID = errors.New("deployer contract not available for chainID")
// addresses can be found on https://github.com/status-im/communities-contracts#deployments // addresses can be found on https://github.com/status-im/communities-contracts#deployments
var contractAddressByChainID = map[uint64]common.Address{ var contractAddressByChainID = map[uint64]common.Address{
1: common.HexToAddress("0xB3Ef5B0825D5f665bE14394eea41E684CE96A4c5"), // Mainnet walletCommon.EthereumMainnet: common.HexToAddress("0xB3Ef5B0825D5f665bE14394eea41E684CE96A4c5"),
10: common.HexToAddress("0x31463D22750324C8721FF7751584EF62F2ff93b3"), // Optimism walletCommon.OptimismMainnet: common.HexToAddress("0x31463D22750324C8721FF7751584EF62F2ff93b3"),
42161: common.HexToAddress("0x744Fd6e98dad09Fb8CCF530B5aBd32B56D64943b"), // Arbitrum walletCommon.ArbitrumMainnet: common.HexToAddress("0x744Fd6e98dad09Fb8CCF530B5aBd32B56D64943b"),
11155111: common.HexToAddress("0xCDE984e57cdb88c70b53437cc694345B646371f9"), // Sepolia walletCommon.BaseMainnet: common.HexToAddress("0x898331B756EE1f29302DeF227a4471e960c50612"),
421614: common.HexToAddress("0x7Ff554af5b6624db2135E4364F416d1D397f43e6"), // Arbitrum Sepolia walletCommon.EthereumSepolia: common.HexToAddress("0xCDE984e57cdb88c70b53437cc694345B646371f9"),
11155420: common.HexToAddress("0xcE2A896eEA2F585BC0C3753DC8116BbE2AbaE541"), // Optimism Sepolia walletCommon.ArbitrumSepolia: common.HexToAddress("0x7Ff554af5b6624db2135E4364F416d1D397f43e6"),
walletCommon.OptimismSepolia: common.HexToAddress("0xcE2A896eEA2F585BC0C3753DC8116BbE2AbaE541"),
walletCommon.BaseSepolia: common.HexToAddress("0x7Ff554af5b6624db2135E4364F416d1D397f43e6"),
} }
func ContractAddress(chainID uint64) (common.Address, error) { func ContractAddress(chainID uint64) (common.Address, error) {

View File

@ -17,10 +17,12 @@ var contractDataByChainID = map[uint64]ContractData{
1: {common.HexToAddress("0x08A8fDBddc160A7d5b957256b903dCAb1aE512C5"), 12_194_222}, // mainnet 1: {common.HexToAddress("0x08A8fDBddc160A7d5b957256b903dCAb1aE512C5"), 12_194_222}, // mainnet
10: {common.HexToAddress("0x9e5076df494fc949abc4461f4e57592b81517d81"), 34_421_097}, // optimism 10: {common.HexToAddress("0x9e5076df494fc949abc4461f4e57592b81517d81"), 34_421_097}, // optimism
42161: {common.HexToAddress("0xbb85398092b83a016935a17fc857507b7851a071"), 70_031_945}, // arbitrum 42161: {common.HexToAddress("0xbb85398092b83a016935a17fc857507b7851a071"), 70_031_945}, // arbitrum
8453: {common.HexToAddress("0xc68c1e011cfE059EB94C8915c291502288704D89"), 24_567_587}, // base
777333: {common.HexToAddress("0x0000000000000000000000000000000000777333"), 50}, // unit tests 777333: {common.HexToAddress("0x0000000000000000000000000000000000777333"), 50}, // unit tests
11155111: {common.HexToAddress("0xec21ebe1918e8975fc0cd0c7747d318c00c0acd5"), 4_366_506}, // sepolia 11155111: {common.HexToAddress("0xec21ebe1918e8975fc0cd0c7747d318c00c0acd5"), 4_366_506}, // sepolia
421614: {common.HexToAddress("0xec21Ebe1918E8975FC0CD0c7747D318C00C0aCd5"), 553_947}, // sepolia arbitrum 421614: {common.HexToAddress("0xec21Ebe1918E8975FC0CD0c7747D318C00C0aCd5"), 553_947}, // sepolia arbitrum
11155420: {common.HexToAddress("0xec21ebe1918e8975fc0cd0c7747d318c00c0acd5"), 7_362_011}, // sepolia optimism 11155420: {common.HexToAddress("0xec21ebe1918e8975fc0cd0c7747d318c00c0acd5"), 7_362_011}, // sepolia optimism
84532: {common.HexToAddress("0xc68c1e011cfE059EB94C8915c291502288704D89"), 20_078_235}, // sepolia base
} }
func ContractAddress(chainID uint64) (common.Address, error) { func ContractAddress(chainID uint64) (common.Address, error) {

View File

@ -13,6 +13,8 @@ var ErrorNotAvailableOnChainID = errors.New("not available for chainID")
var contractAddressByChainID = map[uint64]common.Address{ var contractAddressByChainID = map[uint64]common.Address{
wallet_common.OptimismMainnet: common.HexToAddress("0x8527c030424728cF93E72bDbf7663281A44Eeb22"), wallet_common.OptimismMainnet: common.HexToAddress("0x8527c030424728cF93E72bDbf7663281A44Eeb22"),
wallet_common.OptimismSepolia: common.HexToAddress("0x5230210c2b4995FD5084b0F5FD0D7457aebb5010"), wallet_common.OptimismSepolia: common.HexToAddress("0x5230210c2b4995FD5084b0F5FD0D7457aebb5010"),
wallet_common.BaseMainnet: common.HexToAddress("0x8527c030424728cF93E72bDbf7663281A44Eeb22"),
wallet_common.BaseSepolia: common.HexToAddress("0x5230210c2b4995FD5084b0F5FD0D7457aebb5010"),
} }
func ContractAddress(chainID uint64) (common.Address, error) { func ContractAddress(chainID uint64) (common.Address, error) {

File diff suppressed because one or more lines are too long

View File

@ -48,6 +48,11 @@ var hopBridgeContractAddresses = map[string]map[uint64]map[string]common.Address
CctpL2Bridge: common.HexToAddress("0x6504BFcaB789c35325cA4329f1f41FaC340bf982"), CctpL2Bridge: common.HexToAddress("0x6504BFcaB789c35325cA4329f1f41FaC340bf982"),
CctpMessageTransmitter: common.HexToAddress("0xC30362313FBBA5cf9163F0bb16a0e01f01A896ca"), CctpMessageTransmitter: common.HexToAddress("0xC30362313FBBA5cf9163F0bb16a0e01f01A896ca"),
}, },
walletCommon.BaseMainnet: {
L2CanonicalToken: common.HexToAddress("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 "),
CctpL2Bridge: common.HexToAddress("0xe7F40BF16AB09f4a6906Ac2CAA4094aD2dA48Cc2"),
CctpMessageTransmitter: common.HexToAddress("0xAD09780d193884d503182aD4588450C416D6F9D4"),
},
walletCommon.EthereumSepolia: { walletCommon.EthereumSepolia: {
L1CanonicalToken: common.HexToAddress("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"), L1CanonicalToken: common.HexToAddress("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
CctpL1Bridge: common.HexToAddress("0x05fda2db623fa6a89a2db33550848ab2006a4427"), CctpL1Bridge: common.HexToAddress("0x05fda2db623fa6a89a2db33550848ab2006a4427"),
@ -60,6 +65,10 @@ var hopBridgeContractAddresses = map[string]map[uint64]map[string]common.Address
L2CanonicalToken: common.HexToAddress("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"), L2CanonicalToken: common.HexToAddress("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
CctpL2Bridge: common.HexToAddress("0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5"), CctpL2Bridge: common.HexToAddress("0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5"),
}, },
walletCommon.BaseSepolia: {
L2CanonicalToken: common.HexToAddress("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
CctpL2Bridge: common.HexToAddress("0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5"),
},
}, },
"USDC.e": { "USDC.e": {
walletCommon.EthereumMainnet: { walletCommon.EthereumMainnet: {
@ -94,6 +103,19 @@ var hopBridgeContractAddresses = map[string]map[uint64]map[string]common.Address
L2SaddleSwap: common.HexToAddress("0x10541b07d8Ad2647Dc6cD67abd4c03575dade261"), L2SaddleSwap: common.HexToAddress("0x10541b07d8Ad2647Dc6cD67abd4c03575dade261"),
L2SaddleLpToken: common.HexToAddress("0xB67c014FA700E69681a673876eb8BAFAA36BFf71"), L2SaddleLpToken: common.HexToAddress("0xB67c014FA700E69681a673876eb8BAFAA36BFf71"),
}, },
walletCommon.BaseMainnet: {
L1CanonicalBridge: common.HexToAddress("0x0000000000000000000000000000000000000000"),
L1MessengerWrapper: common.HexToAddress("0x4a55e8e407609A3046804ca500BeF6F5ebaCb6F9"),
L2CanonicalBridge: common.HexToAddress("0x0000000000000000000000000000000000000000"),
L2CanonicalToken: common.HexToAddress("0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA"),
L2Bridge: common.HexToAddress("0x46ae9BaB8CEA96610807a275EBD36f8e916b5C61"),
CctpL2Bridge: common.HexToAddress("0xe7F40BF16AB09f4a6906Ac2CAA4094aD2dA48Cc2"),
CctpMessageTransmitter: common.HexToAddress("0xAD09780d193884d503182aD4588450C416D6F9D4"),
L2HopBridgeToken: common.HexToAddress("0x74fa978EaFFa312bC92e76dF40FcC1bFE7637Aeb"),
L2AmmWrapper: common.HexToAddress("0x7D269D3E0d61A05a0bA976b7DBF8805bF844AF3F"),
L2SaddleSwap: common.HexToAddress("0x022C5cE6F1Add7423268D41e08Df521D5527C2A0"),
L2SaddleLpToken: common.HexToAddress("0x3b507422EBe64440f03BCbE5EEe4bdF76517f320"),
},
walletCommon.EthereumSepolia: { walletCommon.EthereumSepolia: {
L1CanonicalToken: common.HexToAddress("0x95B01328BA6f4de261C4907fB35eE3c4968e9CEF"), L1CanonicalToken: common.HexToAddress("0x95B01328BA6f4de261C4907fB35eE3c4968e9CEF"),
CctpL1Bridge: common.HexToAddress("0x98bc5b835686e1a00e6c2168af162905899e93d6"), CctpL1Bridge: common.HexToAddress("0x98bc5b835686e1a00e6c2168af162905899e93d6"),
@ -191,6 +213,17 @@ var hopBridgeContractAddresses = map[string]map[uint64]map[string]common.Address
L2SaddleSwap: common.HexToAddress("0x652d27c0F72771Ce5C76fd400edD61B406Ac6D97"), L2SaddleSwap: common.HexToAddress("0x652d27c0F72771Ce5C76fd400edD61B406Ac6D97"),
L2SaddleLpToken: common.HexToAddress("0x59745774Ed5EfF903e615F5A2282Cae03484985a"), L2SaddleLpToken: common.HexToAddress("0x59745774Ed5EfF903e615F5A2282Cae03484985a"),
}, },
walletCommon.BaseMainnet: {
L1CanonicalBridge: common.HexToAddress("0x0000000000000000000000000000000000000000"),
L1MessengerWrapper: common.HexToAddress("0x17B5ACE1cD6b0d033431873826937F499Eec2C95"),
L2CanonicalBridge: common.HexToAddress("0x0000000000000000000000000000000000000000"),
L2CanonicalToken: common.HexToAddress("0x4200000000000000000000000000000000000006"),
L2Bridge: common.HexToAddress("0x3666f603Cc164936C1b87e207F36BEBa4AC5f18a"),
L2HopBridgeToken: common.HexToAddress("0xC1985d7a3429cDC85E59E2E4Fcc805b857e6Ee2E"),
L2AmmWrapper: common.HexToAddress("0x10541b07d8Ad2647Dc6cD67abd4c03575dade261"),
L2SaddleSwap: common.HexToAddress("0x0ce6c85cF43553DE10FC56cecA0aef6Ff0DD444d"),
L2SaddleLpToken: common.HexToAddress("0xe9605BEc1c5C3E81F974F80b8dA9fBEFF4845d4D"),
},
}, },
"HOP": { "HOP": {
walletCommon.EthereumMainnet: { walletCommon.EthereumMainnet: {
@ -219,6 +252,17 @@ var hopBridgeContractAddresses = map[string]map[uint64]map[string]common.Address
L2SaddleSwap: common.HexToAddress("0x0000000000000000000000000000000000000000"), L2SaddleSwap: common.HexToAddress("0x0000000000000000000000000000000000000000"),
L2SaddleLpToken: common.HexToAddress("0x0000000000000000000000000000000000000000"), L2SaddleLpToken: common.HexToAddress("0x0000000000000000000000000000000000000000"),
}, },
walletCommon.BaseMainnet: {
L1CanonicalBridge: common.HexToAddress("0x0000000000000000000000000000000000000000"),
L1MessengerWrapper: common.HexToAddress("0x86eD3B8AD6b721fD3a2Fa73c227987Fb9AD3D1Ae"),
L2CanonicalBridge: common.HexToAddress("0x0000000000000000000000000000000000000000"),
L2CanonicalToken: common.HexToAddress("0xc5102fE9359FD9a28f877a67E36B0F050d81a3CC"),
L2Bridge: common.HexToAddress("0xe22D2beDb3Eca35E6397e0C6D62857094aA26F52"),
L2HopBridgeToken: common.HexToAddress("0xc5102fE9359FD9a28f877a67E36B0F050d81a3CC"),
L2AmmWrapper: common.HexToAddress("0x0000000000000000000000000000000000000000"),
L2SaddleSwap: common.HexToAddress("0x0000000000000000000000000000000000000000"),
L2SaddleLpToken: common.HexToAddress("0x0000000000000000000000000000000000000000"),
},
}, },
"SNX": { "SNX": {
walletCommon.EthereumMainnet: { walletCommon.EthereumMainnet: {

File diff suppressed because one or more lines are too long

View File

@ -32,6 +32,8 @@ var sensitiveKeys = []string{
"alchemyArbitrumSepoliaToken", "alchemyArbitrumSepoliaToken",
"alchemyOptimismMainnetToken", "alchemyOptimismMainnetToken",
"alchemyOptimismSepoliaToken", "alchemyOptimismSepoliaToken",
"alchemyBaseMainnetToken",
"alchemyBaseSepoliaToken",
"statusProxyMarketUser", "statusProxyMarketUser",
"statusProxyMarketPassword", "statusProxyMarketPassword",
"statusProxyBlockchainUser", "statusProxyBlockchainUser",

View File

@ -114,9 +114,9 @@ const (
AccountPartiallyOperable AccountOperable = "partially" // an account is partially operable if it is not a keycard account and there is created keystore file for the address it is derived from AccountPartiallyOperable AccountOperable = "partially" // an account is partially operable if it is not a keycard account and there is created keystore file for the address it is derived from
AccountFullyOperable AccountOperable = "fully" // an account is fully operable if it is not a keycard account and there is a keystore file for it AccountFullyOperable AccountOperable = "fully" // an account is fully operable if it is not a keycard account and there is a keystore file for it
ProdPreferredChainIDsDefault = "1:10:42161" ProdPreferredChainIDsDefault = "1:10:42161:8453"
TestPreferredChainIDsDefault = "5:420:421613" TestPreferredChainIDsDefault = "5:420:421613"
TestSepoliaPreferredChainIDsDefault = "11155111:11155420:421614" TestSepoliaPreferredChainIDsDefault = "11155111:11155420:421614:84532"
) )
// Returns true if an account is a wallet account that logged in user has a control over, otherwise returns false. // Returns true if an account is a wallet account that logged in user has a control over, otherwise returns false.

View File

@ -289,7 +289,7 @@ func NewDefaultTokenManager(tm *token.Manager, nm network.ManagerInterface) *Def
type BalancesByChain = map[uint64]map[gethcommon.Address]map[gethcommon.Address]*hexutil.Big type BalancesByChain = map[uint64]map[gethcommon.Address]map[gethcommon.Address]*hexutil.Big
func (m *DefaultTokenManager) GetAllChainIDs() ([]uint64, error) { func (m *DefaultTokenManager) GetAllChainIDs() ([]uint64, error) {
networks, err := m.networkManager.Get(false) networks, err := m.networkManager.GetAll()
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -102,6 +102,8 @@ type WalletSecretsConfig struct {
AlchemyArbitrumSepoliaToken string `json:"alchemyArbitrumSepoliaToken"` AlchemyArbitrumSepoliaToken string `json:"alchemyArbitrumSepoliaToken"`
AlchemyOptimismMainnetToken string `json:"alchemyOptimismMainnetToken"` AlchemyOptimismMainnetToken string `json:"alchemyOptimismMainnetToken"`
AlchemyOptimismSepoliaToken string `json:"alchemyOptimismSepoliaToken"` AlchemyOptimismSepoliaToken string `json:"alchemyOptimismSepoliaToken"`
AlchemyBaseMainnetToken string `json:"alchemyBaseMainnetToken"`
AlchemyBaseSepoliaToken string `json:"alchemyBaseSepoliaToken"`
StatusProxyStageName string `json:"statusProxyStageName"` StatusProxyStageName string `json:"statusProxyStageName"`
StatusProxyMarketUser string `json:"statusProxyMarketUser"` StatusProxyMarketUser string `json:"statusProxyMarketUser"`

View File

@ -11,7 +11,7 @@ import (
"github.com/status-im/status-go/params" "github.com/status-im/status-go/params"
) )
var SepoliaChainIDs = []uint64{11155111, 421614, 11155420} var SepoliaChainIDs = []uint64{11155111, 421614, 11155420, 84532}
type CombinedNetwork struct { type CombinedNetwork struct {
Prod *params.Network Prod *params.Network
@ -319,7 +319,7 @@ func (nm *Manager) GetActiveNetworks() ([]*params.Network, error) {
return nil, err return nil, err
} }
networks, err := nm.Get(false) networks, err := nm.GetAll()
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -454,7 +454,7 @@ func getActivityEntries(ctx context.Context, deps FilterDependencies, addresses
networks = joinItems(chainIDs, nil) networks = joinItems(chainIDs, nil)
} }
layer2Chains := []uint64{common.OptimismMainnet, common.OptimismSepolia, common.ArbitrumMainnet, common.ArbitrumSepolia} layer2Chains := []uint64{common.OptimismMainnet, common.OptimismSepolia, common.ArbitrumMainnet, common.ArbitrumSepolia, common.BaseMainnet, common.BaseSepolia}
layer2Networks := joinItems(layer2Chains, func(chainID uint64) string { layer2Networks := joinItems(layer2Chains, func(chainID uint64) string {
return fmt.Sprintf("%d", chainID) return fmt.Sprintf("%d", chainID)
}) })

View File

@ -37,6 +37,8 @@ const (
BinanceChainID uint64 = 56 // obsolete? BinanceChainID uint64 = 56 // obsolete?
BinanceTestChainID uint64 = 97 // obsolete? BinanceTestChainID uint64 = 97 // obsolete?
AnvilMainnet uint64 = 31337 AnvilMainnet uint64 = 31337
BaseMainnet uint64 = 8453
BaseSepolia uint64 = 84532
) )
var ( var (
@ -44,12 +46,14 @@ var (
EthereumMainnet: true, EthereumMainnet: true,
OptimismMainnet: true, OptimismMainnet: true,
ArbitrumMainnet: true, ArbitrumMainnet: true,
BaseMainnet: true,
} }
SupportedTestNetworks = map[uint64]bool{ SupportedTestNetworks = map[uint64]bool{
EthereumSepolia: true, EthereumSepolia: true,
OptimismSepolia: true, OptimismSepolia: true,
ArbitrumSepolia: true, ArbitrumSepolia: true,
BaseSepolia: true,
} }
) )
@ -84,9 +88,9 @@ func (c ChainID) ToUint() uint64 {
func (c ChainID) IsMainnet() bool { func (c ChainID) IsMainnet() bool {
switch uint64(c) { switch uint64(c) {
case EthereumMainnet, OptimismMainnet, ArbitrumMainnet: case EthereumMainnet, OptimismMainnet, ArbitrumMainnet, BaseMainnet:
return true return true
case EthereumSepolia, OptimismSepolia, ArbitrumSepolia: case EthereumSepolia, OptimismSepolia, ArbitrumSepolia, BaseSepolia:
return false return false
case UnknownChainID: case UnknownChainID:
return false return false
@ -102,12 +106,15 @@ func AllChainIDs() []ChainID {
ChainID(OptimismSepolia), ChainID(OptimismSepolia),
ChainID(ArbitrumMainnet), ChainID(ArbitrumMainnet),
ChainID(ArbitrumSepolia), ChainID(ArbitrumSepolia),
ChainID(BaseMainnet),
ChainID(BaseSepolia),
} }
} }
var AverageBlockDurationForChain = map[ChainID]time.Duration{ var AverageBlockDurationForChain = map[ChainID]time.Duration{
ChainID(UnknownChainID): time.Duration(12000) * time.Millisecond, ChainID(UnknownChainID): time.Duration(12000) * time.Millisecond,
ChainID(EthereumMainnet): time.Duration(12000) * time.Millisecond, ChainID(EthereumMainnet): time.Duration(12000) * time.Millisecond,
ChainID(OptimismMainnet): time.Duration(400) * time.Millisecond, ChainID(OptimismMainnet): time.Duration(2000) * time.Millisecond,
ChainID(ArbitrumMainnet): time.Duration(300) * time.Millisecond, ChainID(ArbitrumMainnet): time.Duration(250) * time.Millisecond,
ChainID(BaseMainnet): time.Duration(2000) * time.Millisecond,
} }

View File

@ -53,7 +53,7 @@ func (p *MercuryoProvider) GetCryptoOnRamp(ctx context.Context) (CryptoOnRamp, e
Hostname: "mercuryo.io", Hostname: "mercuryo.io",
SupportsSinglePurchase: true, SupportsSinglePurchase: true,
SupportsRecurrentPurchase: true, SupportsRecurrentPurchase: true,
SupportedChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.OptimismMainnet}, SupportedChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.OptimismMainnet, walletCommon.BaseMainnet},
URLsNeedParameters: true, URLsNeedParameters: true,
SiteURL: mercuryioNoFeesBaseURL, SiteURL: mercuryioNoFeesBaseURL,
RecurrentSiteURL: mercuryioNoFeesBaseURL + "&widget_flow=recurrent", RecurrentSiteURL: mercuryioNoFeesBaseURL + "&widget_flow=recurrent",

View File

@ -34,7 +34,7 @@ func (p *MoonPayProvider) GetCryptoOnRamp(ctx context.Context) (CryptoOnRamp, er
Hostname: "moonpay.com", Hostname: "moonpay.com",
SupportsSinglePurchase: true, SupportsSinglePurchase: true,
SupportsRecurrentPurchase: false, SupportsRecurrentPurchase: false,
SupportedChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.OptimismMainnet}, SupportedChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.OptimismMainnet, walletCommon.BaseMainnet},
URLsNeedParameters: false, URLsNeedParameters: false,
SiteURL: moonpayURL, SiteURL: moonpayURL,
} }

View File

@ -34,7 +34,7 @@ func (p *RampProvider) GetCryptoOnRamp(ctx context.Context) (CryptoOnRamp, error
Hostname: "ramp.network", Hostname: "ramp.network",
SupportsSinglePurchase: true, SupportsSinglePurchase: true,
SupportsRecurrentPurchase: false, SupportsRecurrentPurchase: false,
SupportedChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.OptimismMainnet}, SupportedChainIDs: []uint64{walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.OptimismMainnet, walletCommon.BaseMainnet},
URLsNeedParameters: false, URLsNeedParameters: false,
SiteURL: rampSiteURL, SiteURL: rampSiteURL,
} }

View File

@ -41,6 +41,8 @@ func getChainPriority(chainID uint64) int {
return 2 return 2
case common.ArbitrumMainnet, common.ArbitrumSepolia: case common.ArbitrumMainnet, common.ArbitrumSepolia:
return 3 return 3
case common.BaseMainnet, common.BaseSepolia:
return 4
default: default:
return 0 return 0
} }

View File

@ -25,6 +25,7 @@ import (
hopL1HopBridge "github.com/status-im/status-go/contracts/hop/l1Contracts/l1HopBridge" hopL1HopBridge "github.com/status-im/status-go/contracts/hop/l1Contracts/l1HopBridge"
hopL2AmmWrapper "github.com/status-im/status-go/contracts/hop/l2Contracts/l2AmmWrapper" hopL2AmmWrapper "github.com/status-im/status-go/contracts/hop/l2Contracts/l2AmmWrapper"
hopL2ArbitrumBridge "github.com/status-im/status-go/contracts/hop/l2Contracts/l2ArbitrumBridge" hopL2ArbitrumBridge "github.com/status-im/status-go/contracts/hop/l2Contracts/l2ArbitrumBridge"
hopL2BaseBridge "github.com/status-im/status-go/contracts/hop/l2Contracts/l2BaseBridge"
hopL2CctpImplementation "github.com/status-im/status-go/contracts/hop/l2Contracts/l2CctpImplementation" hopL2CctpImplementation "github.com/status-im/status-go/contracts/hop/l2Contracts/l2CctpImplementation"
hopL2OptimismBridge "github.com/status-im/status-go/contracts/hop/l2Contracts/l2OptimismBridge" hopL2OptimismBridge "github.com/status-im/status-go/contracts/hop/l2Contracts/l2OptimismBridge"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
@ -184,6 +185,10 @@ func (c *HopBridgeProcessor) getAppropriateABI(contractType string, chainID uint
chainID == walletCommon.ArbitrumSepolia { chainID == walletCommon.ArbitrumSepolia {
return abi.JSON(strings.NewReader(hopL2ArbitrumBridge.HopL2ArbitrumBridgeABI)) return abi.JSON(strings.NewReader(hopL2ArbitrumBridge.HopL2ArbitrumBridgeABI))
} }
if chainID == walletCommon.BaseMainnet ||
chainID == walletCommon.BaseSepolia {
return abi.JSON(strings.NewReader(hopL2BaseBridge.HopL2BaseBridgeABI))
}
} }
return abi.ABI{}, ErrNotAvailableForContractType return abi.ABI{}, ErrNotAvailableForContractType
@ -468,6 +473,7 @@ func (h *HopBridgeProcessor) CalculateFees(params ProcessorInputParams) (*big.In
walletCommon.EthereumMainnet: "ethereum", walletCommon.EthereumMainnet: "ethereum",
walletCommon.OptimismMainnet: "optimism", walletCommon.OptimismMainnet: "optimism",
walletCommon.ArbitrumMainnet: "arbitrum", walletCommon.ArbitrumMainnet: "arbitrum",
walletCommon.BaseMainnet: "base",
} }
fromChainName, ok := hopChainsMap[params.FromChain.ChainID] fromChainName, ok := hopChainsMap[params.FromChain.ChainID]
@ -730,6 +736,24 @@ func (h *HopBridgeProcessor) sendL2BridgeTx(contractAddress common.Address, ethC
bonderFee.AmountOutMin.Int, bonderFee.AmountOutMin.Int,
big.NewInt(bonderFee.Deadline)) big.NewInt(bonderFee.Deadline))
} }
if fromChainID == walletCommon.BaseMainnet ||
fromChainID == walletCommon.BaseSepolia {
contractInstance, err := hopL2BaseBridge.NewHopL2BaseBridge(
contractAddress,
ethClient,
)
if err != nil {
return tx, createBridgeHopErrorResponse(err)
}
return contractInstance.Send(
txOpts,
big.NewInt(int64(toChainID)),
to,
bonderFee.AmountIn.Int,
bonderFee.BonderFee.Int,
bonderFee.AmountOutMin.Int,
big.NewInt(bonderFee.Deadline))
}
return tx, ErrTxForChainNotSupported return tx, ErrTxForChainNotSupported
} }

View File

@ -49,6 +49,8 @@ func getPartnerAddressAndFeePcnt(chainID uint64) (common.Address, float64) {
return common.HexToAddress("0xE9B59dC0b30cd4646430c25de0111D651c395775"), partnerFeePcnt return common.HexToAddress("0xE9B59dC0b30cd4646430c25de0111D651c395775"), partnerFeePcnt
case walletCommon.ArbitrumMainnet: case walletCommon.ArbitrumMainnet:
return common.HexToAddress("0x9a8278e856C0B191B9daa2d7DD1f7B28268E4DA2"), partnerFeePcnt return common.HexToAddress("0x9a8278e856C0B191B9daa2d7DD1f7B28268E4DA2"), partnerFeePcnt
case walletCommon.BaseMainnet:
return common.Address{}, 0
} }
return common.Address{}, 0 return common.Address{}, 0
} }

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,7 @@ var (
newBlockCheckIntervalMainnet = 3 * time.Second newBlockCheckIntervalMainnet = 3 * time.Second
newBlockCheckIntervalOptimism = 1 * time.Second newBlockCheckIntervalOptimism = 1 * time.Second
newBlockCheckIntervalArbitrum = 200 * time.Millisecond newBlockCheckIntervalArbitrum = 200 * time.Millisecond
newBlockCheckIntervalBase = 1 * time.Second
newBlockCheckIntervalAnvilMainnet = 2 * time.Second newBlockCheckIntervalAnvilMainnet = 2 * time.Second
feeRecalculationTimeout = 5 * time.Minute feeRecalculationTimeout = 5 * time.Minute
@ -63,6 +64,9 @@ func (r *Router) subscribeForUdates(chainID uint64) error {
case walletCommon.ArbitrumMainnet, case walletCommon.ArbitrumMainnet,
walletCommon.ArbitrumSepolia: walletCommon.ArbitrumSepolia:
ticker = time.NewTicker(newBlockCheckIntervalArbitrum) ticker = time.NewTicker(newBlockCheckIntervalArbitrum)
case walletCommon.BaseMainnet,
walletCommon.BaseSepolia:
ticker = time.NewTicker(newBlockCheckIntervalBase)
case walletCommon.AnvilMainnet: case walletCommon.AnvilMainnet:
ticker = time.NewTicker(newBlockCheckIntervalAnvilMainnet) ticker = time.NewTicker(newBlockCheckIntervalAnvilMainnet)
} }

View File

@ -106,6 +106,7 @@ func (s SendType) IsAvailableFor(network *params.Network) bool {
walletCommon.EthereumMainnet: true, walletCommon.EthereumMainnet: true,
walletCommon.OptimismMainnet: true, walletCommon.OptimismMainnet: true,
walletCommon.ArbitrumMainnet: true, walletCommon.ArbitrumMainnet: true,
walletCommon.BaseMainnet: true,
} }
// Check for Swap specific networks // Check for Swap specific networks

View File

@ -38,6 +38,10 @@ func getBaseURL(chainID walletCommon.ChainID) (string, error) {
return "https://arb-mainnet.g.alchemy.com", nil return "https://arb-mainnet.g.alchemy.com", nil
case walletCommon.ArbitrumSepolia: case walletCommon.ArbitrumSepolia:
return "https://arb-sepolia.g.alchemy.com", nil return "https://arb-sepolia.g.alchemy.com", nil
case walletCommon.BaseMainnet:
return "https://base-mainnet.g.alchemy.com", nil
case walletCommon.BaseSepolia:
return "https://base-sepolia.g.alchemy.com", nil
} }
return "", thirdparty.ErrChainIDNotSupported return "", thirdparty.ErrChainIDNotSupported

View File

@ -10,6 +10,8 @@ func NetworkToCommonChainID(network string) uint64 {
return walletCommon.OptimismMainnet return walletCommon.OptimismMainnet
case "ARBITRUM": case "ARBITRUM":
return walletCommon.ArbitrumMainnet return walletCommon.ArbitrumMainnet
case "BASE":
return walletCommon.BaseMainnet
} }
return walletCommon.UnknownChainID return walletCommon.UnknownChainID
} }
@ -22,6 +24,8 @@ func CommonChainIDToNetwork(chainID uint64) string {
return "ARBITRUM" return "ARBITRUM"
case walletCommon.OptimismMainnet: case walletCommon.OptimismMainnet:
return "OPTIMISM" return "OPTIMISM"
case walletCommon.BaseMainnet:
return "BASE"
default: default:
return "" return ""
} }

View File

@ -20,9 +20,9 @@ const assetLimitV2 = 50
func getV2BaseURL(chainID walletCommon.ChainID) (string, error) { func getV2BaseURL(chainID walletCommon.ChainID) (string, error) {
switch uint64(chainID) { switch uint64(chainID) {
case walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.OptimismMainnet: case walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.OptimismMainnet, walletCommon.BaseMainnet:
return "https://api.opensea.io/v2", nil return "https://api.opensea.io/v2", nil
case walletCommon.EthereumSepolia, walletCommon.ArbitrumSepolia, walletCommon.OptimismSepolia: case walletCommon.EthereumSepolia, walletCommon.ArbitrumSepolia, walletCommon.OptimismSepolia, walletCommon.BaseSepolia:
return "https://testnets-api.opensea.io/v2", nil return "https://testnets-api.opensea.io/v2", nil
} }

View File

@ -20,9 +20,11 @@ const (
ethereumMainnetString = "ethereum" ethereumMainnetString = "ethereum"
arbitrumMainnetString = "arbitrum" arbitrumMainnetString = "arbitrum"
optimismMainnetString = "optimism" optimismMainnetString = "optimism"
baseMainnetString = "base"
ethereumSepoliaString = "sepolia" ethereumSepoliaString = "sepolia"
arbitrumSepoliaString = "arbitrum_sepolia" arbitrumSepoliaString = "arbitrum_sepolia"
optimismSepoliaString = "optimism_sepolia" optimismSepoliaString = "optimism_sepolia"
baseSepoliaString = "base_sepolia"
) )
type urlGetter func(walletCommon.ChainID, string) (string, error) type urlGetter func(walletCommon.ChainID, string) (string, error)
@ -36,12 +38,16 @@ func chainIDToChainString(chainID walletCommon.ChainID) string {
chainString = arbitrumMainnetString chainString = arbitrumMainnetString
case walletCommon.OptimismMainnet: case walletCommon.OptimismMainnet:
chainString = optimismMainnetString chainString = optimismMainnetString
case walletCommon.BaseMainnet:
chainString = baseMainnetString
case walletCommon.EthereumSepolia: case walletCommon.EthereumSepolia:
chainString = ethereumSepoliaString chainString = ethereumSepoliaString
case walletCommon.ArbitrumSepolia: case walletCommon.ArbitrumSepolia:
chainString = arbitrumSepoliaString chainString = arbitrumSepoliaString
case walletCommon.OptimismSepolia: case walletCommon.OptimismSepolia:
chainString = optimismSepoliaString chainString = optimismSepoliaString
case walletCommon.BaseSepolia:
chainString = baseSepoliaString
} }
return chainString return chainString
} }

View File

@ -43,9 +43,9 @@ func (o *Client) IsConnected() bool {
func getBaseURL(chainID walletCommon.ChainID) (string, error) { func getBaseURL(chainID walletCommon.ChainID) (string, error) {
switch uint64(chainID) { switch uint64(chainID) {
case walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet: case walletCommon.EthereumMainnet, walletCommon.ArbitrumMainnet, walletCommon.BaseMainnet:
return "https://api.rarible.org", nil return "https://api.rarible.org", nil
case walletCommon.EthereumSepolia, walletCommon.ArbitrumSepolia: case walletCommon.EthereumSepolia, walletCommon.ArbitrumSepolia, walletCommon.BaseSepolia:
return "https://testnet-api.rarible.org", nil return "https://testnet-api.rarible.org", nil
} }

View File

@ -22,6 +22,7 @@ const RaribleID = "rarible"
const ( const (
ethereumString = "ETHEREUM" ethereumString = "ETHEREUM"
arbitrumString = "ARBITRUM" arbitrumString = "ARBITRUM"
baseString = "BASE"
) )
func chainStringToChainID(chainString string, isMainnet bool) walletCommon.ChainID { func chainStringToChainID(chainString string, isMainnet bool) walletCommon.ChainID {
@ -39,6 +40,12 @@ func chainStringToChainID(chainString string, isMainnet bool) walletCommon.Chain
} else { } else {
chainID = walletCommon.ArbitrumSepolia chainID = walletCommon.ArbitrumSepolia
} }
case baseString:
if isMainnet {
chainID = walletCommon.BaseMainnet
} else {
chainID = walletCommon.BaseSepolia
}
} }
return walletCommon.ChainID(chainID) return walletCommon.ChainID(chainID)
} }
@ -50,6 +57,8 @@ func chainIDToChainString(chainID walletCommon.ChainID) string {
chainString = ethereumString chainString = ethereumString
case walletCommon.ArbitrumMainnet, walletCommon.ArbitrumSepolia: case walletCommon.ArbitrumMainnet, walletCommon.ArbitrumSepolia:
chainString = arbitrumString chainString = arbitrumString
case walletCommon.BaseMainnet, walletCommon.BaseSepolia:
chainString = baseString
} }
return chainString return chainString
} }

View File

@ -242,6 +242,14 @@ func newDefaultStore() *DefaultStore {
ChainID: 42161, ChainID: 42161,
TokenListID: "status", TokenListID: "status",
}, },
&Token{
Address: common.HexToAddress("0x662015EC830DF08C0FC45896FaB726542e8AC09E"),
Name: "Status Network Token",
Symbol: "SNT",
Decimals: 18,
ChainID: 8453,
TokenListID: "status",
},
&Token{ &Token{
Address: common.HexToAddress("0xaec2e87e0a235266d9c5adc9deb4b2e29b54d009"), Address: common.HexToAddress("0xaec2e87e0a235266d9c5adc9deb4b2e29b54d009"),
Name: "SingularDTV", Name: "SingularDTV",
@ -1770,6 +1778,14 @@ func newDefaultStore() *DefaultStore {
ChainID: 11155111, ChainID: 11155111,
TokenListID: "status", TokenListID: "status",
}, },
&Token{
Address: common.HexToAddress("0xfDB3b57944943a7724fCc0520eE2B10659969a06"),
Name: "Status Test Token",
Symbol: "STT",
Decimals: 18,
ChainID: 84532,
TokenListID: "status",
},
&Token{ &Token{
Address: common.HexToAddress("0x3e622317f8c93f7328350cf0b56d9ed4c620c5d6"), Address: common.HexToAddress("0x3e622317f8c93f7328350cf0b56d9ed4c620c5d6"),
Name: "Dai Stablecoin", Name: "Dai Stablecoin",

View File

@ -52,6 +52,7 @@ var (
sepoliaErc20BatchSize = big.NewInt(100000) sepoliaErc20BatchSize = big.NewInt(100000)
sepoliaErc20ArbitrumBatchSize = big.NewInt(10000) sepoliaErc20ArbitrumBatchSize = big.NewInt(10000)
sepoliaErc20OptimismBatchSize = big.NewInt(10000) sepoliaErc20OptimismBatchSize = big.NewInt(10000)
sepoliaErc20BaseBatchSize = big.NewInt(10000)
erc20BatchSize = big.NewInt(100000) erc20BatchSize = big.NewInt(100000)
transfersRetryInterval = 5 * time.Second transfersRetryInterval = 5 * time.Second
@ -153,6 +154,8 @@ func getErc20BatchSize(chainID uint64) *big.Int {
return sepoliaErc20OptimismBatchSize return sepoliaErc20OptimismBatchSize
case w_common.ArbitrumSepolia: case w_common.ArbitrumSepolia:
return sepoliaErc20ArbitrumBatchSize return sepoliaErc20ArbitrumBatchSize
case w_common.BaseSepolia:
return sepoliaErc20BaseBatchSize
case w_common.BinanceChainID: case w_common.BinanceChainID:
return binanceChainErc20BatchSize return binanceChainErc20BatchSize
case w_common.BinanceTestChainID: case w_common.BinanceTestChainID:

View File

@ -34,6 +34,9 @@ func getTokenSymbols(t *testing.T) []string {
{ {
ChainID: w_common.ArbitrumMainnet, ChainID: w_common.ArbitrumMainnet,
}, },
{
ChainID: w_common.BaseMainnet,
},
} }
ptrNetworkList := make([]*params.Network, 0, len(networksList)) ptrNetworkList := make([]*params.Network, 0, len(networksList))

View File

@ -109,10 +109,12 @@ func (t *Transactor) NextNonce(ctx context.Context, rpcClient rpc.ClientInterfac
return 0, err return 0, err
} }
// We need to take into consideration all pending transactions in case of Optimism, cause the network returns always // We need to take into consideration all pending transactions in case of networks based on the Optimism stack, cause the network returns always
// the nonce of last executed tx + 1 for the next nonce value. // the nonce of last executed tx + 1 for the next nonce value.
if chainID == wallet_common.OptimismMainnet || if chainID == wallet_common.OptimismMainnet ||
chainID == wallet_common.OptimismSepolia { chainID == wallet_common.OptimismSepolia ||
chainID == wallet_common.BaseMainnet ||
chainID == wallet_common.BaseSepolia {
if t.pendingTracker != nil { if t.pendingTracker != nil {
countOfPendingTXs, err := t.pendingTracker.CountPendingTxsFromNonce(wallet_common.ChainID(chainID), common.Address(from), nonce) countOfPendingTXs, err := t.pendingTracker.CountPendingTxsFromNonce(wallet_common.ChainID(chainID), common.Address(from), nonce)
if err != nil { if err != nil {