chore_: celer bridge disabled, due to making correct routes using a single (hop) bridge

This commit is contained in:
Sale Djenic 2024-06-12 22:13:16 +02:00 committed by saledjenic
parent 2c349b629d
commit 9c3b49b866
5 changed files with 28 additions and 4 deletions

View File

@ -543,6 +543,7 @@ type WalletConfig struct {
AlchemyAPIKeys map[uint64]string `json:"AlchemyAPIKeys"` AlchemyAPIKeys map[uint64]string `json:"AlchemyAPIKeys"`
InfuraAPIKey string `json:"InfuraAPIKey"` InfuraAPIKey string `json:"InfuraAPIKey"`
InfuraAPIKeySecret string `json:"InfuraAPIKeySecret"` InfuraAPIKeySecret string `json:"InfuraAPIKeySecret"`
EnableCelerBridge bool `json:"EnableCelerBridge"`
} }
// LocalNotificationsConfig extra configuration for localnotifications.Service. // LocalNotificationsConfig extra configuration for localnotifications.Service.

View File

@ -26,4 +26,7 @@ type FeatureFlags struct {
// Peersyncing indicates whether we should advertise and sync messages with other peers // Peersyncing indicates whether we should advertise and sync messages with other peers
Peersyncing bool Peersyncing bool
// EnableCelerBridge indicates whether we should enable the Celer bridge in the Router
EnableCelerBridge bool
} }

View File

@ -37,7 +37,7 @@ import (
func NewAPI(s *Service) *API { func NewAPI(s *Service) *API {
router := router.NewRouter(s.GetRPCClient(), s.GetTransactor(), s.GetTokenManager(), s.GetMarketManager(), s.GetCollectiblesService(), router := router.NewRouter(s.GetRPCClient(), s.GetTransactor(), s.GetTokenManager(), s.GetMarketManager(), s.GetCollectiblesService(),
s.GetCollectiblesManager(), s.GetEnsService(), s.GetStickersService()) s.GetCollectiblesManager(), s.GetEnsService(), s.GetStickersService(), s.FeatureFlags())
return &API{s, s.reader, router} return &API{s, s.reader, router}
} }

View File

@ -18,6 +18,7 @@ import (
gaspriceoracle "github.com/status-im/status-go/contracts/gas-price-oracle" gaspriceoracle "github.com/status-im/status-go/contracts/gas-price-oracle"
"github.com/status-im/status-go/contracts/ierc20" "github.com/status-im/status-go/contracts/ierc20"
"github.com/status-im/status-go/params" "github.com/status-im/status-go/params"
protocolCommon "github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/rpc" "github.com/status-im/status-go/rpc"
"github.com/status-im/status-go/services/ens" "github.com/status-im/status-go/services/ens"
"github.com/status-im/status-go/services/stickers" "github.com/status-im/status-go/services/stickers"
@ -275,12 +276,12 @@ func newSuggestedRoutes(
} }
func NewRouter(rpcClient *rpc.Client, transactor *transactions.Transactor, tokenManager *token.Manager, marketManager *market.Manager, func NewRouter(rpcClient *rpc.Client, transactor *transactions.Transactor, tokenManager *token.Manager, marketManager *market.Manager,
collectibles *collectibles.Service, collectiblesManager *collectibles.Manager, ensService *ens.Service, stickersService *stickers.Service) *Router { collectibles *collectibles.Service, collectiblesManager *collectibles.Manager, ensService *ens.Service, stickersService *stickers.Service,
featureFlags *protocolCommon.FeatureFlags) *Router {
processors := make(map[string]pathprocessor.PathProcessor) processors := make(map[string]pathprocessor.PathProcessor)
transfer := pathprocessor.NewTransferProcessor(rpcClient, transactor) transfer := pathprocessor.NewTransferProcessor(rpcClient, transactor)
erc721Transfer := pathprocessor.NewERC721Processor(rpcClient, transactor) erc721Transfer := pathprocessor.NewERC721Processor(rpcClient, transactor)
erc1155Transfer := pathprocessor.NewERC1155Processor(rpcClient, transactor) erc1155Transfer := pathprocessor.NewERC1155Processor(rpcClient, transactor)
cbridge := pathprocessor.NewCelerBridgeProcessor(rpcClient, transactor, tokenManager)
hop := pathprocessor.NewHopBridgeProcessor(rpcClient, transactor, tokenManager) hop := pathprocessor.NewHopBridgeProcessor(rpcClient, transactor, tokenManager)
paraswap := pathprocessor.NewSwapParaswapProcessor(rpcClient, transactor, tokenManager) paraswap := pathprocessor.NewSwapParaswapProcessor(rpcClient, transactor, tokenManager)
ensRegister := pathprocessor.NewENSRegisterProcessor(rpcClient, transactor, ensService) ensRegister := pathprocessor.NewENSRegisterProcessor(rpcClient, transactor, ensService)
@ -291,7 +292,6 @@ func NewRouter(rpcClient *rpc.Client, transactor *transactions.Transactor, token
processors[transfer.Name()] = transfer processors[transfer.Name()] = transfer
processors[erc721Transfer.Name()] = erc721Transfer processors[erc721Transfer.Name()] = erc721Transfer
processors[hop.Name()] = hop processors[hop.Name()] = hop
processors[cbridge.Name()] = cbridge
processors[erc1155Transfer.Name()] = erc1155Transfer processors[erc1155Transfer.Name()] = erc1155Transfer
processors[paraswap.Name()] = paraswap processors[paraswap.Name()] = paraswap
processors[ensRegister.Name()] = ensRegister processors[ensRegister.Name()] = ensRegister
@ -299,6 +299,12 @@ func NewRouter(rpcClient *rpc.Client, transactor *transactions.Transactor, token
processors[ensPublicKey.Name()] = ensPublicKey processors[ensPublicKey.Name()] = ensPublicKey
processors[buyStickers.Name()] = buyStickers processors[buyStickers.Name()] = buyStickers
if featureFlags.EnableCelerBridge {
// TODO: Celar Bridge is out of scope for 2.30, check it thoroughly once we decide to include it again
cbridge := pathprocessor.NewCelerBridgeProcessor(rpcClient, transactor, tokenManager)
processors[cbridge.Name()] = cbridge
}
return &Router{ return &Router{
rpcClient: rpcClient, rpcClient: rpcClient,
tokenManager: tokenManager, tokenManager: tokenManager,
@ -309,6 +315,7 @@ func NewRouter(rpcClient *rpc.Client, transactor *transactions.Transactor, token
stickersService: stickersService, stickersService: stickersService,
feesManager: &FeeManager{rpcClient}, feesManager: &FeeManager{rpcClient},
pathProcessors: processors, pathProcessors: processors,
featureFlags: featureFlags,
} }
} }
@ -340,6 +347,7 @@ type Router struct {
stickersService *stickers.Service stickersService *stickers.Service
feesManager *FeeManager feesManager *FeeManager
pathProcessors map[string]pathprocessor.PathProcessor pathProcessors map[string]pathprocessor.PathProcessor
featureFlags *protocolCommon.FeatureFlags
} }
func (r *Router) requireApproval(ctx context.Context, sendType SendType, approvalContractAddress *common.Address, account common.Address, network *params.Network, token *token.Token, amountIn *big.Int) ( func (r *Router) requireApproval(ctx context.Context, sendType SendType, approvalContractAddress *common.Address, account common.Address, network *params.Network, token *token.Token, amountIn *big.Int) (

View File

@ -15,6 +15,7 @@ import (
"github.com/status-im/status-go/account" "github.com/status-im/status-go/account"
"github.com/status-im/status-go/multiaccounts/accounts" "github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/params" "github.com/status-im/status-go/params"
protocolCommon "github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/rpc" "github.com/status-im/status-go/rpc"
"github.com/status-im/status-go/server" "github.com/status-im/status-go/server"
"github.com/status-im/status-go/services/ens" "github.com/status-im/status-go/services/ens"
@ -170,6 +171,11 @@ func NewService(
activity := activity.NewService(db, accountsDB, tokenManager, collectiblesManager, feed, pendingTxManager) activity := activity.NewService(db, accountsDB, tokenManager, collectiblesManager, feed, pendingTxManager)
featureFlags := &protocolCommon.FeatureFlags{}
if config.WalletConfig.EnableCelerBridge {
featureFlags.EnableCelerBridge = true
}
return &Service{ return &Service{
db: db, db: db,
accountsDB: accountsDB, accountsDB: accountsDB,
@ -198,6 +204,7 @@ func NewService(
blockChainState: blockChainState, blockChainState: blockChainState,
keycardPairings: NewKeycardPairings(), keycardPairings: NewKeycardPairings(),
config: config, config: config,
featureFlags: featureFlags,
} }
} }
@ -231,6 +238,7 @@ type Service struct {
blockChainState *blockchainstate.BlockChainState blockChainState *blockchainstate.BlockChainState
keycardPairings *KeycardPairings keycardPairings *KeycardPairings
config *params.NodeConfig config *params.NodeConfig
featureFlags *protocolCommon.FeatureFlags
} }
// Start signals transmitter. // Start signals transmitter.
@ -294,6 +302,10 @@ func (s *Service) Config() *params.NodeConfig {
return s.config return s.config
} }
func (s *Service) FeatureFlags() *protocolCommon.FeatureFlags {
return s.featureFlags
}
func (s *Service) GetRPCClient() *rpc.Client { func (s *Service) GetRPCClient() *rpc.Client {
return s.rpcClient return s.rpcClient
} }