Skip to content

Commit bfca6a3

Browse files
committed
fix: a
1 parent 23a3141 commit bfca6a3

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-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: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,45 @@ 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+
log.Info(liquidatingAccountCall.Name)
44+
// j := append((*mainCalls)[2:], liquidatingAccountCall) // skip the first main call which is open with partial liquidation
45+
j := append([]*ds.FacadeCallNameWithMulticall{liquidatingAccountCall}, (*mainCalls)[2:]...) // skip the first main call which is open with partial liquidation
46+
*mainCalls = j
3447
}
3548
}
3649
//
3750
var ind int
38-
for _, mainCall := range mainCalls[:utils.Min(len(facadeActions), len(mainCalls))] { // TOOD fix
51+
// for _, mainCall := range (*mainCalls)[:utils.Min(len(facadeActions), len(mainCalls))] { // TOOD fix
52+
// log.Fatal(len(*mainCalls))
53+
for _, mainCall := range *mainCalls { // TOOD fix
3954
if len(facadeActions) <= ind {
4055
log.Error(ind, len(facadeActions), mainCall.Name, utils.ToJson(facadeActions[0].Data))
4156
return
4257
}
4358
action := facadeActions[ind]
59+
log.Info("event", action.LenofMulticalls(), action.Type, "call", mainCall.LenOfMulticalls(), mainCall.Name)
4460
switch mainCall.Name {
4561
case ds.FacadeOpenMulticallCall:
4662
if !action.IsOpen() {
@@ -79,13 +95,15 @@ func (mdl *CommonCMAdapter) validateAndSaveFacadeActions(version core.VersionTyp
7995
facadeActions []*mpi.FacadeAccountAction,
8096
mainCalls []*ds.FacadeCallNameWithMulticall,
8197
nonMultiCallExecuteEvents []ds.ExecuteParams) {
98+
log.Info("here")
8299
executeParams := []ds.ExecuteParams{} // non multicall and multicall execute orders for a tx to be compared with call trace
83100
for ind, _mainAction := range facadeActions {
84101
mainEvent := _mainAction.Data
85102

86103
mainCall := mainCalls[ind]
87104
//
88105
mainEventFromCall := mdl.getEventNameFromCall(version, mainCall.Name, mainEvent.SessionId)
106+
log.Info(utils.ToJson(mainCall.GetMulticalls()), "event", utils.ToJson(_mainAction.GetMulticallsFromEvent()))
89107

90108
if mainEventFromCall != mainEvent.Action { // if the mainaction name is different for events(parsed with eth rpc) and calls (received from tenderly)
91109
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)