Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jorbuedo committed Nov 15, 2024
1 parent 1d7a651 commit 51ea966
Show file tree
Hide file tree
Showing 78 changed files with 85 additions and 12,467 deletions.
8 changes: 4 additions & 4 deletions packages/swap/src/adapters/api/muesliswap/api-maker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {transformersMaker} from './transformers'
import {estimateCalculation} from './calculations'

export type MuesliswapApiConfig = {
frontendFeeTiers: ReadonlyArray<App.FrontendFeeTier>
lpTokenHeld?: number
frontendFeeTiers?: ReadonlyArray<App.FrontendFeeTier>
getLpTokensHeld?: () => number
addressHex: string
address: string
primaryTokenInfo: Portfolio.Token.Info
Expand All @@ -29,7 +29,7 @@ export const muesliswapApiMaker = (
): Readonly<Swap.Api> => {
const {
frontendFeeTiers,
lpTokenHeld,
getLpTokensHeld = () => 0,
stakingKey,
addressHex,
primaryTokenInfo,
Expand Down Expand Up @@ -198,7 +198,7 @@ export const muesliswapApiMaker = (
body,
primaryTokenInfo,
frontendFeeTiers,
lpTokenHeld,
getLpTokensHeld(),
),
},
},
Expand Down
14 changes: 8 additions & 6 deletions packages/swap/src/adapters/api/muesliswap/calculations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const estimateCalculation = (
pools: Pools,
estimate: Swap.EstimateRequest,
primaryTokenInfo: Portfolio.Token.Info,
frontendFeeTiers: ReadonlyArray<App.FrontendFeeTier>,
frontendFeeTiers?: ReadonlyArray<App.FrontendFeeTier>,
lpTokenHeld?: number,
): Swap.EstimateResponse => {
const totalInSupply = pools.reduce(
Expand Down Expand Up @@ -116,11 +116,13 @@ export const estimateCalculation = (
)

// TODO check units
const frontendFee = getFrontendFee({
ptAmount,
frontendFeeTiers,
lpTokenHeld,
})
const frontendFee = frontendFeeTiers
? getFrontendFee({
ptAmount,
frontendFeeTiers,
lpTokenHeld,
})
: 0

const aggregatorFee = 0

Expand Down
10 changes: 0 additions & 10 deletions packages/swap/src/adapters/intl/number-locale.mocks.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Portfolio} from '@yoroi/types'
import {ceilDivision} from '../../../utils/ceilDivision'

export const getLiquidityProviderFee = (
poolFee: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {Swap} from '@yoroi/types'
import {Provider} from '../adapters/api/muesliswap/types'

export const getPoolUrlByProvider = (provider: Swap.PoolProvider): string => {
export const getPoolUrlByProvider = (provider: Provider): string => {
return (poolUrls[provider] ?? poolUrls.muesliswap_v1) as string
}

const poolUrls: Record<Swap.PoolProvider, string> = {
const poolUrls: Record<Provider, string> = {
minswap: 'https://minswap.org',
sundaeswap: 'https://sundae.fi',
wingriders: 'https://www.wingriders.com',
Expand Down
Loading

0 comments on commit 51ea966

Please sign in to comment.