@@ -3,10 +3,8 @@ import { AgentManager, AgentOwner, AgentVault } from "../../orm/entities/agent"
33import { AgentVaultSettings } from "../../orm/entities/state/agent"
44import { AgentVaultCreated } from "../../orm/entities/events/agent"
55import { UntrackedAgentVault } from "../../orm/entities/state/var"
6- import { CollateralTypeAdded } from "../../orm/entities/events/token"
7- import { PricePublished , PricesPublished } from "../../orm/entities/events/price"
6+ import { PricesPublished } from "../../orm/entities/events/price"
87import { updateAgentVaultInfo , findOrCreateEvmAddress } from "../utils"
9- import { getPriceFromDal } from "../../context/dal"
108import { EventStorer } from "./event-storer"
119import type { EntityManager } from "@mikro-orm/knex"
1210import type { AgentVaultCreatedEvent } from "../../../chain/typechain/IAssetManager"
@@ -35,10 +33,7 @@ export class StateUpdater extends EventStorer {
3533 }
3634
3735 protected override async onPublishedPrices ( em : EntityManager , evmLog : EvmLog , args : any ) : Promise < PricesPublished > {
38- const pp = await super . onPublishedPrices ( em , evmLog , args )
39- if ( this . context . config . indexPrices )
40- await this . addPriceSnapshot ( em , pp )
41- return pp
36+ return await super . onPublishedPrices ( em , evmLog , args )
4237 }
4338
4439 protected async ensureAgentManager ( em : EntityManager , address : string ) : Promise < AgentManager > {
@@ -75,16 +70,6 @@ export class StateUpdater extends EventStorer {
7570 return agentManager
7671 }
7772
78- private async addPriceSnapshot ( em : EntityManager , pricesPublished : PricesPublished ) : Promise < void > {
79- const collateralTypes = await em . findAll ( CollateralTypeAdded )
80- const symbols = new Set ( collateralTypes . map ( ( ct ) => [ ct . tokenFtsoSymbol , ct . assetFtsoSymbol ] ) . flat ( ) )
81- for ( let symbol of symbols ) {
82- const [ price , decimals ] = await getPriceFromDal ( symbol , pricesPublished . votingRoundId )
83- const priceEntity = new PricePublished ( pricesPublished , symbol , price , decimals )
84- em . persist ( priceEntity )
85- }
86- }
87-
8873 private async updateAgentVaultInfo ( em : EntityManager , agentVault : AgentVault ) : Promise < void > {
8974 try {
9075 const assetManager = this . context . fAssetTypeToAssetManagerAddress ( agentVault . fasset )
0 commit comments