@@ -797,9 +797,46 @@ export async function handleEvent(
797
797
}
798
798
799
799
const strategyAddress = parseAddress ( event . address ) ;
800
- const rawDistribution = await ipfsGet (
800
+
801
+ const roundId = parseAddress (
802
+ await readContract ( {
803
+ contract : "AlloV1/MerklePayoutStrategyImplementation/V2" ,
804
+ address : strategyAddress ,
805
+ functionName : "roundAddress" ,
806
+ } )
807
+ ) ;
808
+
809
+ const round = await db . getRoundById (
810
+ chainId ,
811
+ roundId
812
+ ) ;
813
+
814
+ if ( ! round ) {
815
+ throw new Error ( "Round not found" ) ;
816
+ }
817
+
818
+ const rawDistribution = ( await ipfsGet (
801
819
event . params . distributionMetaPtr . pointer
820
+ ) ) as Record < string , unknown > ;
821
+
822
+ const usdAmount = await convertToUSD (
823
+ priceProvider ,
824
+ chainId ,
825
+ round ?. matchTokenAddress ,
826
+ BigInt ( 1 ) ,
827
+ event . blockNumber
802
828
) ;
829
+
830
+ const blockTimestamp = getDateFromTimestamp (
831
+ BigInt ( ( await blockTimestampInMs ( chainId , event . blockNumber ) ) / 1000 )
832
+ ) ;
833
+ rawDistribution [ "blockNumber" ] = Number ( event . blockNumber ) ;
834
+ if ( blockTimestamp ) {
835
+ rawDistribution [ "blockTimestamp" ] = blockTimestamp ;
836
+ }
837
+ rawDistribution [ "usdPrice" ] = usdAmount . price ;
838
+ rawDistribution [ "usdPriceTimestampAt" ] = usdAmount . timestamp ;
839
+
803
840
const distribution =
804
841
MatchingDistributionSchema . safeParse ( rawDistribution ) ;
805
842
@@ -817,7 +854,7 @@ export async function handleEvent(
817
854
{
818
855
type : "UpdateRoundByStrategyAddress" ,
819
856
chainId,
820
- strategyAddress,
857
+ strategyAddress : strategyAddress ,
821
858
round : {
822
859
matchingDistribution : distribution . data ,
823
860
} ,
0 commit comments