GithubHelp home page GithubHelp logo

uniswap / swap-router-contracts Goto Github PK

View Code? Open in Web Editor NEW
116.0 12.0 117.0 2.07 MB

Smart contracts for swapping on Uniswap V2 and V3. Superseded by https://github.com/Uniswap/universal-router

License: GNU General Public License v2.0

Solidity 35.99% TypeScript 64.01%

swap-router-contracts's People

Contributors

ewilz avatar gakonst avatar grabbou avatar hensha256 avatar jfrankfurt avatar lint-action avatar moodysalem avatar nchamo avatar noahzinsmeister avatar smsunarto avatar snreynolds avatar willpote avatar zhongeric avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swap-router-contracts's Issues

Fix excess dust

  1. In some cases, excess dust is left after the swap portion of the swap+add
  2. Noah will make the changes today/tomorrow
  3. Review w/moody and try to share address EOD Tuesday before Thursday launch

Hardhat compile error

contracts/swap-router-contracts/contracts/base/PeripheryPaymentsExtended.sol:12:9: DeclarationError: Undeclared identifier. "unwrapWETH9" is not (or not yet) visible at this point.
unwrapWETH9(amountMinimum, msg.sender);
^---------^

contracts/swap-router-contracts/contracts/base/PeripheryPaymentsExtended.sol:22:9: DeclarationError: Undeclared identifier. "sweepToken" is not (or not yet) visible at this point.
sweepToken(token, amountMinimum, msg.sender);
^--------^
Can anyone help?

Thank you!

Not compatible with newer solidity versions

The repository is not compatible to integrate with newer versions of the solidity.
for instance, swap-router-contracts/contracts/interfaces/ISwapRouter02.sol interface includes interface IApproveAndCall has locked compiler version to =0.7.6.
image

image

A third party contract with new solidity compiler that wants to integrate ISwapRouter interface will give compile error.
Error (5333): Source file requires different compiler version

SwapRouterV2 wishlist

--

  • allow calling into the nft manager post-swap, e.g. to add as much liquidity as possible
  • allow calling into a swap and add liquidity contract post-swap, e.g. to add the full balance of two tokens after multiple swaps (swap from unrelated token and add liquidity)

--

  • maybe support weiroll style calls via delegatecall for the above workflows

swap-router-contracts vs. periphery contracts

not a bug or feature request, just a question, namely: what is the problem that swap-router-contracts is solving compared to uniswap's already existing routers?

is it to provide a more convenient and possibly unified API?
is it to provide a more concise API, that is only concerned with swapping (and not liquidity providing)?
is it to safe gas, or solve some other technical issues with pure routers?

thanks in advance for any infos!

improve test coverage

p1

  • ApproveAndCall for tokens that require ApprovalType.MAX_MINUS_ONE-style approves
  • PeripheryPaymentsExtended
  • PeripheryPaymentsWithFeeExtended
  • every slippage check
  • fee-on-transfer token swaps

allow rudimentary splitting/merging

We could consider allowing splitting/merging of trades (examples below). tagging as wontfix until a compelling design for this feature is proposed.

merging:

50% ETH → WBTC ↘
50% ETH → USDC → DAI → USDT

splitting:

100% ETH → USDC → DAI → USDT (.3%)
                      ↘ USDT (.05%)

minimize calldata for v3 swaps

recipient, hasAlreadyPaid, sqrtPriceLimitX96, and path vs tokenIn/fee/tokenOut are all prime candidates for optional overloads, but the number of permutations is fairly overwhelming

should the `hasAlreadyPaid` trick in v2 swap router be applied to exact output?

bool hasAlreadyPaid;
if (amountIn == CONTRACT_BALANCE) {
hasAlreadyPaid = true;
amountIn = IERC20(path[0]).balanceOf(address(this));
}
pay(
path[0],
hasAlreadyPaid ? address(this) : msg.sender,
UniswapV2Library.pairFor(factoryV2, path[0], path[1]),
amountIn
);

this is only on exact input but not exact output

i think it's because it's for split/merge and that doesn't work with this pattern for exact output but would be good to document the thoughts there

MixedRouteQuoter deployed?

Is the MixedRouteQuoter deployed? If so, what are the deployment addresses? I couldn't find anything on it.

wherever possible, import contracts from periphery

The following contracts require the relevant functions to be marked public instead of external so that we can inherit from/extend the periphery contracts rather than re-implement

  • Multicall
  • PeripheryPayments
  • PeripheryPaymentsWithFee

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.