Skip to content

Commit

Permalink
wip fixes for token cache
Browse files Browse the repository at this point in the history
  • Loading branch information
nkoljanin committed Oct 17, 2024
1 parent e0f8b19 commit 8a4a1de
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
7 changes: 1 addition & 6 deletions examples/booking/mintnbuy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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....")
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 4 additions & 0 deletions internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pkg/booking/booking.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 8a4a1de

Please sign in to comment.