Skip to content

Commit d2b2796

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

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

ds/dc_wrapper/wrapper.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,9 @@ func (dcw *DataCompressorWrapper) Retry(blockNum int64, account common.Address,
300300
accountData := *abi.ConvertType(out[0], new(creditAccountCompressor.CreditAccountData)).(*creditAccountCompressor.CreditAccountData)
301301
newaccountData = accountData
302302
log.Info(utils.ToJson(newaccountData))
303-
if !accountData.Success {
304-
log.Warn("after retry, getCreditAccoutn data is still not successful", blockNum, account)
305-
return dc.CreditAccountCallData{}, err
303+
if accountData.Success {
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)

0 commit comments

Comments
 (0)