Diversifier contract

Updated 8 months ago

Diversifier automatically splits and swaps an income stream into specific tokens according to set ratios. This is particularly useful for tax withholdings — for example, when you want to automatically swap 40% of your income into a stablecoin to set aside for taxes.

In the example above, incoming payments are split into two streams — 40% is swapped into USDC and withdrawn to taxes.alice.eth, while the remaining 60% is swapped into ETH and withdrawn to alice.eth.

Remember

Keep these in mind whenever interacting with any smart contracts:

  1. Interacting with contracts require onchain transactions, and onchain transactions are irreversible.
  2. Contracts are entirely your property; we hold no control or special privileges over them.
  3. Each contract operates exclusively on the network on which it has been deployed—make sure you're on the right network.

Creating a Diversifier

To create a new contract, first click “New contract” from the navigation. Then select the network on which you want to deploy the contract, and click “Diversifier” from the list of contracts. You will now see that you’re creating a new Diversifier on the network of your choice.

Destinations

Each destination is a recipient of incoming payments. Share of income is the percentage of funds that you want to be forwarded to a particular address. Share of income across destinations must add to 100% (this is the “split” portion of the Diversifier).

The output token is the currency that will be forwarded to the destination’s beneficiary. You can either choose from one of the tokens in the UI, or paste in the contract address using the “Enter address” option.

Two things to be sure of to prevent loss of funds:

  1. That the contract address you’re pasting is on the same network on which you’re deploying your Diversifier.
  2. That your output token is supported by the Oracle you’re using. Here is a list of the supported token pairs for our default UniV3Oracle.

You can also choose not to swap incoming payments, and funds will be forwarded as-is. To do so, just select “Forward as is (no swap)” as the output token.

Owner

You can choose to designate an owner for your Diversifier, who will have admin control and be able to withdraw any unswappable tokens. If you don't choose an owner, unswappable tokens will be permanently stuck in the contract. If you're using this just for yourself, we recommend setting your own wallet as the owner.

Oracle

The oracle is the source for the price of tokens to be swapped. Make sure that the oracle supports any tokens you expect to receive. Currently the app offers Splits' Uniswap-based oracle, but you can also enter the address for a different one that you want to use, as long as it abides by the expected oracle interface. The oracle interface is NOT a Uniswap pool – read the docs if you’re using a custom oracle.

You may notice the "Advanced settings" dropdown, which allows you to change the incentives enables automatic swapping. Do not tinker with this field unless you know what you're doing and have a thought-out plan — mistakes will prevent the Diversifier from functioning as intended.

Name

This is the contract name that will be displayed in the Splits app instead of the contract’s hexadecimal address. This gets stored offchain (therefore you must be signed in to add one), and you can choose to make the name public, available to other Splits users, or keep it private for personal use only.

Using a Diversifier

Once you’ve created your Diversifier, you’re now ready to use it. Using Diversifier means 1) sending ETH or ERC20 tokens to the Diversifier’s address, and 2) releasing the swapped tokens (and possibly withdrawing any unswapped ones).

Sending funds

Sending ETH and ERC20 tokens to your Diversifier is as easy as sending funds to any other account. Just copy the address, which can be found at the top of the contract’s detail page, and send tokens to the address. You can send funds via the app, but most people will use the Diversifier address in other platforms and apps (e.g., Zora, Highlight, OpenSea, Manifold, etc).

Swapping and withdrawing

Diversifier is designed with an incentive for third parties to automatically swap and withdraw your balances on your behalf. However, if you need to swap and withdraw manually, you can do so by navigating to your Diversifier contract’s detail page in the app, selecting the balances, and clicking the “Swap” button. You will need to connect your wallet to complete the swap and withdrawal.

Editing a Diversifier

Connect your wallet and then navigate to the Diversifier’s detail page. At the top, you’ll see a message that says “You control this Diversifier”, and the ability to “Edit Diversifier” or “Pause”.

Editing the Diversifier lets you change the share of income, the output token, and the beneficiary. You can also add a new destination. If you want the new destination to receive a particular output token, you’ll need to create a new Swapper contract and use its address as the beneficiary.

Pausing the Diversifier will prevent non-owners (i.e., any account that is not you/the owner of the Diversifier) from being able to interact with the contract. We encourage you to leave this on unless you need to prevent others from interacting with Diversifier.

Still need help? Reach out in /splits, DM us on Twitter, or join our Discord