Skip to content

Commit

Permalink
Add updater auto (BEP2) (trustwallet#16497)
Browse files Browse the repository at this point in the history
  • Loading branch information
unanoc authored Dec 9, 2021
1 parent db7893b commit 13d5b6b
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 23 deletions.
4 changes: 3 additions & 1 deletion .github/assets.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ app:
log_level: info

client_urls:
binancedex: "https://dex-atlantic.binance.org"
binance:
explorer: https://explorer.binance.org
dex: https://dex-atlantic.binance.org/api

validators_settings:
root_folder:
Expand Down
26 changes: 16 additions & 10 deletions .github/workflows/periodic-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,32 @@ jobs:
with:
token: ${{ secrets.COMMIT_TOKEN }}
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v1

- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
node-version: 12
- name: Install Dependencies
run: npm ci
- name: Run scripts
run: npm run updateAuto
go-version: 1.17
id: go

- name: Check out code
uses: actions/checkout@v2

- name: Run update auto
run: go run ./cmd/main.go --config=./.github/assets.config.yaml --script=update-auto

- name: Show update result (diff)
if: success()
run: |
git status
git diff
- name: Run check
run: npm run check
- name: Run test
run: npm t
run: go run ./cmd/main.go --config=./.github/assets.config.yaml --script=sanity-check

- name: Commit changes
if: success()
uses: stefanzweifel/[email protected]
with:
commit_user_name: trust-wallet-merge-bot
commit_user_email: [email protected]
commit_message: External Updates
commit_message: External Updates
8 changes: 5 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (

"github.com/trustwallet/assets-go-libs/pkg/file"
"github.com/trustwallet/assets-go-libs/src/config"
"github.com/trustwallet/assets-go-libs/src/core"
"github.com/trustwallet/assets-go-libs/src/processor"
"github.com/trustwallet/assets-go-libs/src/reporter"
"github.com/trustwallet/assets-go-libs/src/validator"
)

var (
Expand All @@ -25,14 +25,16 @@ func main() {
log.WithError(err).Fatal("failed to load file structure")
}

fileStorage := file.NewFileService()
validatorsService := validator.NewService(fileStorage)
fileStorage := file.NewService()
validatorsService := core.NewService(fileStorage)
reportService := reporter.NewReportService()
assetfsProcessor := processor.NewService(fileStorage, validatorsService, reportService)

switch script {
case "sanity-check":
err = assetfsProcessor.RunSanityCheck(paths)
case "update-auto":
err = assetfsProcessor.RunUpdateAuto()
default:
log.Error("Nothing to launch. Use --script flag to choose a script to run.")
}
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.17

require (
github.com/sirupsen/logrus v1.8.1
github.com/trustwallet/assets-go-libs v0.0.11-0.20211207143444-a18d96f83e60
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209184253-ba34649a8816
)

require (
Expand All @@ -13,15 +13,17 @@ require (
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.8.1 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/trustwallet/go-libs v0.2.17 // indirect
github.com/trustwallet/go-primitives v0.0.16-0.20211207135220-04b1926f0aa0 // indirect
github.com/trustwallet/go-libs v0.2.19 // indirect
github.com/trustwallet/go-primitives v0.0.16 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912 // indirect
golang.org/x/text v0.3.5 // indirect
Expand Down
34 changes: 28 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y
github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48=
github.com/onsi/gomega v1.11.0/go.mod h1:azGKhqFUon9Vuj0YmTfLSmx0FUwqXYSTl5re8lQLTUg=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
Expand All @@ -242,6 +243,7 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
Expand Down Expand Up @@ -270,12 +272,32 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211207143444-a18d96f83e60 h1:g08ompuO/28QrjdhtidSmYA2FtWL9W3MNwNIdZo3/k0=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211207143444-a18d96f83e60/go.mod h1:eHgw4yTa5HjyAy/K0Y0ZEgd8sAghf01PRDyd7DO/U9Y=
github.com/trustwallet/go-libs v0.2.17 h1:l2zr5Ow19GTPnoWbhjExAhTbz7xLcYPXBa10EIgItjI=
github.com/trustwallet/go-libs v0.2.17/go.mod h1:gBDrDkN5wOY+8kwlU6pnv3l/seGJy2qH1OpTKe7NnXA=
github.com/trustwallet/go-primitives v0.0.16-0.20211207135220-04b1926f0aa0 h1:Dd2L3iCptLdCQFt4bBH5wqrW50J7JqmEcP8aDHSZY0g=
github.com/trustwallet/go-primitives v0.0.16-0.20211207135220-04b1926f0aa0/go.mod h1:jLqd7rm+4EYG5JdpxhngM9HwbqfEXzKy/wK4vUB7STs=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209133216-bfeb25c00fe5 h1:aR5Is4rsq4i4vd5WZQNSql7XWAsFF7/oqqRN9+yVM3Y=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209133216-bfeb25c00fe5/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209140210-dcc2c3db3dd1 h1:SSEqBFVEDAWcObPipYJc+eXWc6vmdCwkYs5tTfEeul8=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209140210-dcc2c3db3dd1/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209140813-6a8cedf0c6a2 h1:PB6A2AeSH79JTJ4hgyPkkLl8/I3TN7G1jX+18SFrnfM=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209140813-6a8cedf0c6a2/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209141303-a7c3afb83543 h1:K2YFKEnGRAUAqOMOU2Mw/+MQ51siKuJZLyeAES3CZZw=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209141303-a7c3afb83543/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209142051-534b35c0638b h1:JTvv59KJFq1XCKATInRkGk3FUSXTvQZMyTWVi6Y/4Rw=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209142051-534b35c0638b/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209144340-c1f0962f72df h1:KpRBbgPBswjSGr4AyRSOHa1SCuWHk4FJaQVwyiMChEk=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209144340-c1f0962f72df/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209144715-a6ecbfaa9b0e h1:B5HP2h0k8Gw5GxG9aomlAtD0vj3JDldgY7OcbJ+IJVk=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209144715-a6ecbfaa9b0e/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209145401-967c8a8f5143 h1:IvBJsNqVxNx3GWpKhqe/ANGLzASDAZBh9sNNvPnRi3c=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209145401-967c8a8f5143/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209145549-b38b58e9c6c5 h1:ulDhK4LX6Nh6EsQ/lozjgFTwXwmhweJ3+CS5ooiV8P4=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209145549-b38b58e9c6c5/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209150306-4e27adeaa175 h1:ZphbKSMWEvMZ/DQcAHtGLqnoGZi3pECK0LZ0Fj9rGPg=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209150306-4e27adeaa175/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209184253-ba34649a8816 h1:DjbGqBvE8HQNMbk9IzoGDFggoXjDu9W5WfvBVwc0kZQ=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209184253-ba34649a8816/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/go-libs v0.2.19 h1:GTdMWYGJpTiWy7XOitveeviQIUYazU4PVxnjUBruT3g=
github.com/trustwallet/go-libs v0.2.19/go.mod h1:7QdAp1lcteKKI0DYqGoaO8KO4eTNYjGmg8vHy0YXkKc=
github.com/trustwallet/go-primitives v0.0.16 h1:RoivfOFmMx8C4felrwWHuIWtWLm7Gd9Fj0mLIBZ8qEY=
github.com/trustwallet/go-primitives v0.0.16/go.mod h1:jLqd7rm+4EYG5JdpxhngM9HwbqfEXzKy/wK4vUB7STs=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down

0 comments on commit 13d5b6b

Please sign in to comment.