Skip to content

Commit

Permalink
use 61166 as eth and set as base currency
Browse files Browse the repository at this point in the history
  • Loading branch information
wraeth-eth committed Dec 5, 2024
1 parent 99604b9 commit d91cd15
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
5 changes: 2 additions & 3 deletions src/packages/v4/models/v4CurrencyOption.ts
Original file line number Diff line number Diff line change
@@ -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
28 changes: 17 additions & 11 deletions src/packages/v4/utils/currency.ts
Original file line number Diff line number Diff line change
@@ -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<V4CurrencyOption, CurrencyMetadata> =
{
[V4_CURRENCY_ETH]: CURRENCY_METADATA.ETH,
[V4_CURRENCY_USD]: CURRENCY_METADATA.USD,
}

export const V4CurrencyName = (
currency?: V4CurrencyOption,
Expand Down
3 changes: 2 additions & 1 deletion src/packages/v4/utils/editRuleset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/packages/v4/utils/launchProjectTransformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit d91cd15

Please sign in to comment.