Skip to content

Commit

Permalink
Update GetRentsForContracts to use cachedCtx (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kbhat1 authored Apr 26, 2023
1 parent cad6f9b commit 01acdcb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions x/dex/contract/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func EndBlockerAtomic(ctx sdk.Context, keeper *keeper.Keeper, validContractsInfo
env := newEnv(ctx, validContractsInfo, keeper)
cachedCtx, msCached := cacheContext(ctx, env)
memStateCopy := dexutils.GetMemState(cachedCtx.Context()).DeepCopy()
preRunRents := keeper.GetRentsForContracts(ctx, seiutils.Map(validContractsInfo, func(c types.ContractInfoV2) string { return c.ContractAddr }))
preRunRents := keeper.GetRentsForContracts(cachedCtx, seiutils.Map(validContractsInfo, func(c types.ContractInfoV2) string { return c.ContractAddr }))

handleDeposits(spanCtx, cachedCtx, env, keeper, tracer)

Expand All @@ -71,7 +71,7 @@ func EndBlockerAtomic(ctx sdk.Context, keeper *keeper.Keeper, validContractsInfo

// No error is thrown for any contract. This should happen most of the time.
if env.failedContractAddresses.Size() == 0 {
postRunRents := keeper.GetRentsForContracts(ctx, seiutils.Map(validContractsInfo, func(c types.ContractInfoV2) string { return c.ContractAddr }))
postRunRents := keeper.GetRentsForContracts(cachedCtx, seiutils.Map(validContractsInfo, func(c types.ContractInfoV2) string { return c.ContractAddr }))
TransferRentFromDexToCollector(ctx, keeper.BankKeeper, preRunRents, postRunRents)
msCached.Write()
return env.validContractsInfo, ctx, true
Expand Down

0 comments on commit 01acdcb

Please sign in to comment.