-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multiple things idk what precisely tbh
- Loading branch information
Showing
20 changed files
with
451 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
defmodule Peach.OnchainEvent do | ||
@moduledoc """ | ||
Defines an onchain event object for the peach app | ||
""" | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
@derive {Jason.Encoder, only: [:onchain, :event_id]} | ||
@primary_key {:id, :string, autogenerate: false} | ||
schema "onchain_events" do | ||
field :onchain, :boolean, default: false | ||
field :_cursor, :integer | ||
belongs_to :event, Peach.Event, foreign_key: :event_id | ||
end | ||
|
||
@doc false | ||
def changeset(onchain_event, attrs) do | ||
onchain_event | ||
|> cast(attrs, [:onchain]) | ||
|> validate_required([:onchain]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
backend/priv/repo/migrations/20241029134146_create_onchain_events.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
defmodule Peach.Repo.Migrations.CreateOnchainEvents do | ||
use Ecto.Migration | ||
|
||
def change do | ||
create table(:onchain_events, primary_key: false) do | ||
add :id, :string, primary_key: true | ||
add :onchain, :boolean, default: false | ||
add :_cursor, :bigint | ||
add :event_id, references(:events, on_delete: :nothing) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Notice that the base image is build from scratch (not an OS like Ubuntu), | ||
# so the binary is in a location that depends on the build. | ||
# For this reason we stick to a specific version and architecture. | ||
# | ||
# When updating the image you also need to update the entrypoint below. | ||
# | ||
# - docker image pull quay.io/apibara/sink-postgres:0.7.0-x86_64 | ||
# - docker image inspect quay.io/apibara/sink-postgres:0.7.0-x86_64 | jq '.[].Config.Entrypoint' | ||
FROM quay.io/apibara/sink-postgres:0.7.0-x86_64 | ||
|
||
WORKDIR /app | ||
COPY ./src/* /app/ | ||
ENV SN_NETWORK=SN_SEPOLIA | ||
ENV STARTING_BLOCK=287896 | ||
ENV POSTGRES_CONNECTION_STRING=postgresql://postgres:[email protected]:5432/peach_dev | ||
ENV AUTH_TOKEN=dna_MTNdSFU3zwM9tdQBdg1s | ||
|
||
ENTRYPOINT ["/nix/store/rh1g8pb7wfnyr527jfmkkc5lm3sa1f0l-apibara-sink-postgres-0.7.0/bin/apibara-sink-postgres"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Indexers Setup | ||
|
||
Current Status : | ||
|
||
| Indexer | Dev | Prod | | ||
| --------------- | --- | ---- | | ||
| Events creation | | | | ||
| Events transfer | | | | ||
|
||
To run the indexer : | ||
|
||
```sh | ||
AUTH_TOKEN=<AUTH_TOKEN> docker-compose up | ||
``` | ||
|
||
To configure the k8s indexer : | ||
|
||
```sh | ||
cp envs.example.yaml envs.yaml | ||
kubectl apply -f envs.yaml | ||
``` |
Oops, something went wrong.