Skip to content

A generalized 1inchProtocol-like protocol, allowing optimized swaps between any ERC-20/721/1155

License

Notifications You must be signed in to change notification settings

StakeDAO/cross-asset-swap-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cross-asset-swap

A generalized 1inch-like protocol, allowing optimized swaps between any ERC-20/721/1155

Architecture

Cross Asset Swap Architecture

Cross-Asset-Swap (CAS) is a set of contracts which lets you to swap any input combination of assets (ETH+ERC20+ERC721+ERC1155) to any output combination of assets in a single transaction (in an optimized way).

The CAS is composed of following parts:

  • CrossAssetSwap: This is the main contract, and single point of contact for the user (EOA/contract). It contains all the functions that can be used to perform different types of swaps.

  • Markets: Markets are where you buy/sell your assets (eg. NFTX, NFT20, OpenSea, etc). All the markets, "active" or "unactive", are registered on the MarketRegistry. You can see a list of markets currently registered on the MarketRegistry. There is no limit to how many markets can be added to the MarketRegistry. Anybody can add a new market to the MarketRegistry following the procedure explained below. A market can be deactivated (can be re-activated) in case of any emergency.

NOTE: Community is encouraged to add more markets to the CAS. Market strategist can earn a cut of the trade amount.

  • Exchanges: Exchanges are where you swap the ERC20 tokens (eg. Uniswap, SushiSwap, 1inch, etc). All the exchanges, "active" or "unactive", are registered on the ExchangeRegistry. You can see a list of exchanges currently active on the ExchangeRegistry. There is no limit to how many exchanges can be added to the ExchangeRegistry. Anybody can add a new exchange to the ExchangeRegistry following the procedure explained below. An exchange can be deactivated (can be re-activated) in case of any emergency.

NOTE: Community is encouraged to add more exchanges to the CAS. Exchange strategist can earn a cut of the trade amount.

What does CAS enable?

  • Makes the ecosystem (especially, NFT ecosystem) more liquid by allowing you to trade across multiple markets in a single transaction.
  • It allows single transaction arb trades across multiple markets. This helps to stabalize the price of assets (especially NFTs) across the ecosystem.
  • Allows you to perform NFT arbs without any initial capital (using NFT flashloans). This also stabalizes the NFT price across markets.

TODO: Maybe add Flashloans as a part of the protocol.

Supported Markets

Note: Here TBD means "To be deployed". WIP means "Work in progress"

Market Type Status Address [index]
NFTX BUY(WIP), SELL ACTIVE TBD (waiting for v2)
NFT20 BUY, SELL ACTIVE 0x064C9c5Fe72ab6acdc0d220050d519AfAa59B9bB [0]
AxieInfinity BUY ACTIVE 0xdCAEE44ED2965d5615a9A206f6f3ab8fb90Fcd62 [1]
Cryptokitties BUY ACTIVE 0x7207d099EBAb7cF9DE49A29739Dd0C628dDCf48D [2]
CryptoPunks BUY ACTIVE 0x03DcA7d783175Ba9D97cc41D20e4c266C7abb881 [3]
Decentraland BUY ACTIVE 0x0545405a2c208d3E2c50c71cF0B6B9a72A021b49 [4]
EulerBeats BUY ACTIVE 0x2428aE09b453692A667b8A8dee1Fc4082f44Ad05 [5]
KnownOrigin BUY ACTIVE 0xCBc360534370F1d5465e531236027f0610E067bf [6]
MoonCatsMarket BUY ACTIVE 0xdAD871D701Da0D98993Eaa27Ce9c2e51D8912B87 [7]
SuperRare BUY ACTIVE 0x99f2B1FF838dA5Ee5062358b4Fa2c763C93Fe474 [8]
UniqueOne (WIP) BUY WIP TBD
Makerspace (WIP) BUY WIP TBD
OpenSea (WIP) BUY WIP TBD
Rarible (WIP) BUY WIP TBD
Synther (WIP) BUY, SELL WIP TBD
Drops (WIP) BUY, SELL WIP TBD
0xProject (TODO) BUY, SELL WIP TBD
Sorare (TODO) BUY WIP TBD
SandboxGame (TODO) BUY WIP TBD

Supported Exchanges

Note: Here TBD means "To be deployed"

Exchange Status Address [index]
UniswapV2 ACTIVE 0xb5C70AC5147eF7DbB060382F7A5C724C2bEF070d [0]
SushiSwap ACTIVE TBD
UniswapV3 WIP TBD

How to add a new market to CAS?

The CAS is agnostic to how the (sell/buy) markets work. It's possible to add any market to CAS by creating a simple market contract which follows the market interface and submitting a PR. The market contract is reviewed and will be registered to the MarketRegistry.

How to add a new exchange to CAS?

The CAS is agnostic to how the exchanges work. It's possible to add any exchange to CAS by creating a simple exchange contract which follows the exchange interface and submitting a PR. The exchange contract is reviewed and will be registered to the ExchangeRegistry.

Available Swaps

FROM [ERC1155] TO [ETH+ERC20+ERC721+ERC1155]

FROM [ERC721] TO [ETH+ERC20+ERC721+ERC1155]

FROM [ERC20] TO [ETH+ERC20+ERC721+ERC1155]

FROM [ETH] TO [ETH+ERC20+ERC721+ERC1155]

FROM [ETH+ERC20+ERC721+ERC1155] TO [ETH+ERC20+ERC721+ERC1155]

About

A generalized 1inchProtocol-like protocol, allowing optimized swaps between any ERC-20/721/1155

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Solidity 100.0%