1- import { Address , BigInt , Bytes } from "@graphprotocol/graph-ts" ;
1+ import { Address , Bytes } from "@graphprotocol/graph-ts" ;
22
33import { handlePoolCreated , PoolType } from "./common" ;
44import { PoolCreated } from "../types/LBPoolV2Factory/BasePoolFactory" ;
55import { LBPool } from "../types/LBPoolV2Factory/LBPool" ;
6- import { LBPParams } from "../types/schema" ;
6+ import { LBPParams , FixedLBPParams } from "../types/schema" ;
7+ import { FixedPriceLBPool } from "../types/FixedPriceLBPoolFactory/FixedPriceLBPool" ;
78
89function handleLBPoolParams ( poolAddress : Address ) : Bytes {
910 let lbp = LBPool . bind ( poolAddress ) ;
@@ -16,14 +17,14 @@ function handleLBPoolParams(poolAddress: Address): Bytes {
1617 lbpParams . owner = lbp . owner ( ) ;
1718 lbpParams . projectToken = immutableData . tokens [ projectTokenIndex ] ;
1819 lbpParams . reserveToken = immutableData . tokens [ reserveTokenIndex ] ;
20+ lbpParams . startTime = immutableData . startTime ;
21+ lbpParams . endTime = immutableData . endTime ;
1922 lbpParams . projectTokenStartWeight =
2023 immutableData . startWeights [ projectTokenIndex ] ;
2124 lbpParams . projectTokenEndWeight = immutableData . endWeights [ projectTokenIndex ] ;
2225 lbpParams . reserveTokenStartWeight =
2326 immutableData . startWeights [ reserveTokenIndex ] ;
2427 lbpParams . reserveTokenEndWeight = immutableData . endWeights [ reserveTokenIndex ] ;
25- lbpParams . startTime = immutableData . startTime ;
26- lbpParams . endTime = immutableData . endTime ;
2728 lbpParams . isProjectTokenSwapInBlocked =
2829 immutableData . isProjectTokenSwapInBlocked ;
2930
@@ -53,3 +54,47 @@ export function handleLBPoolV2Created(event: PoolCreated): void {
5354 "lbpParams"
5455 ) ;
5556}
57+
58+ export function handleLBPoolV3Created ( event : PoolCreated ) : void {
59+ handlePoolCreated (
60+ event . params . pool ,
61+ event . address , // Factory
62+ PoolType . LBP ,
63+ 3 ,
64+ handleLBPoolParams ,
65+ "lbpParams"
66+ ) ;
67+ }
68+
69+ function handleFixedPriceLBPoolParams ( poolAddress : Address ) : Bytes {
70+ let fixedPriceLBP = FixedPriceLBPool . bind ( poolAddress ) ;
71+ let fixedLBPParams = new FixedLBPParams ( poolAddress ) ;
72+
73+ let immutableData = fixedPriceLBP . getFixedPriceLBPoolImmutableData ( ) ;
74+ let projectTokenIndex = immutableData . projectTokenIndex . toI32 ( ) ;
75+ let reserveTokenIndex = immutableData . reserveTokenIndex . toI32 ( ) ;
76+
77+ fixedLBPParams . owner = fixedPriceLBP . owner ( ) ;
78+ fixedLBPParams . projectToken = immutableData . tokens [ projectTokenIndex ] ;
79+ fixedLBPParams . reserveToken = immutableData . tokens [ reserveTokenIndex ] ;
80+ fixedLBPParams . startTime = immutableData . startTime ;
81+ fixedLBPParams . endTime = immutableData . endTime ;
82+ fixedLBPParams . projectTokenRate = immutableData . projectTokenRate ;
83+ fixedLBPParams . isProjectTokenSwapInBlocked =
84+ fixedPriceLBP . isProjectTokenSwapInBlocked ( ) ;
85+
86+ fixedLBPParams . save ( ) ;
87+
88+ return fixedLBPParams . id ;
89+ }
90+
91+ export function handleFixedPriceLBPoolCreated ( event : PoolCreated ) : void {
92+ handlePoolCreated (
93+ event . params . pool ,
94+ event . address , // Factory
95+ PoolType . FixedLBP ,
96+ 1 ,
97+ handleFixedPriceLBPoolParams ,
98+ "fixedLBPParams"
99+ ) ;
100+ }
0 commit comments