Skip to content

Commit ecdafcf

Browse files
committed
fix: etherscan logs
1 parent 6291cbd commit ecdafcf

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

debts/index.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,17 @@ func (eng *DebtEngine) processBlocksInBatch(from, to int64, lastSync schemas.Las
125125
}
126126
eng.repo.LoadBlocks(from, to)
127127
if len(eng.repo.GetBlocks()) > 0 {
128-
eng.CalculateDebtAndClear(to, lastSync)
128+
eng.calculateDebtAndClear(to, lastSync)
129129
}
130130
}
131131

132132
// called for the engine/index.go and the debt engine
133-
func (eng *DebtEngine) CalculateDebtAndClear(to int64, lastSync schemas.LastSync) {
133+
func (eng *DebtEngine) CalculateDebtAndClear(to int64) {
134+
eng.calculateDebtAndClear(to, eng.repo.LoadLastDebtSync())
135+
}
136+
func (eng *DebtEngine) calculateDebtAndClear(to int64, lastSync schemas.LastSync) {
134137
if !eng.config.DisableDebtEngine {
135138
eng.CalculateDebt()
136-
//
137139
tx := eng.db.Begin()
138140
eng.flushDebt(to, tx, lastSync)
139141
eng.flushTvl(to, tx, lastSync)

ds/debt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
type DebtEngineI interface {
1515
Clear()
1616
ProcessBackLogs()
17-
CalculateDebtAndClear(to int64, lastSync schemas.LastSync)
17+
CalculateDebtAndClear(to int64)
1818
CalCurrentDebts(to int64)
1919
CalculateDebt()
2020
GetDebts() core.Json

engine/index.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,7 @@ func (e *Engine) syncLoop(syncedTill, latestBlockNum int64) int64 {
148148
func (e *Engine) SyncAndFlush(syncTill int64) {
149149
e.Sync(syncTill)
150150
e.repo.Flush(syncTill)
151-
e.debtEng.CalculateDebtAndClear(syncTill, schemas.LastSync{
152-
Debt: 0,
153-
Tvl: 0,
154-
})
151+
e.debtEng.CalculateDebtAndClear(syncTill)
155152
if syncTill > e.syncedBlock.Load().(int64) {
156153
e.syncedBlock.Store(syncTill)
157154
}
@@ -219,6 +216,9 @@ func (e *Engine) SyncModel(mdl ds.SyncAdapterI, syncTill int64, wg *sync.WaitGro
219216
return
220217
}
221218

219+
if mdl.GetName() == ds.LMRewardsv3 {
220+
log.Info("LMRewardsv3 syncing from", syncFrom, "to", syncTill)
221+
}
222222
txLogs, err := e.GetLogs(syncFrom, syncTill, addrsToFetchLogs, mdl.Topics())
223223
log.CheckFatal(err)
224224
log.Infof("Sync %s(%s)[addrs: %d] from %d to %d: no: %d", mdl.GetName(), mdl.GetAddress(), len(addrsToFetchLogs), syncFrom, syncTill, len(txLogs))

repository/reward_v3.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (repo *Repository) loadLMRewardDetailsv3() {
2626

2727
//
2828
dieselsync := []*v3.DieselSync{}
29-
err = repo.db.Raw(`SELECT * FROM diesel_sync`).Find(&farms).Error
29+
err = repo.db.Raw(`SELECT * FROM diesel_sync`).Find(&dieselsync).Error
3030
log.CheckFatal(err)
3131
adapter.SetUnderlyingState(dieselsync)
3232
//

0 commit comments

Comments
 (0)