swaprhq / swapr-sdk Goto Github PK
View Code? Open in Web Editor NEW🛠 An SDK for building applications on top of Swapr.
Home Page: https://swapr.eth.limo/
License: GNU Affero General Public License v3.0
🛠 An SDK for building applications on top of Swapr.
Home Page: https://swapr.eth.limo/
License: GNU Affero General Public License v3.0
Create a wrapper for the balancer project.
common pairs list is a collection of pairs that could link currencyA to currencyB. For instance, I trade from WETH to CRV. A possible trade route would be:
WETH > WETH-USDC > USDC-CRV > CRV
WETH-USDC
and USDC-CRV
are the common pairs between WETH and CRV. This is list is computed in the SDK by assuming that every token will have a pool of the token and a stablecoin or the native token of the given chain. For example, CRV will likely to have a pair of CRV-WETH and CRV-USDC. This approach discriminates against less known tokens by skipping potential pairs that would be more liquid and given better rates.
The solution is to utilize The Graph and find these pairs by running such query with the following conditions:
where token0 = tokenA OR token1 = tokenA OR token0 = tokenB OR token1 = tokenB
This yields all the pairs that have either currencyA
or currencyB
. The above query can include reserves, which leads to a slight gain in performance.
AC
The common pairs list is computed from the subgraph. If the subgraph query fails due to network, default to the current SDK implementation.
If I try to swap from XDAI to USDC or USDT I don't get COW swap as an option in the exchange list
and when I try from USDC to 1INCH I get this error message.
Originally posted by @MilanVojnovic95 in SwaprHQ/swapr-dapp#1280 (comment)
Update these modules according to what Uniswap core package standards.
The correct address the GPv2VaultRelayer
Replace @gnosis.pm/gp-v2-contracts
with cowprotocol/cow-sdk.
Jumping between JSBI and BigNumber/parseUnits
from ethers.js is not ideal.
AC
parseUnit
/formatUnits
Description
Curve v2 has a factory contract to deploy new Curve pools.
Acceptance Criteria
CurveTrade
can find and get quotes from Curve v2 poolsUniswap underlying Ether
implementation does not support MATIC. The solution is creating another NativeCurrecny called MaticNativeCurrency
. This is what Uniswap interfaces use internally.
AC
UniswapTrade
supports Polygon's Matic.
From Felix:
Actually, we recently changed the format slightly (the bottom level "referrer" is now called "address"). Updated schema is here: https://github.com/cowprotocol/cow-sdk/blob/e086d9edeb24b25bb873a11c462019fa1ea4c021/README.md#create-a-meta-data-document-for-attaching-to-an-order and there is now even SDK functionality to create and upload the correct document
Deprecate Rinkeby in the next release, and add Göerli (chain ID: 5)
Consult the docs
https://community.optimism.io/docs/useful-tools/networks/#optimism-mainnet
Acceptance Criteria
ChainId
has Optimism Mainnet and optimism Göerli
Description
getAllCommonUniswapV2Pairs
works only for Swapr because swapFee
property is not available on the standard UniswapV2Pair contract. Here's the snippet of where it breaks:
Every CoW quote has an ID. By sending back the quote ID, the API can reference it again. This shall fix InsufficientFee
.
The Pair
constructor parameter uses Swapr as the default platform:
Pair.getOutputAmount
and Pair.getInputAmount
do not pass the same platform back to the construct when calling creating new Pair
instances
When the wrong platform (Swapr for example on Polygon) is used, the Pair.getAddress
throws an unsupported platform error:
The fix is to pass back the instance platform property in Pair.getOutputAmount
and Pair.getInputAmount
.
This logic error affects any EVM chain where Swapr is not supported and potentially leads to calculating the wrong UniswapV2Pair
address using keccak256 method.
AC
Pair.getOutputAmount
and Pair.getInputAmount
pass back the current instance's platform.Curve does not support the native xDAI token on Gnosis Chain. It only works with ERC20 stable tokens: WXDAI, USDC, and USDT.
AC
Currently, the SDK uses Multicall2. Upgrade to Multicall3 and add a factory function.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.