diff --git a/blockchains/binance/tokenlist.json b/blockchains/binance/tokenlist.json index b1bbc5b7a..35cde45dd 100644 --- a/blockchains/binance/tokenlist.json +++ b/blockchains/binance/tokenlist.json @@ -1,7 +1,7 @@ { "name": "Trust Wallet: BNB", "logoURI": "https://trustwallet.com/assets/images/favicon.png", - "timestamp": "2022-01-07T01:30:04.539853", + "timestamp": "2022-01-09T23:11:17.823201", "tokens": [ { "asset": "c714", @@ -22,11 +22,6 @@ "lotSize": "1000000000", "tickSize": "1" }, - { - "base": "c714_tARN-71B", - "lotSize": "10000000000", - "tickSize": "1" - }, { "base": "c714_tARPA-575", "lotSize": "1000000000", @@ -164,7 +159,7 @@ }, { "base": "c714_tCSM-734", - "lotSize": "100000000000", + "lotSize": "1000000000000", "tickSize": "1" }, { @@ -554,8 +549,8 @@ }, { "base": "c714_tXRPBEAR-00B", - "lotSize": "1000000", - "tickSize": "100" + "lotSize": "10000000", + "tickSize": "10" }, { "base": "c714_tXRPBULL-E7C", @@ -846,7 +841,7 @@ { "base": "c714_tBUSD-BD1", "lotSize": "100000000", - "tickSize": "1000" + "tickSize": "100" } ] }, @@ -894,7 +889,7 @@ { "base": "c714", "lotSize": "100000", - "tickSize": "100000" + "tickSize": "1000000" } ] }, @@ -944,16 +939,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/binance/assets/ANKR-E97/logo.png", "pairs": [] }, - { - "asset": "c714_tARN-71B", - "type": "BEP2", - "address": "ARN-71B", - "name": "Aeron", - "symbol": "ARN", - "decimals": 8, - "logoURI": "https://assets.trustwalletapp.com/blockchains/binance/assets/ARN-71B/logo.png", - "pairs": [] - }, { "asset": "c714_tARPA-575", "type": "BEP2", @@ -2186,7 +2171,7 @@ } ], "version": { - "major": 259, + "major": 260, "minor": 0, "patch": 0 } diff --git a/blockchains/ethereum/assets/0xdd974D5C2e2928deA5F71b9825b8b646686BD200/info.json b/blockchains/ethereum/assets/0xdd974D5C2e2928deA5F71b9825b8b646686BD200/info.json index 74370f027..7044c7bcc 100644 --- a/blockchains/ethereum/assets/0xdd974D5C2e2928deA5F71b9825b8b646686BD200/info.json +++ b/blockchains/ethereum/assets/0xdd974D5C2e2928deA5F71b9825b8b646686BD200/info.json @@ -6,7 +6,7 @@ "type": "ERC20", "symbol": "KNCL", "decimals": 18, - "status": "active", + "status": "abandoned", "id": "0xdd974D5C2e2928deA5F71b9825b8b646686BD200", "links": [ { diff --git a/blockchains/ethereum/tokenlist.json b/blockchains/ethereum/tokenlist.json index 001c64570..3672c43b6 100644 --- a/blockchains/ethereum/tokenlist.json +++ b/blockchains/ethereum/tokenlist.json @@ -118,15 +118,9 @@ { "base": "c60_t0x25e1474170c4c0aA64fa98123bdc8dB49D7802fa" }, - { - "base": "c60_t0x26a79Bd709A7eF5E5F747B8d8f83326EA044d8cC" - }, { "base": "c60_t0x26c8AFBBFE1EBaca03C2bB082E69D0476Bffe099" }, - { - "base": "c60_t0x26CE25148832C04f3d7F26F32478a9fe55197166" - }, { "base": "c60_t0x27C70Cd1946795B66be9d954418546998b546634" }, @@ -253,9 +247,6 @@ { "base": "c60_t0x7FF4169a6B5122b664c51c95727d87750eC07c84" }, - { - "base": "c60_t0x80fB784B7eD66730e8b1DBd9820aFD29931aab03" - }, { "base": "c60_t0x8207c1FfC5B6804F6024322CcF34F29c3541Ae26" }, @@ -463,9 +454,6 @@ { "base": "c60_t0xdAC17F958D2ee523a2206206994597C13D831ec7" }, - { - "base": "c60_t0xdd974D5C2e2928deA5F71b9825b8b646686BD200" - }, { "base": "c60_t0xDDB3422497E61e13543BeA06989C0789117555c5" }, @@ -868,16 +856,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x16980b3B4a3f9D89E33311B5aa8f80303E5ca4F8/logo.png", "pairs": [] }, - { - "asset": "c60_t0x178c820f862B14f316509ec36b13123DA19A6054", - "type": "ERC20", - "address": "0x178c820f862B14f316509ec36b13123DA19A6054", - "name": "Energy Web Token Bridged", - "symbol": "EWTB", - "decimals": 18, - "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x178c820f862B14f316509ec36b13123DA19A6054/logo.png", - "pairs": [] - }, { "asset": "c60_t0x1796ae0b0fa4862485106a0de9b654eFE301D0b2", "type": "ERC20", @@ -1062,16 +1040,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x25e1474170c4c0aA64fa98123bdc8dB49D7802fa/logo.png", "pairs": [] }, - { - "asset": "c60_t0x26a79Bd709A7eF5E5F747B8d8f83326EA044d8cC", - "type": "ERC20", - "address": "0x26a79Bd709A7eF5E5F747B8d8f83326EA044d8cC", - "name": "BankSocial", - "symbol": "BSOCIAL", - "decimals": 8, - "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x26a79Bd709A7eF5E5F747B8d8f83326EA044d8cC/logo.png", - "pairs": [] - }, { "asset": "c60_t0x26c8AFBBFE1EBaca03C2bB082E69D0476Bffe099", "type": "ERC20", @@ -1082,16 +1050,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x26c8AFBBFE1EBaca03C2bB082E69D0476Bffe099/logo.png", "pairs": [] }, - { - "asset": "c60_t0x26CE25148832C04f3d7F26F32478a9fe55197166", - "type": "ERC20", - "address": "0x26CE25148832C04f3d7F26F32478a9fe55197166", - "name": "DEXTools", - "symbol": "DEXT", - "decimals": 18, - "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x26CE25148832C04f3d7F26F32478a9fe55197166/logo.png", - "pairs": [] - }, { "asset": "c60_t0x26E43759551333e57F073bb0772F50329A957b30", "type": "ERC20", @@ -1244,17 +1202,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x362bc847A3a9637d3af6624EeC853618a43ed7D2/logo.png", "pairs": [] }, - { - "chainId": 1, - "asset": "c60_t0x37236CD05b34Cc79d3715AF2383E96dd7443dCF1", - "type": "ERC20", - "address": "0x37236CD05b34Cc79d3715AF2383E96dd7443dCF1", - "name": "Small Love Potion", - "symbol": "SLP", - "decimals": 0, - "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x37236CD05b34Cc79d3715AF2383E96dd7443dCF1/logo.png", - "pairs": [] - }, { "asset": "c60_t0x3845badAde8e6dFF049820680d1F14bD3903a5d0", "type": "ERC20", @@ -1305,16 +1252,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x3D3D35bb9bEC23b06Ca00fe472b50E7A4c692C30/logo.png", "pairs": [] }, - { - "asset": "c60_t0x3DB6Ba6ab6F95efed1a6E794caD492fAAabF294D", - "type": "ERC20", - "address": "0x3DB6Ba6ab6F95efed1a6E794caD492fAAabF294D", - "name": "LTO Network", - "symbol": "LTO", - "decimals": 8, - "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x3DB6Ba6ab6F95efed1a6E794caD492fAAabF294D/logo.png", - "pairs": [] - }, { "chainId": 1, "asset": "c60_t0x408e41876cCCDC0F92210600ef50372656052a38", @@ -1457,16 +1394,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x4C19596f5aAfF459fA38B0f7eD92F11AE6543784/logo.png", "pairs": [] }, - { - "asset": "c60_t0x4de2573e27E648607B50e1Cfff921A33E4A34405", - "type": "ERC20", - "address": "0x4de2573e27E648607B50e1Cfff921A33E4A34405", - "name": "Lendroid Support Token", - "symbol": "LST", - "decimals": 18, - "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x4de2573e27E648607B50e1Cfff921A33E4A34405/logo.png", - "pairs": [] - }, { "asset": "c60_t0x4e352cF164E64ADCBad318C3a1e222E9EBa4Ce42", "type": "ERC20", @@ -1894,17 +1821,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x72e9D9038cE484EE986FEa183f8d8Df93f9aDA13/logo.png", "pairs": [] }, - { - "chainId": 1, - "asset": "c60_t0x740623d2c797b7D8D1EcB98e9b4Afcf99Ec31E14", - "type": "ERC20", - "address": "0x740623d2c797b7D8D1EcB98e9b4Afcf99Ec31E14", - "name": "DoYourTip", - "symbol": "DYT", - "decimals": 18, - "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x740623d2c797b7D8D1EcB98e9b4Afcf99Ec31E14/logo.png", - "pairs": [] - }, { "asset": "c60_t0x761D38e5ddf6ccf6Cf7c55759d5210750B5D60F3", "type": "ERC20", @@ -2016,17 +1932,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x7FF4169a6B5122b664c51c95727d87750eC07c84/logo.png", "pairs": [] }, - { - "chainId": 1, - "asset": "c60_t0x80fB784B7eD66730e8b1DBd9820aFD29931aab03", - "type": "ERC20", - "address": "0x80fB784B7eD66730e8b1DBd9820aFD29931aab03", - "name": "Aave", - "symbol": "LEND", - "decimals": 18, - "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0x80fB784B7eD66730e8b1DBd9820aFD29931aab03/logo.png", - "pairs": [] - }, { "asset": "c60_t0x8207c1FfC5B6804F6024322CcF34F29c3541Ae26", "type": "ERC20", @@ -2454,16 +2359,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0xa117000000f279D81A1D3cc75430fAA017FA5A2e/logo.png", "pairs": [] }, - { - "asset": "c60_t0xA15C7Ebe1f07CaF6bFF097D8a589fb8AC49Ae5B3", - "type": "ERC20", - "address": "0xA15C7Ebe1f07CaF6bFF097D8a589fb8AC49Ae5B3", - "name": "Pundi X (Old)", - "symbol": "NPXS", - "decimals": 18, - "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0xA15C7Ebe1f07CaF6bFF097D8a589fb8AC49Ae5B3/logo.png", - "pairs": [] - }, { "asset": "c60_t0xa1d6Df714F91DeBF4e0802A542E13067f31b8262", "type": "ERC20", @@ -2474,16 +2369,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0xa1d6Df714F91DeBF4e0802A542E13067f31b8262/logo.png", "pairs": [] }, - { - "asset": "c60_t0xa1eD0364D53394209D61aE8bfdb8Ff50484D8c91", - "type": "ERC20", - "address": "0xa1eD0364D53394209D61aE8bfdb8Ff50484D8c91", - "name": "TeraBlock Token", - "symbol": "TBC", - "decimals": 18, - "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0xa1eD0364D53394209D61aE8bfdb8Ff50484D8c91/logo.png", - "pairs": [] - }, { "asset": "c60_t0xA2b4C0Af19cC16a6CfAcCe81F192B024d625817D", "type": "ERC20", @@ -2695,16 +2580,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0xB4d930279552397bbA2ee473229f89Ec245bc365/logo.png", "pairs": [] }, - { - "asset": "c60_t0xB4EFd85c19999D84251304bDA99E90B92300Bd93", - "type": "ERC20", - "address": "0xB4EFd85c19999D84251304bDA99E90B92300Bd93", - "name": "Rocket Pool", - "symbol": "RPL", - "decimals": 18, - "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0xB4EFd85c19999D84251304bDA99E90B92300Bd93/logo.png", - "pairs": [] - }, { "asset": "c60_t0xB62132e35a6c13ee1EE0f84dC5d40bad8d815206", "type": "ERC20", @@ -3060,16 +2935,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0xd2877702675e6cEb975b4A1dFf9fb7BAF4C91ea9/logo.png", "pairs": [] }, - { - "asset": "c60_t0xD2dDa223b2617cB616c1580db421e4cFAe6a8a85", - "type": "ERC20", - "address": "0xD2dDa223b2617cB616c1580db421e4cFAe6a8a85", - "name": "Bondly", - "symbol": "BONDLY", - "decimals": 18, - "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0xD2dDa223b2617cB616c1580db421e4cFAe6a8a85/logo.png", - "pairs": [] - }, { "asset": "c60_t0xd379700999F4805Ce80aa32DB46A94dF64561108", "type": "ERC20", @@ -3162,17 +3027,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0xDcB01cc464238396E213a6fDd933E36796eAfF9f/logo.png", "pairs": [] }, - { - "chainId": 1, - "asset": "c60_t0xdd974D5C2e2928deA5F71b9825b8b646686BD200", - "type": "ERC20", - "address": "0xdd974D5C2e2928deA5F71b9825b8b646686BD200", - "name": "Kyber Network Crystal Legacy", - "symbol": "KNCL", - "decimals": 18, - "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0xdd974D5C2e2928deA5F71b9825b8b646686BD200/logo.png", - "pairs": [] - }, { "asset": "c60_t0xDDB3422497E61e13543BeA06989C0789117555c5", "type": "ERC20", @@ -3434,17 +3288,6 @@ "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0xF4d861575ecC9493420A3f5a14F85B13f0b50EB3/logo.png", "pairs": [] }, - { - "chainId": 1, - "asset": "c60_t0xF5D669627376EBd411E34b98F19C868c8ABA5ADA", - "type": "ERC20", - "address": "0xF5D669627376EBd411E34b98F19C868c8ABA5ADA", - "name": "Axie Infinity", - "symbol": "AXS", - "decimals": 18, - "logoURI": "https://assets.trustwalletapp.com/blockchains/ethereum/assets/0xF5D669627376EBd411E34b98F19C868c8ABA5ADA/logo.png", - "pairs": [] - }, { "chainId": 1, "asset": "c60_t0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c", diff --git a/go.mod b/go.mod index 490a9489b..44f68593c 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.17 require ( github.com/sirupsen/logrus v1.8.1 - github.com/trustwallet/assets-go-libs v0.0.19 + github.com/trustwallet/assets-go-libs v0.0.21 github.com/trustwallet/go-libs v0.2.21-0.20211217144209-59d4828f9793 github.com/trustwallet/go-primitives v0.0.19 ) diff --git a/go.sum b/go.sum index e70864983..13ce8fe86 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,12 @@ 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.19 h1:Zn7su7wSrJLOHSeEoM+jz8smmIFsX+tAGI3FQ7rwwqQ= github.com/trustwallet/assets-go-libs v0.0.19/go.mod h1:/il5tQtqP3uSDbyDTfP1OsL3kSIg+v6+QBRz3okXZpc= +github.com/trustwallet/assets-go-libs v0.0.20 h1:gsBbhXd8OMRjEWD/5UAY+h6itKlui6c3tv+8GYO7QwI= +github.com/trustwallet/assets-go-libs v0.0.20/go.mod h1:/il5tQtqP3uSDbyDTfP1OsL3kSIg+v6+QBRz3okXZpc= +github.com/trustwallet/assets-go-libs v0.0.21-0.20220108160642-caef06257f15 h1:Sl2w9DqZebjbUVXqfVVrpi85gy8lMao7rIqNkMOjCOE= +github.com/trustwallet/assets-go-libs v0.0.21-0.20220108160642-caef06257f15/go.mod h1:/il5tQtqP3uSDbyDTfP1OsL3kSIg+v6+QBRz3okXZpc= +github.com/trustwallet/assets-go-libs v0.0.21 h1:gJBPyjCNsbyKMUcayQCVT9+IU6//jQzTbq3lkUvTgho= +github.com/trustwallet/assets-go-libs v0.0.21/go.mod h1:/il5tQtqP3uSDbyDTfP1OsL3kSIg+v6+QBRz3okXZpc= github.com/trustwallet/go-libs v0.2.21-0.20211217144209-59d4828f9793 h1:KFtyLpBPbMyUdeCth/Zcej/SSgAFIo6fxdS2eEPEg3I= github.com/trustwallet/go-libs v0.2.21-0.20211217144209-59d4828f9793/go.mod h1:7QdAp1lcteKKI0DYqGoaO8KO4eTNYjGmg8vHy0YXkKc= github.com/trustwallet/go-primitives v0.0.19 h1:IvuzU1tB5u+UpjPkJqPqVvb8axLj1LI5nQmTvhmNIck= diff --git a/internal/processor/fixers.go b/internal/processor/fixers.go index 95075e018..565403cd4 100644 --- a/internal/processor/fixers.go +++ b/internal/processor/fixers.go @@ -118,10 +118,10 @@ func (s *Service) FixChainInfoJSON(f *file.AssetFile) error { return nil } -func (s *Service) FixAssetInfoJSON(file *file.AssetFile) error { +func (s *Service) FixAssetInfo(f *file.AssetFile) error { assetInfo := info.AssetModel{} - err := fileLib.ReadJSONFile(file.Path(), &assetInfo) + err := fileLib.ReadJSONFile(f.Path(), &assetInfo) if err != nil { return err } @@ -137,24 +137,24 @@ func (s *Service) FixAssetInfoJSON(file *file.AssetFile) error { // We need to skip error check to fix asset type if it's incorrect or empty. chain, _ := types.GetChainFromAssetType(assetType) - expectedTokenType, ok := types.GetTokenType(file.Chain().ID, file.Asset()) + expectedTokenType, ok := types.GetTokenType(f.Chain().ID, f.Asset()) if !ok { expectedTokenType = strings.ToUpper(assetType) } - if chain.ID != file.Chain().ID || !strings.EqualFold(assetType, expectedTokenType) { + if chain.ID != f.Chain().ID || !strings.EqualFold(assetType, expectedTokenType) { assetInfo.Type = &expectedTokenType isModified = true } // Fix asset id. - assetID := file.Asset() + assetID := f.Asset() if assetInfo.ID == nil || *assetInfo.ID != assetID { assetInfo.ID = &assetID isModified = true } - expectedExplorerURL, err := coin.GetCoinExploreURL(file.Chain(), file.Asset()) + expectedExplorerURL, err := coin.GetCoinExploreURL(f.Chain(), f.Asset()) if err != nil { return err } @@ -166,7 +166,7 @@ func (s *Service) FixAssetInfoJSON(file *file.AssetFile) error { } if isModified { - return fileLib.CreateJSONFile(file.Path(), &assetInfo) + return fileLib.CreateJSONFile(f.Path(), &assetInfo) } return nil diff --git a/internal/processor/service.go b/internal/processor/service.go index 151ba882d..e5443571e 100644 --- a/internal/processor/service.go +++ b/internal/processor/service.go @@ -53,7 +53,7 @@ func (s *Service) GetValidator(f *file.AssetFile) []Validator { case file.TypeTokenListFile: return []Validator{ jsonValidator, - {Name: "Token list (if assets from list present in chain)", Run: s.ValidateTokenListFile}, + {Name: "Token list", Run: s.ValidateTokenListFile}, } case file.TypeChainInfoFolder: return []Validator{ @@ -83,7 +83,7 @@ func (s *Service) GetFixers(f *file.AssetFile) []Fixer { case file.TypeAssetInfoFile: return []Fixer{ jsonFixer, - {Name: "Fixing asset info.json files", Run: s.FixAssetInfoJSON}, + {Name: "Fixing asset info.json files", Run: s.FixAssetInfo}, } case file.TypeValidatorsListFile: return []Fixer{ diff --git a/internal/processor/updaters_auto.go b/internal/processor/updaters_auto.go index 1c1671981..b6edca16d 100644 --- a/internal/processor/updaters_auto.go +++ b/internal/processor/updaters_auto.go @@ -1,7 +1,10 @@ package processor import ( + "bytes" + "encoding/json" "fmt" + "os" "reflect" "sort" "strconv" @@ -30,6 +33,8 @@ const ( twLogoURL = "https://trustwallet.com/assets/images/favicon.png" timestampFormat = "2006-01-02T15:04:05.000000" + + activeStatus = "active" ) func (s *Service) UpdateBinanceTokens() error { @@ -67,6 +72,8 @@ func (s *Service) UpdateBinanceTokens() error { return err } + sortTokens(tokens) + return createTokenListJSON(chain, tokens) } @@ -111,7 +118,7 @@ func createInfoJSON(chain coin.Coin, a explorer.Bep2Asset) error { assetType := string(types.BEP2) website := "" description := "-" - status := "active" + status := activeStatus assetInfo := info.AssetModel{ Name: &a.Name, @@ -139,8 +146,6 @@ func createTokenListJSON(chain coin.Coin, tokens []TokenItem) error { return nil } - sortTokens(tokens) - if reflect.DeepEqual(oldTokenList.Tokens, tokens) { return nil } @@ -204,13 +209,17 @@ func generateTokenList(marketPairs []binance.MarketPair, tokenList binance.Token } for _, marketPair := range marketPairs { - key := marketPair.QuoteAssetSymbol + if !isTokenExistOrActive(marketPair.BaseAssetSymbol) || !isTokenExistOrActive(marketPair.QuoteAssetSymbol) { + continue + } - if val, exists := pairsMap[key]; exists { + tokenSymbol := marketPair.QuoteAssetSymbol + + if val, exists := pairsMap[tokenSymbol]; exists { val = append(val, getPair(marketPair)) - pairsMap[key] = val + pairsMap[tokenSymbol] = val } else { - pairsMap[key] = []Pair{getPair(marketPair)} + pairsMap[tokenSymbol] = []Pair{getPair(marketPair)} } pairsList[marketPair.BaseAssetSymbol] = struct{}{} @@ -243,6 +252,42 @@ func generateTokenList(marketPairs []binance.MarketPair, tokenList binance.Token return tokenItems, nil } +func isTokenExistOrActive(symbol string) bool { + if symbol == coin.Coins[coin.BINANCE].Symbol { + return true + } + + assetPath := path.GetAssetInfoPath(coin.Coins[coin.BINANCE].Handle, symbol) + + infoFile, err := os.Open(assetPath) + if err != nil { + log.Debugf("asset file open error: %s", err.Error()) + return false + } + + buf := bytes.NewBuffer(nil) + if _, err = buf.ReadFrom(infoFile); err != nil { + log.Debugf("buffer read error: %s", err.Error()) + return false + } + + infoFile.Close() + + var infoAsset info.AssetModel + err = json.Unmarshal(buf.Bytes(), &infoAsset) + if err != nil { + log.Debugf("json unmarshalling error: %s", err.Error()) + return false + } + + if infoAsset.GetStatus() != activeStatus { + log.Debugf("asset status [%s] is not active", symbol) + return false + } + + return true +} + func getPair(marketPair binance.MarketPair) Pair { return Pair{ Base: getAssetIDSymbol(marketPair.BaseAssetSymbol, coin.Coins[coin.BINANCE].Symbol, coin.BINANCE), diff --git a/internal/processor/updaters_manual.go b/internal/processor/updaters_manual.go index 69fef8d86..410c0bf2c 100644 --- a/internal/processor/updaters_manual.go +++ b/internal/processor/updaters_manual.go @@ -429,6 +429,8 @@ func rebuildTokenList(chain coin.Coin, pairs [][]TokenItem, forceExcludeList []s log.Debugf("Tokenlist updated: %d tokens", len(list.Tokens)) + sortTokens(list.Tokens) + return createTokenListJSON(chain, list.Tokens) } diff --git a/internal/processor/validators.go b/internal/processor/validators.go index da4b8489f..b36ec06bd 100644 --- a/internal/processor/validators.go +++ b/internal/processor/validators.go @@ -407,6 +407,10 @@ func (s *Service) ValidateTokenListFile(f *file.AssetFile) error { compErr.Append(fmt.Errorf("field name - '%s' differs from '%s' in %s", token.Name, *infoAsset.Name, assetPath)) } + + if infoAsset.GetStatus() != activeStatus { + compErr.Append(fmt.Errorf("token '%s' is not active, remove it from %s", token.Address, f.Path())) + } } if compErr.Len() > 0 {