@@ -3,7 +3,7 @@ package services
33import (
44 "encoding/hex"
55 "reflect"
6-
6+ "strings"
77 "github.com/Gearbox-protocol/sdk-go/artifacts/multicall"
88 "github.com/Gearbox-protocol/sdk-go/core"
99 "github.com/Gearbox-protocol/sdk-go/log"
@@ -48,6 +48,7 @@ func (ep *ExecuteParser) getMainEvents(call *trace_service.Call, creditFacade co
4848 "e3f46b26" , // liquidateCreditAccount (v3) // v310, v3
4949 "36b2ced3" , // closeCreditAccount(creditAccount,to,skipTokenMask,convertToETH,calls) // v310, v3
5050 // "5d91a0e0", // liquidateCreditAccount
51+ // "85589e10", //Partial
5152 "92beab1d" : // openCreditAccount(onBehalfOf,calls,referralCode) // v310, v3
5253 // log.Info("v3 main event", call.Input[2:10])
5354 event , err := getCreditFacadeMainEvent (call .To , call .Input , creditFacadev3Parser )
@@ -56,6 +57,8 @@ func (ep *ExecuteParser) getMainEvents(call *trace_service.Call, creditFacade co
5657 }
5758 // log.Info(utils.ToJson(event.GetMulticalls()))
5859 mainEvents = append (mainEvents , event )
60+ default :
61+ log .Warn (call .Input [2 :10 ], "1234" )
5962 }
6063 } else {
6164 for _ , c := range call .Calls {
@@ -75,8 +78,22 @@ var creditFacadev2Parser, creditFacadev3Parser *abi.ABI
7578func init () {
7679 creditFacadev2Parser = core .GetAbi ("CreditFacade" )
7780 creditFacadev3Parser = core .GetAbi ("CreditFacadev3" )
81+
82+
83+
7884}
85+ func getABI (data string ) * abi.ABI {
86+ abi , err := abi .JSON (strings .NewReader (data ))
87+ log .CheckFatal (err )
88+ return & abi
89+ }
90+
91+ var pp = "[{\" inputs\" :[{\" internalType\" :\" address\" ,\" name\" :\" creditAccount\" ,\" type\" :\" address\" },{\" internalType\" :\" address\" ,\" name\" :\" token\" ,\" type\" :\" address\" },{\" internalType\" :\" uint256\" ,\" name\" :\" repaidAmount\" ,\" type\" :\" uint256\" },{\" internalType\" :\" uint256\" ,\" name\" :\" minSeizedAmount\" ,\" type\" :\" uint256\" },{\" internalType\" :\" address\" ,\" name\" :\" to\" ,\" type\" :\" address\" },{\" components\" :[{\" internalType\" :\" address\" ,\" name\" :\" priceFeed\" ,\" type\" :\" address\" },{\" internalType\" :\" bytes\" ,\" name\" :\" data\" ,\" type\" :\" bytes\" }],\" internalType\" :\" struct PriceUpdate[]\" ,\" name\" :\" priceUpdates\" ,\" type\" :\" tuple[]\" }],\" name\" :\" partiallyLiquidateCreditAccount\" ,\" outputs\" :[{\" internalType\" :\" uint256\" ,\" name\" :\" seizedAmount\" ,\" type\" :\" uint256\" }],\" stateMutability\" :\" nonpayable\" ,\" type\" :\" function\" }]"
7992func getCreditFacadeMainEvent (contract string , input string , parser * abi.ABI ) (* ds.FacadeCallNameWithMulticall , error ) {
93+ a := input [2 :10 ] == "85589e10"
94+ if a {
95+ parser = getABI (pp )
96+ }
8097 hexData , err := hex .DecodeString (input [2 :])
8198 if err != nil {
8299 return nil , err
@@ -95,7 +112,7 @@ func getCreditFacadeMainEvent(contract string, input string, parser *abi.ABI) (*
95112 Target common.Address `json:"target"`
96113 CallData []uint8 `json:"callData"`
97114 })
98- if ! ok {
115+ if ! ok && ! a {
99116 log .Fatal ("calls type is different the creditFacade multicall: " , reflect .TypeOf (data ["calls" ]))
100117 }
101118 multicalls := []multicall.Multicall2Call {}
0 commit comments