Rename repo

This commit is contained in:
Kirill Fedoseev 2022-04-21 15:47:02 +02:00
parent f7a7a68c27
commit 7dd22cf730
35 changed files with 81 additions and 81 deletions

View File

@ -13,8 +13,8 @@ WORKDIR /app
RUN apt-get update && apt-get install -y ca-certificates && update-ca-certificates RUN apt-get update && apt-get install -y ca-certificates && update-ca-certificates
COPY db/migrations ./db/migrations/ COPY db/migrations ./db/migrations/
COPY --from=build /app/amb-monitor ./ COPY --from=build /app/tokenbridge-monitor ./
EXPOSE 3333 EXPOSE 3333
ENTRYPOINT ./amb-monitor ENTRYPOINT ./tokenbridge-monitor

View File

@ -1,5 +1,5 @@
# Tokenbridge AMB monitor # Tokenbridge monitor
This repo provides a real-time monitoring solution for the AMB bridge contracts. This repo provides a real-time monitoring solution for the AMB/XDAI bridge contracts.
It performs a real-time chain indexing for the configured bridged instances, and alerts in case of some important events or outages. It performs a real-time chain indexing for the configured bridged instances, and alerts in case of some important events or outages.
## Tech layout ## Tech layout
@ -57,8 +57,8 @@ docker-compose -f docker-compose.dev.yml up monitor
For final deployment, you will need a VM with a static IP and a DNS domain name attached to that IP. For final deployment, you will need a VM with a static IP and a DNS domain name attached to that IP.
SSL certificates will be managed by a Traefik and Let's Encrypt automatically. SSL certificates will be managed by a Traefik and Let's Encrypt automatically.
```bash ```bash
git clone https://github.com/poanetwork/amb-monitor.git git clone https://github.com/poanetwork/tokenbridge-monitor.git
cd amb-monitor cd tokenbridge-monitor
cp .env.example .env cp .env.example .env
nano .env # put valid INFURA_PROJECT_KEY and valid domain names nano .env # put valid INFURA_PROJECT_KEY and valid domain names

View File

@ -1,6 +1,6 @@
{ {
"$schema": "https://json-schema.org/draft/2020-12/schema", "$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/poanetwork/amb-monitor/blob/master/config.schema.json", "$id": "https://github.com/poanetwork/tokenbridge-monitor/blob/master/config.schema.json",
"title": "AMB monitor config", "title": "AMB monitor config",
"type": "object", "type": "object",
"properties": { "properties": {

View File

@ -1,10 +1,10 @@
package contract package contract
import ( import (
"amb-monitor/entity"
"amb-monitor/ethclient"
"context" "context"
"fmt" "fmt"
"tokenbridge-monitor/entity"
"tokenbridge-monitor/ethclient"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi"

View File

@ -1,12 +1,12 @@
package db package db
import ( import (
"amb-monitor/config"
"context" "context"
"database/sql" "database/sql"
"fmt" "fmt"
"runtime" "runtime"
"strings" "strings"
"tokenbridge-monitor/config"
"github.com/golang-migrate/migrate/v4" "github.com/golang-migrate/migrate/v4"
_ "github.com/golang-migrate/migrate/v4/database/pgx" _ "github.com/golang-migrate/migrate/v4/database/pgx"

View File

@ -83,7 +83,7 @@ services:
restart: unless-stopped restart: unless-stopped
monitor: monitor:
container_name: monitor container_name: monitor
image: ghcr.io/poanetwork/amb-monitor:v0.0.20 image: ghcr.io/poanetwork/tokenbridge-monitor:v0.0.20
env_file: env_file:
- .env - .env
volumes: volumes:

2
go.mod
View File

@ -1,4 +1,4 @@
module amb-monitor module tokenbridge-monitor
go 1.17 go 1.17

12
main.go
View File

@ -1,16 +1,16 @@
package main package main
import ( import (
"amb-monitor/config"
"amb-monitor/db"
"amb-monitor/logging"
"amb-monitor/monitor"
"amb-monitor/presenter"
"amb-monitor/repository"
"context" "context"
"net/http" "net/http"
"os" "os"
"os/signal" "os/signal"
"tokenbridge-monitor/config"
"tokenbridge-monitor/db"
"tokenbridge-monitor/logging"
"tokenbridge-monitor/monitor"
"tokenbridge-monitor/presenter"
"tokenbridge-monitor/repository"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
) )

View File

@ -1,12 +1,12 @@
package alerts package alerts
import ( import (
"amb-monitor/config"
"amb-monitor/db"
"amb-monitor/logging"
"context" "context"
"fmt" "fmt"
"time" "time"
"tokenbridge-monitor/config"
"tokenbridge-monitor/db"
"tokenbridge-monitor/logging"
) )
type AlertManager struct { type AlertManager struct {

View File

@ -1,11 +1,11 @@
package alerts package alerts
import ( import (
"amb-monitor/db"
"context" "context"
"fmt" "fmt"
"strconv" "strconv"
"time" "time"
"tokenbridge-monitor/db"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"

View File

@ -1,9 +1,9 @@
package alerts package alerts
import ( import (
"amb-monitor/logging"
"context" "context"
"time" "time"
"tokenbridge-monitor/logging"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"

View File

@ -1,9 +1,9 @@
package monitor package monitor
import ( import (
"amb-monitor/entity"
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"tokenbridge-monitor/entity"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"

View File

@ -1,14 +1,14 @@
package monitor package monitor
import ( import (
"amb-monitor/config"
"amb-monitor/contract/abi"
"amb-monitor/entity"
"amb-monitor/ethclient"
"amb-monitor/repository"
"context" "context"
"fmt" "fmt"
"math/big" "math/big"
"tokenbridge-monitor/config"
"tokenbridge-monitor/contract/abi"
"tokenbridge-monitor/entity"
"tokenbridge-monitor/ethclient"
"tokenbridge-monitor/repository"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"

View File

@ -1,16 +1,6 @@
package monitor package monitor
import ( import (
"amb-monitor/config"
"amb-monitor/contract"
"amb-monitor/contract/abi"
"amb-monitor/db"
"amb-monitor/entity"
"amb-monitor/ethclient"
"amb-monitor/logging"
"amb-monitor/monitor/alerts"
"amb-monitor/repository"
"amb-monitor/utils"
"context" "context"
"database/sql" "database/sql"
"errors" "errors"
@ -19,6 +9,16 @@ import (
"sort" "sort"
"sync" "sync"
"time" "time"
"tokenbridge-monitor/config"
"tokenbridge-monitor/contract"
"tokenbridge-monitor/contract/abi"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
"tokenbridge-monitor/ethclient"
"tokenbridge-monitor/logging"
"tokenbridge-monitor/monitor/alerts"
"tokenbridge-monitor/repository"
"tokenbridge-monitor/utils"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"

View File

@ -1,7 +1,7 @@
package monitor package monitor
import ( import (
"amb-monitor/entity" "tokenbridge-monitor/entity"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
) )

View File

@ -1,10 +1,10 @@
package presenter package presenter
import ( import (
"amb-monitor/logging"
"fmt" "fmt"
"net/http" "net/http"
"time" "time"
"tokenbridge-monitor/logging"
"github.com/go-chi/chi/v5/middleware" "github.com/go-chi/chi/v5/middleware"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"

View File

@ -1,15 +1,15 @@
package presenter package presenter
import ( import (
"amb-monitor/config"
"amb-monitor/entity"
"amb-monitor/logging"
"amb-monitor/repository"
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"net/http" "net/http"
"strconv" "strconv"
"tokenbridge-monitor/config"
"tokenbridge-monitor/entity"
"tokenbridge-monitor/logging"
"tokenbridge-monitor/repository"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5"

View File

@ -1,8 +1,8 @@
package presenter package presenter
import ( import (
"amb-monitor/entity"
"time" "time"
"tokenbridge-monitor/entity"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"

View File

@ -1,8 +1,8 @@
package presenter package presenter
import ( import (
"amb-monitor/entity"
"fmt" "fmt"
"tokenbridge-monitor/entity"
) )
var formats = map[string]string{ var formats = map[string]string{

View File

@ -1,7 +1,7 @@
package postgres package postgres
import ( import (
"amb-monitor/db" "tokenbridge-monitor/db"
) )
type basePostgresRepo struct { type basePostgresRepo struct {
@ -14,4 +14,4 @@ func newBasePostgresRepo(table string, db *db.DB) *basePostgresRepo {
table: table, table: table,
db: db, db: db,
} }
} }

View File

@ -1,12 +1,12 @@
package postgres package postgres
import ( import (
"amb-monitor/db"
"amb-monitor/entity"
"context" "context"
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
) )

View File

@ -1,12 +1,12 @@
package postgres package postgres
import ( import (
"amb-monitor/db"
"amb-monitor/entity"
"context" "context"
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"

View File

@ -1,12 +1,12 @@
package postgres package postgres
import ( import (
"amb-monitor/db"
"amb-monitor/entity"
"context" "context"
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"

View File

@ -1,12 +1,12 @@
package postgres package postgres
import ( import (
"amb-monitor/db"
"amb-monitor/entity"
"context" "context"
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"

View File

@ -1,12 +1,12 @@
package postgres package postgres
import ( import (
"amb-monitor/db"
"amb-monitor/entity"
"context" "context"
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"

View File

@ -1,12 +1,12 @@
package postgres package postgres
import ( import (
"amb-monitor/db"
"amb-monitor/entity"
"context" "context"
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"

View File

@ -1,12 +1,12 @@
package postgres package postgres
import ( import (
"amb-monitor/db"
"amb-monitor/entity"
"context" "context"
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -53,4 +53,4 @@ func (r *informationRequestsRepo) FindByMessageID(ctx context.Context, bridgeID
return nil, fmt.Errorf("can't get information request: %w", err) return nil, fmt.Errorf("can't get information request: %w", err)
} }
return req, nil return req, nil
} }

View File

@ -1,10 +1,10 @@
package postgres package postgres
import ( import (
"amb-monitor/db"
"amb-monitor/entity"
"context" "context"
"fmt" "fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"

View File

@ -1,10 +1,10 @@
package postgres package postgres
import ( import (
"amb-monitor/db"
"amb-monitor/entity"
"context" "context"
"fmt" "fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"

View File

@ -1,12 +1,12 @@
package postgres package postgres
import ( import (
"amb-monitor/db"
"amb-monitor/entity"
"context" "context"
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"

View File

@ -1,12 +1,12 @@
package postgres package postgres
import ( import (
"amb-monitor/db"
"amb-monitor/entity"
"context" "context"
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"

View File

@ -1,12 +1,12 @@
package postgres package postgres
import ( import (
"amb-monitor/db"
"amb-monitor/entity"
"context" "context"
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"

View File

@ -1,12 +1,12 @@
package postgres package postgres
import ( import (
"amb-monitor/db"
"amb-monitor/entity"
"context" "context"
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"

View File

@ -1,12 +1,12 @@
package postgres package postgres
import ( import (
"amb-monitor/db"
"amb-monitor/entity"
"context" "context"
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"

View File

@ -1,9 +1,9 @@
package repository package repository
import ( import (
"amb-monitor/db" "tokenbridge-monitor/db"
"amb-monitor/entity" "tokenbridge-monitor/entity"
"amb-monitor/repository/postgres" "tokenbridge-monitor/repository/postgres"
) )
type Repo struct { type Repo struct {