Skip to content

Commit

Permalink
fix: new addCollateral call in facade 2.20
Browse files Browse the repository at this point in the history
  • Loading branch information
5lliot committed Sep 27, 2023
1 parent 55efa41 commit 08102cf
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions ds/execute_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ func (f *FacadeCallNameWithMulticall) SameMulticallLenAsEvents(events []*schemas
multiCall := f.multiCalls[callInd]
sig := hex.EncodeToString(multiCall.CallData[:4])
switch sig {
case "59781034": // add collateral
case "59781034": // add collateral,
if events[eventInd].Action != "AddCollateral(address,address,uint256)" {
return false
}
eventInd++
callInd++
case "6d75b9ee": // add collateral extended 2.2
if events[eventInd].Action != "AddCollateral(address,address,uint256)" {
return false
}
Expand Down Expand Up @@ -100,7 +106,7 @@ func (f *FacadeCallNameWithMulticall) SameMulticallLenAsEvents(events []*schemas
}
eventInd++
callInd++
case "81314b59": // revert if less than // ignore for event
case "81314b59": // revert if less than // ignore for event // revertIfReceivedLessThan
callInd++
default: //execute order
// it might happen that some of the execution call are not executed so len of provided multicalls will be more than executed calls.
Expand All @@ -110,7 +116,15 @@ func (f *FacadeCallNameWithMulticall) SameMulticallLenAsEvents(events []*schemas
eventInd++
}
executeCall := 0
for callInd < callLen && !utils.Contains([]string{"59781034", "2b7c7b11", "2a7ba1f7", "c690908a", "23e27a64", "81314b59"},
for callInd < callLen && !utils.Contains([]string{
"59781034", // add collateral
"6d75b9ee", // add collateral 2.2
"2b7c7b11", // increase debt
"2a7ba1f7", // decrease debt
"c690908a", // enable token
"23e27a64", // disable token
"81314b59", // revertIfReceivedLessThan
},
hex.EncodeToString(f.multiCalls[callInd].CallData[:4])) {
executeCall++
callInd++
Expand Down

0 comments on commit 08102cf

Please sign in to comment.