Skip to content

Commit

Permalink
Update code to show only authorized accounts and balances in ticker s…
Browse files Browse the repository at this point in the history
…ervice
  • Loading branch information
karthikiyer56 committed Oct 1, 2024
1 parent 6f06c58 commit e5edf19
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions services/ticker/internal/scraper/asset_scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,28 +144,14 @@ func isDomainVerified(orgURL string, tomlURL string, hasCurrency bool) bool {
}
return true
}
func AddStringsToSum(values ...string) (float64, error) {
var sum float64
for _, s := range values {
if s == "" {
continue // Treat empty string as zero
}
value, err := strconv.ParseFloat(s, 64)
if err != nil {
return 0, fmt.Errorf("failed to convert '%s': %w", s, err)
}
sum += value
}
return sum, nil
}

// makeTomlAsset aggregates Horizon Data with TOML Data
func makeFinalAsset(
asset hProtocol.AssetStat,
issuer TOMLIssuer,
errors []error,
) (t FinalAsset, err error) {
amount, err := AddStringsToSum(asset.Balances.Authorized + asset.Balances.Unauthorized + asset.Balances.Unauthorized)
amount, err := strconv.ParseFloat(asset.Balances.Authorized, 64)
if err != nil {
return
}
Expand All @@ -174,7 +160,7 @@ func makeFinalAsset(
Type: asset.Type,
Code: asset.Code,
Issuer: asset.Issuer,
NumAccounts: asset.Accounts.Authorized + asset.Accounts.Unauthorized + asset.Accounts.AuthorizedToMaintainLiabilities,
NumAccounts: asset.Accounts.Authorized,
AuthRequired: asset.Flags.AuthRequired,
AuthRevocable: asset.Flags.AuthRevocable,
Amount: amount,
Expand Down

0 comments on commit e5edf19

Please sign in to comment.