Skip to content

Commit

Permalink
use 61166 as eth and set as base currency (#4555)
Browse files Browse the repository at this point in the history
  • Loading branch information
wraeth-eth authored Dec 7, 2024
1 parent ba88fc7 commit ac4ac32
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/packages/v4/models/v4CurrencyOption.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// same as v2v3 for now (@todo: make V4 specific)
export type V4CurrencyETH = 1
export type V4CurrencyUSD = 2
// TODO: This is for backward compatibility - correct token codes are listed as comments
export type V4CurrencyETH = 1 // TODO: 61166
export type V4CurrencyUSD = 2 // TODO: 1
export type V4CurrencyOption = V4CurrencyETH | V4CurrencyUSD
29 changes: 18 additions & 11 deletions src/packages/v4/utils/currency.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
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
// TODO: This is for backward compatibility - correct token codes are listed as comments
export const V4_CURRENCY_ETH: V4CurrencyETH = 1 // TODO: 61166
export const V4_CURRENCY_USD: V4CurrencyUSD = 2 // TODO: 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 { BASE_CURRENCY_ETH } from './shared/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: BASE_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 { BASE_CURRENCY_ETH } from './shared/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: BASE_CURRENCY_ETH,
pausePay: fundingCycleMetadata.pausePay,
pauseRedeem: fundingCycleMetadata.pauseRedeem,
pauseCreditTransfers: Boolean(fundingCycleMetadata.global.pauseTransfers),
Expand Down
1 change: 1 addition & 0 deletions src/packages/v4/utils/shared/currency.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const BASE_CURRENCY_ETH = 61166

0 comments on commit ac4ac32

Please sign in to comment.