Skip to content

Commit 516f454

Browse files
committed
fix: get account data
1 parent 7ad9834 commit 516f454

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

ds/dc_wrapper/wrapper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ func (dcw *DataCompressorWrapper) Retry(blockNum int64, account common.Address,
301301
newaccountData = accountData
302302
log.Info(utils.ToJson(newaccountData))
303303
if !accountData.Success {
304-
log.Warn("after retry, getCreditAccoutn data is still not successful", blockNum, account)
305-
return dc.CreditAccountCallData{}, err
304+
log.Warn("Not success v3", blockNum, account)
305+
// return dc.CreditAccountCallData{}, err
306306
}
307307
}
308308
return dc.GetAccountDataFromDCCall(dcw.client, core.NULL_ADDR, blockNum, newaccountData)

models/credit_manager/cm_common/credit_session_state.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ func (mdl *CommonCMAdapter) liqv3SessionCallAndResultFn(liquidatedAt int64, sess
105105
if err == nil && !dcAccountData.IsSuccessful && mdl.GetVersion() == core.NewVersion(300) {
106106
dcAccountData, err = mdl.retry(dcAccountData, liquidatedAt-1)
107107
}
108-
log.Info(utils.ToJson(dcAccountData))
108+
if err == nil && !dcAccountData.IsSuccessful && dcAccountData.HealthFactor.Convert().Cmp(new(big.Int)) == 0 {
109+
dcAccountData.HealthFactor = (*core.BigInt)(big.NewInt(65535))
110+
111+
}
109112
if err != nil {
110113
log.Fatalf("For blockNum %d Account:%s %v. txHash: %s", liquidatedAt, session.Account, err, liqv3Details.TxHash)
111114
}

models/credit_manager/cm_common/retry_redstone_get_account.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package cm_common
22

33
import (
4+
"math/big"
5+
46
"github.com/Gearbox-protocol/sdk-go/core"
57
"github.com/Gearbox-protocol/sdk-go/log"
68
"github.com/Gearbox-protocol/sdk-go/pkg/dc"
@@ -38,6 +40,7 @@ func (mdl *CommonCMAdapter) priceFeedNeeded(balances core.DBBalanceFormat) (ans
3840
func (mdl *CommonCMAdapter) retry(oldaccount dc.CreditAccountCallData, blockNum int64) (dc.CreditAccountCallData, error) {
3941
ts := mdl.Repo.SetAndGetBlock(blockNum).Timestamp
4042
bal := moreThan1Balance(oldaccount.Balances)
43+
bal[mdl.GetUnderlyingToken()] = core.DBTokenBalance{BI: (*core.BigInt)(big.NewInt(1))}
4144
redPFs := mdl.priceFeedNeeded(bal)
4245
v3Pods := mdl.Repo.GetRedStonemgr().GetPodSign(int64(ts), redPFs)
4346
v3PodsCalls := redstone.GetpodToCalls(300, common.HexToAddress(mdl.GetCreditFacadeAddr()), v3Pods, redPFs)

repository/handlers/blocks.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ func (repo *BlocksRepo) Save(tx *gorm.DB) {
6868
x[pf.Feed] = true
6969
}
7070
blocksToSync = append(blocksToSync, block)
71-
if len(block.PriceFeeds) != 0 {
72-
log.Info("Price feeds", utils.ToJson(block.PriceFeeds))
73-
}
7471
}
7572
// clauses not needed here
7673
err := tx.Clauses(clause.OnConflict{

0 commit comments

Comments
 (0)