diff --git a/packages/ociswap-v2-adapter-v1/src/lib.rs b/packages/ociswap-v2-adapter-v1/src/lib.rs index 72099637..7e03d93d 100644 --- a/packages/ociswap-v2-adapter-v1/src/lib.rs +++ b/packages/ociswap-v2-adapter-v1/src/lib.rs @@ -171,10 +171,11 @@ pub mod adapter { let (receipt, change_x, change_y) = pool.add_liquidity(lower_tick, upper_tick, bucket_x, bucket_y); - let non_fungible_global_id = NonFungibleGlobalId::new( - receipt.as_non_fungible().resource_address(), - receipt.as_non_fungible().non_fungible_local_id(), - ); + let non_fungible = receipt + .as_non_fungible() + .non_fungible::(); + let non_fungible_data = non_fungible.data(); + let non_fungible_global_id = non_fungible.global_id().clone(); OpenLiquidityPositionOutput { pool_units: IndexedBuckets::from_bucket(receipt), @@ -183,7 +184,8 @@ pub mod adapter { adapter_specific_information: AnyValue::from_typed( &OciswapV2AdapterSpecificInformation { liquidity_receipt_non_fungible_global_id: - non_fungible_global_id.clone(), + non_fungible_global_id, + liquidity_receipt_data: non_fungible_data, }, ) .expect(UNEXPECTED_ERROR), @@ -259,6 +261,9 @@ pub mod adapter { pub struct OciswapV2AdapterSpecificInformation { /// Stores the non-fungible global id of the liquidity receipt. pub liquidity_receipt_non_fungible_global_id: NonFungibleGlobalId, + + /// The data of the underlying liquidity receipt + pub liquidity_receipt_data: LiquidityPosition, } impl From for AnyValue { @@ -266,3 +271,15 @@ impl From for AnyValue { AnyValue::from_typed(&value).unwrap() } } + +#[derive(NonFungibleData, ScryptoSbor, Debug, Clone)] +pub struct LiquidityPosition { + liquidity: PreciseDecimal, + left_bound: i32, + right_bound: i32, + shape_id: Option, + x_fee_checkpoint: PreciseDecimal, + y_fee_checkpoint: PreciseDecimal, + x_total_fee_checkpoint: PreciseDecimal, + y_total_fee_checkpoint: PreciseDecimal, +}