@odatano/core 2.0.0-rc.12 → 2.0.0-rc.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/db/schema.cds CHANGED
@@ -170,7 +170,7 @@ entity Pools : temporal {
170
170
  liveSize : Decimal(5, 4);
171
171
 
172
172
  @title : 'Live Saturation'
173
- @description: 'Current live saturation as fraction of ideal size'
173
+ @description: 'Current live saturation as fraction of ideal size (1.0 = 100% saturated)'
174
174
  liveSaturation : Decimal(5, 4);
175
175
 
176
176
  @title : 'Live Delegators'
@@ -239,7 +239,7 @@ entity PoolEpochSnapshots {
239
239
  liveSize : Decimal(5, 4);
240
240
 
241
241
  @title : 'Live Saturation'
242
- @description: 'Live saturation as fraction of ideal size'
242
+ @description: 'Live saturation as fraction of ideal size (1.0 = 100% saturated)'
243
243
  liveSaturation : Decimal(5, 4);
244
244
 
245
245
  @title : 'Live Delegators'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odatano/core",
3
- "version": "2.0.0-rc.12",
3
+ "version": "2.0.0-rc.13",
4
4
  "description": "SAP CAP plugin for Cardano blockchain OData V4 integration",
5
5
  "imports": {
6
6
  "#cds-models/*": "./@cds-models/*/index.js"
@@ -258,6 +258,8 @@ class BlockfrostBackend {
258
258
  liveStake: poolData.live_stake || '0',
259
259
  liveSize: poolData.live_size,
260
260
  liveDelegators: poolData.live_delegators,
261
+ // Blockfrost already reports a fraction (0.7542 = 75.42 %), which is the
262
+ // canonical unit — see the conversion in KoiosBackend._mapKoiosPool.
261
263
  liveSaturation: poolData.live_saturation,
262
264
  activeStake: poolData.active_stake || '0',
263
265
  activeSize: poolData.active_size,
@@ -466,7 +466,12 @@ class KoiosBackend {
466
466
  liveStake: poolData.live_stake || '0',
467
467
  liveSize: poolData.live_size || 0,
468
468
  liveDelegators: poolData.live_delegators || 0,
469
- liveSaturation: poolData.live_saturation || 0,
469
+ // Koios reports saturation in PERCENT (75.42 = 75.42 %), Blockfrost as a
470
+ // fraction (0.7542). PoolData is a fraction everywhere — and the columns
471
+ // behind it are Decimal(5, 4) — so convert here. Passing the percent value
472
+ // through overflows the column for any pool at or above 10 % and takes the
473
+ // whole epoch snapshot down with it.
474
+ liveSaturation: (Number(poolData.live_saturation) || 0) / 100,
470
475
  activeStake: poolData.active_stake || '0',
471
476
  activeSize: poolData.active_size || 0,
472
477
  pledge: poolData.pledge || '0',
@@ -210,6 +210,7 @@ export interface PoolData {
210
210
  blocksEpoch: number;
211
211
  liveStake: string;
212
212
  liveSize: number;
213
+ /** Fraction of the ideal (saturated) pool size, NOT percent: 0.7542 = 75.42 %. */
213
214
  liveSaturation: number;
214
215
  liveDelegators: number;
215
216
  activeStake: string;