PersonalBusiness
PersonalBusiness
Buy Crypto

Buy Bitcoin, Ethereum and 100+ more.

  • Download the MoonPay App
  • See all cryptocurrencies
Popular
  • Buy BitcoinBTC
  • Buy EthereumETH
  • Buy PolygonPOL
  • Buy SolanaSOL
  • Buy DogecoinDOGE
  • Buy CardanoADA
  • Buy AvalancheAVAX
  • Buy BNBBNB
  • Buy XRPXRP
  • Buy LitecoinLTC
  • Buy ChainlinkLINK
  • Buy Bitcoin CashBCH
Get started
  • How to buy crypto
  • Payment methods
  • Fees
  • Help Center

Sell crypto and cash out to your bank.

  • Download the MoonPay App
  • See all cryptocurrencies
Popular
  • Sell BitcoinBTC
  • Sell EthereumETH
  • Sell PolygonPOL
  • Sell SolanaSOL
  • Sell DogecoinDOGE
  • Sell CardanoADA
  • Sell AvalancheAVAX
  • Sell BNBBNB
  • Sell XRPXRP
  • Sell LitecoinLTC
  • Sell ChainlinkLINK
  • Sell Bitcoin CashBCH
Get started
  • How to sell crypto
  • Payout methods
  • Fees
  • Help Center

Convert between tokens, even across chains.

  • Download the MoonPay App
  • See all cryptocurrencies
Popular
  • Convert BitcoinBTC
  • Convert EthereumETH
  • Convert PolygonPOL
  • Convert SolanaSOL
  • Convert DogecoinDOGE
  • Convert CardanoADA
  • Convert AvalancheAVAX
  • Convert BNBBNB
  • Convert XRPXRP
  • Convert LitecoinLTC
  • Convert ChainlinkLINK
  • Convert Bitcoin CashBCH
Get started
  • How to convert crypto
  • Supported networks
  • Fees
  • Help Center

Track prices for Bitcoin, Ethereum and 100+ more.

  • Download the MoonPay App
  • All crypto prices
Popular
  • Bitcoin priceBTC
  • Ethereum priceETH
  • Polygon pricePOL
  • Solana priceSOL
  • Dogecoin priceDOGE
  • Cardano priceADA
  • Avalanche priceAVAX
  • BNB priceBNB
  • XRP priceXRP
  • Litecoin priceLTC
  • Chainlink priceLINK
  • Bitcoin Cash priceBCH
Explore
  • Learn about crypto
  • Buy crypto
  • Sell crypto
  • Help Center

MoonPay is how the world moves value.

  • Contact us
Company
  • About us
  • Careers
  • Press & Media
  • Newsroom
Resources
  • Learn
  • MoonPay Minute
  • Help Center
  • Security & Trust Center
  • MoonPay Discover
MoonPay MinuteSeed PhrasesA seed phrase is a list of 12 to 24 random words that gives a person access to their crypto wallet. When a wallet is first set up, it generates a seed phrase, also called a…

Popular

Buy BitcoinBTCBuy EthereumETHBuy PolygonPOLBuy SolanaSOLBuy DogecoinDOGEBuy CardanoADABuy AvalancheAVAXBuy BNBBNBBuy XRPXRPBuy LitecoinLTCBuy ChainlinkLINKBuy Bitcoin CashBCH

Get started

How to buy cryptoPayment methodsFeesHelp Center
Download the MoonPay AppSee all cryptocurrencies

Popular

Sell BitcoinBTCSell EthereumETHSell PolygonPOLSell SolanaSOLSell DogecoinDOGESell CardanoADASell AvalancheAVAXSell BNBBNBSell XRPXRPSell LitecoinLTCSell ChainlinkLINKSell Bitcoin CashBCH

Get started

How to sell cryptoPayout methodsFeesHelp Center
Download the MoonPay AppSee all cryptocurrencies

Popular

Convert BitcoinBTCConvert EthereumETHConvert PolygonPOLConvert SolanaSOLConvert DogecoinDOGEConvert CardanoADAConvert AvalancheAVAXConvert BNBBNBConvert XRPXRPConvert LitecoinLTCConvert ChainlinkLINKConvert Bitcoin CashBCH

Get started

How to convert cryptoSupported networksFeesHelp Center
Download the MoonPay AppSee all cryptocurrencies

Popular

Bitcoin priceBTCEthereum priceETHPolygon pricePOLSolana priceSOLDogecoin priceDOGECardano priceADAAvalanche priceAVAXBNB priceBNBXRP priceXRPLitecoin priceLTCChainlink priceLINKBitcoin Cash priceBCH

Explore

Learn about cryptoBuy cryptoSell cryptoHelp Center
Download the MoonPay AppAll crypto prices

Company

About usCareersPress & MediaNewsroom

Resources

LearnMoonPay MinuteHelp CenterSecurity & Trust CenterMoonPay Discover

MoonPay Minute

Seed Phrases
Contact us
Buy Crypto

All rights reserved. MoonPay USA LLC is a registered money service business (NMLS ID: 2071245). For Law Enforcement requests please direct your official document to our compliance team here.

  • Personal
  • Buy Crypto
  • Sell Crypto
  • Trade Crypto
  • Learn about Crypto
  • Crypto Price
  • MoonAgentsNew!
  • Business
  • Ramps
  • Virtual AccountsNew!
  • MoonPay Discover
  • MoonPay Commerce
  • MoonPay InstitutionalNew!
  • Stablecoin Transparency
  • Company
  • About Us
  • CareersWe're hiring
  • Newsroom
  • Media
  • Changelog
  • Support
  • API Docs
  • Help Center
  • Contact Us
  • Status
  • Security
  • Buy
  • Buy Bitcoin
  • Buy Ethereum
  • Buy Solana
  • Buy Cardano
  • Sell
  • Sell Bitcoin
  • Sell Ethereum
  • Sell XRP
  • Sell Solana
  • Trade
  • Trade Ethereum
  • Trade SOL
  • Trade Aave
  • Trade Chainlink
  • Crypto Prices
  • Bitcoin Price
  • Ethereum Price
  • Dogecoin Price
  • XRP Price
  • Cardano Price
  • Learn
  • What is Blockchain?
  • What are NFTs?
  • What is Bitcoin mining?
  • What is DeFi?
  • What is crypto staking?
  • Legal
  • Licenses
  • Privacy Policy
  • Cookie Policy
  • Terms of Use

All rights reserved. MoonPay USA LLC is a registered money service business (NMLS ID: 2071245). For Law Enforcement requests please direct your official document to our compliance team here.

PersonalBusiness
PersonalBusiness
Buy Crypto

Buy Bitcoin, Ethereum and 100+ more.

  • Download the MoonPay App
  • See all cryptocurrencies
Popular
  • Buy BitcoinBTC
  • Buy EthereumETH
  • Buy PolygonPOL
  • Buy SolanaSOL
  • Buy DogecoinDOGE
  • Buy CardanoADA
  • Buy AvalancheAVAX
  • Buy BNBBNB
  • Buy XRPXRP
  • Buy LitecoinLTC
  • Buy ChainlinkLINK
  • Buy Bitcoin CashBCH
Get started
  • How to buy crypto
  • Payment methods
  • Fees
  • Help Center

Sell crypto and cash out to your bank.

  • Download the MoonPay App
  • See all cryptocurrencies
Popular
  • Sell BitcoinBTC
  • Sell EthereumETH
  • Sell PolygonPOL
  • Sell SolanaSOL
  • Sell DogecoinDOGE
  • Sell CardanoADA
  • Sell AvalancheAVAX
  • Sell BNBBNB
  • Sell XRPXRP
  • Sell LitecoinLTC
  • Sell ChainlinkLINK
  • Sell Bitcoin CashBCH
Get started
  • How to sell crypto
  • Payout methods
  • Fees
  • Help Center

Convert between tokens, even across chains.

  • Download the MoonPay App
  • See all cryptocurrencies
Popular
  • Convert BitcoinBTC
  • Convert EthereumETH
  • Convert PolygonPOL
  • Convert SolanaSOL
  • Convert DogecoinDOGE
  • Convert CardanoADA
  • Convert AvalancheAVAX
  • Convert BNBBNB
  • Convert XRPXRP
  • Convert LitecoinLTC
  • Convert ChainlinkLINK
  • Convert Bitcoin CashBCH
Get started
  • How to convert crypto
  • Supported networks
  • Fees
  • Help Center

Track prices for Bitcoin, Ethereum and 100+ more.

  • Download the MoonPay App
  • All crypto prices
Popular
  • Bitcoin priceBTC
  • Ethereum priceETH
  • Polygon pricePOL
  • Solana priceSOL
  • Dogecoin priceDOGE
  • Cardano priceADA
  • Avalanche priceAVAX
  • BNB priceBNB
  • XRP priceXRP
  • Litecoin priceLTC
  • Chainlink priceLINK
  • Bitcoin Cash priceBCH
Explore
  • Learn about crypto
  • Buy crypto
  • Sell crypto
  • Help Center

MoonPay is how the world moves value.

  • Contact us
Company
  • About us
  • Careers
  • Press & Media
  • Newsroom
Resources
  • Learn
  • MoonPay Minute
  • Help Center
  • Security & Trust Center
  • MoonPay Discover
MoonPay MinuteSeed PhrasesA seed phrase is a list of 12 to 24 random words that gives a person access to their crypto wallet. When a wallet is first set up, it generates a seed phrase, also called a…

Popular

Buy BitcoinBTCBuy EthereumETHBuy PolygonPOLBuy SolanaSOLBuy DogecoinDOGEBuy CardanoADABuy AvalancheAVAXBuy BNBBNBBuy XRPXRPBuy LitecoinLTCBuy ChainlinkLINKBuy Bitcoin CashBCH

Get started

How to buy cryptoPayment methodsFeesHelp Center
Download the MoonPay AppSee all cryptocurrencies

Popular

Sell BitcoinBTCSell EthereumETHSell PolygonPOLSell SolanaSOLSell DogecoinDOGESell CardanoADASell AvalancheAVAXSell BNBBNBSell XRPXRPSell LitecoinLTCSell ChainlinkLINKSell Bitcoin CashBCH

Get started

How to sell cryptoPayout methodsFeesHelp Center
Download the MoonPay AppSee all cryptocurrencies

Popular

Convert BitcoinBTCConvert EthereumETHConvert PolygonPOLConvert SolanaSOLConvert DogecoinDOGEConvert CardanoADAConvert AvalancheAVAXConvert BNBBNBConvert XRPXRPConvert LitecoinLTCConvert ChainlinkLINKConvert Bitcoin CashBCH

Get started

How to convert cryptoSupported networksFeesHelp Center
Download the MoonPay AppSee all cryptocurrencies

Popular

Bitcoin priceBTCEthereum priceETHPolygon pricePOLSolana priceSOLDogecoin priceDOGECardano priceADAAvalanche priceAVAXBNB priceBNBXRP priceXRPLitecoin priceLTCChainlink priceLINKBitcoin Cash priceBCH

Explore

Learn about cryptoBuy cryptoSell cryptoHelp Center
Download the MoonPay AppAll crypto prices

Company

About usCareersPress & MediaNewsroom

Resources

LearnMoonPay MinuteHelp CenterSecurity & Trust CenterMoonPay Discover

MoonPay Minute

Seed Phrases
Contact us
Buy Crypto

All rights reserved. MoonPay USA LLC is a registered money service business (NMLS ID: 2071245). For Law Enforcement requests please direct your official document to our compliance team here.

  • Personal
  • Buy Crypto
  • Sell Crypto
  • Trade Crypto
  • Learn about Crypto
  • Crypto Price
  • MoonAgentsNew!
  • Business
  • Ramps
  • Virtual AccountsNew!
  • MoonPay Discover
  • MoonPay Commerce
  • MoonPay InstitutionalNew!
  • Stablecoin Transparency
  • Company
  • About Us
  • CareersWe're hiring
  • Newsroom
  • Media
  • Changelog
  • Support
  • API Docs
  • Help Center
  • Contact Us
  • Status
  • Security
  • Buy
  • Buy Bitcoin
  • Buy Ethereum
  • Buy Solana
  • Buy Cardano
  • Sell
  • Sell Bitcoin
  • Sell Ethereum
  • Sell XRP
  • Sell Solana
  • Trade
  • Trade Ethereum
  • Trade SOL
  • Trade Aave
  • Trade Chainlink
  • Crypto Prices
  • Bitcoin Price
  • Ethereum Price
  • Dogecoin Price
  • XRP Price
  • Cardano Price
  • Learn
  • What is Blockchain?
  • What are NFTs?
  • What is Bitcoin mining?
  • What is DeFi?
  • What is crypto staking?
  • Legal
  • Licenses
  • Privacy Policy
  • Cookie Policy
  • Terms of Use

All rights reserved. MoonPay USA LLC is a registered money service business (NMLS ID: 2071245). For Law Enforcement requests please direct your official document to our compliance team here.

Back to all articles

What is composability in DeFi? A guide to DeFi composability

Decentralized finance (DeFi) aims to create a financial ecosystem in which anyone can participate without the need for a central custodian.

Mrig P

By Mrig P

Published on Jan 9, 2024

Last modified on May 1, 2025

guidedefi
What is composability in DeFi? banner
  1. 1.What is composability?
  2. 2.Types of composability
  3. 3.How does composability work in the traditional world?
  4. 4.How does composability work in DeFi?
  5. 5.Examples of highly composable components in DeFi
  6. 6.Risks associated with DeFi composability
  7. 7.Begin your DeFi journey with MoonPay

Decentralized finance (DeFi) aims to create a financial ecosystem in which anyone can participate without the need for a central custodian. 

The cherry on top for users and developers is that the DeFi ecosystem is open and permissionless, ensuring maximum “composability” of DeFi protocols and smart contracts.

But what does that term mean, “composability”?

This article explains the concept of composability, how DeFi composability works, and its benefits and risks.

What is composability?

Composability in software development refers to the ability to freely combine existing applications or their specific codes or components to build new products.

In DeFi, composability refers to the potential to use codes, smart contracts, application programming interfaces (APIs), and software development kits (SDKs) of existing decentralized applications in endless combinations to create new applications or build new services.

A more straightforward way to understand composability is to think of DeFi protocols as Lego blocks that you can combine to build interesting structures. That means each software component has the ability to connect to every other software component like a block so the output of one application can be the input of another.

We can see the potential of composability in decentralized finance due to the open-source nature of most DeFi protocols. Developers can reuse various applications without reinventing the wheel or fearing intellectual property issues.

Types of composability 

Composability exists in three forms: morphological, syntactic, and atomic. 

Morphological composability 

Morphological composability means the various components, codes, tokens, and functions (the Lego blocks) comprising DeFi applications (dApps) and platforms follow the same overall standards so that they are compatible and interoperable with each other. 

Not having morphological composability would be like Lego creating Lego blocks that do not fit perfectly with each other. While each individual block may serve a certain purpose, no one could actually use multiple blocks to build something unique. 

Achieving morphological composability can be challenging since there needs to be an industry-wide agreement on these standards. This is why the Ethereum ecosystem (like other blockchains) follows Ethereum Request for Comment (ERC) standards for tokens and smart contracts. Developers on the chain can propose new standards, open them for community discussion, and agree to implement them through voting.

Syntactic composability 

Syntactic composability refers to the ability of dApps and decentralized autonomous organizations (DAOs) to effectively integrate with each other to form entirely new systems. This is best achieved in an ecosystem that has effective morphological composability built into it.

A chart listing the types of composability in DeFi.

Ethereum achieves syntactic composability very well — any smart contract on Ethereum can call any other contract in the entire ecosystem. This allows developers to reuse code from existing decentralized applications and create new dApps without spending too much time coding.

For instance, the decentralized exchange Uniswap already developed an effective token swap. Now, if a developer is creating a cryptocurrency wallet, they can integrate Uniswap’s token swap mechanism or smart contract code into their wallet without having to create it from scratch.

Atomic composability 

To understand atomic composability, you must first understand atomicity. 

Atomicity in blockchain means combining multiple actions into one transaction that executes only if every action is legitimate. You can leverage this property to split a transaction across multiple crypto exchanges or vote on several DAO proposals without the risk of a partial failure. 

Atomic composability is the combination of atomicity and composability — a single transaction involves calls to multiple smart contracts and the transaction goes through only if all of its parts succeed. A flash loan is a good example of a DeFi protocol using atomic composability.

How does composability work in the traditional world?

Composability was a huge part of early Web2. It existed in the form of business models called mash-ups that involved bundling existing products to create new ones based on consumer trends. 

Housing Maps was one of the earliest examples of a mash-up. It combined the data from Google Maps and Craigslist’s real estate listings to display apartment and housing listings on a map. 

Like other mash-up services that operated during its time, Housing Maps didn’t control or own the data it used and would compete with other mash-ups. 

In fact, the more data sets a mash-up had, the more problems it could solve, but its usefulness would depend on whether there was a demand for solving these problems. The most popular mash-ups leveraged this principle to build successful companies. 

But by 2010, many centralized platforms started asserting their dominance on the web and shut down access to their APIs, which caused the mash-up business model to fade out. 

Gradually, Meta (previously Facebook), Amazon, Apple, Google, and other tech leaders replaced open-source applications (and composability) with a closed ecosystem of their own applications.

The result was walled gardens that left certain companies in control of all operations and reduced the number of alternate applications for users. 

Take Meta or Google ads, for instance. Advertisers have no choice but to use these companies’ data management platforms to get user data for targeting and the companies control their ads’ transmission. 

Does this mean composability is now non-existent in Web2?

Composability still exists in many forms in Web2. When you use PayPal to pay for your Uber ride or your Meta ID to log in to play a game, you’re leveraging the composability of each application. 

While this type of composability is beneficial, it comes with a caveat: you have to trust centralized third parties who might use the interaction as an opportunity to collect data on you and seek to profit from it.

How does composability work in DeFi?

Composability in Web3 could look something like this: 

A Web3 app consolidates the miles logged on your Peloton and the data from other workouts from different classes to form your on-chain digital fitness identity. 

It then connects to other Web3 applications offering personalized training programs to set up a fitness regimen or modify your existing one based on the progress you’ve made.

Although this may sound futuristic, it is possible that this type of composability could affect DeFi’s various components (the “DeFi Money Legos”) and cause them to evolve and expand across industries to create useful real world applications. 

But for now, let’s look at a practical example of how composability works in DeFi by understanding flash loans. 

Flash loans are uncollateralized loans that enable users to borrow and return funds in the same transaction. They’re commonly used to try to create an instant profit via arbitrage opportunities.

A picture that shows how flash loans work.
How flash loans work

To get started with a flash loan, you first create a set of pre-designated operations on flash loan providers like Aave. Then, you run the transaction to execute the operations and repay the loan. 

To understand this, we’ll break down this transaction from January 2020 made by the Arbitrage DAO. They take a flash loan of 3137 DAI from Aave, swap it for SAI on MakerDAO, and swap it back to DAI using Uniswap. Once these operations are complete, they repay the flash loan and are left with a profit of 3 DAI. 

Here, the DAO uses three platforms in a single transaction to make a small profit, and these profits can be easily scaled by increasing the size of the transactions.

Examples of highly composable components in DeFi 

The DeFi ecosystem has a vast array of components, and anyone can interact with them in different combinations. 

Here are examples of some highly composable components in the decentralized finance (DeFi) space that developers can use:

MakerDAO

MakerDAO is the Ethereum-based DeFi protocol that mints DAI — the decentralized stablecoin that attempts to maintain a stable value by being soft-pegged to the US dollar.

An image of the MakerDAO logo.

DAI is highly composable and works with more than 400 services and apps, including popular ones like Uniswap and Curve.

Compound

Compound (COMP) is a decentralized and permissionless lending and borrowing protocol where anyone can lend and borrow cryptocurrencies.

An image of the Compound logo.

Compound integrates with exchanges, portfolio managers, and wallets to enable its users to earn interest, secure their funds, and track their earnings and losses easily. 

Curve

Curve is an automated market maker (AMM) that only accommodates liquidity pools made of similarly behaving assets like stablecoins or wrapped versions of the same assets such as wrapped Bitcoin (WBTC) and wrapped Ether (wETH).

An image of the Curve logo.

Curve integrates with protocols like yearn.finance and Synthetix to try to maximize incentives for liquidity providers. 

Aave

Aave (AAVE) is a decentralized lending platform primarily based on the Ethereum blockchain, though it also offers markets for Avalanche, Polygon, Optimism, Arbitrum, and more. 

An image of the Aave logo.

Aave can integrate with several types of DeFi platforms, like decentralized exchanges. A good example of Aave’s use of composability is its ability to give users flash loans.

Sushi

Sushi is a Uniswap clone that allows you to swap, earn, lend, and borrow ERC-20 tokens.

An image of the Sushi logo.

Sushi can easily integrate with exchanges and lending platforms across multiple chains.

Yearn

Yearn is a yield aggregator protocol that automatically deposits tokens across different DeFi platforms like Curve, MakerDAO, etc.

An image of the Yearn.finance logo.

Yearn uses a broad range of platforms so their users can attempt to earn maximum yield from lending, trading, and liquidity incentives. 

Additional DeFi components 

Alchemix

Alchemix is a DeFi platform that auto-repays your loans. It places money into yearn.finance and allows you to take out a loan against the capital you provided.

Alchemix logo

Once you start earning yield, Alchemix will use it to start repaying the principal and interest of the loan.

HydraDX

HydraDX is a cross-chain token swap solution that enables users to transfer tokens between the Ethereum and Polkadot ecosystems.

An image of the HydraDX logo.

HydraDX allows users to trade many assets in a single pool, establishing a comprehensive ecosystem for things like liquidity and yield farming.

Risks associated with DeFi composability

DeFi’s composability is often seen as a double-edged sword as it can create endless combinations with its various components but also open the door to more risks. 

For starters, while composability facilitates sophisticated transactions, it also increases the number of interactions with external, untrusted code. This is potentially dangerous as the exploitation of a vulnerability within a single smart contract can have a devastating impact on multiple DeFi protocols in the space and your cryptocurrencies.

Take the 2021 yearn.finance’s DAI vault attack, for instance. The protocol suffered an exploit on one of its DAI lending pools, causing a loss of $11.1 million. 

According to an Ethereum address that was presumed to be associated with the exploit, an Aave flash loan triggered the attack. The attacker’s strategy was to deposit DAI into Curve’s 3Pool which held DAI, USDC, and USDT, to manipulate DAI’s price, as the 3Pool was responsible for calculating the value of the stablecoins. 

After cashing out the funds, the attacker withdrew the contract and repeated the same process a few times to drain the funds from the vault.

In short, the attacker exploited a vulnerability on Curve to drain funds from yearn.finance’s DAI vault.

Begin your DeFi journey with MoonPay

DeFi can help you earn interest and grow your crypto portfolio. To get started, simply buy cryptocurrency via MoonPay using your credit card or any other preferred payment method.

MoonPay's widget offers a fast and easy way to buy Bitcoin, Ethereum, and more than 50 other cryptocurrencies.

MoonPay also makes it easy to sell crypto when you decide it's time to cash out, including several tokens mentioned in this article like ETH, USDT, and USDC. Simply enter the amount of the token you'd like to sell and enter the details where you want to receive your funds.

You might also like

MoonPay Enterprise guide
virtual accounts

The Complete Guide to Virtual Accounts with MoonPay Enterprise

Virtual accounts give every customer a named USD, EUR or GBP account that converts bank transfers into stablecoins. How MoonPay Enterprise provisions them.

PayBox agentic payments
cryptocurrency

Agentic Payments & How AI Agents Actually Pay for Things

Agentic payments let an AI agent buy things without holding your money or seeing your card number. How they work, what agents can buy, and how MoonPay's PayBox does it.

embedded wallets end of seed phrases
guide

Embedded Wallets and The End of Seed Phrases

For most of crypto's history, the price of admission was a ritual: write down 12 words, in order, on something that can't catch fire or get wet, and guard them for the rest of your life. Get it right and you're your own bank. Get it wrong o

Accepting Crypto Payments
cryptocurrency

How to Accept Crypto Payments: Checkout, Settlement & Merchant Setup

A customer just bought a $100 hoodie from your online store and paid in crypto. Quick question: where is that $100 right now?

What is an MPC wallet? Benefits, Tradeoffs & Use Cases
cryptocurrency

What is an MPC wallet? Benefits, Tradeoffs & Use Cases

An MPC wallet is a crypto wallet that never stores your private key in one piece. The key is split into encrypted shares held in different places, and signing a transaction combines those shares without ever rebuilding the whole key. That d

Wallet as a Service (WaaS)
security

What Builders Need to Know About Wallet as a Service (WaaS)

You want to add a crypto wallet to your product. You start researching and hit three terms that all overlap: white-label wallets, embedded wallets, and wallet as a service. Marketing pages from infrastructure providers blur the lines. Most