main.go 992 B

123456789101112131415161718192021222324252627282930313233343536
  1. package main
  2. import (
  3. _ "github.com/go-sql-driver/mysql"
  4. "github.com/go-xorm/xorm"
  5. "os"
  6. "syncscan-go/collector"
  7. "syncscan-go/er"
  8. ethclient "syncscan-go/eth"
  9. models_table "syncscan-go/models/table"
  10. )
  11. func main() {
  12. db, err := xorm.NewEngine("mysql", "syncscan_db:ICjryB3GkHB@tcp(175.126.146.155:3306)/syncscan_db?charset=utf8mb4&parseTime=true&loc=Local")
  13. er.Check(err)
  14. er.Check(db.Ping())
  15. db.SetLogger(xorm.NewSimpleLogger(os.Stdout))
  16. db.ShowSQL(true)
  17. db.Sync(new(models_table.EthLastSync))
  18. db.Sync(new(models_table.EthTxMethod))
  19. db.Sync(new(models_table.EthBlock))
  20. db.Sync(new(models_table.EthUncleBlock))
  21. db.Sync(new(models_table.EthContract))
  22. db.Sync(new(models_table.EthToken))
  23. db.Sync(new(models_table.EthTransInter))
  24. db.Sync(new(models_table.EthTokenHolder))
  25. db.Sync(new(models_table.EthTranxn))
  26. ethclient, err := ethclient.New("https://mainnet.infura.io/v3/8efdf62c742545d5836d741c9d4b5300")
  27. er.Check(err)
  28. c := collector.New(db, ethclient, 100)
  29. c.Run()
  30. }