Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMemi committed Oct 9, 2022
1 parent 3dc6244 commit 7d5d367
Show file tree
Hide file tree
Showing 13 changed files with 1,582 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"nuxt.isNuxtApp": false
}
380 changes: 380 additions & 0 deletions DataTypes.sol

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

FROM golang:latest

WORKDIR /app

ADD . .

RUN go install
RUN go build
ENTRYPOINT ["./main"]
45 changes: 45 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

docker_test:
docker system prune
docker build -t main .
docker run --name main main

docker create:
docker build -t main .

docker test exec:
# docker kill $(docker ps -q)
# docker system prune
docker build -t tracker .
docker run --name tracker tracker
docker exec -it tracker bash

test:
docker build -t tracker .
docker run --name tracker tracker

clean:
docker system prune

Build_and_Push:
# Your Project ID here as argument in line!
echo "Set PROJECT_ID=YOUR_PROJECT_ID if you have not !!!"
docker buildx build --platform linux/amd64 -t gcr.io/$(PROJECT_ID)/tracker .
docker push gcr.io/$(PROJECT_ID)/tracker


setting up gcloud etc:
gcloud auth login
gcloud auth configure-docker

production:
# Your Project ID here as argument in line!
echo "Set PROJECT_ID=YOUR_PROJECT_ID if you have not !!!"
# Build for production for arm64 to make it work on GKE
docker buildx build --platform linux/amd64 -t gcr.io/$(PROJECT_ID)/tracker .
docker push gcr.io/$(PROJECT_ID)/tracker
cd terraform; terraform apply;




1 change: 1 addition & 0 deletions abi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"symbol","type":"string"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"BaseInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collectModule","type":"address"},{"indexed":true,"internalType":"bool","name":"whitelisted","type":"bool"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"CollectModuleWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"pubId","type":"uint256"},{"indexed":true,"internalType":"address","name":"collectNFT","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"CollectNFTDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"pubId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"CollectNFTInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"pubId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"collectNFTId","type":"uint256"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"CollectNFTTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collector","type":"address"},{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"pubId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rootProfileId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rootPubId","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"collectModuleData","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Collected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"pubId","type":"uint256"},{"indexed":false,"internalType":"string","name":"contentURI","type":"string"},{"indexed":false,"internalType":"uint256","name":"profileIdPointed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pubIdPointed","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"referenceModuleData","type":"bytes"},{"indexed":false,"internalType":"address","name":"collectModule","type":"address"},{"indexed":false,"internalType":"bytes","name":"collectModuleReturnData","type":"bytes"},{"indexed":false,"internalType":"address","name":"referenceModule","type":"address"},{"indexed":false,"internalType":"bytes","name":"referenceModuleReturnData","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"CommentCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"DefaultProfileSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":true,"internalType":"address","name":"dispatcher","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"DispatcherSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"oldEmergencyAdmin","type":"address"},{"indexed":true,"internalType":"address","name":"newEmergencyAdmin","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"EmergencyAdminSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"moduleGlobals","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"FeeModuleBaseConstructed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":false,"internalType":"address","name":"followModule","type":"address"},{"indexed":false,"internalType":"bytes","name":"followModuleReturnData","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"FollowModuleSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"followModule","type":"address"},{"indexed":true,"internalType":"bool","name":"whitelisted","type":"bool"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"FollowModuleWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":true,"internalType":"uint256","name":"newPower","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"FollowNFTDelegatedPowerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":true,"internalType":"address","name":"followNFT","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"FollowNFTDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"FollowNFTInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"followNFTId","type":"uint256"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"FollowNFTTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":false,"internalType":"string","name":"followNFTURI","type":"string"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"FollowNFTURISet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"follower","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"profileIds","type":"uint256[]"},{"indexed":false,"internalType":"bytes[]","name":"followModuleDatas","type":"bytes[]"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Followed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"addresses","type":"address[]"},{"indexed":false,"internalType":"bool[]","name":"approved","type":"bool[]"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"FollowsApproved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"profileIds","type":"uint256[]"},{"indexed":false,"internalType":"bool[]","name":"enabled","type":"bool[]"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"FollowsToggled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"prevGovernance","type":"address"},{"indexed":true,"internalType":"address","name":"newGovernance","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"GovernanceSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"pubId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"profileIdPointed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pubIdPointed","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"referenceModuleData","type":"bytes"},{"indexed":false,"internalType":"address","name":"referenceModule","type":"address"},{"indexed":false,"internalType":"bytes","name":"referenceModuleReturnData","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"MirrorCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"hub","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ModuleBaseConstructed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"currency","type":"address"},{"indexed":true,"internalType":"bool","name":"prevWhitelisted","type":"bool"},{"indexed":true,"internalType":"bool","name":"whitelisted","type":"bool"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ModuleGlobalsCurrencyWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"prevGovernance","type":"address"},{"indexed":true,"internalType":"address","name":"newGovernance","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ModuleGlobalsGovernanceSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"prevTreasuryFee","type":"uint16"},{"indexed":true,"internalType":"uint16","name":"newTreasuryFee","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ModuleGlobalsTreasuryFeeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"prevTreasury","type":"address"},{"indexed":true,"internalType":"address","name":"newTreasury","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ModuleGlobalsTreasurySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"pubId","type":"uint256"},{"indexed":false,"internalType":"string","name":"contentURI","type":"string"},{"indexed":false,"internalType":"address","name":"collectModule","type":"address"},{"indexed":false,"internalType":"bytes","name":"collectModuleReturnData","type":"bytes"},{"indexed":false,"internalType":"address","name":"referenceModule","type":"address"},{"indexed":false,"internalType":"bytes","name":"referenceModuleReturnData","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"PostCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":true,"internalType":"address","name":"creator","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"string","name":"handle","type":"string"},{"indexed":false,"internalType":"string","name":"imageURI","type":"string"},{"indexed":false,"internalType":"address","name":"followModule","type":"address"},{"indexed":false,"internalType":"bytes","name":"followModuleReturnData","type":"bytes"},{"indexed":false,"internalType":"string","name":"followNFTURI","type":"string"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ProfileCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"profileCreator","type":"address"},{"indexed":true,"internalType":"bool","name":"whitelisted","type":"bool"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ProfileCreatorWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"profileId","type":"uint256"},{"indexed":false,"internalType":"string","name":"imageURI","type":"string"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ProfileImageURISet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"referenceModule","type":"address"},{"indexed":true,"internalType":"bool","name":"whitelisted","type":"bool"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"ReferenceModuleWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"enum DataTypes.ProtocolState","name":"prevState","type":"uint8"},{"indexed":true,"internalType":"enum DataTypes.ProtocolState","name":"newState","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"StateSet","type":"event"}]
4 changes: 4 additions & 0 deletions abi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
solc --abi events.sol
solc --bin events.sol
abigen --bin=Store_sol_Store.bin --abi=Store_sol_Store.abi --pkg=store --out=Store.go

67 changes: 67 additions & 0 deletions database/database.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package database

import (
"time"

"github.com/google/uuid"
"github.com/shopspring/decimal"
)

type User struct {
ID string `gorm:"primaryKey"`
Address string
}

type CommentMessage struct {
MessageID uuid.UUID `gorm:"primaryKey"`
Sent bool
ProfileId decimal.Decimal
PubId decimal.Decimal
ContentURI string
ProfileIdPointed decimal.Decimal
PubIdPointed decimal.Decimal
CollectModule string
CollectModuleReturnData string
ReferenceModule string
ReferenceModuleReturnData string
Timestamp decimal.Decimal
}

type FollowMessage struct {
MessageID uuid.UUID `gorm:"primaryKey"`
ProfileId decimal.Decimal
FollowNFT string
Timestamp decimal.Decimal
Sent bool
}

type Clone struct {
Day time.Time `gorm:"primaryKey"`
Count int
Uniques int
Repository string `gorm:"primaryKey"`
}

type View struct {
Day time.Time `gorm:"primaryKey"`
Count int
Uniques int
Repository string `gorm:"primaryKey"`
}

type Path struct {
Path string `gorm:"primaryKey"`
Title string
Count int
Uniques int
Day time.Time `gorm:"primaryKey"`
Repository string `gorm:"primaryKey"`
}

type Referral struct {
Referrer string `gorm:"primaryKey"`
Count int
Uniques int
Day time.Time `gorm:"primaryKey"`
Repository string `gorm:"primaryKey"`
}
Loading

0 comments on commit 7d5d367

Please sign in to comment.