From d91cd154319d725df91c88b9e812fe822af420e3 Mon Sep 17 00:00:00 2001 From: Wraeth Date: Thu, 5 Dec 2024 15:23:54 +1000 Subject: [PATCH] use 61166 as eth and set as base currency --- src/packages/v4/models/v4CurrencyOption.ts | 5 ++-- src/packages/v4/utils/currency.ts | 28 +++++++++++-------- src/packages/v4/utils/editRuleset.ts | 3 +- .../v4/utils/launchProjectTransformers.ts | 3 +- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/packages/v4/models/v4CurrencyOption.ts b/src/packages/v4/models/v4CurrencyOption.ts index 3f8b85a472..6b1c057e57 100644 --- a/src/packages/v4/models/v4CurrencyOption.ts +++ b/src/packages/v4/models/v4CurrencyOption.ts @@ -1,4 +1,3 @@ -// same as v2v3 for now (@todo: make V4 specific) -export type V4CurrencyETH = 1 -export type V4CurrencyUSD = 2 +export type V4CurrencyETH = 61166 +export type V4CurrencyUSD = 1 export type V4CurrencyOption = V4CurrencyETH | V4CurrencyUSD diff --git a/src/packages/v4/utils/currency.ts b/src/packages/v4/utils/currency.ts index e7bad5d225..870597afa7 100644 --- a/src/packages/v4/utils/currency.ts +++ b/src/packages/v4/utils/currency.ts @@ -1,16 +1,22 @@ -import { CURRENCY_METADATA, CurrencyMetadata, CurrencyName } from "constants/currency" -import { V4CurrencyETH, V4CurrencyOption, V4CurrencyUSD } from "../models/v4CurrencyOption" +import { + CURRENCY_METADATA, + CurrencyMetadata, + CurrencyName, +} from 'constants/currency' +import { + V4CurrencyETH, + V4CurrencyOption, + V4CurrencyUSD, +} from '../models/v4CurrencyOption' -export const V4_CURRENCY_ETH: V4CurrencyETH = 1 -export const V4_CURRENCY_USD: V4CurrencyUSD = 2 +export const V4_CURRENCY_ETH: V4CurrencyETH = 61166 +export const V4_CURRENCY_USD: V4CurrencyUSD = 1 -export const V4_CURRENCY_METADATA: Record< - V4CurrencyOption, - CurrencyMetadata -> = { - [V4_CURRENCY_ETH]: CURRENCY_METADATA.ETH, - [V4_CURRENCY_USD]: CURRENCY_METADATA.USD, -} +export const V4_CURRENCY_METADATA: Record = + { + [V4_CURRENCY_ETH]: CURRENCY_METADATA.ETH, + [V4_CURRENCY_USD]: CURRENCY_METADATA.USD, + } export const V4CurrencyName = ( currency?: V4CurrencyOption, diff --git a/src/packages/v4/utils/editRuleset.ts b/src/packages/v4/utils/editRuleset.ts index 38f28dbd09..9a987278f7 100644 --- a/src/packages/v4/utils/editRuleset.ts +++ b/src/packages/v4/utils/editRuleset.ts @@ -4,6 +4,7 @@ import { issuanceRateFrom } from 'packages/v2v3/utils/math' import { parseWad } from 'utils/format/formatNumber' import { otherUnitToSeconds } from 'utils/format/formatTime' import { EditCycleFormFields } from '../views/V4ProjectSettings/EditCyclePage/EditCycleFormFields' +import { V4_CURRENCY_ETH } from './currency' export function transformEditCycleFormFieldsToTxArgs({ formValues, @@ -38,7 +39,7 @@ export function transformEditCycleFormFieldsToTxArgs({ metadata: { reservedPercent: formValues.reservedPercent * 100, redemptionRate: formValues.redemptionRate * 100, - baseCurrency: 1, // Assuming base currency is a constant value, typically USD + baseCurrency: V4_CURRENCY_ETH, pausePay: formValues.pausePay, pauseRedeem: false, // Defaulting this value since it's not in formValues pauseCreditTransfers: !formValues.tokenTransfers, diff --git a/src/packages/v4/utils/launchProjectTransformers.ts b/src/packages/v4/utils/launchProjectTransformers.ts index 0effb3028b..3ff3e4f690 100644 --- a/src/packages/v4/utils/launchProjectTransformers.ts +++ b/src/packages/v4/utils/launchProjectTransformers.ts @@ -17,6 +17,7 @@ import { Address } from 'viem' import { FundAccessLimitGroup } from '../models/fundAccessLimits' import { GroupedSplits as V4GroupedSplits } from '../models/splits' import { LaunchProjectJBTerminal } from '../models/terminals' +import { V4_CURRENCY_ETH } from './currency' export type LaunchV2V3ProjectArgs = [ string, // _owner @@ -100,7 +101,7 @@ export function transformFCMetadataToRulesetMetadata({ return { reservedPercent: fundingCycleMetadata.reservedRate.toNumber(), redemptionRate: fundingCycleMetadata.redemptionRate.toNumber(), - baseCurrency: 1, // Not present in v2v3, passing 1 by default + baseCurrency: V4_CURRENCY_ETH, pausePay: fundingCycleMetadata.pausePay, pauseRedeem: fundingCycleMetadata.pauseRedeem, pauseCreditTransfers: Boolean(fundingCycleMetadata.global.pauseTransfers),