Skip to content

Commit

Permalink
fix: hyeth quotes for erc20's (#104)
Browse files Browse the repository at this point in the history
* fix: hyeth quotes for erc20's

* make test more robust
  • Loading branch information
janndriessen authored Dec 20, 2024
1 parent 56db38b commit f98524f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/quote/flashmint/hyeth/component-quotes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ export class ComponentQuotesProvider {
const amount = positions[index].toBigInt()

if (isAddressEqual(component, this.wethAddress)) {
quotePromises.push(Promise.resolve(amount))
if (
isAddressEqual(inputTokenAddress, this.wethAddress) ||
isAddressEqual(outputTokenAddress, this.wethAddress)
) {
quotePromises.push(Promise.resolve(amount))
}
}

if (this.isAcross(component)) {
Expand Down
15 changes: 14 additions & 1 deletion src/tests/hyeth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
TestFactory,
transferFromWhale,
wei,
wrapETH,
} from './utils'

describe('hyETH', () => {
Expand All @@ -31,6 +32,18 @@ describe('hyETH', () => {
await factory.executeTx()
})

test.skip('can mint with WETH', async () => {
const quote = await factory.fetchQuote({
isMinting: true,
inputToken: getTokenByChainAndSymbol(chainId, 'WETH'),
outputToken: indexToken,
indexTokenAmount: wei('3').toString(),
slippage: 0.5,
})
await wrapETH(quote.inputAmount, factory.getSigner(), chainId)
await factory.executeTx()
})

test.skip('can mint with ETH (large amout)', async () => {
await factory.fetchQuote({
isMinting: true,
Expand All @@ -42,7 +55,7 @@ describe('hyETH', () => {
await factory.executeTx()
})

test.skip('can mint with USDC', async () => {
test('can mint with USDC', async () => {
const quote = await factory.fetchQuote({
isMinting: true,
inputToken: usdc,
Expand Down
3 changes: 2 additions & 1 deletion src/utils/component-swap-data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ describe('getRedemptionComponentSwapData()', () => {
const dexData = componentSwapData[i].dexData
expect(dexData.exchange).toEqual(Exchange.UniV3)
expect(dexData.fees.length).toBeGreaterThan(0)
expect(dexData.path).toEqual([usdc.toLowerCase(), weth])
expect(dexData.path[0]).toEqual(usdc.toLowerCase())
expect(dexData.path[1]).toEqual(weth)
expect(dexData.pool).toEqual(AddressZero)
expect(dexData.poolIds).toEqual([])
expect(
Expand Down

0 comments on commit f98524f

Please sign in to comment.