-
Notifications
You must be signed in to change notification settings - Fork 109
Support STETH trades that auto wrap to WSTETH #148
Conversation
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 | ||
}) |
There was a problem hiding this comment.
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
test/utils/uniswapData.ts
Outdated
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') |
There was a problem hiding this comment.
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?
test/utils/uniswapData.ts
Outdated
@@ -79,6 +103,12 @@ export async function getUniswapPools(forkBlock?: number): Promise<UniswapPools> | |||
} | |||
} | |||
|
|||
export async function getUniswapStethPool(forkBlock?: number): Promise<Pool> { |
There was a problem hiding this comment.
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
test/uniswapTrades.test.ts
Outdated
// other assertions carried out in forge | ||
}) | ||
|
||
it('encodes a single exactInput STETH -> WSTETH -> WETH exactOutput swap', async () => { |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
test/uniswapTrades.test.ts
Outdated
// other assertions carried out in forge | ||
}) | ||
|
||
it('encodes a single exactInput WETH -> WSTETH -> STETH exactOutput swap', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit test name
* 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]>
No description provided.