Lint imports
This commit is contained in:
parent
9270c9911c
commit
b3cc0be853
|
@ -4,14 +4,15 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
"tokenbridge-monitor/config"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
"tokenbridge-monitor/ethclient"
|
||||
"tokenbridge-monitor/logging"
|
||||
"tokenbridge-monitor/repository"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/config"
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
"github.com/poanetwork/tokenbridge-monitor/ethclient"
|
||||
"github.com/poanetwork/tokenbridge-monitor/logging"
|
||||
"github.com/poanetwork/tokenbridge-monitor/repository"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -5,15 +5,16 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"tokenbridge-monitor/config"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/ethclient"
|
||||
"tokenbridge-monitor/logging"
|
||||
"tokenbridge-monitor/monitor"
|
||||
"tokenbridge-monitor/presenter"
|
||||
"tokenbridge-monitor/repository"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/config"
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/ethclient"
|
||||
"github.com/poanetwork/tokenbridge-monitor/logging"
|
||||
"github.com/poanetwork/tokenbridge-monitor/monitor"
|
||||
"github.com/poanetwork/tokenbridge-monitor/presenter"
|
||||
"github.com/poanetwork/tokenbridge-monitor/repository"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -3,11 +3,12 @@ package contract
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/config"
|
||||
"tokenbridge-monitor/contract/abi"
|
||||
"tokenbridge-monitor/ethclient"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/config"
|
||||
"github.com/poanetwork/tokenbridge-monitor/contract/abi"
|
||||
"github.com/poanetwork/tokenbridge-monitor/ethclient"
|
||||
)
|
||||
|
||||
type BridgeContract struct {
|
||||
|
|
|
@ -3,12 +3,13 @@ package contract
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/entity"
|
||||
"tokenbridge-monitor/ethclient"
|
||||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
"github.com/poanetwork/tokenbridge-monitor/ethclient"
|
||||
)
|
||||
|
||||
type Contract struct {
|
||||
|
|
|
@ -2,10 +2,11 @@ package contract
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
func Indexed(args abi.Arguments) abi.Arguments {
|
||||
|
|
3
db/db.go
3
db/db.go
|
@ -6,7 +6,6 @@ import (
|
|||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
"tokenbridge-monitor/config"
|
||||
|
||||
"github.com/golang-migrate/migrate/v4"
|
||||
_ "github.com/golang-migrate/migrate/v4/database/pgx"
|
||||
|
@ -14,6 +13,8 @@ import (
|
|||
_ "github.com/jackc/pgx/v4/stdlib"
|
||||
"github.com/jmoiron/sqlx"
|
||||
_ "github.com/lib/pq"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/config"
|
||||
)
|
||||
|
||||
type DB struct {
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
|||
module tokenbridge-monitor
|
||||
module github.com/poanetwork/tokenbridge-monitor
|
||||
|
||||
go 1.17
|
||||
|
||||
|
|
|
@ -4,9 +4,10 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
"tokenbridge-monitor/config"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/logging"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/config"
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/logging"
|
||||
)
|
||||
|
||||
type AlertManager struct {
|
||||
|
|
|
@ -4,11 +4,12 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
"tokenbridge-monitor/db"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/lib/pq"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
)
|
||||
|
||||
type DBAlertsProvider struct {
|
||||
|
|
|
@ -6,11 +6,12 @@ import (
|
|||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
"tokenbridge-monitor/logging"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/logging"
|
||||
)
|
||||
|
||||
type AlertJobParams struct {
|
||||
|
|
|
@ -8,14 +8,6 @@ import (
|
|||
"sort"
|
||||
"sync"
|
||||
"time"
|
||||
"tokenbridge-monitor/config"
|
||||
"tokenbridge-monitor/contract"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
"tokenbridge-monitor/ethclient"
|
||||
"tokenbridge-monitor/logging"
|
||||
"tokenbridge-monitor/repository"
|
||||
"tokenbridge-monitor/utils"
|
||||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
@ -23,6 +15,15 @@ import (
|
|||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/config"
|
||||
"github.com/poanetwork/tokenbridge-monitor/contract"
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
"github.com/poanetwork/tokenbridge-monitor/ethclient"
|
||||
"github.com/poanetwork/tokenbridge-monitor/logging"
|
||||
"github.com/poanetwork/tokenbridge-monitor/repository"
|
||||
"github.com/poanetwork/tokenbridge-monitor/utils"
|
||||
)
|
||||
|
||||
const defaultSyncedThreshold = 10
|
||||
|
|
|
@ -3,10 +3,11 @@ package monitor
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
func unmarshalMessage(bridgeID string, direction entity.Direction, encodedData []byte) *entity.Message {
|
||||
|
|
|
@ -5,15 +5,16 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"tokenbridge-monitor/config"
|
||||
"tokenbridge-monitor/contract/abi"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
"tokenbridge-monitor/ethclient"
|
||||
"tokenbridge-monitor/repository"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/config"
|
||||
"github.com/poanetwork/tokenbridge-monitor/contract/abi"
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
"github.com/poanetwork/tokenbridge-monitor/ethclient"
|
||||
"github.com/poanetwork/tokenbridge-monitor/repository"
|
||||
)
|
||||
|
||||
type EventHandler func(ctx context.Context, log *entity.Log, data map[string]interface{}) error
|
||||
|
|
|
@ -3,13 +3,14 @@ package monitor
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/config"
|
||||
"tokenbridge-monitor/contract/abi"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/ethclient"
|
||||
"tokenbridge-monitor/logging"
|
||||
"tokenbridge-monitor/monitor/alerts"
|
||||
"tokenbridge-monitor/repository"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/config"
|
||||
"github.com/poanetwork/tokenbridge-monitor/contract/abi"
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/ethclient"
|
||||
"github.com/poanetwork/tokenbridge-monitor/logging"
|
||||
"github.com/poanetwork/tokenbridge-monitor/monitor/alerts"
|
||||
"github.com/poanetwork/tokenbridge-monitor/repository"
|
||||
)
|
||||
|
||||
type Monitor struct {
|
||||
|
|
|
@ -2,9 +2,10 @@ package monitor
|
|||
|
||||
import (
|
||||
"math"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type BlocksRange struct {
|
||||
|
|
|
@ -2,10 +2,11 @@ package monitor_test
|
|||
|
||||
import (
|
||||
"testing"
|
||||
"tokenbridge-monitor/entity"
|
||||
"tokenbridge-monitor/monitor"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
"github.com/poanetwork/tokenbridge-monitor/monitor"
|
||||
)
|
||||
|
||||
func TestSplitBlockRange(t *testing.T) {
|
||||
|
|
|
@ -4,10 +4,11 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
"tokenbridge-monitor/logging"
|
||||
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/logging"
|
||||
)
|
||||
|
||||
func NewRequestLogger(logger logging.Logger) func(next http.Handler) http.Handler {
|
||||
|
|
|
@ -8,15 +8,16 @@ import (
|
|||
"net/http"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"tokenbridge-monitor/config"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
"tokenbridge-monitor/logging"
|
||||
"tokenbridge-monitor/repository"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/config"
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
"github.com/poanetwork/tokenbridge-monitor/logging"
|
||||
"github.com/poanetwork/tokenbridge-monitor/repository"
|
||||
)
|
||||
|
||||
type Presenter struct {
|
||||
|
|
|
@ -2,10 +2,11 @@ package presenter
|
|||
|
||||
import (
|
||||
"time"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type MessageInfo struct {
|
||||
|
|
|
@ -2,7 +2,8 @@ package presenter
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
var formats = map[string]string{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
)
|
||||
|
||||
type basePostgresRepo struct {
|
||||
|
|
|
@ -5,10 +5,11 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type blockTimestampsRepo basePostgresRepo
|
||||
|
|
|
@ -5,11 +5,12 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type bridgeValidatorsRepo basePostgresRepo
|
||||
|
|
|
@ -5,11 +5,12 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type collectedMessagesRepo basePostgresRepo
|
||||
|
|
|
@ -5,11 +5,12 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type ercToNativeMessagesRepo basePostgresRepo
|
||||
|
|
|
@ -5,11 +5,12 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type executedInformationRequestsRepo basePostgresRepo
|
||||
|
|
|
@ -5,11 +5,12 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type executedMessagesRepo basePostgresRepo
|
||||
|
|
|
@ -5,11 +5,12 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type informationRequestsRepo basePostgresRepo
|
||||
|
|
|
@ -3,11 +3,12 @@ package postgres
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type logsRepo basePostgresRepo
|
||||
|
|
|
@ -5,11 +5,12 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type logsCursorsRepo basePostgresRepo
|
||||
|
|
|
@ -5,11 +5,12 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type messagesRepo basePostgresRepo
|
||||
|
|
|
@ -5,11 +5,12 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type sentInformationRequestsRepo basePostgresRepo
|
||||
|
|
|
@ -5,11 +5,12 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type sentMessagesRepo basePostgresRepo
|
||||
|
|
|
@ -5,11 +5,12 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type signedInformationRequestsRepo basePostgresRepo
|
||||
|
|
|
@ -5,11 +5,12 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
)
|
||||
|
||||
type signedMessagesRepo basePostgresRepo
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package repository
|
||||
|
||||
import (
|
||||
"tokenbridge-monitor/db"
|
||||
"tokenbridge-monitor/entity"
|
||||
"tokenbridge-monitor/repository/postgres"
|
||||
"github.com/poanetwork/tokenbridge-monitor/db"
|
||||
"github.com/poanetwork/tokenbridge-monitor/entity"
|
||||
"github.com/poanetwork/tokenbridge-monitor/repository/postgres"
|
||||
)
|
||||
|
||||
type Repo struct {
|
||||
|
|
Loading…
Reference in New Issue