diff --git a/api/.gitkeep b/api/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/build/docker-compose.yml b/build/docker-compose.yml new file mode 100644 index 00000000..e69de29b diff --git a/cmd/main.go b/cmd/main.go new file mode 100644 index 00000000..06ab7d0f --- /dev/null +++ b/cmd/main.go @@ -0,0 +1 @@ +package main diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..c90ef606 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/0xPolygon/cdk + +go 1.22 diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..e69de29b diff --git a/internal/.gitkeep b/internal/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/pkg/aggregatormanager/.gitkeep b/pkg/aggregatormanager/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/pkg/cdk/sequencermanager/.gitkeep b/pkg/cdk/sequencermanager/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/pkg/dataavailability/.gitkeep b/pkg/dataavailability/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/pkg/rpcproxy/.gitkeep b/pkg/rpcproxy/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/pkg/sequencesender/.gitkeep b/pkg/sequencesender/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/pkg/syncer/.gitkeep b/pkg/syncer/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/scripts/.gitkeep b/scripts/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/sequencermanager/.gitkeep b/sequencermanager/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/sequencesender/.gitkeep b/sequencesender/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/syncer/ethprovider/ethprovider.go b/syncer/ethprovider/ethprovider.go new file mode 100644 index 00000000..9bc463d8 --- /dev/null +++ b/syncer/ethprovider/ethprovider.go @@ -0,0 +1,9 @@ +package ethsyncer + +import ( + "github.com/0xPolygon/cdk/syncer/storage" +) + +type EthSyncer struct { + Storage storage.StorageService +} diff --git a/syncer/interfaces.go b/syncer/interfaces.go new file mode 100644 index 00000000..2be883fd --- /dev/null +++ b/syncer/interfaces.go @@ -0,0 +1,9 @@ +package syncer + +type EventSyncer interface { + GetData() []byte +} + +type EventProcessor interface { + Process(data []byte) error +} \ No newline at end of file diff --git a/syncer/provider.go b/syncer/provider.go new file mode 100644 index 00000000..d62c4fbc --- /dev/null +++ b/syncer/provider.go @@ -0,0 +1 @@ +package syncer diff --git a/syncer/storage/inmem/inmem.go b/syncer/storage/inmem/inmem.go new file mode 100644 index 00000000..b9a930b0 --- /dev/null +++ b/syncer/storage/inmem/inmem.go @@ -0,0 +1,8 @@ +package inmem + +type Inmem struct { +} + +func (inmem *Inmem) GetData() []byte { + return []byte("Inmem") +} diff --git a/syncer/storage/storage.go b/syncer/storage/storage.go new file mode 100644 index 00000000..c485ecb6 --- /dev/null +++ b/syncer/storage/storage.go @@ -0,0 +1,7 @@ +package storage + +// Storage is an interface for the storage of the syncer +type StorageService interface { + GetData() []byte + GetLatestVerifiedBlock() uint64 +} diff --git a/syncer/syncer.go b/syncer/syncer.go new file mode 100644 index 00000000..fab1add8 --- /dev/null +++ b/syncer/syncer.go @@ -0,0 +1,23 @@ +package syncer + +type Syncer interface { + // Start starts the syncer + Start() error + // Stop stops the syncer + Stop() error + // Synced returns true if the syncer is synced + Synced() bool + // SyncedChan returns a channel that is closed when the syncer is synced + SyncedChan() <-chan struct{} + // LatestVerifiedBlock returns the latest verified block + LatestVerifiedBlock() uint64 + // LatestBlock returns the latest block + LatestBlock() uint64 + // SyncedBlock returns the latest block that is synced + SyncedBlock() uint64 + // SyncedBlockChan returns a channel that is closed when the latest block is synced + SyncedBlockChan() <-chan struct{} +} + +type Sync struct { +} diff --git a/test/e2e.go b/test/e2e.go new file mode 100644 index 00000000..df8caf70 --- /dev/null +++ b/test/e2e.go @@ -0,0 +1 @@ +package e2e