diff --git a/examples/booking/mintnbuy.go b/examples/booking/mintnbuy.go index f965f192..fe5a4267 100644 --- a/examples/booking/mintnbuy.go +++ b/examples/booking/mintnbuy.go @@ -18,7 +18,6 @@ import ( "go.uber.org/zap" "github.com/chain4travel/camino-messenger-bot/pkg/booking" - "github.com/chain4travel/camino-messenger-bot/pkg/cache" "github.com/chain4travel/camino-messenger-contracts/go/contracts/bookingtoken" ) @@ -39,10 +38,6 @@ func main() { defer logger.Sync() sugar := logger.Sugar() - // initiate token cache - // erc20 token cache - tokenCache, err := cache.NewTokenCache(20) - sugar.Info("Starting Mint & Buy Example...") cmAccountAddrString := flag.String("cmaccount", "", "CMAccount Address. Ex: 0x....") @@ -75,7 +70,7 @@ func main() { } sugar.Info("Creating Booking Service...") - bs, err := booking.NewService(&cmAccountAddr, pk, client, sugar, tokenCache) + bs, err := booking.NewService(&cmAccountAddr, pk, client, sugar) if err != nil { sugar.Fatalf("Failed to create Booking Service: %v", err) } diff --git a/internal/app/app.go b/internal/app/app.go index 46a77ccb..6d9406df 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -65,6 +65,10 @@ func NewApp(ctx context.Context, cfg *config.Config, logger *zap.SugaredLogger) // erc20 token cache tokenCache, err := cache.NewTokenCache(20) + if err != nil { + logger.Errorf("Failed to create token cache: %v", err) + return nil, err + } // partner-plugin rpc client var rpcClient *client.RPCClient diff --git a/pkg/booking/booking.go b/pkg/booking/booking.go index bca2bacd..35485386 100644 --- a/pkg/booking/booking.go +++ b/pkg/booking/booking.go @@ -37,7 +37,6 @@ func NewService( privateKey *ecdsa.PrivateKey, client *ethclient.Client, logger *zap.SugaredLogger, - tokenCache *cache.TokenCache, ) (*Service, error) { // Get the chain ID to prevent replay attacks chainID, err := client.ChainID(context.Background())