Skip to content

Commit 101ceb1

Browse files
committed
fix: a
1 parent 23a3141 commit 101ceb1

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

ds/dc_wrapper/wrapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ func (dcw *DataCompressorWrapper) GetZapperInfo(blockNum int64, poolAddrs ...com
600600
case DCV310:
601601
data, err := dcw.getZapperInfov3(blockNum, poolAddrs...)
602602
if err != nil {
603-
log.Warn(err)
603+
// log.Warn(err) // of v3.1 pools have zapper info
604604
}
605605
return data
606606
// marketConfigs := GetMarketConfigurators()

models/credit_manager/cm_common/facade_actions.go

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,44 @@ import (
1818
// multicalls and liquidate/close/openwithmulticalls are separate data points,
1919
// this function adds multicall to mainFacadeActions
2020
// if that is the correct structure of operation
21-
func (mdl *CommonCMAdapter) fixFacadeActionStructureViaTenderlyCalls(mainCalls []*ds.FacadeCallNameWithMulticall,
21+
func (mdl *CommonCMAdapter) fixFacadeActionStructureViaTenderlyCalls(mainCalls *[]*ds.FacadeCallNameWithMulticall,
2222
facadeActions []*mpi.FacadeAccountAction, partialLiqAccount common.Address) (result []*mpi.FacadeAccountAction) { // facadeEvents from rpc, mainCalls from tenderly
23-
if len(mainCalls) > len(facadeActions) {
23+
if len(*mainCalls) > len(facadeActions) {
2424
log.Warnf("Len of calls(%d) can't be more than separated close/liquidate and multicall(%d).",
25-
len(mainCalls), len(facadeActions),
25+
len(*mainCalls), len(facadeActions),
2626
)
27-
if len(facadeActions) == 1 && len(mainCalls) == 2 && partialLiqAccount != core.NULL_ADDR { // in the partial declaration in the open call, there is no instruction done, and there is another separate multi-call where all the instructions are done.
28-
if len(mainCalls[0].GetMulticalls()) != 0 || mainCalls[0].Name != ds.FacadeOpenMulticallCall {
27+
for _, call := range facadeActions {
28+
log.Info(utils.ToJson(call.GetMulticallsFromEvent()))
29+
30+
}
31+
mainCallLen := len(*mainCalls)
32+
// if
33+
if (len(facadeActions) == 1 && mainCallLen == 2 && partialLiqAccount != core.NULL_ADDR) || // in the partial declaration in the open call, there is no instruction done, and there is another separate multi-call where all the instructions are done.
34+
len(facadeActions) == 2 && mainCallLen == 3 && (*mainCalls)[1].Name == "FacadeBotMulticall" { // if liquidated using PartialLiquidationBotV3 such as in tx https://etherscan.io/tx/0x3df2f68621486ac4110cbcee7a94d4575ac402b6f52071cf9772877a663fd886#eventlog
35+
liquidatingAccountCall := (*mainCalls)[0]
36+
if len(liquidatingAccountCall.GetMulticalls()) != 0 || liquidatingAccountCall.Name != ds.FacadeOpenMulticallCall {
2937
log.Fatal("first main call should be open with multicall and no multicalls inside")
3038
}
31-
mainCalls[0].AddMulticall(mainCalls[1].GetMulticalls())
39+
log.Info(utils.ToJson(mainCalls), "here")
40+
liquidatingAccountCall.AddMulticall((*mainCalls)[1].GetMulticalls())
3241
log.Warnf(" with partial liquidation for account %s, combining open with multicall", partialLiqAccount.Hex())
33-
mainCalls = mainCalls[:1] // skip the first main call which is open with partial liquidation
42+
43+
j := append((*mainCalls)[2:], liquidatingAccountCall) // skip the first main call which is open with partial liquidation
44+
// j := append([]*ds.FacadeCallNameWithMulticall{liquidatingAccountCall}, (*mainCalls)[2:]...) // skip the first main call which is open with partial liquidation
45+
*mainCalls = j
3446
}
3547
}
3648
//
3749
var ind int
38-
for _, mainCall := range mainCalls[:utils.Min(len(facadeActions), len(mainCalls))] { // TOOD fix
50+
// for _, mainCall := range (*mainCalls)[:utils.Min(len(facadeActions), len(mainCalls))] { // TOOD fix
51+
// log.Fatal(len(*mainCalls))
52+
for _, mainCall := range *mainCalls { // TOOD fix
3953
if len(facadeActions) <= ind {
4054
log.Error(ind, len(facadeActions), mainCall.Name, utils.ToJson(facadeActions[0].Data))
4155
return
4256
}
4357
action := facadeActions[ind]
58+
log.Info("event", action.LenofMulticalls(), "call", mainCall.LenOfMulticalls())
4459
switch mainCall.Name {
4560
case ds.FacadeOpenMulticallCall:
4661
if !action.IsOpen() {
@@ -79,13 +94,15 @@ func (mdl *CommonCMAdapter) validateAndSaveFacadeActions(version core.VersionTyp
7994
facadeActions []*mpi.FacadeAccountAction,
8095
mainCalls []*ds.FacadeCallNameWithMulticall,
8196
nonMultiCallExecuteEvents []ds.ExecuteParams) {
97+
log.Info("here")
8298
executeParams := []ds.ExecuteParams{} // non multicall and multicall execute orders for a tx to be compared with call trace
8399
for ind, _mainAction := range facadeActions {
84100
mainEvent := _mainAction.Data
85101

86102
mainCall := mainCalls[ind]
87103
//
88104
mainEventFromCall := mdl.getEventNameFromCall(version, mainCall.Name, mainEvent.SessionId)
105+
log.Info(utils.ToJson(mainCall.GetMulticalls()), "event", utils.ToJson(_mainAction.GetMulticallsFromEvent()))
89106

90107
if mainEventFromCall != mainEvent.Action { // if the mainaction name is different for events(parsed with eth rpc) and calls (received from tenderly)
91108
msg := fmt.Sprintf("Tenderly call(%s)is different from facade event(%s)", mainCall.Name, mainEvent.Action)

models/credit_manager/cm_common/process_multicall.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (mdl CommonCMAdapter) ProcessRemainingMultiCalls(version core.VersionType,
4040
}
4141
if len(facadeActions) > 0 { // account operation will only exist if there are one or more facade actions
4242
mainCalls := mdl.Repo.GetExecuteParser().GetMainCalls(lastTxHash, mdl.GetCreditFacadeAddr())
43-
fixedFacadeActions := mdl.fixFacadeActionStructureViaTenderlyCalls(mainCalls, facadeActions, partialLiqAccount)
43+
fixedFacadeActions := mdl.fixFacadeActionStructureViaTenderlyCalls(&mainCalls, facadeActions, partialLiqAccount)
4444
mdl.validateAndSaveFacadeActions(version, lastTxHash, fixedFacadeActions, mainCalls, nonMultiCallExecuteEvents)
4545
} else if len(nonMultiCallExecuteEvents) > 0 {
4646
mdl.SaveExecuteEvents(lastTxHash, nonMultiCallExecuteEvents)

0 commit comments

Comments
 (0)