Skip to content

Commit

Permalink
fix: vault ICY balance
Browse files Browse the repository at this point in the history
  • Loading branch information
anhnh12 committed Aug 23, 2024
1 parent 7c5a315 commit f2d009b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/entities/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ func (e *Entity) listEvmWalletAssets(req request.ListWalletAssetsRequest) ([]res
assets := make([]response.WalletAssetData, 0)
for _, item := range res.Data {
chain, err := e.repo.Chain.GetByID(item.ChainId)
if item.ChainId == 8453 {
fmt.Println("base:", chain)
}
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
continue
Expand All @@ -389,6 +392,9 @@ func (e *Entity) listEvmWalletAssets(req request.ListWalletAssetsRequest) ([]res
}

for _, bal := range item.Balances {
if bal.Token.Symbol == "ICY" {
fmt.Println("bal:", bal)
}
assetBal, quote := e.calculateEvmTokenBalance(bal, item.ChainId)
// filter out dusty tokens
if quote < 0.001 && bal.TokenType != "NATIVE" {
Expand Down Expand Up @@ -1400,7 +1406,7 @@ func (e *Entity) calculateEvmTokenBalance(item krystal.Balance, chainID int) (ba
}
parsedBal, _ := balance.Float64()
bal = parsedBal / math.Pow10(item.Token.Decimals)
if strings.EqualFold(item.Token.Symbol, "icy") && chainID == 137 {
if strings.EqualFold(item.Token.Symbol, "icy") && chainID == 8453 {
quote = 1.5 * bal
} else {
quote = item.Quotes.Usd.Value
Expand Down

0 comments on commit f2d009b

Please sign in to comment.