(path1, path2 string, chain1 coin.Coin)
| 278 | } |
| 279 | |
| 280 | func validateTokenList(path1, path2 string, chain1 coin.Coin) error { |
| 281 | var tokenList1 tokenlist.Model |
| 282 | err := file.ReadJSONFile(path1, &tokenList1) |
| 283 | if err != nil { |
| 284 | return err |
| 285 | } |
| 286 | |
| 287 | if file.Exists(path2) { |
| 288 | var tokenList2 tokenlist.Model |
| 289 | err = file.ReadJSONFile(path2, &tokenList2) |
| 290 | if err != nil { |
| 291 | return err |
| 292 | } |
| 293 | |
| 294 | tokensMap := make(map[string]bool) |
| 295 | for _, token := range tokenList2.Tokens { |
| 296 | tokensMap[token.Asset] = true |
| 297 | } |
| 298 | |
| 299 | for _, token := range tokenList1.Tokens { |
| 300 | if _, exists := tokensMap[token.Asset]; exists { |
| 301 | return fmt.Errorf("duplicate asset: %s from %s, already exist in %s", |
| 302 | token.Asset, path1, path2) |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | err = tokenlist.ValidateTokenList(tokenList1, chain1, path1) |
| 308 | if err != nil { |
| 309 | return err |
| 310 | } |
| 311 | |
| 312 | return nil |
| 313 | } |
| 314 | |
| 315 | func (s *Service) ValidateInfoFolder(f *file.AssetFile) error { |
| 316 | dirFiles, err := file.ReadDir(f.Path()) |
no outgoing calls
no test coverage detected
searching dependent graphs…