Skip to content

Commit 6475127

Browse files
committed
fix: tenderly
1 parent d233164 commit 6475127

File tree

5 files changed

+16
-15
lines changed

5 files changed

+16
-15
lines changed

ds/dc_wrapper/wrapper.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ func (dcw *DataCompressorWrapper) Retry(blockNum int64, account common.Address,
335335
x := abi.ConvertType(out[0], new(globalAccountCompressor.CreditAccountData)).(*globalAccountCompressor.CreditAccountData)
336336
accountData = dc.Convert(x)
337337
}
338-
log.Info(utils.ToJson(accountData))
339338
if !accountData.Success {
340339
log.Warn("Not success v3", blockNum, account)
341340
// return dc.CreditAccountCallData{}, err

ds/execute_parser.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ func (f *FacadeCallNameWithMulticall) v3(events []*schemas.AccountOperation) boo
127127
callInd++
128128
case "81314b59": // revert if less than // can't find in v3
129129
callInd++
130-
case "82ff942c", "2f2ca49b": // can't find in v3
130+
case "82ff942c",
131+
"2f2ca49b": // v300 // second is storeExpectedBalances((address,int256)[])
132+
// "6161dc85": // exactDiffInput((bytes,uint256,uint256,uint256))
131133
callInd++
132134
case "0768bbfe": // setFullCheckParams
133135
callInd++

models/credit_manager/cm_v3/v3.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (mdl *CMv3) checkLogV3(txLog types.Log) {
9696
poolv3 := mdl.Repo.GetAdapter(mdl.State.PoolAddress).(*pool_v3.Poolv3)
9797
debts := poolv3.GetDebt(txLog.TxHash, mdl.Address, txLog.Index)
9898
mdl.MulticallMgr.End(txLog.Index, debts, mdl.GetUnderlyingToken())
99-
case core.Topic("IncreaseDebt(address,uint256)"):
99+
case core.Topic("IncreaseDebt(address,uint256)"): // works for v300 for V3 10: The increased or decreased debt event is not emitted. We can check that using the debt that is emitted from the pool. In the finish_multicall we are emitting that call. So this function is just above you.
100100
increaseBorrowEvent, err := mdl.facadeContractv3.ParseIncreaseDebt(txLog)
101101
if err != nil {
102102
log.Fatal("[CreditManagerModel]: Cant unpack IncreaseBorrowedAmount event", err)

models/pool/pool_v3/on_log.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ func (mdl *Poolv3) OnLog(txLog types.Log) {
104104
mdl.updateBorrowRate(blockNum)
105105
case core.Topic("Borrow(address,address,uint256)"):
106106
mdl.AddDebt(ManageDebt{
107-
BlockNum: int64(txLog.BlockNumber),
108-
TxHash: txLog.TxHash.Hex(),
109-
Amount: new(big.Int).SetBytes(txLog.Data),
110-
Account: common.BytesToAddress(txLog.Topics[2][:]).Hex(),
111-
Type: INCREASE_DEBT,
112-
LogId: txLog.Index,
113-
CreditManager: common.BytesToAddress(txLog.Topics[1][:]).Hex(),
107+
BlockNum: int64(txLog.BlockNumber),
108+
TxHash: txLog.TxHash.Hex(),
109+
Amount: new(big.Int).SetBytes(txLog.Data),
110+
Account: common.BytesToAddress(txLog.Topics[2][:]).Hex(),
111+
Type: INCREASE_DEBT,
112+
LogId: txLog.Index,
113+
CreditManager: common.BytesToAddress(txLog.Topics[1][:]).Hex(),
114114
})
115115
mdl.updateBorrowRate(blockNum)
116116
case core.Topic("Repay(address,uint256,uint256,uint256)"):
@@ -129,9 +129,9 @@ func (mdl *Poolv3) OnLog(txLog types.Log) {
129129
TxHash: txLog.TxHash.Hex(),
130130
Amount: new(big.Int).SetBytes(txLog.Data[:32]),
131131
// Account: common.BytesToAddress(txLog.Topics[2][:]).Hex(),
132-
Type: DECREASE_DEBT,
133-
LogId: txLog.Index,
134-
CreditManager: common.BytesToAddress(txLog.Topics[1][:]).Hex(),
132+
Type: DECREASE_DEBT,
133+
LogId: txLog.Index,
134+
CreditManager: common.BytesToAddress(txLog.Topics[1][:]).Hex(),
135135
})
136136
amount := new(big.Int).Sub(new(big.Int).Add(repayEvent.BorrowedAmount, repayEvent.Profit), repayEvent.Loss)
137137
mdl.repayEvents = append(mdl.repayEvents, &schemas.PoolLedger{
@@ -200,4 +200,4 @@ func (mdl Poolv3) setPoolKeeperAdapter(poolQuotaKeeper string, blockNum int64) {
200200

201201
func (mdl Poolv3) GetDebt(txHash common.Hash, cm string, lastLogId uint) []ManageDebt {
202202
return mdl.CMDebtHandler.Get(txHash.Hex(), cm, lastLogId)
203-
}
203+
}

repository/handlers/treasury/price.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func (repo *TreasuryRepo) getPricesInBatch(oracle schemas.PriceOracleT, version
9595
prices = v2PriceAnswers(result[:len(tokenAddrs)])
9696
}
9797
for ind, token := range tokenAddrs {
98-
if prices[ind] == nil {
98+
if prices[ind] == nil || prices[ind].Cmp(big.NewInt(0)) == 0 {
9999
if price := repo.GetRedStonePrice(blockNum, oracle, token); price != nil {
100100
prices[ind] = price
101101
}

0 commit comments

Comments
 (0)