levr-sdk 0.2.2 → 0.3.0
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/dist/esm/abis/ClankerAirdropV2.js +289 -0
- package/dist/esm/abis/ClankerVault.js +215 -0
- package/dist/esm/abis/LevrFactory_v1.js +23 -0
- package/dist/esm/abis/LevrFeeSplitterFactory_v1.js +197 -0
- package/dist/esm/abis/LevrFeeSplitter_v1.js +544 -0
- package/dist/esm/abis/LevrGovernor_v1.js +10 -0
- package/dist/esm/abis/index.js +4 -0
- package/dist/esm/airdrop.js +160 -0
- package/dist/esm/airdrop.js.map +1 -0
- package/dist/esm/build-calldatas-v4.js +3 -1
- package/dist/esm/build-calldatas-v4.js.map +1 -1
- package/dist/esm/build-clanker-v4.js +75 -25
- package/dist/esm/build-clanker-v4.js.map +1 -1
- package/dist/esm/client/hook/index.js +10 -0
- package/dist/esm/client/hook/index.js.map +1 -1
- package/dist/esm/client/hook/use-airdrop.js +8 -4
- package/dist/esm/client/hook/use-airdrop.js.map +1 -1
- package/dist/esm/client/hook/use-configure-splits.js +43 -0
- package/dist/esm/client/hook/use-configure-splits.js.map +1 -0
- package/dist/esm/client/hook/use-deploy.js +3 -3
- package/dist/esm/client/hook/use-deploy.js.map +1 -1
- package/dist/esm/client/hook/use-factory.js +33 -0
- package/dist/esm/client/hook/use-factory.js.map +1 -0
- package/dist/esm/client/hook/use-fee-receivers.js +3 -2
- package/dist/esm/client/hook/use-fee-receivers.js.map +1 -1
- package/dist/esm/client/hook/use-governance.js +18 -3
- package/dist/esm/client/hook/use-governance.js.map +1 -1
- package/dist/esm/client/hook/use-project.js +7 -3
- package/dist/esm/client/hook/use-project.js.map +1 -1
- package/dist/esm/client/hook/use-proposal.js +11 -5
- package/dist/esm/client/hook/use-proposal.js.map +1 -1
- package/dist/esm/client/hook/use-stake.js +1 -1
- package/dist/esm/client/hook/use-stake.js.map +1 -1
- package/dist/esm/client/hook/use-vault.js +67 -0
- package/dist/esm/client/hook/use-vault.js.map +1 -0
- package/dist/esm/client/levr-provider.js +18 -2
- package/dist/esm/client/levr-provider.js.map +1 -1
- package/dist/esm/client/query-keys.js +13 -1
- package/dist/esm/client/query-keys.js.map +1 -1
- package/dist/esm/constants.js +83 -6
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/deploy-v4.js +56 -3
- package/dist/esm/deploy-v4.js.map +1 -1
- package/dist/esm/factory.js +94 -0
- package/dist/esm/factory.js.map +1 -0
- package/dist/esm/fee-receivers.js +265 -4
- package/dist/esm/fee-receivers.js.map +1 -1
- package/dist/esm/fee-splitter.js +68 -0
- package/dist/esm/fee-splitter.js.map +1 -0
- package/dist/esm/governance.js +86 -9
- package/dist/esm/governance.js.map +1 -1
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/ipfs-merkle-tree.js +130 -0
- package/dist/esm/ipfs-merkle-tree.js.map +1 -0
- package/dist/esm/project.js +114 -26
- package/dist/esm/project.js.map +1 -1
- package/dist/esm/schema/levr.schema.js +94 -33
- package/dist/esm/schema/levr.schema.js.map +1 -1
- package/dist/esm/stake.js +157 -19
- package/dist/esm/stake.js.map +1 -1
- package/dist/esm/vault.js +136 -0
- package/dist/esm/vault.js.map +1 -0
- package/dist/types/abis/ClankerAirdropV2.d.ts +573 -0
- package/dist/types/abis/ClankerVault.d.ts +407 -0
- package/dist/types/abis/LevrFactory_v1.d.ts +18 -0
- package/dist/types/abis/LevrFeeSplitterFactory_v1.d.ts +149 -0
- package/dist/types/abis/LevrFeeSplitter_v1.d.ts +422 -0
- package/dist/types/abis/LevrGovernor_v1.d.ts +8 -0
- package/dist/types/abis/index.d.ts +4 -0
- package/dist/types/airdrop.d.ts +18 -0
- package/dist/types/airdrop.d.ts.map +1 -0
- package/dist/types/build-calldatas-v4.d.ts +3 -0
- package/dist/types/build-calldatas-v4.d.ts.map +1 -1
- package/dist/types/build-clanker-v4.d.ts +6 -1
- package/dist/types/build-clanker-v4.d.ts.map +1 -1
- package/dist/types/client/hook/index.d.ts +10 -0
- package/dist/types/client/hook/index.d.ts.map +1 -1
- package/dist/types/client/hook/use-airdrop.d.ts +3 -1
- package/dist/types/client/hook/use-airdrop.d.ts.map +1 -1
- package/dist/types/client/hook/use-configure-splits.d.ts +17 -0
- package/dist/types/client/hook/use-configure-splits.d.ts.map +1 -0
- package/dist/types/client/hook/use-deploy.d.ts +21 -14
- package/dist/types/client/hook/use-deploy.d.ts.map +1 -1
- package/dist/types/client/hook/use-factory.d.ts +34 -0
- package/dist/types/client/hook/use-factory.d.ts.map +1 -0
- package/dist/types/client/hook/use-fee-receivers.d.ts +1 -1
- package/dist/types/client/hook/use-fee-receivers.d.ts.map +1 -1
- package/dist/types/client/hook/use-governance.d.ts +18 -2
- package/dist/types/client/hook/use-governance.d.ts.map +1 -1
- package/dist/types/client/hook/use-project.d.ts +169 -1
- package/dist/types/client/hook/use-project.d.ts.map +1 -1
- package/dist/types/client/hook/use-proposal.d.ts +3 -2
- package/dist/types/client/hook/use-proposal.d.ts.map +1 -1
- package/dist/types/client/hook/use-vault.d.ts +13 -0
- package/dist/types/client/hook/use-vault.d.ts.map +1 -0
- package/dist/types/client/levr-provider.d.ts +15 -1
- package/dist/types/client/levr-provider.d.ts.map +1 -1
- package/dist/types/client/query-keys.d.ts +13 -1
- package/dist/types/client/query-keys.d.ts.map +1 -1
- package/dist/types/constants.d.ts +59 -1
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/deploy-v4.d.ts +3 -1
- package/dist/types/deploy-v4.d.ts.map +1 -1
- package/dist/types/factory.d.ts +21 -0
- package/dist/types/factory.d.ts.map +1 -0
- package/dist/types/fee-receivers.d.ts +1822 -1
- package/dist/types/fee-receivers.d.ts.map +1 -1
- package/dist/types/fee-splitter.d.ts +23 -0
- package/dist/types/fee-splitter.d.ts.map +1 -0
- package/dist/types/governance.d.ts +18 -2
- package/dist/types/governance.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/ipfs-merkle-tree.d.ts +72 -0
- package/dist/types/ipfs-merkle-tree.d.ts.map +1 -0
- package/dist/types/project.d.ts +10 -2
- package/dist/types/project.d.ts.map +1 -1
- package/dist/types/proposal.d.ts +16 -0
- package/dist/types/proposal.d.ts.map +1 -1
- package/dist/types/schema/levr.schema.d.ts +16 -4
- package/dist/types/schema/levr.schema.d.ts.map +1 -1
- package/dist/types/stake.d.ts +33 -2
- package/dist/types/stake.d.ts.map +1 -1
- package/dist/types/vault.d.ts +70 -0
- package/dist/types/vault.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/esm/treasury.js +0 -90
- package/dist/esm/treasury.js.map +0 -1
- package/dist/types/treasury.d.ts +0 -11
- package/dist/types/treasury.d.ts.map +0 -1
package/dist/esm/governance.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { decodeEventLog, parseUnits } from "viem";
|
|
2
|
-
import { IClankerAirdrop, LevrGovernor_v1 } from "./abis/index.js";
|
|
1
|
+
import { decodeEventLog, encodeFunctionData, parseUnits } from "viem";
|
|
2
|
+
import { IClankerAirdrop, LevrForwarder_v1, LevrGovernor_v1 } from "./abis/index.js";
|
|
3
3
|
import { GET_CLANKER_AIRDROP_ADDRESS } from "./constants.js";
|
|
4
4
|
export class Governance {
|
|
5
5
|
wallet;
|
|
@@ -148,27 +148,29 @@ export class Governance {
|
|
|
148
148
|
args: [parsedProposalId, voterAddress],
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
async claimAirdrop(
|
|
151
|
+
async claimAirdrop(recipient) {
|
|
152
152
|
const chainId = this.publicClient.chain?.id;
|
|
153
153
|
const airdropAddress = GET_CLANKER_AIRDROP_ADDRESS(chainId);
|
|
154
154
|
if (!airdropAddress) {
|
|
155
155
|
throw new Error(`No airdrop address found for chain ID ${chainId}`);
|
|
156
156
|
}
|
|
157
|
-
if (
|
|
158
|
-
throw new Error(
|
|
157
|
+
if (recipient.error) {
|
|
158
|
+
throw new Error(recipient.error);
|
|
159
159
|
}
|
|
160
|
-
if (!
|
|
160
|
+
if (!recipient.isAvailable) {
|
|
161
161
|
throw new Error("No airdrop available to claim");
|
|
162
162
|
}
|
|
163
|
+
// Ensure proof is properly typed as bytes32[] (even if empty)
|
|
164
|
+
const proofArray = recipient.proof && recipient.proof.length > 0 ? recipient.proof : [];
|
|
163
165
|
const hash = await this.wallet.writeContract({
|
|
164
166
|
address: airdropAddress,
|
|
165
167
|
abi: IClankerAirdrop,
|
|
166
168
|
functionName: "claim",
|
|
167
169
|
args: [
|
|
168
170
|
this.project.token.address,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
recipient.address,
|
|
172
|
+
recipient.allocatedAmount.raw,
|
|
173
|
+
proofArray,
|
|
172
174
|
],
|
|
173
175
|
chain: this.wallet.chain,
|
|
174
176
|
});
|
|
@@ -178,5 +180,80 @@ export class Governance {
|
|
|
178
180
|
}
|
|
179
181
|
return receipt;
|
|
180
182
|
}
|
|
183
|
+
async claimAirdropBatch(recipients) {
|
|
184
|
+
const chainId = this.publicClient.chain?.id;
|
|
185
|
+
const airdropAddress = GET_CLANKER_AIRDROP_ADDRESS(chainId);
|
|
186
|
+
if (!airdropAddress) {
|
|
187
|
+
throw new Error(`No airdrop address found for chain ID ${chainId}`);
|
|
188
|
+
}
|
|
189
|
+
// Handle single recipient with direct call (bypass forwarder/multicall)
|
|
190
|
+
if (recipients.length === 1) {
|
|
191
|
+
const recipient = recipients[0];
|
|
192
|
+
if (recipient.error) {
|
|
193
|
+
throw new Error(recipient.error);
|
|
194
|
+
}
|
|
195
|
+
if (!recipient.isAvailable) {
|
|
196
|
+
throw new Error("No airdrop available to claim");
|
|
197
|
+
}
|
|
198
|
+
const proofArray = recipient.proof && recipient.proof.length > 0 ? recipient.proof : [];
|
|
199
|
+
const hash = await this.wallet.writeContract({
|
|
200
|
+
address: airdropAddress,
|
|
201
|
+
abi: IClankerAirdrop,
|
|
202
|
+
functionName: "claim",
|
|
203
|
+
args: [
|
|
204
|
+
this.project.token.address,
|
|
205
|
+
recipient.address,
|
|
206
|
+
recipient.allocatedAmount.raw,
|
|
207
|
+
proofArray,
|
|
208
|
+
],
|
|
209
|
+
chain: this.wallet.chain,
|
|
210
|
+
});
|
|
211
|
+
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
212
|
+
if (receipt.status === "reverted") {
|
|
213
|
+
throw new Error(`Claim airdrop transaction reverted: ${hash}`);
|
|
214
|
+
}
|
|
215
|
+
return receipt;
|
|
216
|
+
}
|
|
217
|
+
// Handle multiple recipients with multicall + forwarder wrapper
|
|
218
|
+
const callDataArray = recipients.map((recipient) => {
|
|
219
|
+
// Ensure proof is properly typed as bytes32[] (even if empty)
|
|
220
|
+
const proofArray = recipient.proof && recipient.proof.length > 0 ? recipient.proof : [];
|
|
221
|
+
// Encode the claim call
|
|
222
|
+
const claimCallData = encodeFunctionData({
|
|
223
|
+
abi: IClankerAirdrop,
|
|
224
|
+
functionName: "claim",
|
|
225
|
+
args: [
|
|
226
|
+
this.project.token.address,
|
|
227
|
+
recipient.address,
|
|
228
|
+
recipient.allocatedAmount.raw,
|
|
229
|
+
proofArray,
|
|
230
|
+
],
|
|
231
|
+
});
|
|
232
|
+
// Wrap via executeTransaction of the forwarder
|
|
233
|
+
return {
|
|
234
|
+
target: this.project.forwarder,
|
|
235
|
+
allowFailure: false,
|
|
236
|
+
value: 0n,
|
|
237
|
+
callData: encodeFunctionData({
|
|
238
|
+
abi: LevrForwarder_v1,
|
|
239
|
+
functionName: "executeTransaction",
|
|
240
|
+
args: [airdropAddress, claimCallData],
|
|
241
|
+
}),
|
|
242
|
+
};
|
|
243
|
+
});
|
|
244
|
+
// Execute all wrapped claims in a single multicall transaction
|
|
245
|
+
const hash = await this.wallet.writeContract({
|
|
246
|
+
address: this.project.forwarder,
|
|
247
|
+
abi: LevrForwarder_v1,
|
|
248
|
+
functionName: "executeMulticall",
|
|
249
|
+
args: [callDataArray],
|
|
250
|
+
chain: this.wallet.chain,
|
|
251
|
+
});
|
|
252
|
+
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
253
|
+
if (receipt.status === "reverted") {
|
|
254
|
+
throw new Error(`Claim airdrop batch transaction reverted: ${hash}`);
|
|
255
|
+
}
|
|
256
|
+
return receipt;
|
|
257
|
+
}
|
|
181
258
|
}
|
|
182
259
|
//# sourceMappingURL=governance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governance.js","sourceRoot":"","sources":["../../src/governance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"governance.js","sourceRoot":"","sources":["../../src/governance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAGrE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAC3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AA2DzD,MAAM,OAAO,UAAU;IACb,MAAM,CAAiB;IACvB,YAAY,CAAiB;IAC7B,OAAO,CAAS;IAExB,YAAY,MAAwB;QAClC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAA;QAEpF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;QAC3B,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAA;QACvC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;IAC/B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,eAAe,CACnB,SAAwB,EACxB,MAAgC,EAChC,WAAmB;QAEnB,M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AC/B,GAAG,EAAE,gBAAgB;YACrB,YAAY,EAAE,kBAAkB;YAChC,IAAI,EAAE,CAAC,aAAa,CAAC;YACrB,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;SACzB,CAAC,CAAA;QAEF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,yBAAyB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;QAE3E,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,6CAA6C,IAAI,EAAE,CAAC,CAAA;QACtE,CAAC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;CACF"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
export * from "./abis/index.js";
|
|
2
|
+
export * from "./airdrop.js";
|
|
2
3
|
export * from "./balance.js";
|
|
3
4
|
export * from "./build-calldatas-v4.js";
|
|
4
5
|
export * from "./build-clanker-v4.js";
|
|
5
6
|
export * from "./constants.js";
|
|
6
7
|
export * from "./deploy-v4.js";
|
|
8
|
+
export * from "./factory.js";
|
|
7
9
|
export * from "./fee-receivers.js";
|
|
10
|
+
export * from "./fee-splitter.js";
|
|
8
11
|
export * from "./governance.js";
|
|
12
|
+
export * from "./ipfs-merkle-tree.js";
|
|
9
13
|
export * from "./pool.js";
|
|
10
14
|
export * from "./pool-key.js";
|
|
11
15
|
export * from "./project.js";
|
|
@@ -14,9 +18,9 @@ export * from "./quote/index.js";
|
|
|
14
18
|
export * from "./schema/index.js";
|
|
15
19
|
export * from "./stake.js";
|
|
16
20
|
export * from "./swap-v4.js";
|
|
17
|
-
export * from "./treasury.js";
|
|
18
21
|
export * from "./types.js";
|
|
19
22
|
export * from "./usd-price.js";
|
|
20
23
|
export * from "./user.js";
|
|
21
24
|
export * from "./util.js";
|
|
25
|
+
export * from "./vault.js";
|
|
22
26
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IPFS Merkle Tree Storage Utilities
|
|
3
|
+
* Stores and retrieves merkle tree data for airdrops using IPFS
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Generates a consistent key for storing merkle tree data
|
|
7
|
+
* Format: chainId-tokenAddress
|
|
8
|
+
*/
|
|
9
|
+
export function getMerkleTreeKey(tokenAddress, chainId) {
|
|
10
|
+
return `${chainId}-${tokenAddress.toLowerCase()}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Stores merkle tree data to IPFS via API proxy
|
|
14
|
+
* @param params Storage parameters
|
|
15
|
+
* @returns The IPFS CID where the data was stored
|
|
16
|
+
*/
|
|
17
|
+
export async function storeMerkleTreeToIPFS(params) {
|
|
18
|
+
const { tokenAddress, chainId, treeData, ipfsJsonUploadUrl, lockupEndTime, lockupDuration } = params;
|
|
19
|
+
const key = getMerkleTreeKey(tokenAddress, chainId);
|
|
20
|
+
const payload = {
|
|
21
|
+
format: 'standard-v1',
|
|
22
|
+
tree: treeData,
|
|
23
|
+
metadata: {
|
|
24
|
+
lockupEndTime,
|
|
25
|
+
lockupDuration,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const response = await fetch(ipfsJsonUploadUrl, {
|
|
29
|
+
method: 'POST',
|
|
30
|
+
headers: {
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
},
|
|
33
|
+
body: JSON.stringify({
|
|
34
|
+
data: payload,
|
|
35
|
+
metadata: {
|
|
36
|
+
name: `merkle-tree-${key}`,
|
|
37
|
+
keyValues: {
|
|
38
|
+
tokenAddress: tokenAddress.toLowerCase(),
|
|
39
|
+
chainId: chainId.toString(),
|
|
40
|
+
type: 'airdrop-merkle-tree',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
if (!response.ok) {
|
|
46
|
+
const error = await response.text();
|
|
47
|
+
throw new Error(`Failed to store merkle tree to IPFS: ${error}`);
|
|
48
|
+
}
|
|
49
|
+
const result = await response.json();
|
|
50
|
+
return result.cid;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Retrieves merkle tree data from IPFS by searching for it using metadata
|
|
54
|
+
* @param params Retrieval parameters
|
|
55
|
+
* @returns The merkle tree data with metadata or null if not found
|
|
56
|
+
*/
|
|
57
|
+
export async function retrieveMerkleTreeFromIPFS(params) {
|
|
58
|
+
const { tokenAddress, chainId, ipfsSearchUrl, ipfsJsonUrl } = params;
|
|
59
|
+
try {
|
|
60
|
+
const searchUrl = `${ipfsSearchUrl}?tokenAddress=${tokenAddress.toLowerCase()}&chainId=${chainId}`;
|
|
61
|
+
// Search for the CID using Pinata metadata query
|
|
62
|
+
const searchResponse = await fetch(searchUrl);
|
|
63
|
+
if (!searchResponse.ok) {
|
|
64
|
+
const errorText = await searchResponse.text();
|
|
65
|
+
console.warn('[IPFS] Failed to search for merkle tree on IPFS:', errorText);
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const result = await searchResponse.json();
|
|
69
|
+
const { cid } = result;
|
|
70
|
+
if (!cid) {
|
|
71
|
+
console.warn('[IPFS] No CID found for this token. Was the token deployed with ipfsJsonUploadUrl?');
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
// Fetch the merkle tree data using the CID
|
|
75
|
+
return await fetchMerkleTreeByCID(cid, ipfsJsonUrl);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
console.error('[IPFS] Error retrieving merkle tree from IPFS:', error);
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Fetches merkle tree data by CID
|
|
84
|
+
* @param cid The IPFS CID
|
|
85
|
+
* @param ipfsJsonUrl Full URL to /api/ipfs-json endpoint
|
|
86
|
+
*/
|
|
87
|
+
export async function fetchMerkleTreeByCID(cid, ipfsJsonUrl) {
|
|
88
|
+
try {
|
|
89
|
+
const fetchUrl = `${ipfsJsonUrl}?cid=${cid}`;
|
|
90
|
+
const response = await fetch(fetchUrl);
|
|
91
|
+
if (!response.ok) {
|
|
92
|
+
const errorText = await response.text();
|
|
93
|
+
console.warn(`[IPFS] Failed to fetch merkle tree from IPFS: ${errorText}`);
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const data = await response.json();
|
|
97
|
+
// Return tree data with metadata attached
|
|
98
|
+
const treeWithMetadata = {
|
|
99
|
+
...data.tree,
|
|
100
|
+
metadata: data.metadata,
|
|
101
|
+
};
|
|
102
|
+
return treeWithMetadata;
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
console.error('[IPFS] Error fetching merkle tree from IPFS:', error);
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Helper function to get CID for a token by searching IPFS
|
|
111
|
+
* @param tokenAddress Token address
|
|
112
|
+
* @param chainId Chain ID
|
|
113
|
+
* @param ipfsSearchUrl Full URL to /api/ipfs-search endpoint
|
|
114
|
+
* @returns CID if found, null otherwise
|
|
115
|
+
*/
|
|
116
|
+
export async function getCIDForToken(tokenAddress, chainId, ipfsSearchUrl) {
|
|
117
|
+
try {
|
|
118
|
+
const searchResponse = await fetch(`${ipfsSearchUrl}?tokenAddress=${tokenAddress.toLowerCase()}&chainId=${chainId}`);
|
|
119
|
+
if (!searchResponse.ok) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
const { cid } = await searchResponse.json();
|
|
123
|
+
return cid || null;
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
console.error('Error fetching CID:', error);
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=ipfs-merkle-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipfs-merkle-tree.js","sourceRoot":"","sources":["../../src/ipfs-merkle-tree.ts"],"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
|
|
|
2
2
|
import { IClankerToken, LevrFactory_v1, LevrGovernor_v1, LevrStaking_v1 } from "./abis/index.js";
|
|
3
3
|
import { formatBalanceWithUsd } from "./balance.js";
|
|
4
4
|
import { GET_FACTORY_ADDRESS, WETH } from "./constants.js";
|
|
5
|
-
import { getFeeReceiverContracts, parseFeeReceivers } from "./fee-receivers.js";
|
|
5
|
+
import { getFeeReceiverContracts, getFeeSplitterDynamicContracts, getFeeSplitterStaticContracts, parseFeeReceivers, parseFeeSplitterDynamic, parseFeeSplitterStatic, } from "./fee-receivers.js";
|
|
6
|
+
import { getFeeSplitter } from "./fee-splitter.js";
|
|
6
7
|
import { getUsdPrice, getWethUsdPrice } from "./usd-price.js";
|
|
7
8
|
// ---
|
|
8
9
|
// Contract Getters
|
|
@@ -50,8 +51,8 @@ function getFactoryContracts(factoryAddress, clankerToken) {
|
|
|
50
51
|
},
|
|
51
52
|
];
|
|
52
53
|
}
|
|
53
|
-
function getTreasuryContracts(clankerToken, treasury, staking) {
|
|
54
|
-
|
|
54
|
+
function getTreasuryContracts(clankerToken, treasury, staking, wethAddress) {
|
|
55
|
+
const contracts = [
|
|
55
56
|
{
|
|
56
57
|
address: clankerToken,
|
|
57
58
|
abi: erc20Abi,
|
|
@@ -65,6 +66,15 @@ function getTreasuryContracts(clankerToken, treasury, staking) {
|
|
|
65
66
|
args: [staking],
|
|
66
67
|
},
|
|
67
68
|
];
|
|
69
|
+
if (wethAddress) {
|
|
70
|
+
contracts.push({
|
|
71
|
+
address: wethAddress,
|
|
72
|
+
abi: erc20Abi,
|
|
73
|
+
functionName: "balanceOf",
|
|
74
|
+
args: [staking],
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return contracts;
|
|
68
78
|
}
|
|
69
79
|
function getGovernanceContracts(governor) {
|
|
70
80
|
return [
|
|
@@ -185,10 +195,11 @@ function parseFactoryData(results) {
|
|
|
185
195
|
forwarder: forwarder.result,
|
|
186
196
|
};
|
|
187
197
|
}
|
|
188
|
-
function parseTreasuryStats(results, tokenDecimals, totalSupply, tokenUsdPrice) {
|
|
189
|
-
const [treasuryBalance, stakingBalance] = results;
|
|
198
|
+
function parseTreasuryStats(results, tokenDecimals, totalSupply, tokenUsdPrice, wethUsdPrice) {
|
|
199
|
+
const [treasuryBalance, stakingBalance, stakingWethBalance] = results;
|
|
190
200
|
const treasuryBalanceRaw = treasuryBalance.result;
|
|
191
201
|
const stakingBalanceRaw = stakingBalance.result;
|
|
202
|
+
const stakingWethBalanceRaw = stakingWethBalance ? stakingWethBalance.result : null;
|
|
192
203
|
// Total allocated = treasury + staking balances (protocol-controlled tokens)
|
|
193
204
|
const totalAllocatedRaw = treasuryBalanceRaw + stakingBalanceRaw;
|
|
194
205
|
// Utilization = (total allocated / total supply) * 100
|
|
@@ -198,19 +209,23 @@ function parseTreasuryStats(results, tokenDecimals, totalSupply, tokenUsdPrice)
|
|
|
198
209
|
balance: formatBalanceWithUsd(treasuryBalanceRaw, tokenDecimals, tokenUsdPrice),
|
|
199
210
|
totalAllocated: formatBalanceWithUsd(totalAllocatedRaw, tokenDecimals, tokenUsdPrice),
|
|
200
211
|
utilization,
|
|
212
|
+
stakingContractBalance: formatBalanceWithUsd(stakingBalanceRaw, tokenDecimals, tokenUsdPrice),
|
|
213
|
+
stakingContractWethBalance: stakingWethBalanceRaw
|
|
214
|
+
? formatBalanceWithUsd(stakingWethBalanceRaw, 18, wethUsdPrice ?? null)
|
|
215
|
+
: undefined,
|
|
201
216
|
};
|
|
202
217
|
}
|
|
203
218
|
function parseGovernanceData(results) {
|
|
204
219
|
const [currentCycleId, boostCount, transferCount] = results;
|
|
205
220
|
return {
|
|
206
|
-
currentCycleId: currentCycleId.result,
|
|
221
|
+
currentCycleId: currentCycleId.result === 0n ? 1n : currentCycleId.result,
|
|
207
222
|
activeProposalCount: {
|
|
208
223
|
boost: boostCount.result,
|
|
209
224
|
transfer: transferCount.result,
|
|
210
225
|
},
|
|
211
226
|
};
|
|
212
227
|
}
|
|
213
|
-
function parseStakingStats(results, tokenDecimals, tokenUsdPrice, wethUsdPrice, pricing) {
|
|
228
|
+
function parseStakingStats(results, tokenDecimals, tokenUsdPrice, wethUsdPrice, blockTimestamp, pricing, feeSplitterPending) {
|
|
214
229
|
const totalStakedRaw = results[0].result;
|
|
215
230
|
const aprBpsRaw = results[1].result;
|
|
216
231
|
const outstandingRewardsTokenRaw = results[2].result;
|
|
@@ -244,9 +259,19 @@ function parseStakingStats(results, tokenDecimals, tokenUsdPrice, wethUsdPrice,
|
|
|
244
259
|
};
|
|
245
260
|
}
|
|
246
261
|
}
|
|
247
|
-
// Calculate if stream is active
|
|
248
|
-
const
|
|
249
|
-
|
|
262
|
+
// Calculate if stream is active using blockchain timestamp
|
|
263
|
+
const isStreamActive = streamStartRaw <= blockTimestamp && blockTimestamp <= streamEndRaw;
|
|
264
|
+
// When fee splitter is active, ADD both fee splitter's pending AND staking's pending
|
|
265
|
+
// (hybrid setup: fee splitter gets some %, staking gets rest % directly from ClankerFeeLocker)
|
|
266
|
+
// When fee splitter is NOT active, use only staking's pending from ClankerFeeLocker
|
|
267
|
+
const tokenPendingTotal = feeSplitterPending
|
|
268
|
+
? feeSplitterPending.token + outstandingRewardsTokenRaw[1] // ADD both portions
|
|
269
|
+
: outstandingRewardsTokenRaw[1]; // Use staking's pending (it's the only recipient)
|
|
270
|
+
const wethPendingTotal = feeSplitterPending?.weth !== undefined
|
|
271
|
+
? (feeSplitterPending.weth ?? 0n) + (outstandingRewardsWethRaw?.[1] ?? 0n) // ADD both portions
|
|
272
|
+
: outstandingRewardsWethRaw
|
|
273
|
+
? outstandingRewardsWethRaw[1] // Use staking's pending (it's the only recipient)
|
|
274
|
+
: null;
|
|
250
275
|
return {
|
|
251
276
|
totalStaked: formatBalanceWithUsd(totalStakedRaw, tokenDecimals, tokenUsdPrice),
|
|
252
277
|
apr: {
|
|
@@ -259,12 +284,12 @@ function parseStakingStats(results, tokenDecimals, tokenUsdPrice, wethUsdPrice,
|
|
|
259
284
|
outstandingRewards: {
|
|
260
285
|
staking: {
|
|
261
286
|
available: formatBalanceWithUsd(outstandingRewardsTokenRaw[0], tokenDecimals, tokenUsdPrice),
|
|
262
|
-
pending: formatBalanceWithUsd(
|
|
287
|
+
pending: formatBalanceWithUsd(tokenPendingTotal, tokenDecimals, tokenUsdPrice),
|
|
263
288
|
},
|
|
264
289
|
weth: outstandingRewardsWethRaw
|
|
265
290
|
? {
|
|
266
291
|
available: formatBalanceWithUsd(outstandingRewardsWethRaw[0], 18, wethUsdPrice),
|
|
267
|
-
pending: formatBalanceWithUsd(
|
|
292
|
+
pending: formatBalanceWithUsd(wethPendingTotal ?? 0n, 18, wethUsdPrice),
|
|
268
293
|
}
|
|
269
294
|
: null,
|
|
270
295
|
},
|
|
@@ -308,21 +333,31 @@ export async function getProjects({ publicClient, offset = 0, limit = 50, }) {
|
|
|
308
333
|
total: Number(total),
|
|
309
334
|
};
|
|
310
335
|
}
|
|
336
|
+
// Track contracts and their mapping per project for correct result parsing
|
|
337
|
+
const contractsPerProject = [];
|
|
311
338
|
// Build contract calls for all projects (token data + treasury balances)
|
|
312
|
-
const contracts = projectsData.flatMap((projectInfo) =>
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
339
|
+
const contracts = projectsData.flatMap((projectInfo) => {
|
|
340
|
+
const tokenContracts = getTokenContracts(projectInfo.clankerToken);
|
|
341
|
+
const treasuryContracts = getTreasuryContracts(projectInfo.clankerToken, projectInfo.project.treasury, projectInfo.project.staking, undefined);
|
|
342
|
+
contractsPerProject.push({
|
|
343
|
+
tokenCount: tokenContracts.length,
|
|
344
|
+
treasuryCount: treasuryContracts.length,
|
|
345
|
+
});
|
|
346
|
+
return [...tokenContracts, ...treasuryContracts];
|
|
347
|
+
});
|
|
316
348
|
const results = await publicClient.multicall({ contracts });
|
|
317
349
|
// Parse results into Project objects
|
|
318
350
|
const projects = [];
|
|
319
|
-
|
|
351
|
+
let currentOffset = 0;
|
|
320
352
|
for (let i = 0; i < projectsData.length; i++) {
|
|
321
353
|
const projectInfo = projectsData[i];
|
|
322
|
-
const
|
|
354
|
+
const tokenCount = contractsPerProject[i].tokenCount;
|
|
355
|
+
const treasuryCount = contractsPerProject[i].treasuryCount;
|
|
323
356
|
// Extract results for this project
|
|
324
|
-
const tokenResults = results.slice(
|
|
325
|
-
|
|
357
|
+
const tokenResults = results.slice(currentOffset, currentOffset + tokenCount);
|
|
358
|
+
currentOffset += tokenCount;
|
|
359
|
+
const treasuryResults = results.slice(currentOffset, currentOffset + treasuryCount);
|
|
360
|
+
currentOffset += treasuryCount;
|
|
326
361
|
// Parse using our type-safe parsers
|
|
327
362
|
const tokenData = parseTokenData(tokenResults, projectInfo.clankerToken);
|
|
328
363
|
const treasuryStats = parseTreasuryStats(treasuryResults, tokenData.decimals, tokenData.totalSupply, null // No pricing for list view
|
|
@@ -357,17 +392,25 @@ export async function getStaticProject({ publicClient, clankerToken, userAddress
|
|
|
357
392
|
const factoryAddress = GET_FACTORY_ADDRESS(chainId);
|
|
358
393
|
if (!factoryAddress)
|
|
359
394
|
throw new Error("Factory address not found");
|
|
360
|
-
//
|
|
395
|
+
// Get deployed fee splitter for this token (if exists)
|
|
396
|
+
const feeSplitterAddress = await getFeeSplitter({
|
|
397
|
+
publicClient,
|
|
398
|
+
clankerToken,
|
|
399
|
+
chainId,
|
|
400
|
+
});
|
|
401
|
+
// Build contract calls including tokenRewards and fee splitter static in the same multicall
|
|
361
402
|
const contracts = [
|
|
362
403
|
...getTokenContracts(clankerToken),
|
|
363
404
|
...getFactoryContracts(factoryAddress, clankerToken),
|
|
364
405
|
...getFeeReceiverContracts(clankerToken, chainId),
|
|
406
|
+
...(feeSplitterAddress ? getFeeSplitterStaticContracts(clankerToken, feeSplitterAddress) : []),
|
|
365
407
|
];
|
|
366
408
|
const multicallResults = await publicClient.multicall({ contracts });
|
|
367
409
|
// Calculate slice indices for each data group
|
|
368
410
|
const tokenCount = 5;
|
|
369
411
|
const factoryCount = 2;
|
|
370
412
|
const tokenRewardsCount = 1;
|
|
413
|
+
const feeSplitterStaticCount = feeSplitterAddress ? 3 : 0;
|
|
371
414
|
let idx = 0;
|
|
372
415
|
const tokenResults = multicallResults.slice(idx, idx + tokenCount);
|
|
373
416
|
idx += tokenCount;
|
|
@@ -375,6 +418,10 @@ export async function getStaticProject({ publicClient, clankerToken, userAddress
|
|
|
375
418
|
idx += factoryCount;
|
|
376
419
|
const tokenRewardsResult = multicallResults[idx];
|
|
377
420
|
idx += tokenRewardsCount;
|
|
421
|
+
const feeSplitterStaticResults = feeSplitterAddress
|
|
422
|
+
? multicallResults.slice(idx, idx + feeSplitterStaticCount)
|
|
423
|
+
: null;
|
|
424
|
+
idx += feeSplitterStaticCount;
|
|
378
425
|
// Parse results using individual parsers
|
|
379
426
|
const tokenData = parseTokenData(tokenResults, clankerToken);
|
|
380
427
|
const factoryData = parseFactoryData(factoryResults);
|
|
@@ -398,6 +445,14 @@ export async function getStaticProject({ publicClient, clankerToken, userAddress
|
|
|
398
445
|
feeReceivers = parseFeeReceivers(tokenRewards, userAddress);
|
|
399
446
|
}
|
|
400
447
|
// If tokenRewards fails (e.g., token not deployed through Clanker), poolInfo remains undefined
|
|
448
|
+
// Parse fee splitter static data
|
|
449
|
+
let feeSplitter;
|
|
450
|
+
if (feeSplitterStaticResults) {
|
|
451
|
+
// Get current fee recipient from fee receivers (if user is admin)
|
|
452
|
+
const currentFeeRecipient = feeReceivers?.find((fr) => fr.areYouAnAdmin)?.recipient;
|
|
453
|
+
const parsed = parseFeeSplitterStatic(feeSplitterStaticResults, currentFeeRecipient, feeSplitterAddress);
|
|
454
|
+
feeSplitter = parsed ?? undefined;
|
|
455
|
+
}
|
|
401
456
|
return {
|
|
402
457
|
treasury: factoryData.treasury,
|
|
403
458
|
governor: factoryData.governor,
|
|
@@ -408,6 +463,7 @@ export async function getStaticProject({ publicClient, clankerToken, userAddress
|
|
|
408
463
|
token: tokenData,
|
|
409
464
|
pool: poolInfo,
|
|
410
465
|
feeReceivers,
|
|
466
|
+
feeSplitter,
|
|
411
467
|
};
|
|
412
468
|
}
|
|
413
469
|
/**
|
|
@@ -424,6 +480,9 @@ export async function getProject({ publicClient, staticProject, oraclePublicClie
|
|
|
424
480
|
throw new Error("Chain ID not found on public client");
|
|
425
481
|
const wethAddress = WETH(chainId)?.address;
|
|
426
482
|
const clankerToken = staticProject.token.address;
|
|
483
|
+
// Use fee splitter from staticProject (already fetched in getStaticProject)
|
|
484
|
+
const feeSplitterAddress = staticProject.feeSplitter?.address;
|
|
485
|
+
const rewardTokens = wethAddress ? [clankerToken, wethAddress] : [clankerToken];
|
|
427
486
|
// Fetch pricing data if oracle client is provided and pool exists
|
|
428
487
|
let pricing;
|
|
429
488
|
if (oraclePublicClient && staticProject.pool) {
|
|
@@ -450,29 +509,56 @@ export async function getProject({ publicClient, staticProject, oraclePublicClie
|
|
|
450
509
|
console.warn("Failed to fetch USD pricing:", error);
|
|
451
510
|
}
|
|
452
511
|
}
|
|
453
|
-
//
|
|
512
|
+
// Get current block timestamp for accurate stream status
|
|
513
|
+
const block = await publicClient.getBlock();
|
|
514
|
+
const blockTimestamp = block.timestamp;
|
|
515
|
+
// Fetch only dynamic data (treasury, governance, staking stats, and fee splitter dynamic)
|
|
454
516
|
const contracts = [
|
|
455
|
-
...getTreasuryContracts(clankerToken, staticProject.treasury, staticProject.staking),
|
|
517
|
+
...getTreasuryContracts(clankerToken, staticProject.treasury, staticProject.staking, wethAddress),
|
|
456
518
|
...getGovernanceContracts(staticProject.governor),
|
|
457
519
|
...getStakingContracts(staticProject.staking, clankerToken, wethAddress),
|
|
520
|
+
...(feeSplitterAddress && staticProject.feeSplitter?.isActive
|
|
521
|
+
? getFeeSplitterDynamicContracts(clankerToken, feeSplitterAddress, rewardTokens)
|
|
522
|
+
: []),
|
|
458
523
|
];
|
|
459
524
|
const results = await publicClient.multicall({ contracts });
|
|
460
525
|
// Calculate slice indices for dynamic data
|
|
461
|
-
const treasuryCount = 2;
|
|
526
|
+
const treasuryCount = wethAddress ? 3 : 2;
|
|
462
527
|
const governanceCount = 3; // currentCycleId + 2 activeProposalCount calls
|
|
463
528
|
const stakingCount = wethAddress ? 9 : 7; // Added 3 stream-related calls
|
|
529
|
+
const feeSplitterDynamicCount = feeSplitterAddress && staticProject.feeSplitter?.isActive ? rewardTokens.length : 0;
|
|
464
530
|
let idx = 0;
|
|
465
531
|
const treasuryResults = results.slice(idx, idx + treasuryCount);
|
|
466
532
|
idx += treasuryCount;
|
|
467
533
|
const governanceResults = results.slice(idx, idx + governanceCount);
|
|
468
534
|
idx += governanceCount;
|
|
469
535
|
const stakingResults = results.slice(idx, idx + stakingCount);
|
|
536
|
+
idx += stakingCount;
|
|
537
|
+
const feeSplitterDynamicResults = feeSplitterDynamicCount > 0 ? results.slice(idx, idx + feeSplitterDynamicCount) : null;
|
|
470
538
|
// Calculate USD values for stats if pricing is available
|
|
471
539
|
const tokenUsdPrice = pricing ? parseFloat(pricing.tokenUsd) : null;
|
|
472
540
|
const wethUsdPrice = pricing ? parseFloat(pricing.wethUsd) : null;
|
|
541
|
+
// Parse fee splitter dynamic data first (needed for staking stats)
|
|
542
|
+
let feeSplitter = staticProject.feeSplitter;
|
|
543
|
+
let feeSplitterPendingFees;
|
|
544
|
+
if (feeSplitterDynamicResults && staticProject.feeSplitter) {
|
|
545
|
+
const feeSplitterDynamic = parseFeeSplitterDynamic(feeSplitterDynamicResults, wethAddress);
|
|
546
|
+
feeSplitter = {
|
|
547
|
+
...staticProject.feeSplitter,
|
|
548
|
+
...feeSplitterDynamic,
|
|
549
|
+
};
|
|
550
|
+
// Extract pending fees to add to outstanding rewards
|
|
551
|
+
// When using fee splitter, fees in LP locker should show as "pending" in outstanding rewards
|
|
552
|
+
if (staticProject.feeSplitter.isActive && feeSplitterDynamic.pendingFees) {
|
|
553
|
+
feeSplitterPendingFees = {
|
|
554
|
+
token: feeSplitterDynamic.pendingFees.token,
|
|
555
|
+
weth: feeSplitterDynamic.pendingFees.weth ?? null,
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
}
|
|
473
559
|
// Parse treasury and staking stats using individual parsers
|
|
474
|
-
const treasuryStats = parseTreasuryStats(treasuryResults, staticProject.token.decimals, staticProject.token.totalSupply, tokenUsdPrice);
|
|
475
|
-
const stakingStats = parseStakingStats(stakingResults, staticProject.token.decimals, tokenUsdPrice, wethUsdPrice, pricing);
|
|
560
|
+
const treasuryStats = parseTreasuryStats(treasuryResults, staticProject.token.decimals, staticProject.token.totalSupply, tokenUsdPrice, wethUsdPrice);
|
|
561
|
+
const stakingStats = parseStakingStats(stakingResults, staticProject.token.decimals, tokenUsdPrice, wethUsdPrice, blockTimestamp, pricing, feeSplitterPendingFees);
|
|
476
562
|
const governanceStats = parseGovernanceData(governanceResults);
|
|
477
563
|
return {
|
|
478
564
|
chainId,
|
|
@@ -481,6 +567,8 @@ export async function getProject({ publicClient, staticProject, oraclePublicClie
|
|
|
481
567
|
stakingStats,
|
|
482
568
|
governanceStats,
|
|
483
569
|
pricing,
|
|
570
|
+
feeSplitter,
|
|
571
|
+
blockTimestamp,
|
|
484
572
|
};
|
|
485
573
|
}
|
|
486
574
|
//# sourceMappingURL=project.js.map
|