C.R.E.A.M. Swap: A Tutorial

By dudesahn | DeFi Tutorials | 15 Sep 2020



Swap

C.R.E.A.M. Swap is a new automated market maker (AMM) product that has recently been added to the platform. Swap is a fork of Balancer (see audits here) with a Uniswap-like front end to manage the swaps. Swap was created to allow users to optimize their yield on the C.R.E.A.M. platform– by allowing users to swap directly between collateral positions (such as crYFI and crCREAM) instead of requiring them to manually withdraw, swap, and supply the new position. While C.R.E.A.M. Swap currently only supports swaps with crTokens and yTokens, Swap can also support tokens from Compound, Aave, Balancer, Uniswap, TokenSet, and more. You can read the official announcement about C.R.E.A.M Swap here.

To get started with Swap, navigate to it from the side panel on app.cream.finance, or head directly to app.cream.finance/swap.

1*YI11ZwOEFkHtLktgRo1UiQ.png

Select the token you’d like to swap from on top, and select the token you’d like to swap to on the bottom. Based on the first token you choose, only specific tokens will be available to swap into. The example below uses CREAM as the token you are swapping from. 

 
1*MNAGbTv4vlzI3BQtHhYlcw.png CREAM currently can only be swapped into USDC or WETH

The first time you are interacting with a specific token, you will need to “Unlock” it– give the C.R.E.A.M. protocol permission to spend it from your wallet. Once you’ve done this, you should be able to swap your pair.

 
1*YRWSYeP1QdxkwS8INetssQ.png Bugged gas limit (left) and correct gas limit (right)

Note: Occasionally, when conducting performing interactions on C.R.E.A.M. Swap, users may see a very high gas limit. This is a known issue and typically occurs when swapping “max” amounts of tokens. To fix this, simply remove a few digits from the end of your token swap or stake value. For instance– the gas limit on the left was shown when trying to swap 0.154765 USDC, while the correct value on the left showed when this was reduced to 0.1547 USDC. 

C.R.E.A.M. Swap charges 0.25% for trading fees– liquidity providers will receive 0.2%, while the other 0.05% will go to the CREAM network.

Pools

The Pools are where liquidity providers can supply the tokens for C.R.E.A.M. Swap. You can see currently available pools below:

 
1*VGs8IvV5bAj17jLv1BMADw.png The Pools page shows total value locked in each pool, as well as a user’s liquidity and volume in the past 24 hours.

 

Supplying Liquidity

In order to supply liquidity to any of the pools, simply click on the pool you are interested staking in. 

 
1*tpPvn-knZQ22gZQI0_MHhw.png Pool info page for the CREAM/USDC pool.

From there, click on “Add Liquidity” in the upper-right corner. 

 

1*whFXQHBUs90lurCKF4xnTw.png

As with the Swap page, if you have not previously allowed C.R.E.A.M. to spend your funds, you will need to do so– in this case by clicking the small green lock symbol to approve the use of each token individually. You can also supply just one asset at a time, as seen below:

 

1*EeE0W4Vh09Eqpiv-FA3_Ew.png

However, it is important to note– if you do provide only one asset to the liquidity pool, you will incur a small amount of slippage when the pool rebalances– and the protocol will estimate how large this slippage will be based on the size of your deposit. 

Reward

Once you’ve supplied liquidity to the Pools, you can now stake your CRPT (Cream Pool Token) in the Reward portal at app.cream.finance/reward

 
1*YSkrDwTRrJt6yAkGa2tWSQ.png Currently available Pools for staking on the Reward page.

Navigate over to the C.R.E.A.M. Swap tab and select the appropriate pool. In this case we are selecting the CREAM/USDC Reward pool. 

 

1*hFKWhZkeyGNB8LZnOMReKw.png

Just as for the Swap and for the Pools, you will need to “Enable” the C.R.E.A.M. platform to spend your CRPT. Once this transaction clears, then you can stake the CRPT– but again, be careful of the error with exceptionally high gas limits. 

As soon as you stake your CRPT, you will start to see CREAM rewards accrue on the right under “Rewards Available.” These can be claimed any time and rewards will not disappear, although use your best judgement when to claim due to gas costs. 

Unstaking/Removing Liquidity

In order to remove your liquidity from the C.R.E.A.M. platform, you’ll first need to unstake any CRPT on the Reward page (select “Unstake Tokens” in the “Staked Balance” box). Once you’ve done this, navigate back to the Pools page, and select the relevant pool. 

 

1*Miu7pq5dkhqRSsYqhdpFXg.png

This time, you’ll want to select “Remove Liquidity”. 

 

1*xZjQHGsuGjBhy4Un8jYdcQ.png

Again, you’ll have the option to remove your liquidity as either an equal balance of both assets, or as a single asset. Note that similarly to when adding liquidity, if you remove only a single asset you will incur some slippage. 


FAQs

Q: Can you provide a list of all of the smart contracts used by the C.R.E.A.M. platform?

You can find a list of all smart contracts here

Q: Are the Pools contracts audited?

Yes, the Pools contracts are forked from Balancer, and you can find more info about the Balancer audits here

Q: Why am is MetaMask showing a gas fee of over 1 ETH?

This is a known bug that happens when the smart contract throws an error– if this happens, try reducing the number of decimals you are depositing (i.e., from 1.6789 to 1.67). 

How do you rate this article?


13

0

dudesahn
dudesahn

PhD Student | Celsius Network Ambassador


DeFi Tutorials
DeFi Tutorials

Here I try and make DeFi (decentralized finance) applications easy with tutorials, explainers, and general updates.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.