Back to blog

Introducing Swapper

Jun 08, 2023
Picture of Abram Dawson
Abram Dawson
Picture of William Minshew
William Minshew
Feature image for

What do creators like Jonathan Mann and Reo Cragun, DAOs like Nouns and AirSwap, collectives like Protocol Guild and Metalabel, and distributed validators running on Obol all have in common? They face a mismatch, where they generate revenue in one currency (typically ETH) and incur expenses in another (typically USDC, DAI or another stable coin).

This mismatch is sometimes resolved through a combination of suboptimal solutions: rebalancing manually, granting custody to a third party, and developing custom software. What if there was a better way? What if these onchain entities could dictate the currency their revenue arrived in?

Today, we're introducing just that. It's called Swapper, and it swaps all tokens (ETH or ERC20s) it receives into a predefined output token of your choice. It gives you control over what tokens you receive regardless of what tokens you're sent; someone can send you ETH and you'll receive USDC.

Similar to Split and Waterfall, Swapper is a stackable, modular smart contract that functions entirely onchain and operates at gas. It’s a public good for the Ethereum community. The contracts have been audited, and you can read more in our docs.

You can try it right now and show your support by minting the free launch NFT.

Below, we'll go over how to create one, how it works, when you might use it, and how it can be stacked with a Split to create a "tax-withholding wallet". For a more engineering-focused overview, please take a look at the Engineering Swapper post.

Creating a Swapper

Each Swapper has an output token, a beneficiary, an (optional) owner, and an oracle

A Swapper needs an output token, a beneficiary, an (optional) owner, and an oracle. The oracle that we're launching today uses Uniswap v3 TWAP to determine fair pricing. We built the oracle to be flexible, meaning you can use any oracle contract you’d like, and we expect to have a version supporting Chainlink out soon. The Swapper can be automated, by offering discounts to oracle pricing to incentivize third parties to swap with it (similar to Split’s distributor fee).

How Swapper works

As tokens are received by a Swapper, they're held as balances until the owner or any third party calls the permissionless swap function. This function atomically swaps the balance(s) into the output token and sends it to the beneficiary. If the oracle cannot determine a fair price, tokens will remain in the Swapper until the owner manually swaps or withdraws them.

For those interested in a deeper technical breakdown of how the system works, we encourage you to read Engineering Swapper.

When to use Swapper

Many instances exist where a person or system desires control over which tokens they receive. With Swapper, you now have that control, regardless of what tokens you're sent. Best of all, you can incorporate this swapping functionality directly into your payment flows without writing a single line of code. Here are a few examples:

  • automatically swap income and staking rewards to USDC for taxes or salaries (more on this below!)
  • add granular controls over what types of tokens flow through Splits and Waterfalls

Diversifier: a tax-withholding wallet for creators

In the US, taxes are owed on the dollar amount earned at the time of receipt. (Not tax advice.) The issue is, NFTs aren't sold in dollars; they're typically sold in ETH. This creates a mismatch between what currency you receive and what currency you owe.

So today, along with Swapper, we're also launching Diversifier. Diversifier stacks a Split in front of Swapper(s), allowing you to swap different percentages of income into different tokens. Here is one live on mainnet.

By swapping a portion of income into stablecoins, Diversifier acts as a tax-withholding wallet for NFT creators, DAO contributors, and anyone else earning onchain income. Since the swap happens shortly after funds are received, Diversifier sets aside the right amount of the right currency at the right time.

Handling the swapping this way also has an added benefit: it prevents you from having to worry about the volatility of ETH. This volatility has been a huge issue for creators. Just ask Jonathan Mann about his experience.

Diversifier solves this issue for creators. For example, let's say Alice is earning royalties and income from various NFT projects. She creates a Diversifier that permissionlessly sends 40% of her income as USDC to taxes.alice.eth. The remaining 60% is sent as is to alice.eth, her primary day-to-day wallet. Alice could even set up "payto.alice.eth" to resolve to her Diversifier contract, making it easy to share her payable address with others.

A Diversifier acts as a tax-withholding wallet for NFT creators

If someone sends NFTs or tokens that can't be swapped to Alice's Diversifier, it's not a problem since Alice can set themselves as the contract owner and easily withdraw or transfer the tokens at any time.

What’s next

We at Splits believe that small groups of passionate people working together have the power to change the world. These groups deserve full custody and control of their earnings, and Swapper and Diversifier bring us one step closer to making this dream a reality.

We’d love to hear your feedback, suggestions, and ideas, so please reach out. Thanks for joining us on this journey!

Subscribe for future updates