removed dead vars + front tracing
This commit is contained in:
@@ -56,11 +56,6 @@ chains:
|
||||
- symbol: USDC
|
||||
contract: "0x75faf114eafb1bdbe2f0316df893fd58ce46aa4d"
|
||||
|
||||
service_wallet:
|
||||
chain: arbitrum_sepolia
|
||||
address_env: CHAIN_GATEWAY_SERVICE_WALLET_ADDRESS
|
||||
private_key_env: CHAIN_GATEWAY_SERVICE_WALLET_KEY
|
||||
|
||||
key_management:
|
||||
driver: vault
|
||||
settings:
|
||||
|
||||
@@ -53,11 +53,6 @@ chains:
|
||||
- symbol: USDC
|
||||
contract: "0xaf88d065e77c8cc2239327c5edb3a432268e5831"
|
||||
|
||||
service_wallet:
|
||||
chain: arbitrum_one
|
||||
address_env: CHAIN_GATEWAY_SERVICE_WALLET_ADDRESS
|
||||
private_key_env: CHAIN_GATEWAY_SERVICE_WALLET_KEY
|
||||
|
||||
key_management:
|
||||
driver: vault
|
||||
settings:
|
||||
|
||||
@@ -43,7 +43,6 @@ type Imp struct {
|
||||
type config struct {
|
||||
*grpcapp.Config `yaml:",inline"`
|
||||
Chains []chainConfig `yaml:"chains"`
|
||||
ServiceWallet serviceWalletConfig `yaml:"service_wallet"`
|
||||
KeyManagement keymanager.Config `yaml:"key_management"`
|
||||
Settings gatewayservice.CacheSettings `yaml:"cache"`
|
||||
}
|
||||
@@ -57,13 +56,6 @@ type chainConfig struct {
|
||||
GasTopUpPolicy *gasTopUpPolicyConfig `yaml:"gas_topup_policy"`
|
||||
}
|
||||
|
||||
type serviceWalletConfig struct {
|
||||
Chain pmodel.ChainNetwork `yaml:"chain"`
|
||||
Address string `yaml:"address"`
|
||||
AddressEnv string `yaml:"address_env"`
|
||||
PrivateKeyEnv string `yaml:"private_key_env"`
|
||||
}
|
||||
|
||||
type tokenConfig struct {
|
||||
Symbol string `yaml:"symbol"`
|
||||
Contract string `yaml:"contract"`
|
||||
@@ -138,7 +130,6 @@ func (i *Imp) Start() error {
|
||||
return err
|
||||
}
|
||||
i.rpcClients = rpcClients
|
||||
walletConfig := resolveServiceWallet(cl.Named("wallet"), cfg.ServiceWallet)
|
||||
keyManager, err := resolveKeyManager(i.logger.Named("key_manager"), cfg.KeyManagement)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -156,7 +147,6 @@ func (i *Imp) Start() error {
|
||||
opts := []gatewayservice.Option{
|
||||
gatewayservice.WithDiscoveryInvokeURI(invokeURI),
|
||||
gatewayservice.WithNetworks(networkConfigs),
|
||||
gatewayservice.WithServiceWallet(walletConfig),
|
||||
gatewayservice.WithKeyManager(keyManager),
|
||||
gatewayservice.WithRPCClients(rpcClients),
|
||||
gatewayservice.WithDriverRegistry(driverRegistry),
|
||||
@@ -325,32 +315,6 @@ func parseGasTopUpRule(chainName pmodel.ChainNetwork, label string, cfg gasTopUp
|
||||
}, true, nil
|
||||
}
|
||||
|
||||
func resolveServiceWallet(logger mlogger.Logger, cfg serviceWalletConfig) gatewayshared.ServiceWallet {
|
||||
address := strings.TrimSpace(cfg.Address)
|
||||
if address == "" && cfg.AddressEnv != "" {
|
||||
address = strings.TrimSpace(os.Getenv(cfg.AddressEnv))
|
||||
}
|
||||
|
||||
privateKey := strings.TrimSpace(os.Getenv(cfg.PrivateKeyEnv))
|
||||
|
||||
if address == "" {
|
||||
if cfg.AddressEnv != "" {
|
||||
logger.Warn("Service wallet address not configured", zap.String("env", cfg.AddressEnv))
|
||||
} else {
|
||||
logger.Warn("Service wallet address not configured", zap.String("chain", string(cfg.Chain)))
|
||||
}
|
||||
}
|
||||
if privateKey == "" {
|
||||
logger.Warn("Service wallet private key not configured", zap.String("env", cfg.PrivateKeyEnv))
|
||||
}
|
||||
|
||||
return gatewayshared.ServiceWallet{
|
||||
Network: cfg.Chain,
|
||||
Address: address,
|
||||
PrivateKey: privateKey,
|
||||
}
|
||||
}
|
||||
|
||||
func resolveKeyManager(logger mlogger.Logger, cfg keymanager.Config) (keymanager.Manager, error) {
|
||||
driver := strings.ToLower(strings.TrimSpace(string(cfg.Driver)))
|
||||
if driver == "" {
|
||||
|
||||
@@ -55,13 +55,6 @@ func WithNetworks(networks []shared.Network) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// WithServiceWallet configures the service wallet binding.
|
||||
func WithServiceWallet(wallet shared.ServiceWallet) Option {
|
||||
return func(s *Service) {
|
||||
s.serviceWallet = wallet
|
||||
}
|
||||
}
|
||||
|
||||
// WithDriverRegistry configures the chain driver registry.
|
||||
func WithDriverRegistry(registry *drivers.Registry) Option {
|
||||
return func(s *Service) {
|
||||
|
||||
@@ -49,7 +49,6 @@ type Service struct {
|
||||
outbox gatewayoutbox.ReliableRuntime
|
||||
|
||||
networks map[pmodel.ChainNetwork]shared.Network
|
||||
serviceWallet shared.ServiceWallet
|
||||
keyManager keymanager.Manager
|
||||
rpcClients *rpcclient.Clients
|
||||
networkRegistry *rpcclient.Registry
|
||||
|
||||
@@ -700,7 +700,6 @@ func newTestServiceWithRepository(t *testing.T, repo storage.Repository) *Servic
|
||||
svc := NewService(logger, repo, nil,
|
||||
WithKeyManager(&fakeKeyManager{}),
|
||||
WithNetworks(networks),
|
||||
WithServiceWallet(shared.ServiceWallet{Network: "ethereum_mainnet", Address: "0xservice"}),
|
||||
WithDriverRegistry(driverRegistry),
|
||||
)
|
||||
return svc
|
||||
|
||||
@@ -201,13 +201,6 @@ type TokenContract struct {
|
||||
ContractAddress string
|
||||
}
|
||||
|
||||
// ServiceWallet captures the managed service wallet configuration.
|
||||
type ServiceWallet struct {
|
||||
Network pmodel.ChainNetwork
|
||||
Address string
|
||||
PrivateKey string
|
||||
}
|
||||
|
||||
func ProtoToMoney(money *moneyv1.Money) *paymenttypes.Money {
|
||||
if money == nil {
|
||||
return &paymenttypes.Money{}
|
||||
|
||||
Reference in New Issue
Block a user