Skip to content

Commit

Permalink
fix: remove incorrect require check for sellEthForTokenToUniswapV3
Browse files Browse the repository at this point in the history
  • Loading branch information
kimpers authored and asoong committed May 27, 2021
1 parent ea59a2e commit 7f8048d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
4 changes: 1 addition & 3 deletions contracts/protocol/integration/exchange/ZeroExApiAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,7 @@ contract ZeroExApiAdapter {
(encodedPath, minOutputTokenAmount, recipient) =
abi.decode(_data[4:], (bytes, uint256, address));
supportsRecipient = true;
address _decodedInputToken;
(_decodedInputToken, outputToken) = _decodeTokensFromUniswapV3EncodedPath(encodedPath);
require(_decodedInputToken == ETH_ADDRESS, "sellEthForToken requires ETH input token");
(, outputToken) = _decodeTokensFromUniswapV3EncodedPath(encodedPath);
inputToken = ETH_ADDRESS;
} else {
revert("Unsupported 0xAPI function selector");
Expand Down
17 changes: 0 additions & 17 deletions test/protocol/integration/exchange/zeroExApiAdapter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,23 +955,6 @@ describe("ZeroExApiAdapter", () => {
});
}

it("rejects non ETH input token", async () => {
const data = zeroExMock.interface.encodeFunctionData("sellEthForTokenToUniswapV3", [
encodePath([otherToken, destToken]),
minDestinationQuantity,
destination,
]);
const tx = zeroExApiAdapter.getTradeCalldata(
ETH_ADDRESS,
destToken,
destination,
sourceQuantity,
minDestinationQuantity,
data,
);
await expect(tx).to.be.revertedWith("sellEthForToken requires ETH input token");
});

it("rejects wrong input token", async () => {
const data = zeroExMock.interface.encodeFunctionData("sellEthForTokenToUniswapV3", [
encodePath([ETH_ADDRESS, destToken]),
Expand Down

0 comments on commit 7f8048d

Please sign in to comment.