diff --git a/pkg/assets/asset.go b/pkg/assets/asset.go index efe1af084..231f63a2a 100644 --- a/pkg/assets/asset.go +++ b/pkg/assets/asset.go @@ -41,15 +41,15 @@ func NewAssetsStore(assetsJSONPath string) (*AssetsStore, error) { store := &AssetsStore{ Assets: make(map[string]Assets), } - if err := store.loadaccountsStore(assetsJSONPath); err != nil { + if err := store.loadAccountsStore(assetsJSONPath); err != nil { return nil, errors.Wrap(err, "failed to create AssetsStore") } return store, nil } -// loadaccountsStore loads the data from the assets JSON file into the AssetsStore. -func (s *AssetsStore) loadaccountsStore(assetsJSONPath string) error { +// loadAccountsStore loads the data from the assets JSON file into the AssetsStore. +func (s *AssetsStore) loadAccountsStore(assetsJSONPath string) error { // Check if the file exists, and if not, create a new one with an empty object if _, err := os.Stat(assetsJSONPath); os.IsNotExist(err) { if err := createJSONFile(assetsJSONPath); err != nil { @@ -85,11 +85,12 @@ func (s *AssetsStore) loadaccountsStore(assetsJSONPath string) error { } for _, asset := range accountData.Assets { + decimals := asset.Decimals // Copy the decimals value to avoid a pointer to a local variable assetInfo := models.AssetInfo{ Address: asset.ContractAddress, Name: asset.Name, Symbol: asset.Symbol, - Decimals: &asset.Decimals, + Decimals: &decimals, } accountAssets.ContractAssets[asset.ContractAddress] = assetInfo } diff --git a/pkg/types/address.go b/pkg/types/address.go index 9186d433c..1f1f18f8f 100644 --- a/pkg/types/address.go +++ b/pkg/types/address.go @@ -30,7 +30,7 @@ func (a *Address) validate() error { return nil } -// Custom YAML marshaller for EncryptedPrivateKey +// Custom YAML marshaller for Address func (a Address) MarshalYAML() (interface{}, error) { data, err := a.MarshalText()