@glowlabs-org/utils 0.2.137 → 0.2.139

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/index.js CHANGED
@@ -15,7 +15,7 @@ var viem = require('viem');
15
15
  var merkletreejs = require('merkletreejs');
16
16
  var ethers = require('ethers');
17
17
  var Decimal = require('decimal.js');
18
- var farmsRouter = require('./farms-router-BFFs_D4v.js');
18
+ var farmsRouter = require('./farms-router-D1kQ7pOC.js');
19
19
 
20
20
  const GENESIS_TIMESTAMP = 1700352000;
21
21
 
@@ -278,7 +278,7 @@ export interface SponsoredFarm {
278
278
  certifiedInstallerId: string | null;
279
279
  kwhCapacity: string;
280
280
  solarPanelsQuantity: number;
281
- adjustedWeeklyCarbonCredits: string;
281
+ expectedWeeklyCarbonCredits: string;
282
282
  protocolDepositUSDC6Decimals: string;
283
283
  protocolDepositPaidAmount: string;
284
284
  protocolDepositPaidCurrency: string;
@@ -400,7 +400,7 @@ export interface WalletFarmInfo {
400
400
  location: string;
401
401
  kwhCapacity: string;
402
402
  solarPanelsQuantity: number;
403
- adjustedWeeklyCarbonCredits: string;
403
+ expectedWeeklyCarbonCredits: string;
404
404
  protocolDepositPaidAmount: string;
405
405
  protocolDepositPaidCurrency: string;
406
406
  builtEpoch: number;
@@ -420,7 +420,7 @@ export interface EstimateRewardScoreParams {
420
420
  sponsorSplitPercent: number;
421
421
  protocolDepositAmount: string;
422
422
  paymentCurrency: PaymentCurrency;
423
- adjustedWeeklyCarbonCredits: number;
423
+ expectedWeeklyCarbonCredits: number;
424
424
  regionId: number;
425
425
  }
426
426
  export interface RewardScoreResponse {
@@ -1,5 +1,5 @@
1
- import { T as TRANSFER_TYPES } from './farms-router-C1WmJIpM.js';
2
- export { C as ControlRouter, D as DECIMALS_BY_TOKEN, i as FORWARDER_ABI, F as FarmsRouter, d as ForwarderError, l as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, c as KICKSTARTER_STATUS, K as KickstarterRouter, M as MAX_WEIGHT, j as OFFCHAIN_FRACTIONS_ABI, O as OFF_CHAIN_PAYMENT_CURRENCIES, e as OffchainFractionsError, P as PAYMENT_CURRENCIES, b as REGIONS, R as RegionRouter, S as STAKING_DIRECTIONS, U as USDG_WEIGHT_DECIMAL_PRECISION, W as WalletsRouter, f as allRegions, h as countries, k as getAddresses, r as regionMetadata, g as usStates, u as useForwarder, a as useOffchainFractions } from './farms-router-C1WmJIpM.js';
1
+ import { T as TRANSFER_TYPES } from './farms-router-9XHw3u2N.js';
2
+ export { C as ControlRouter, D as DECIMALS_BY_TOKEN, i as FORWARDER_ABI, F as FarmsRouter, d as ForwarderError, l as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, c as KICKSTARTER_STATUS, K as KickstarterRouter, M as MAX_WEIGHT, j as OFFCHAIN_FRACTIONS_ABI, O as OFF_CHAIN_PAYMENT_CURRENCIES, e as OffchainFractionsError, P as PAYMENT_CURRENCIES, b as REGIONS, R as RegionRouter, S as STAKING_DIRECTIONS, U as USDG_WEIGHT_DECIMAL_PRECISION, W as WalletsRouter, f as allRegions, h as countries, k as getAddresses, r as regionMetadata, g as usStates, u as useForwarder, a as useOffchainFractions } from './farms-router-9XHw3u2N.js';
3
3
  import { verifyTypedData, checksumAddress } from 'viem';
4
4
  import 'ethers';
5
5
 
@@ -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";
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";
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>;
@@ -245,7 +245,7 @@ const ERC20_ABI = [
245
245
 
246
246
  // Contract-specific addresses
247
247
  const mainnetAddresses = {
248
- AUDIT_FEE_WALLET: "0x3ff5af3333ddc6048d98849ec5e67868494693c9",
248
+ AUDIT_FEE_WALLET: "0x3ff5af3333ddc6048d98849ec5e67868494693c9", //aka GVE wallet
249
249
  IMPACT_CATALYST: "0x552Fbb4E0269fd5036daf72Ec006AAF6C958F4Fa",
250
250
  USDG_REDEMPTION: "0x1c2cA537757e1823400F857EdBe72B55bbAe0F08",
251
251
  USDG: "0xe010ec500720bE9EF3F82129E7eD2Ee1FB7955F2",
@@ -253,14 +253,15 @@ const mainnetAddresses = {
253
253
  USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
254
254
  USDG_UNISWAP: "0xe010ec500720bE9EF3F82129E7eD2Ee1FB7955F2",
255
255
  GLW_UNISWAP: "0xf4fbC617A5733EAAF9af08E1Ab816B103388d8B6",
256
- FORWARDER: "0xD487240a9Cc032Dc5CC092F2Bbe2C19aCD583eef",
257
- OFFCHAIN_FRACTIONS: "0x1Eca5C4391f10097C3232a0672e83c60A7dab7cD", // TODO: change to mainnet address
258
- COUNTERFACTUAL_HOLDER_FACTORY: "0x52ad78446eb4066F729034825cE9765997C297a7", // TODO: change to mainnet address
256
+ FORWARDER: "0x1519a8fE33acf8C164578789629146278541506A",
257
+ OFFCHAIN_FRACTIONS: "0x80EA852448c2807BeAe321deC7c603990209F7db",
258
+ COUNTERFACTUAL_HOLDER_FACTORY: "0x5bB7eC88cA80146FF47019079Cf0330532A1157F",
259
259
  FOUNDATION_HUB_MANAGER_WALLET: "0x5252FdA14A149c01EA5A1D6514a9c1369E4C70b4", // TODO: change to mainnet address
260
- FOUNDATION_WALLET: "0xc5174BBf649a92F9941e981af68AaA14Dd814F85", // TODO: change to mainnet address
261
- FOUNDATION_REWARDS_WALLET: "0x5252FdA14A149c01EA5A1D6514a9c1369E4C70b4", // TODO: change to mainnet address
260
+ FOUNDATION_WALLET: "0x77040BbBD506F5e5a7D65f6917416Bae6C78B9fa",
261
+ FOUNDATION_REWARDS_WALLET: "0x6972B05A0c80064fBE8a10CBc2a2FBCF6fb47D6a",
262
262
  UNISWAP_V2_ROUTER: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
263
263
  UNISWAP_V2_FACTORY: "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
264
+ ENDOWMENT_WALLET: "0x868D99B4a6e81b4683D10ea5665f13579A9d1607",
264
265
  };
265
266
  const sepoliaAddresses = {
266
267
  AUDIT_FEE_WALLET: "0x3ff5af3333ddc6048d98849ec5e67868494693c9",
@@ -279,6 +280,7 @@ const sepoliaAddresses = {
279
280
  FOUNDATION_REWARDS_WALLET: "0x5252FdA14A149c01EA5A1D6514a9c1369E4C70b4",
280
281
  UNISWAP_V2_ROUTER: "0xeE567Fe1712Faf6149d80dA1E6934E354124CfE3",
281
282
  UNISWAP_V2_FACTORY: "0xF62c03E08ada871A0bEb309762E260a7a6a880E6",
283
+ ENDOWMENT_WALLET: "0x868D99B4a6e81b4683D10ea5665f13579A9d1607",
282
284
  };
283
285
  const getAddresses = (CHAIN_ID) => {
284
286
  switch (CHAIN_ID) {
@@ -545,7 +547,7 @@ function useForwarder(signer, CHAIN_ID) {
545
547
  throw new Error(`Unsupported currency for forwarding: ${currency}`);
546
548
  }
547
549
  // Determine sendToCounterfactualWallet based on currency
548
- const sendToCounterfactualWallet = currency === "GLW" || currency === "USDG";
550
+ const sendToCounterfactualWallet = true;
549
551
  // Run a static call first to surface any revert reason (ethers v6)
550
552
  try {
551
553
  if (!isAuditFees && currency === "USDC") {
@@ -739,8 +741,6 @@ function useForwarder(signer, CHAIN_ID) {
739
741
  }
740
742
  // Construct the appropriate message for this forward type
741
743
  const message = constructForwardMessage(params);
742
- // Determine sendToCounterfactualWallet based on currency
743
- const sendToCounterfactualWallet = currency === "GLW" || currency === "USDG";
744
744
  // Get token address
745
745
  let tokenAddress;
746
746
  switch (currency) {
@@ -764,12 +764,12 @@ function useForwarder(signer, CHAIN_ID) {
764
764
  const estimatedGas = !isAuditFees && currency === "USDC"
765
765
  ? await forwarderContract
766
766
  .getFunction("swapUSDCAndForwardUSDG")
767
- .estimateGas(amount, ADDRESSES.FOUNDATION_WALLET, sendToCounterfactualWallet, message)
767
+ .estimateGas(amount, ADDRESSES.FOUNDATION_WALLET, true, message)
768
768
  : await forwarderContract
769
769
  .getFunction("forward")
770
770
  .estimateGas(tokenAddress, isAuditFees
771
771
  ? ADDRESSES.AUDIT_FEE_WALLET
772
- : ADDRESSES.FOUNDATION_WALLET, amount, sendToCounterfactualWallet, message);
772
+ : ADDRESSES.FOUNDATION_WALLET, amount, true, message);
773
773
  const estimatedCost = estimatedGas * gasPrice;
774
774
  if (ethPriceInUSD) {
775
775
  const estimatedCostInEth = formatEther(estimatedCost);
@@ -3695,4 +3695,4 @@ function FarmsRouter(baseUrl) {
3695
3695
  }
3696
3696
 
3697
3697
  export { ControlRouter as C, DECIMALS_BY_TOKEN as D, FarmsRouter as F, GLOW_WEIGHT_DECIMAL_PRECISION as G, HUB_URL as H, KickstarterRouter as K, MAX_WEIGHT as M, OFF_CHAIN_PAYMENT_CURRENCIES as O, PAYMENT_CURRENCIES as P, RegionRouter as R, STAKING_DIRECTIONS as S, TRANSFER_TYPES as T, USDG_WEIGHT_DECIMAL_PRECISION as U, WalletsRouter as W, useOffchainFractions as a, REGIONS as b, KICKSTARTER_STATUS as c, ForwarderError as d, OffchainFractionsError as e, allRegions as f, usStates as g, countries as h, FORWARDER_ABI as i, OFFCHAIN_FRACTIONS_ABI as j, getAddresses as k, GCA_URLS as l, regionMetadata as r, useForwarder as u };
3698
- //# sourceMappingURL=farms-router-C1WmJIpM.js.map
3698
+ //# sourceMappingURL=farms-router-9XHw3u2N.js.map