File tree 1 file changed +29
-1
lines changed
1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -797,9 +797,37 @@ export async function handleEvent(
797
797
}
798
798
799
799
const strategyAddress = parseAddress ( event . address ) ;
800
- const rawDistribution = await ipfsGet (
800
+ const round = await db . getRoundByStrategyAddress (
801
+ chainId ,
802
+ strategyAddress
803
+ ) ;
804
+
805
+ if ( ! round ) {
806
+ throw new Error ( "Round not found" ) ;
807
+ }
808
+
809
+ const rawDistribution = ( await ipfsGet (
801
810
event . params . distributionMetaPtr . pointer
811
+ ) ) as Record < string , unknown > ;
812
+
813
+ const usdAmount = await convertToUSD (
814
+ priceProvider ,
815
+ chainId ,
816
+ round ?. matchTokenAddress ,
817
+ BigInt ( 1 ) ,
818
+ event . blockNumber
802
819
) ;
820
+
821
+ const blockTimestamp = getDateFromTimestamp (
822
+ BigInt ( ( await blockTimestampInMs ( chainId , event . blockNumber ) ) / 1000 )
823
+ ) ;
824
+ rawDistribution [ "blockNumber" ] = Number ( event . blockNumber ) ;
825
+ if ( blockTimestamp ) {
826
+ rawDistribution [ "blockTimestamp" ] = blockTimestamp ;
827
+ }
828
+ rawDistribution [ "usdPrice" ] = usdAmount . price ;
829
+ rawDistribution [ "usdPriceTimestampAt" ] = usdAmount . timestamp ;
830
+
803
831
const distribution =
804
832
MatchingDistributionSchema . safeParse ( rawDistribution ) ;
805
833
You can’t perform that action at this time.
0 commit comments