Skip to content

Commit 497c448

Browse files
committed
fix(bot): ensure balance check includes 'balance_on_chain' bot
The 'balance_on_chain' bot is now explicitly activated for tokens without a configured bot, enforcing a default behavior for balance checks. This update addresses an issue where tokens on specific chains were not being processed due to the absence of a defined bot. Additionally, the balance check logic has been enhanced to iterate over a list of configured bots, incorporating support for multiple bot types per token-chain combination.
1 parent 0b372ad commit 497c448

File tree

35 files changed

+1065
-428
lines changed

35 files changed

+1065
-428
lines changed

cmd/commands.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ var (
4141
for chainName, chainItems := range result {
4242
for tokenName, TokenItems := range chainItems {
4343
for address, balance := range TokenItems {
44-
if balance.LessThan(decimal.RequireFromString("0")) {
45-
w.AppendRow(table.Row{chainName, tokenName, address, "not found in config"})
44+
if balance.LessThanOrEqual(decimal.RequireFromString("0")) {
45+
// w.AppendRow(table.Row{chainName, tokenName, address, "not found in config"})
4646
continue
4747
}
4848
w.AppendRow(table.Row{chainName, tokenName, address, balance})

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ require (
1616
github.com/ilyakaznacheev/cleanenv v1.5.0
1717
github.com/jedib0t/go-pretty/v6 v6.5.9
1818
github.com/jinzhu/copier v0.4.0
19-
github.com/labstack/gommon v0.3.1
2019
github.com/patrickmn/go-cache v2.1.0+incompatible
2120
github.com/pkg/errors v0.9.1
2221
github.com/satori/go.uuid v1.2.0
2322
github.com/schollz/progressbar/v3 v3.14.6
2423
github.com/shopspring/decimal v1.4.0
2524
github.com/spf13/cast v1.6.0
2625
github.com/stretchr/testify v1.9.0
26+
github.com/tidwall/gjson v1.17.3
2727
github.com/uniswapv3-go/uniswapv3-universal-router-decoder-go v0.3.0
2828
github.com/urfave/cli/v2 v2.27.2
2929
github.com/zwgblue/yaml-encoder v0.0.0-20221226083717-a0bdbda0d998
@@ -126,11 +126,11 @@ require (
126126
github.com/stretchr/objx v0.5.2 // indirect
127127
github.com/supranational/blst v0.3.11 // indirect
128128
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
129+
github.com/tidwall/match v1.1.1 // indirect
130+
github.com/tidwall/pretty v1.2.1 // indirect
129131
github.com/tklauser/go-sysconf v0.3.13 // indirect
130132
github.com/tklauser/numcpus v0.7.0 // indirect
131133
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
132-
github.com/valyala/bytebufferpool v1.0.0 // indirect
133-
github.com/valyala/fasttemplate v1.2.1 // indirect
134134
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
135135
github.com/yusufpapurcu/wmi v1.2.4 // indirect
136136
go.mongodb.org/mongo-driver v1.14.0 // indirect

go.sum

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,12 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
209209
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
210210
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
211211
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
212-
github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o=
213-
github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
214212
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
215213
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
216214
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
217215
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
218-
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
219216
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
220217
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
221-
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
222218
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
223219
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
224220
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
@@ -315,6 +311,13 @@ github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbe
315311
github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
316312
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs=
317313
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48=
314+
github.com/tidwall/gjson v1.17.3 h1:bwWLZU7icoKRG+C+0PNwIKC6FCJO/Q3p2pZvuP0jN94=
315+
github.com/tidwall/gjson v1.17.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
316+
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
317+
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
318+
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
319+
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
320+
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
318321
github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4=
319322
github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0=
320323
github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4=
@@ -325,10 +328,6 @@ github.com/uniswapv3-go/uniswapv3-universal-router-decoder-go v0.3.0 h1:6cA2BelN
325328
github.com/uniswapv3-go/uniswapv3-universal-router-decoder-go v0.3.0/go.mod h1:gIRL4wwG3WyKQbcp3v44N9INbNulPZFq1fGpbLOc4v4=
326329
github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI=
327330
github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM=
328-
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
329-
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
330-
github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4=
331-
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
332331
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw=
333332
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913/go.mod h1:4aEEwZQutDLsQv2Deui4iYQ6DWTxR14g6m8Wv88+Xqk=
334333
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -396,9 +395,6 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
396395
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
397396
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
398397
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
399-
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
400-
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
401-
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
402398
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
403399
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
404400
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -457,7 +453,6 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
457453
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
458454
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
459455
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
460-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
461456
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
462457
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
463458
gorm.io/datatypes v1.2.1 h1:r+g0bk4LPCW2v4+Ls7aeNgGme7JYdNDQ2VtvlNUfBh0=

internal/daemons/bot/bot.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@ func Run(ctx context.Context, conf configs.Config) error {
4848
continue
4949
}
5050
var botTypes = conf.ListBotNames(wallet.Address, chainName, token.Name)
51-
5251
if len(botTypes) == 0 {
5352
botTypes = append(botTypes, "balance_on_chain")
5453
}
55-
54+
log.Debugf("wallet %s token %s on chain %s has %+v bots to execute", wallet.Address, token.Name, chainName, botTypes)
5655
for _, botType := range botTypes {
5756
w.Add(1)
5857
go func(f func() ([]bot.Task, bot.ProcessType, error), botType string) {

internal/daemons/market/market.go

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ import (
1919
log "omni-balance/utils/logging"
2020

2121
"github.com/ethereum/go-ethereum/common"
22+
"github.com/jinzhu/copier"
2223
"github.com/pkg/errors"
24+
"github.com/shopspring/decimal"
2325
"go.uber.org/zap/zapcore"
2426
)
2527

@@ -232,6 +234,7 @@ func processOrder(ctx context.Context, order models.Order, conf configs.Config)
232234
if err != nil {
233235
return errors.Wrap(err, "generate order by wallet mode error")
234236
}
237+
235238
providerObj, err := getBestProvider(ctx, order, conf)
236239
if err != nil {
237240
return errors.Wrap(err, "get provider error")
@@ -243,6 +246,7 @@ func processOrder(ctx context.Context, order models.Order, conf configs.Config)
243246

244247
log.Infof("start rebalance %s on %s use %s provider", order.TokenOutName, order.TargetChainName, providerObj.Name())
245248
args.SourceChainNames = order.TokenInChainNames
249+
args.SourceToken = order.TokenInName
246250
result, providerErr := providerObj.Swap(ctx, args)
247251
if errors.Is(providerErr, context.Canceled) {
248252
return nil
@@ -277,7 +281,8 @@ func generateOrderByWalletMode(ctx context.Context, order models.Order, conf con
277281
if order.TokenInName != "" {
278282
return order, nil
279283
}
280-
if conf.GetWalletConfig(order.Wallet).Mode != "balance" {
284+
if conf.GetWalletConfig(order.Wallet).Mode != "balance" ||
285+
(order.TokenInName != "" && order.SourceChainName != "") {
281286
return order, nil
282287
}
283288
token := conf.GetWalletTokenInfo(order.Wallet, order.TokenOutName)
@@ -288,19 +293,39 @@ func generateOrderByWalletMode(ctx context.Context, order models.Order, conf con
288293
if err != nil {
289294
return order, errors.Wrap(err, "new evm client error")
290295
}
291-
tokenInfo := conf.GetTokenInfoOnChain(token.Name, v)
292-
balance, err := chains.GetTokenBalance(ctx, client, tokenInfo.ContractAddress, order.Wallet, tokenInfo.Decimals)
293-
if err != nil {
294-
return order, errors.Wrap(err, "get token balance error")
296+
bots := conf.ListBotNames(order.Wallet, v, token.Name)
297+
if len(bots) == 0 {
298+
bots = append(bots, "balance_on_chain")
299+
}
300+
var total = decimal.Zero
301+
for _, botType := range bots {
302+
balance, err := bot.GetBot(botType).Balance(ctx, bot.Params{
303+
Conf: conf,
304+
Info: bot.Config{
305+
Wallet: conf.GetWallet(order.Wallet),
306+
TokenName: token.Name,
307+
Chain: v,
308+
},
309+
Client: client,
310+
})
311+
if err != nil {
312+
return order, errors.Wrap(err, "get bot balance error")
313+
}
314+
total = total.Add(balance)
295315
}
296-
if balance.Sub(order.Amount).LessThan(threshold) {
316+
if total.Sub(order.Amount).LessThan(threshold) {
297317
continue
298318
}
319+
log.Debugf("wallet %s token %s on chain %s balance is %s, amount is %s, balance - amount >= threshold, can rebalance from this chain", order.Wallet, token.Name, v, total, order.Amount)
299320
sourceChains = append(sourceChains, v)
300321
}
301322
if len(sourceChains) != 0 {
302-
order.TokenInName = token.Name
303-
order.TokenInChainNames = sourceChains
323+
newOrder := new(models.Order)
324+
_ = copier.Copy(newOrder, order)
325+
newOrder.TokenInName = token.Name
326+
newOrder.TokenInChainNames = sourceChains
327+
order = *newOrder
328+
log.Debugf("order mode is 'balance', use %s on %+v as token in, token out is %s on %s", order.TokenInName, order.TokenInChainNames, order.TokenOutName, order.TargetChainName)
304329
}
305330
return order, nil
306331
}

internal/daemons/market/util.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func createUpdateLog(ctx context.Context, order models.Order, result provider.Sw
4848
updateOrder.Status = provider.TxStatus(models.OrderStatusWaitTransferFromOperator)
4949
}
5050
if result.Error != "" {
51-
log.Errorf("#%d wallet %s rebalance %s on %s %s token failed, error info %s", order.ID, wallet.GetAddress(true).Hex(), order.TargetChainName, order.TokenOutName, order.TokenInName, result.Error)
51+
log.Errorf("#%d wallet %s rebalance %s on %s %s token failed, error: %s", order.ID, order.Wallet, order.TokenOutName, order.TargetChainName, order.TokenInName, result.Error)
5252
}
5353

5454
return db.DB().Model(&models.Order{}).Where("id = ?", order.ID).Limit(1).Updates(updateOrder).Error
@@ -175,9 +175,10 @@ func providerSupportsOrder(ctx context.Context, p provider.Provider, order model
175175
SourceChainNames: order.TokenInChainNames,
176176
})
177177
if err != nil {
178-
log.Debugf("check token %s on %s use %s error: %s", order.TokenOutName, order.TargetChainName, p.Name(), err.Error())
178+
log.Debugf("token %s on %s cannot use %s provider, source chain is '%s', source token is '%s'", order.TokenOutName, order.TargetChainName, p.Name(), order.SourceChainName, order.TokenInName)
179179
return nil, false
180180
}
181+
log.Debugf("check token %s on %s use %s success, the tokenInCosts is %+v", order.TokenOutName, order.TargetChainName, p.Name(), tokenInCosts)
181182
return tokenInCosts, true
182183
}
183184

internal/daemons/token_price/token_price.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import (
77
"omni-balance/internal/models"
88
"omni-balance/utils"
99
"omni-balance/utils/configs"
10+
log "omni-balance/utils/logging"
1011
"omni-balance/utils/token_price"
1112
"sync"
1213
"time"
1314

14-
"github.com/labstack/gommon/log"
1515
"github.com/shopspring/decimal"
1616
)
1717

@@ -39,6 +39,7 @@ func Run(ctx context.Context, conf configs.Config) error {
3939
defer w.Done()
4040
result, err := provider.GetTokenPriceInUSDT(ctx, conf.SourceTokens...)
4141
if err != nil {
42+
4243
log.Warnf("%s get token price error: %s", provider.Name(), err)
4344
return
4445
}

internal/daemons/utils.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ func FindAllChainBalance(_ context.Context, confPath string, needPrintProgress b
160160
log.Fatalf("get %s balance on %s error: %s", v.tokenName, chainName, err)
161161
return
162162
}
163-
log.Errorf("get %s balance on %s error: %s", v.tokenName, chainName, err)
164163
continue
165164
}
166165
errorCount = 0

utils/bot/balance_on_chain/monitor.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@ func (b BalanceOnChain) Name() string {
2323
return "balance_on_chain"
2424
}
2525

26+
func (b BalanceOnChain) Balance(ctx context.Context, args bot.Params) (decimal.Decimal, error) {
27+
token := args.Conf.GetTokenInfoOnChain(args.Info.TokenName, args.Info.Chain)
28+
return args.Info.Wallet.GetExternalBalance(ctx, common.HexToAddress(token.ContractAddress), token.Decimals, args.Client)
29+
}
30+
2631
func (b BalanceOnChain) Check(ctx context.Context, args bot.Params) ([]bot.Task, bot.ProcessType, error) {
2732
var (
2833
config = args.Conf
2934
info = args.Info
3035
tasks []bot.Task
3136
)
32-
token := config.GetTokenInfoOnChain(info.TokenName, args.Info.Chain)
33-
balance, err := info.Wallet.GetExternalBalance(ctx, common.HexToAddress(token.ContractAddress), token.Decimals, args.Client)
37+
balance, err := b.Balance(ctx, args)
3438
if err != nil {
3539
return nil, "", errors.Wrap(err, "get balance error")
3640
}

utils/bot/bot.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package bot
22

33
import (
44
"context"
5-
"github.com/ethereum/go-ethereum/ethclient/simulated"
6-
"github.com/shopspring/decimal"
75
"omni-balance/utils/configs"
86
"omni-balance/utils/provider"
97
"omni-balance/utils/wallets"
8+
9+
"github.com/ethereum/go-ethereum/ethclient/simulated"
10+
"github.com/shopspring/decimal"
1011
)
1112

1213
type ProcessType string
@@ -28,6 +29,7 @@ type Params struct {
2829

2930
type Bot interface {
3031
Check(ctx context.Context, args Params) ([]Task, ProcessType, error)
32+
Balance(ctx context.Context, args Params) (decimal.Decimal, error)
3133
Name() string
3234
}
3335

utils/bot/gate_liquidity/gate_liquidity.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"omni-balance/utils/bot/balance_on_chain"
77
"omni-balance/utils/configs"
88

9+
"github.com/shopspring/decimal"
910
"github.com/spf13/cast"
1011
)
1112

@@ -21,6 +22,10 @@ func (g GateLiquidity) Name() string {
2122
return "gate_liquidity"
2223
}
2324

25+
func (b GateLiquidity) Balance(ctx context.Context, args bot.Params) (decimal.Decimal, error) {
26+
return balance_on_chain.BalanceOnChain{}.Balance(ctx, args)
27+
}
28+
2429
func (b GateLiquidity) Check(ctx context.Context, args bot.Params) ([]bot.Task, bot.ProcessType, error) {
2530
if b.Bot == nil {
2631
b.Bot = balance_on_chain.BalanceOnChain{}

0 commit comments

Comments
 (0)