Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hyeth quotes for erc20's #104

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading