LogoLogo
WebsiteAppDocs
  • Getting Started
    • 🤙Overview
      • Intro to Shell
      • White Papers
      • GitHub Repositories
      • Contract Addresses
      • Roadmap
      • Community
      • Ecosystem
    • 🗣️Governance
    • 🤝Integrations
      • Protocol Adapters
      • Shell-Native Primitives
        • Stable Token AMMs
        • Volatile Token AMMs
        • NFT Fractionalizer
        • NFT AMMs
        • LBPs (Liquidity Bootstrapping Pools)
        • Managed Pools
        • Pools for Large Swaps
    • 🛠️Developers
      • What to Build on Shell
      • Aggregating Pools
    • 🛡️Security & Bounties
    • ❓FAQ
  • SHELL DAO
    • 🌺Overview
    • 🏛️Shell DAO Permissions
    • 🐟SHELL Token
      • Airdrop Eligibility & CRAB
      • Sablier Vesting Stream SHELL
    • ☑️veSHELL Staking
    • ⚖️Governance Process
      • Governance Stages
      • Delegating Votes
    • ➰Mutable Protocol Fees
    • 🔓DAO Multisig
    • 🍭Toucan Votes
  • User Guide
    • 🎟️Earn Rewards
      • Shell Points (Concluded)
      • Bro Kwon's Booty
      • Get Quota
      • Multipliers and Boosters
      • Dynamic Multipliers
      • Crafting
    • 🎁Wrap Tokens
    • ⚔️LP in a Pool
    • 🐣Wrap NFTs
    • 🤺LP in an NFT Pool
    • 🔄Swap NFTs with an AMM
    • 🧭Shellscan
    • 🌴All About Toucans
    • 🧑‍🚀Using Arbitrum
    • 🚛Migrate from Shell v2 (Retired)
    • 🚚Migrate from Shell v1 (Retired)
    • 🖼️Art of Shell NFTs
  • How Shell Works
    • 🐚Architecture Overview
    • 🌊The Ocean: Accounting Hub
    • 🔱Proteus: AMM Engine
    • 💸Intents (MEV Harnessing System)
    • 🌚Why Arbitrum
    • 🍧Shell v1 (Retired)
    • 💧ShellDrop DAO (Retired)
  • Shell Lore
    • 👁️Hidden Fortune
Powered by GitBook
On this page
  • Quick Links
  • Swap through Shell-native fractal pools
  1. Getting Started
  2. Developers

Aggregating Pools

Tips on integrating Shell-native liquidity pools

PreviousWhat to Build on ShellNextSecurity & Bounties

Last updated 1 year ago

Quick Links

Swap through Shell-native fractal pools

You can use Shell pools to swap any ERC-20 (or ERC-721 or ERC-1155) tokens, as long as there exists a viable path of AMMs.

Fractal pools can serve as a stepping stone in swapping between ERC-20 tokens. A fractal pool uses LP tokens as one or both of its reserve assets. For example:

  • The two reserve assets of Stablepool are DAI+USDC LP token and USDT+USDC LP token.

  • The two reserve assets for ETH+USD pool are shETH and Stablepool LP token.

Let's swap shDAI to shETH. You must deposit shDAI into the DAI+USDC pool to get the DAI+USDC LP token, then take that LP token and deposit it into Stablepool to get the Stablepool LP token, then swap that LP token to shETH using the fractal pool (ETH+USD).

Tip: Depositing or withdrawing from a pool is functionally the same as swapping. You call computeOutputAmount but with the LP token ID as the output token instead of a wrapped token.

Shell LP tokens are also ERC-1155. They each have their own Ocean IDs, just as the Shell-wrapped ERC-20s do.

Tip: You can get the LP token ID from the LP pool contract. There is a read function called lpTokenId.

Whenever you swap from one ERC-20 token to another through Shell pools, there will be a wrap and unwrap in that transaction. For example, trading DAI for ETH would look like this:

  1. wrap DAI -> shDAI

  2. deposit shDAI -> DAI+USDC LP

  3. deposit DAI+USDC LP -> Stablepool LP

  4. swap Stablepool LP -> shETH (through ETH+USD pool)

  5. unwrap shETH -> ETH

Tip: All of this can be done in one function call with doMultipleInteractions.

The fractal design makes querying the prices of token pairs somewhat complicated.

Coming soon: Sample code for finding the price between two tokens.

Remember in Shell Protocol, ERC-20 (or 721 or 1155) tokens are wrapped onto a shared ERC-1155 ledger (). Shell pools always use the Shell-wrapped ERC-1155 version of these tokens.

🛠️
the Ocean
Contract Addresses
Native Primitives
Example of sending a swap through the Ocean
Shell Protocol GitHub
You can swap any ERC-20s by creating a path through this graph.