@raac/rpc 1.2.0-beta.8 → 1.2.0-beta.9

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.
@@ -37,12 +37,12 @@
37
37
  "feecollector": {
38
38
  "id": "feecollector",
39
39
  "name": "Fee Collector",
40
- "contract": "0xf460b2436753AEed5Df275CA33528f5C9abB579D"
40
+ "contract": "0x789f62Ee0471B369b28D4A5345Fe12a70Bd8Be3B"
41
41
  },
42
42
  "treasury": {
43
43
  "id": "treasury",
44
44
  "name": "Treasury",
45
- "contract": "0xDc1FCd959881533CCFBfB572881CdC6d8a2b35E7"
45
+ "contract": "0xFE72Afa6e52E041B036B0E28e25ffE5CA5fD6170"
46
46
  },
47
47
  "pmtreasury": {
48
48
  "id": "pmtreasury",
@@ -146,17 +146,22 @@
146
146
  "stabilitypool": {
147
147
  "id": "stabilitypool",
148
148
  "name": "Stability Pool",
149
- "contract": "0xd7663c079445A070Ef24405CD5ef1511B9d9E060"
149
+ "contract": "0x647dE5B6Db7f4a3e0E1f4D9DB478B86b7B430248"
150
150
  },
151
151
  "lendingpool": {
152
152
  "id": "lendingpool",
153
153
  "name": "Lending Pool",
154
- "contract": "0xefCff23AEed94ae0f23377DFDaB78C3c868eeB33"
154
+ "contract": "0xd8cd0194c1Dc3287f2666ECEB45A1Ac3450dD38a"
155
155
  },
156
156
  "crvusdraacpool": {
157
157
  "id": "crvusdraacpool",
158
- "name": "Curve crvUSD/RAAC twocrypto-ng Pool",
159
- "contract": "0xCfDBbad91770fb7Fd57e623A59dcbD14670164c7"
158
+ "name": "Curve pmUSD/RAAC twocrypto-ng Pool",
159
+ "contract": "0xAe98A7EF8557491fD34b45036Aada075c9385c6C"
160
+ },
161
+ "pmusdireetpool": {
162
+ "id": "pmusdireetpool",
163
+ "name": "pmUSD/iREET Mock Pool",
164
+ "contract": "0x4b9b6D1468846B00dB898698a13E11f2C2347EC1"
160
165
  }
161
166
  },
162
167
  "nfts": {
@@ -192,21 +197,21 @@
192
197
  },
193
198
  "crvusd": {
194
199
  "id": "crvusd",
195
- "name": "CRVUSD",
200
+ "name": "pmUSD",
196
201
  "decimals": 18,
197
- "contract": "0x8047a14301583CAaf9e2128D5F88F9f435659d35"
202
+ "contract": "0x970697EF41A89f7448BC658B5308dcADaC2a663c"
198
203
  },
199
204
  "rtoken": {
200
205
  "id": "rtoken",
201
206
  "name": "RToken",
202
207
  "decimals": 18,
203
- "contract": "0xc96c34825aa96A77A4AD884e393960a70c5f1186"
208
+ "contract": "0x6F713079002a0a485E91fB276E4682CB01d18439"
204
209
  },
205
210
  "detoken": {
206
211
  "id": "detoken",
207
212
  "name": "DEToken",
208
213
  "decimals": 18,
209
- "contract": "0x5841dc06d2C9e0D2605392f669be71Bfe6d04cf7"
214
+ "contract": "0x7099e48A96eEeCd93c9a1bBA535d8715826df70e"
210
215
  },
211
216
  "raactoken": {
212
217
  "id": "raactoken",
@@ -230,7 +235,7 @@
230
235
  "id": "debttoken",
231
236
  "name": "Debt Token",
232
237
  "decimals": 18,
233
- "contract": "0x98db917a623a92a8553Fe59b9f05B8c936aa1E1e"
238
+ "contract": "0x90f1f1431c46F851c54DD9518a28e4C20AB0aC4c"
234
239
  },
235
240
  "rwaindextoken": {
236
241
  "id": "rwaindextoken",
@@ -250,7 +255,7 @@
250
255
  "rwaindextokenadapter": {
251
256
  "id": "rwaindextokenadapter",
252
257
  "name": "RWA Index Token",
253
- "contract": "0x5374287a807c5513fC31bc9AECE5aC40f0e37c71",
258
+ "contract": "0x075c96D803E64f25bA28C7a765F3911BBf773B56",
254
259
  "type": "ERC20"
255
260
  }
256
261
  },
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getUserClaimableRewards = void 0;
40
+ const ethers_1 = require("ethers");
41
+ const chains_1 = __importDefault(require("../../../configs/chains"));
42
+ const getContractAddress_1 = __importStar(require("../../getContractAddress"));
43
+ const GAUGE_ABI = [
44
+ "function pendingRewards(address account) view returns (uint256)",
45
+ "function balanceOf(address account) view returns (uint256)", // boosted working balance
46
+ "function totalSupply() view returns (uint256)", // working supply
47
+ "function getExtraRewardTokens() view returns (address[])",
48
+ "function pendingExtraRewards(address token, address account) view returns (uint256)",
49
+ ];
50
+ const DISTRIBUTOR_ABI = ["function getClaimableForGauge(address gauge) view returns (uint256)"];
51
+ const ERC20_META_ABI = [
52
+ "function symbol() view returns (string)",
53
+ "function decimals() view returns (uint8)",
54
+ ];
55
+ /**
56
+ * The user's TRUE claimable rewards on a gauge.
57
+ *
58
+ * The gauge's `pendingRewards()` view only reflects RAAC already pulled into the gauge.
59
+ * RAAC emitted to the gauge sits in the GaugeRewardsDistributor until a claim pulls it in
60
+ * (`claimRewardToken`/`claimRewardsFor` call `_pullRewardsFromDistributor` first). So a
61
+ * user's real claimable also includes their working-balance share of the distributor's
62
+ * `getClaimableForGauge(gauge)`. This helper combines both, plus any extra reward tokens.
63
+ *
64
+ * @param chainId - The chain/network to use.
65
+ * @param gaugeAddressOrId - Address of the gauge contract or its config ID.
66
+ * @param accountAddress - Address of the user.
67
+ * @param provider - Optional ethers.js Provider instance.
68
+ */
69
+ const getUserClaimableRewards = async (chainId, gaugeAddressOrId, accountAddress, provider) => {
70
+ if (!provider) {
71
+ const rpc = chains_1.default[chainId].rpcs[0];
72
+ provider = new ethers_1.ethers.JsonRpcProvider(rpc);
73
+ }
74
+ let gaugeAddress;
75
+ if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
76
+ gaugeAddress = gaugeAddressOrId;
77
+ }
78
+ else {
79
+ // @ts-ignore
80
+ gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
81
+ }
82
+ const gauge = new ethers_1.ethers.Contract(gaugeAddress, GAUGE_ABI, provider);
83
+ const [inGauge, working, supply, extraTokens] = await Promise.all([
84
+ gauge.pendingRewards(accountAddress).then((v) => BigInt(v)).catch(() => 0n),
85
+ gauge.balanceOf(accountAddress).then((v) => BigInt(v)).catch(() => 0n),
86
+ gauge.totalSupply().then((v) => BigInt(v)).catch(() => 0n),
87
+ gauge.getExtraRewardTokens().catch(() => []),
88
+ ]);
89
+ // User's share of RAAC still held by the distributor for this gauge.
90
+ let inDistributor = 0n;
91
+ try {
92
+ const distributorAddr = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
93
+ const distributor = new ethers_1.ethers.Contract(distributorAddr, DISTRIBUTOR_ABI, provider);
94
+ const gaugeClaimable = BigInt(await distributor.getClaimableForGauge(gaugeAddress));
95
+ if (supply > 0n && working > 0n && gaugeClaimable > 0n) {
96
+ inDistributor = (gaugeClaimable * working) / supply;
97
+ }
98
+ }
99
+ catch {
100
+ /* distributor not configured / no pending */
101
+ }
102
+ const raac = inGauge + inDistributor;
103
+ const extras = [];
104
+ for (const token of extraTokens) {
105
+ try {
106
+ const amount = BigInt(await gauge.pendingExtraRewards(token, accountAddress));
107
+ if (amount <= 0n)
108
+ continue;
109
+ const erc20 = new ethers_1.ethers.Contract(token, ERC20_META_ABI, provider);
110
+ const [symbol, decimals] = await Promise.all([
111
+ erc20.symbol().catch(() => "?"),
112
+ erc20.decimals().then((d) => Number(d)).catch(() => 18),
113
+ ]);
114
+ extras.push({
115
+ token,
116
+ symbol,
117
+ decimals,
118
+ amount,
119
+ formatted: ethers_1.ethers.formatUnits(amount, decimals),
120
+ });
121
+ }
122
+ catch {
123
+ /* ignore a single extra token */
124
+ }
125
+ }
126
+ return {
127
+ gauge: gaugeAddress,
128
+ inGauge,
129
+ inDistributor,
130
+ raac,
131
+ raacFormatted: ethers_1.ethers.formatEther(raac),
132
+ extras,
133
+ };
134
+ };
135
+ exports.getUserClaimableRewards = getUserClaimableRewards;
@@ -40,6 +40,7 @@ __exportStar(require("./getRaacAutolockMin"), exports);
40
40
  __exportStar(require("./getRawBalanceOf"), exports);
41
41
  __exportStar(require("./getRawTotalSupply"), exports);
42
42
  __exportStar(require("./getTotalSupply"), exports);
43
+ __exportStar(require("./getUserClaimableRewards"), exports);
43
44
  __exportStar(require("./getUserRewardTokenData"), exports);
44
45
  __exportStar(require("./getUserWeight"), exports);
45
46
  __exportStar(require("./isPaused"), exports);
@@ -10,13 +10,16 @@ const getContractAddress_1 = require("../../getContractAddress");
10
10
  const artifacts_1 = require("../../../utils/artifacts");
11
11
  const E18 = 10n ** 18n;
12
12
  /**
13
- * Per-epoch emissions actually received by a gauge: the GaugeController snapshots
14
- * gauge weights per epoch, and the GaugeRewardsDistributor records the RAAC deposited
15
- * per epoch. A gauge's emission for an epoch is therefore
13
+ * Per-epoch emissions for a gauge. The GaugeController snapshots gauge weights per epoch
14
+ * and the GaugeRewardsDistributor records the RAAC deposited per epoch, so for a COMPLETED
15
+ * epoch a gauge's emission is:
16
16
  * depositedAtEpoch(epoch) × gaugeRelativeWeight(gauge, epoch).
17
17
  *
18
- * Returns a series ending at the current (in-progress) epoch so callers can chart
19
- * "week of X this gauge received Y RAAC".
18
+ * For the in-progress epoch, `depositedAtEpoch` only reflects what has been ticked in so
19
+ * far and keeps growing through the week which is misleading. Since the emission schedule
20
+ * already determines the full week's emission, the current (and upcoming) epoch instead use
21
+ * scheduledWeekEmission(epoch) × gaugeRelativeWeight(gauge, epoch)
22
+ * where scheduledWeekEmission = minter.calculateScheduledMintableAmount(week) × distributorShare.
20
23
  *
21
24
  * @param chainId - The chain/network to use.
22
25
  * @param gauge - Gauge address (or config key).
@@ -39,6 +42,34 @@ const getGaugeEmissions = async (chainId, gauge, numEpochs = 8, includeUpcoming
39
42
  const week = BigInt(weekBn);
40
43
  const currentEpoch = BigInt(currentEpochBn);
41
44
  const startEpoch = BigInt(startEpochBn) > 0n ? BigInt(startEpochBn) : currentEpoch;
45
+ // ── Distributor's share of the minter + scheduled-emission helper ─────────
46
+ // The schedule deterministically sets each week's system emission, so we use it for
47
+ // the in-progress and upcoming epochs (where depositedAtEpoch is partial/zero).
48
+ let distShare = 0n; // 1e18-scaled fraction of the minter routed to the distributor
49
+ let minter = null;
50
+ try {
51
+ minter = new ethers_1.ethers.Contract((0, getContractAddress_1.getContractAddress)(chainId, "raacminter"), (0, artifacts_1.getABI)("raacminter"), provider);
52
+ const distAddr = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
53
+ const [info, totalWeight] = await Promise.all([minter.poolInfo(distAddr), minter.totalWeight()]);
54
+ const poolWeight = BigInt(info.weight ?? info[0] ?? 0n);
55
+ const exists = Boolean(info.exists ?? info[1]);
56
+ const tw = BigInt(totalWeight);
57
+ distShare = exists && tw > 0n ? (poolWeight * E18) / tw : 0n;
58
+ }
59
+ catch {
60
+ /* minter not readable — scheduled emission stays 0 */
61
+ }
62
+ const scheduledSystemEmission = async (epochStart) => {
63
+ if (!minter || distShare === 0n)
64
+ return 0n;
65
+ try {
66
+ const minterWeekly = BigInt(await minter.calculateScheduledMintableAmount(epochStart, epochStart + week));
67
+ return (minterWeekly * distShare) / E18;
68
+ }
69
+ catch {
70
+ return 0n;
71
+ }
72
+ };
42
73
  // Window: [currentEpoch - (numEpochs-1)*week .. currentEpoch], clamped to startEpoch.
43
74
  const span = BigInt(Math.max(1, numEpochs) - 1) * week;
44
75
  let from = currentEpoch - span;
@@ -48,10 +79,11 @@ const getGaugeEmissions = async (chainId, gauge, numEpochs = 8, includeUpcoming
48
79
  for (let e = from; e <= currentEpoch; e += week)
49
80
  epochList.push(e);
50
81
  const epochs = await Promise.all(epochList.map(async (e) => {
51
- let deposited = 0n;
82
+ const isCurrent = e === currentEpoch;
83
+ let depositedSoFar = 0n;
52
84
  let relativeWeight = 0n;
53
85
  try {
54
- deposited = BigInt(await distributor.depositedAtEpoch(rewardToken, e));
86
+ depositedSoFar = BigInt(await distributor.depositedAtEpoch(rewardToken, e));
55
87
  }
56
88
  catch {
57
89
  /* ignore */
@@ -63,29 +95,33 @@ const getGaugeEmissions = async (chainId, gauge, numEpochs = 8, includeUpcoming
63
95
  catch {
64
96
  /* no snapshot at this epoch */
65
97
  }
66
- const gaugeEmissionRaw = (deposited * relativeWeight) / E18;
98
+ // Past epochs: use the actual deposited. Current (in-progress) epoch: use the
99
+ // scheduled full-week emission (deposited is still partial/tick-based).
100
+ let systemEmission = depositedSoFar;
101
+ if (isCurrent) {
102
+ const scheduled = await scheduledSystemEmission(e);
103
+ systemEmission = scheduled > depositedSoFar ? scheduled : depositedSoFar;
104
+ }
105
+ const gaugeEmissionRaw = (systemEmission * relativeWeight) / E18;
67
106
  return {
68
107
  epoch: Number(e),
69
- deposited: ethers_1.ethers.formatEther(deposited),
108
+ deposited: ethers_1.ethers.formatEther(systemEmission),
109
+ depositedSoFar: ethers_1.ethers.formatEther(depositedSoFar),
70
110
  relativeWeight,
71
111
  relativeWeightPct: Number((relativeWeight * 10000n) / E18) / 100,
72
112
  gaugeEmission: ethers_1.ethers.formatEther(gaugeEmissionRaw),
73
113
  gaugeEmissionRaw,
74
- isCurrent: e === currentEpoch,
114
+ isCurrent,
75
115
  };
76
116
  }));
77
117
  const current = epochs[epochs.length - 1];
78
118
  // ── Upcoming-epoch preview ────────────────────────────────────────────────
79
119
  // Votes cast this epoch take effect at nextEpoch, so getGaugeRelativeWeightView
80
- // at nextEpoch already reflects current voting. Nothing is deposited yet, so we
81
- // project the distributor's deposit from the emission schedule:
82
- // projectedSystem = minterWeekly(nextEpoch) × distributorShareOfMinter
83
- // projectedGauge = projectedSystem × gaugeRelativeWeight(nextEpoch)
120
+ // at nextEpoch already reflects current voting. Nothing is deposited yet, so the
121
+ // deposit is projected from the same emission schedule.
84
122
  if (includeUpcoming) {
85
123
  const nextEpoch = currentEpoch + week;
86
124
  let relNext = 0n;
87
- let minterWeekly = 0n;
88
- let distShare = 0n; // 1e18-scaled fraction of the minter routed to the distributor
89
125
  try {
90
126
  const [rel] = await controller.getGaugeRelativeWeightView(gauge, nextEpoch);
91
127
  relNext = BigInt(rel);
@@ -93,28 +129,12 @@ const getGaugeEmissions = async (chainId, gauge, numEpochs = 8, includeUpcoming
93
129
  catch {
94
130
  /* no projected snapshot */
95
131
  }
96
- try {
97
- const minter = new ethers_1.ethers.Contract((0, getContractAddress_1.getContractAddress)(chainId, "raacminter"), (0, artifacts_1.getABI)("raacminter"), provider);
98
- minterWeekly = BigInt(await minter.calculateScheduledMintableAmount(nextEpoch, nextEpoch + week));
99
- // distributor's share of the minter's weighted distribution
100
- const distAddr = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
101
- const [info, totalWeight] = await Promise.all([
102
- minter.poolInfo(distAddr),
103
- minter.totalWeight(),
104
- ]);
105
- const poolWeight = BigInt(info.weight ?? info[0] ?? 0n);
106
- const exists = Boolean(info.exists ?? info[1]);
107
- const tw = BigInt(totalWeight);
108
- distShare = exists && tw > 0n ? (poolWeight * E18) / tw : 0n;
109
- }
110
- catch {
111
- /* minter not readable — projection stays 0 */
112
- }
113
- const projectedSystem = (minterWeekly * distShare) / E18;
132
+ const projectedSystem = await scheduledSystemEmission(nextEpoch);
114
133
  const projectedRaw = (projectedSystem * relNext) / E18;
115
134
  epochs.push({
116
135
  epoch: Number(nextEpoch),
117
136
  deposited: ethers_1.ethers.formatEther(projectedSystem),
137
+ depositedSoFar: "0",
118
138
  relativeWeight: relNext,
119
139
  relativeWeightPct: Number((relNext * 10000n) / E18) / 100,
120
140
  gaugeEmission: ethers_1.ethers.formatEther(projectedRaw),
@@ -130,6 +150,7 @@ const getGaugeEmissions = async (chainId, gauge, numEpochs = 8, includeUpcoming
130
150
  weekSeconds: Number(week),
131
151
  relativeWeightPct: current ? current.relativeWeightPct : 0,
132
152
  currentWeekEmission: current ? current.gaugeEmission : "0",
153
+ currentWeekDepositedSoFar: current ? current.depositedSoFar : "0",
133
154
  epochs,
134
155
  };
135
156
  };
@@ -0,0 +1,40 @@
1
+ import { Provider } from "ethers";
2
+ import { ChainId } from "../../../configs/chains";
3
+ export interface ClaimableExtraReward {
4
+ token: string;
5
+ symbol: string;
6
+ decimals: number;
7
+ /** Claimable amount, base units. */
8
+ amount: bigint;
9
+ /** Claimable amount, formatted to `decimals`. */
10
+ formatted: string;
11
+ }
12
+ export interface UserClaimableRewards {
13
+ gauge: string;
14
+ /** RAAC already accrued to the user inside the gauge (gauge.pendingRewards). */
15
+ inGauge: bigint;
16
+ /** The user's pro-rata share of RAAC still sitting in the distributor for this gauge
17
+ * (deposited but not yet pulled in via a claim). */
18
+ inDistributor: bigint;
19
+ /** Total claimable RAAC = inGauge + inDistributor, base units. */
20
+ raac: bigint;
21
+ /** Total claimable RAAC, formatted (18 decimals). */
22
+ raacFormatted: string;
23
+ /** Extra reward tokens claimable by the user. */
24
+ extras: ClaimableExtraReward[];
25
+ }
26
+ /**
27
+ * The user's TRUE claimable rewards on a gauge.
28
+ *
29
+ * The gauge's `pendingRewards()` view only reflects RAAC already pulled into the gauge.
30
+ * RAAC emitted to the gauge sits in the GaugeRewardsDistributor until a claim pulls it in
31
+ * (`claimRewardToken`/`claimRewardsFor` call `_pullRewardsFromDistributor` first). So a
32
+ * user's real claimable also includes their working-balance share of the distributor's
33
+ * `getClaimableForGauge(gauge)`. This helper combines both, plus any extra reward tokens.
34
+ *
35
+ * @param chainId - The chain/network to use.
36
+ * @param gaugeAddressOrId - Address of the gauge contract or its config ID.
37
+ * @param accountAddress - Address of the user.
38
+ * @param provider - Optional ethers.js Provider instance.
39
+ */
40
+ export declare const getUserClaimableRewards: (chainId: ChainId, gaugeAddressOrId: string, accountAddress: string, provider?: Provider) => Promise<UserClaimableRewards>;
@@ -23,6 +23,7 @@ export * from "./getRaacAutolockMin";
23
23
  export * from "./getRawBalanceOf";
24
24
  export * from "./getRawTotalSupply";
25
25
  export * from "./getTotalSupply";
26
+ export * from "./getUserClaimableRewards";
26
27
  export * from "./getUserRewardTokenData";
27
28
  export * from "./getUserWeight";
28
29
  export * from "./isPaused";
@@ -3,8 +3,14 @@ import { ChainId } from "../../../configs/chains";
3
3
  export interface GaugeEpochEmission {
4
4
  /** Epoch (Unix-week) start timestamp, seconds. */
5
5
  epoch: number;
6
- /** Reward token deposited into the distributor for this epoch (formatted). */
6
+ /** System reward emission attributed to this epoch (formatted). For past epochs this
7
+ * is the actual deposited amount; for the in-progress epoch it is the FULL scheduled
8
+ * week emission (not the partial tick deposit). */
7
9
  deposited: string;
10
+ /** RAAC actually deposited into the distributor so far for this epoch (formatted).
11
+ * For the current epoch this grows via tick() during the week; for past epochs it
12
+ * equals `deposited`. */
13
+ depositedSoFar: string;
8
14
  /** Gauge relative weight at this epoch, 1e18-scaled (1e18 = 100%). */
9
15
  relativeWeight: bigint;
10
16
  /** Gauge relative weight as a percentage 0..100. */
@@ -12,7 +18,8 @@ export interface GaugeEpochEmission {
12
18
  /** RAAC this gauge received/was allocated for this epoch = deposited × relativeWeight. */
13
19
  gaugeEmission: string;
14
20
  gaugeEmissionRaw: bigint;
15
- /** True for the in-progress (current) epoch — `deposited` may still grow via tick(). */
21
+ /** True for the in-progress (current) epoch — `deposited` is the scheduled full-week
22
+ * total, while `depositedSoFar` is what has been ticked in so far. */
16
23
  isCurrent: boolean;
17
24
  /**
18
25
  * True for the upcoming (next) epoch preview. Nothing is deposited yet, so `deposited`
@@ -29,19 +36,25 @@ export interface GaugeEmissionsResult {
29
36
  weekSeconds: number;
30
37
  /** Current-epoch gauge relative weight as a percentage 0..100. */
31
38
  relativeWeightPct: number;
32
- /** RAAC allocated to this gauge for the current (in-progress) epoch. */
39
+ /** RAAC allocated to this gauge for the current (in-progress) epoch — the scheduled
40
+ * full-week total, deterministic from the emission schedule (not the tick deposit). */
33
41
  currentWeekEmission: string;
42
+ /** RAAC deposited into the distributor so far for the current epoch (tick-based). */
43
+ currentWeekDepositedSoFar: string;
34
44
  /** Per-epoch series, oldest → newest, ending at the current epoch. */
35
45
  epochs: GaugeEpochEmission[];
36
46
  }
37
47
  /**
38
- * Per-epoch emissions actually received by a gauge: the GaugeController snapshots
39
- * gauge weights per epoch, and the GaugeRewardsDistributor records the RAAC deposited
40
- * per epoch. A gauge's emission for an epoch is therefore
48
+ * Per-epoch emissions for a gauge. The GaugeController snapshots gauge weights per epoch
49
+ * and the GaugeRewardsDistributor records the RAAC deposited per epoch, so for a COMPLETED
50
+ * epoch a gauge's emission is:
41
51
  * depositedAtEpoch(epoch) × gaugeRelativeWeight(gauge, epoch).
42
52
  *
43
- * Returns a series ending at the current (in-progress) epoch so callers can chart
44
- * "week of X this gauge received Y RAAC".
53
+ * For the in-progress epoch, `depositedAtEpoch` only reflects what has been ticked in so
54
+ * far and keeps growing through the week which is misleading. Since the emission schedule
55
+ * already determines the full week's emission, the current (and upcoming) epoch instead use
56
+ * scheduledWeekEmission(epoch) × gaugeRelativeWeight(gauge, epoch)
57
+ * where scheduledWeekEmission = minter.calculateScheduledMintableAmount(week) × distributorShare.
45
58
  *
46
59
  * @param chainId - The chain/network to use.
47
60
  * @param gauge - Gauge address (or config key).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raac/rpc",
3
- "version": "1.2.0-beta.8",
3
+ "version": "1.2.0-beta.9",
4
4
  "description": "RPC Library for RAAC",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types/index.d.ts",