Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Support STETH trades that auto wrap to WSTETH #148

Merged
merged 18 commits into from
Sep 29, 2023
Merged

Support STETH trades that auto wrap to WSTETH #148

merged 18 commits into from
Sep 29, 2023

Conversation

ewilz
Copy link
Member

@ewilz ewilz commented Sep 19, 2023

No description provided.

@@ -43,7 +44,7 @@ export class UniswapTrade implements Command {
constructor(public trade: RouterTrade<Currency, Currency, TradeType>, public options: SwapOptions) {}

encode(planner: RoutePlanner, _config: TradeConfig): void {
let payerIsUser = true
let payerIsUser = !this.options.payerIsRouter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh interesting, did we not expose the option to set payerIsUser/Router before via the sdk?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct. I don't think it made any sense for any of the features we had.... wasn't sure if asking for the opposite (payerIsROUTER) as an option was awkward...

registerFixture('_UNISWAP_V3_001_ETH_FOR_STETH', methodParameters)
expect(hexToDecimalString(methodParameters.value)).to.eq(inputETH.toString())
// other assertions carried out in forge
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would like to see some tests for exactOut with STETH as input and as output

const FORK_BLOCK = 16075500

export const ETHER = Ether.onChain(1)
export const WETH = new Token(1, '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', 18, 'WETH', 'Wrapped Ether')
export const DAI = new Token(1, '0x6B175474E89094C44Da98b954EedeAC495271d0F', 18, 'DAI', 'dai')
export const USDC = new Token(1, '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', 6, 'USDC', 'USD Coin')
export const STETH = new Token(1, '0xae7ab96520de3a18e5e111b5eaab095312d7fe84', 18, 'STETH', 'Liquid staked Ether')
export const WSTETH = new Token(1, '0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0', 18, 'WSTETH', 'Liquid staked Ether')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do they have the same name?

@@ -79,6 +103,12 @@ export async function getUniswapPools(forkBlock?: number): Promise<UniswapPools>
}
}

export async function getUniswapStethPool(forkBlock?: number): Promise<Pool> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can assign default value to parameter

// other assertions carried out in forge
})

it('encodes a single exactInput STETH -> WSTETH -> WETH exactOutput swap', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: test name should be exactOut

const methodParameters = SwapRouter.swapCallParameters([
wrapSTETH,
new UniswapTrade(buildTrade([trade]), swapOpts),
unwrapSTETH,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need an unwrap here for STETH? since its WETH out

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, bc it's exactOut so the input amount is uncertain

// other assertions carried out in forge
})

it('encodes a single exactInput WETH -> WSTETH -> STETH exactOutput swap', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit test name

@ewilz ewilz merged commit d52ed08 into main Sep 29, 2023
3 checks passed
@ewilz ewilz deleted the steth branch September 29, 2023 17:40
marktoda added a commit that referenced this pull request Nov 15, 2023
hensha256 pushed a commit that referenced this pull request Jan 12, 2024
* Revert "2.0.0"

This reverts commit b9f5fb0.

* Revert "Support STETH trades that auto wrap to WSTETH (#148)"

This reverts commit d52ed08.
hensha256 pushed a commit that referenced this pull request Jan 12, 2024
* Revert "2.0.0"

This reverts commit b9f5fb0.

* Revert "Support STETH trades that auto wrap to WSTETH (#148)"

This reverts commit d52ed08.

* feat: update v2 supported ur

* bump sdk version

* revert v2 sdk bump

* yarn

* update celo

---------

Co-authored-by: Mark Toda <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants