@glowlabs-org/utils 0.2.164 → 0.2.166
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/cjs/browser.js +1 -1
- package/dist/cjs/{calculate-farm-efficiency-DIL_hKMo.js → calculate-farm-efficiency-DabpqtXj.js} +8 -3
- package/dist/cjs/calculate-farm-efficiency-DabpqtXj.js.map +1 -0
- package/dist/cjs/constants/addresses.d.ts +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/lib/types/index.d.ts +6 -0
- package/dist/esm/browser.js +2 -2
- package/dist/esm/{calculate-farm-efficiency-VRzMgQmC.js → calculate-farm-efficiency-HjxTADsE.js} +8 -3
- package/dist/esm/calculate-farm-efficiency-HjxTADsE.js.map +1 -0
- package/dist/esm/constants/addresses.d.ts +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/lib/types/index.d.ts +6 -0
- package/package.json +1 -1
- package/src/constants/addresses.ts +4 -1
- package/src/lib/hooks/use-offchain-fractions.ts +5 -2
- package/src/lib/types/index.ts +6 -0
- package/dist/cjs/calculate-farm-efficiency-DIL_hKMo.js.map +0 -1
- package/dist/esm/calculate-farm-efficiency-VRzMgQmC.js.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type ContractKeys = "USDC" | "FORWARDER" | "FOUNDATION_WALLET" | "GLW" | "USDG" | "USDG_REDEMPTION" | "IMPACT_CATALYST" | "AUDIT_FEE_WALLET" | "UNISWAP_V2_ROUTER" | "UNISWAP_V2_FACTORY" | "USDG_UNISWAP" | "GLW_UNISWAP" | "OFFCHAIN_FRACTIONS" | "COUNTERFACTUAL_HOLDER_FACTORY" | "FOUNDATION_HUB_MANAGER_WALLET" | "FOUNDATION_REWARDS_WALLET" | "ENDOWMENT_WALLET" | "REWARDS_KERNEL";
|
|
1
|
+
export type ContractKeys = "USDC" | "FORWARDER" | "FOUNDATION_WALLET" | "GLW" | "USDG" | "USDG_REDEMPTION" | "IMPACT_CATALYST" | "AUDIT_FEE_WALLET" | "UNISWAP_V2_ROUTER" | "UNISWAP_V2_FACTORY" | "USDG_UNISWAP" | "GLW_UNISWAP" | "OFFCHAIN_FRACTIONS" | "COUNTERFACTUAL_HOLDER_FACTORY" | "FOUNDATION_HUB_MANAGER_WALLET" | "FOUNDATION_REWARDS_WALLET" | "ENDOWMENT_WALLET" | "REWARDS_KERNEL" | "FOUNDATION_HOT_WALLET_PD";
|
|
2
2
|
export declare const getAddresses: (CHAIN_ID: number) => Record<ContractKeys, `0x${string}`>;
|
|
3
3
|
export declare const DECIMALS_BY_TOKEN: Record<"USDC" | "USDG" | "GCTL" | "SGCTL" | "GLW", number>;
|
package/dist/esm/index.js
CHANGED
|
@@ -13,8 +13,8 @@ import { parseUnits, formatUnits } from 'viem';
|
|
|
13
13
|
import { MerkleTree } from 'merkletreejs';
|
|
14
14
|
import { solidityPackedKeccak256, keccak256 } from 'ethers';
|
|
15
15
|
import Decimal from 'decimal.js';
|
|
16
|
-
import { H as HUB_URL, U as USDG_WEIGHT_DECIMAL_PRECISION, G as GLOW_WEIGHT_DECIMAL_PRECISION, M as MAX_WEIGHT } from './calculate-farm-efficiency-
|
|
17
|
-
export { C as ControlRouter, F as FarmsRouter, e as KICKSTARTER_STATUS, K as KickstarterRouter, O as OFF_CHAIN_PAYMENT_CURRENCIES, P as PAYMENT_CURRENCIES, d as REGIONS, R as RegionRouter, S as STAKING_DIRECTIONS, T as TRANSFER_TYPES, W as WalletsRouter, f as calculateFarmEfficiency, c as configureSentry, u as useForwarder, a as useOffchainFractions, b as useRewardsKernel } from './calculate-farm-efficiency-
|
|
16
|
+
import { H as HUB_URL, U as USDG_WEIGHT_DECIMAL_PRECISION, G as GLOW_WEIGHT_DECIMAL_PRECISION, M as MAX_WEIGHT } from './calculate-farm-efficiency-HjxTADsE.js';
|
|
17
|
+
export { C as ControlRouter, F as FarmsRouter, e as KICKSTARTER_STATUS, K as KickstarterRouter, O as OFF_CHAIN_PAYMENT_CURRENCIES, P as PAYMENT_CURRENCIES, d as REGIONS, R as RegionRouter, S as STAKING_DIRECTIONS, T as TRANSFER_TYPES, W as WalletsRouter, f as calculateFarmEfficiency, c as configureSentry, u as useForwarder, a as useOffchainFractions, b as useRewardsKernel } from './calculate-farm-efficiency-HjxTADsE.js';
|
|
18
18
|
|
|
19
19
|
const GENESIS_TIMESTAMP = 1700352000;
|
|
20
20
|
|
|
@@ -711,6 +711,8 @@ export interface TosStatusResponse {
|
|
|
711
711
|
}
|
|
712
712
|
export interface FarmEfficiencyScore {
|
|
713
713
|
farmId: string;
|
|
714
|
+
name: string;
|
|
715
|
+
builtEpoch: number;
|
|
714
716
|
efficiencyScore: number;
|
|
715
717
|
protocolDepositUsd6: string;
|
|
716
718
|
weeklyImpactAssetsWad: string;
|
|
@@ -730,6 +732,8 @@ export interface FarmWeeklyRewardsBatchQuery {
|
|
|
730
732
|
}
|
|
731
733
|
export interface FarmWeeklyRewardsBatchResult {
|
|
732
734
|
regionId: number;
|
|
735
|
+
builtAt: string;
|
|
736
|
+
builtEpoch: number;
|
|
733
737
|
summary: FarmWeeklyRewardsSummary;
|
|
734
738
|
rewards: FarmWeeklyReward[];
|
|
735
739
|
}
|
|
@@ -743,6 +747,8 @@ export interface WalletFarmReward {
|
|
|
743
747
|
farmId: string;
|
|
744
748
|
farmName: string;
|
|
745
749
|
regionId: number;
|
|
750
|
+
builtAt: string;
|
|
751
|
+
builtEpoch: number;
|
|
746
752
|
expectedWeeklyCarbonCredits: string;
|
|
747
753
|
protocolDepositUSDC6Decimals: string;
|
|
748
754
|
weekNumber: number;
|
package/package.json
CHANGED
|
@@ -16,7 +16,8 @@ export type ContractKeys =
|
|
|
16
16
|
| "FOUNDATION_HUB_MANAGER_WALLET"
|
|
17
17
|
| "FOUNDATION_REWARDS_WALLET"
|
|
18
18
|
| "ENDOWMENT_WALLET"
|
|
19
|
-
| "REWARDS_KERNEL"
|
|
19
|
+
| "REWARDS_KERNEL"
|
|
20
|
+
| "FOUNDATION_HOT_WALLET_PD";
|
|
20
21
|
|
|
21
22
|
// Contract-specific addresses
|
|
22
23
|
const mainnetAddresses: Record<ContractKeys, `0x${string}`> = {
|
|
@@ -38,6 +39,7 @@ const mainnetAddresses: Record<ContractKeys, `0x${string}`> = {
|
|
|
38
39
|
UNISWAP_V2_FACTORY: "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
|
|
39
40
|
ENDOWMENT_WALLET: "0x868D99B4a6e81b4683D10ea5665f13579A9d1607",
|
|
40
41
|
REWARDS_KERNEL: "0xd6d3139d40a32F8bA71D576c1A743529AB4786BB",
|
|
42
|
+
FOUNDATION_HOT_WALLET_PD: "0x465E5573c648BC50a11911Cd48D0e279F4409Ec8",
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
const sepoliaAddresses: Record<ContractKeys, `0x${string}`> = {
|
|
@@ -59,6 +61,7 @@ const sepoliaAddresses: Record<ContractKeys, `0x${string}`> = {
|
|
|
59
61
|
UNISWAP_V2_FACTORY: "0xF62c03E08ada871A0bEb309762E260a7a6a880E6",
|
|
60
62
|
ENDOWMENT_WALLET: "0x868D99B4a6e81b4683D10ea5665f13579A9d1607",
|
|
61
63
|
REWARDS_KERNEL: "0x92fcC4D8565062381d8fBD5Af1b32432104FDBC7",
|
|
64
|
+
FOUNDATION_HOT_WALLET_PD: "0x465E5573c648BC50a11911Cd48D0e279F4409Ec8",
|
|
62
65
|
};
|
|
63
66
|
|
|
64
67
|
export const getAddresses = (
|
|
@@ -173,7 +173,7 @@ export function useOffchainFractions(
|
|
|
173
173
|
address: tokenAddress as Address,
|
|
174
174
|
abi: ERC20_ABI,
|
|
175
175
|
functionName: "approve",
|
|
176
|
-
args: [ADDRESSES.OFFCHAIN_FRACTIONS as Address, amount],
|
|
176
|
+
args: [ADDRESSES.OFFCHAIN_FRACTIONS as Address, amount + 10000000n],
|
|
177
177
|
chain: walletClient.chain,
|
|
178
178
|
account: walletClient.account!,
|
|
179
179
|
});
|
|
@@ -382,7 +382,10 @@ export function useOffchainFractions(
|
|
|
382
382
|
address: fractionData.token as Address,
|
|
383
383
|
abi: ERC20_ABI,
|
|
384
384
|
functionName: "approve",
|
|
385
|
-
args: [
|
|
385
|
+
args: [
|
|
386
|
+
ADDRESSES.OFFCHAIN_FRACTIONS as Address,
|
|
387
|
+
requiredAmount + 10000000n,
|
|
388
|
+
],
|
|
386
389
|
chain: walletClient.chain,
|
|
387
390
|
account: walletClient.account!,
|
|
388
391
|
});
|
package/src/lib/types/index.ts
CHANGED
|
@@ -859,6 +859,8 @@ export interface TosStatusResponse {
|
|
|
859
859
|
// ----------------------------- Farm Efficiency Scores ------------------------
|
|
860
860
|
export interface FarmEfficiencyScore {
|
|
861
861
|
farmId: string;
|
|
862
|
+
name: string; // Farm name
|
|
863
|
+
builtEpoch: number; // Epoch when the farm was built
|
|
862
864
|
efficiencyScore: number;
|
|
863
865
|
protocolDepositUsd6: string;
|
|
864
866
|
weeklyImpactAssetsWad: string;
|
|
@@ -883,6 +885,8 @@ export interface FarmWeeklyRewardsBatchQuery {
|
|
|
883
885
|
|
|
884
886
|
export interface FarmWeeklyRewardsBatchResult {
|
|
885
887
|
regionId: number; // Region ID where the farm is located
|
|
888
|
+
builtAt: string; // ISO 8601 timestamp when the farm was built
|
|
889
|
+
builtEpoch: number; // Epoch number when the farm was built
|
|
886
890
|
summary: FarmWeeklyRewardsSummary;
|
|
887
891
|
rewards: FarmWeeklyReward[];
|
|
888
892
|
}
|
|
@@ -903,6 +907,8 @@ export interface WalletFarmReward {
|
|
|
903
907
|
farmId: string;
|
|
904
908
|
farmName: string;
|
|
905
909
|
regionId: number; // Region ID where the farm is located
|
|
910
|
+
builtAt: string; // ISO 8601 timestamp when the farm was built
|
|
911
|
+
builtEpoch: number; // Epoch number when the farm was built
|
|
906
912
|
expectedWeeklyCarbonCredits: string; // Decimal format
|
|
907
913
|
protocolDepositUSDC6Decimals: string; // 6 decimals
|
|
908
914
|
weekNumber: number;
|