Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentysc committed Nov 29, 2024
1 parent 7b4920d commit 3411d0d
Show file tree
Hide file tree
Showing 41 changed files with 953 additions and 946 deletions.
6 changes: 3 additions & 3 deletions external/tmcosmosutils/cosmoscoin.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func NewCoinFromAmountInterface(amount map[string]interface{}) (coin.Coin, error
return coin.Coin{}, err
}

return result, nil
return *result, nil
}

// MustNewCoinsFromAmountInterface returns Coins from the list of amount in the
Expand Down Expand Up @@ -58,8 +58,8 @@ func NewCoinsFromAmountInterface(amounts []interface{}) (coin.Coins, error) {
return nil, err
}

coins = coins.Add(coinUnit)
*coins = coins.Add(coinUnit)
}

return coins, nil
return *coins, nil
}
14 changes: 7 additions & 7 deletions infrastructure/cosmosapp/httpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func (client *HTTPClient) Balances(accountAddress string) (coin.Coins, error) {
if coinErr != nil {
return nil, coinErr
}
balances = balances.Add(balance)
balances = balances.Add(*balance)
}

if resp.Pagination.MaybeNextKey == nil {
Expand Down Expand Up @@ -252,7 +252,7 @@ func (client *HTTPClient) BalanceByDenom(accountAddress string, denom string) (c
return coin.Coin{}, coinErr
}

return balance, nil
return *balance, nil
}

func (client *HTTPClient) BondedBalance(accountAddress string) (coin.Coins, error) {
Expand Down Expand Up @@ -296,7 +296,7 @@ func (client *HTTPClient) BondedBalance(accountAddress string) (coin.Coins, erro
if coinErr != nil {
return nil, fmt.Errorf("error parsing Coin from delegation balance: %v", coinErr)
}
balance = balance.Add(delegatedCoin)
balance = balance.Add(*delegatedCoin)
}

if resp.MaybePagination.MaybeNextKey == nil {
Expand Down Expand Up @@ -341,7 +341,7 @@ func (client *HTTPClient) RedelegatingBalance(accountAddress string) (coin.Coins
if coinErr != nil {
return nil, fmt.Errorf("error parsing Coin from unbonding balance: %v", coinErr)
}
balance = balance.Add(unbondingCoin)
balance = balance.Add(*unbondingCoin)
}
}

Expand Down Expand Up @@ -388,7 +388,7 @@ func (client *HTTPClient) UnbondingBalance(accountAddress string) (coin.Coins, e
if coinErr != nil {
return nil, fmt.Errorf("error parsing Coin from unbonding balance: %v", coinErr)
}
balance = balance.Add(unbondingCoin)
balance = balance.Add(*unbondingCoin)
}
}

Expand Down Expand Up @@ -422,7 +422,7 @@ func (client *HTTPClient) SupplyByDenom(denom string) (coin.Coin, error) {
return coin.Coin{}, coinErr
}

return supply, nil
return *supply, nil
}

func (client *HTTPClient) TotalRewards(accountAddress string) (coin.DecCoins, error) {
Expand Down Expand Up @@ -609,7 +609,7 @@ func (client *HTTPClient) TotalBondedBalance() (coin.Coin, error) {
return coin.Coin{}, fmt.Errorf("error when creating new coin: %v", newCoinErr)
}

return totalBondedBalance, nil
return *totalBondedBalance, nil
}

func (client *HTTPClient) CommunityTax() (*big.Float, error) {
Expand Down
4 changes: 3 additions & 1 deletion infrastructure/httpapi/handlers/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ func (handler *StatusHandler) GetStatus(ctx *fasthttp.RequestCtx) {
httpapi.InternalServerError(ctx)
return
}
handler.totalDelegated, err = coin.NewCoins(totalBondedBalance)
var coins *coin.Coins
coins, err = coin.NewCoins(totalBondedBalance)
handler.totalDelegated = *coins
if err != nil {
handler.logger.Errorf("error parsing total bonded balance: %v", err)
httpapi.InternalServerError(ctx)
Expand Down
8 changes: 4 additions & 4 deletions projection/account/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func TestAccount_HandleEvents(t *testing.T) {
coin.Coins{
coin.Coin{
Denom: "Denom",
Amount: coin.NewInt(100),
Amount: *coin.NewInt(100),
},
},
nil,
Expand All @@ -145,7 +145,7 @@ func TestAccount_HandleEvents(t *testing.T) {
Balance: coin.Coins{
{
Denom: "Denom",
Amount: coin.NewInt(100),
Amount: *coin.NewInt(100),
},
},
},
Expand Down Expand Up @@ -194,7 +194,7 @@ func TestAccount_HandleEvents(t *testing.T) {
coin.Coins{
coin.Coin{
Denom: "Denom",
Amount: coin.NewInt(1000),
Amount: *coin.NewInt(1000),
},
},
nil,
Expand All @@ -212,7 +212,7 @@ func TestAccount_HandleEvents(t *testing.T) {
Balance: coin.Coins{
{
Denom: "Denom",
Amount: coin.NewInt(1000),
Amount: *coin.NewInt(1000),
},
},
},
Expand Down
Loading

0 comments on commit 3411d0d

Please sign in to comment.