Welcome to the Superfluid Auto-Wrap developer quickstart. Here, you’ll learn how to automate the just-in-time wrapping of Super Tokens using Auto-Wrap. This guide assumes a knowledge of basic Solidity and performing web3 calls. Let’s get started 🚀

What’s Auto-Wrap?

Check out this high-level explainer.

You can find the codebase here.

Resources

Auto-Wrap Manager Interface:

protocol-monorepo/IManager.sol at dev · superfluid-finance/protocol-monorepo

Auto-Wrap Strategy Interface:

protocol-monorepo/IStrategy.sol at dev · superfluid-finance/protocol-monorepo

Auto-Wrap Manager Addresses:

Polygon: 0x2581c27E7f6D6AF452E63fCe884EDE3EDd716b32

Binance Smart Chain: 0x2AcdD61ac1EFFe1535109449c31889bdE8d7f325

Avalanche: 0x8082e58681350876aFe8f52d3Bf8672034A03Db0

Optimism: 0x1fA76f2Cd0C3fe6c399A80111408d9C42C0CAC23

Arbitrum: 0xf01825eAFAe5CD1Dab5593EFAF218efC8968D272

Ethereum: 0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1

Gnosis: 0x8082e58681350876aFe8f52d3Bf8672034A03Db0

Goerli (Testnet): 0x0B82D14E9616ca4d260E77454834AdCf5887595F

Mumbai (Testnet): 0x3eAB3c6207F488E475b7955B631B564F0E6317B9

Avalanche Fuji (Testnet): 0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1

Auto-Wrap Strategy Addresses:

Polygon: 0xb4afa36BAd8c76976Dc77a21c9Ad711EF720eE4b

Binance Smart Chain: 0x9e308cb079ae130790F604b1030cDf386670f199

Avalanche: 0x51FBAbD31A615E14b1bC12E9d887f60997264a4E

Optimism: 0x0Cf060a501c0040e9CCC708eFE94079F501c6Bb4

Arbitrum: 0x342076aA957B0ec8bC1d3893af719b288eA31e61

Ethereum: 0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d

Gnosis: 0x51FBAbD31A615E14b1bC12E9d887f60997264a4E

Goerli (Testnet): 0xea49af829d3e28d3ec49e0e0a0ba1e7860a56f60

Mumbai (Testnet): 0x544728AFDBeEafBeC9e1329031788edb53017bC4

Avalanche Fuji (Testnet): 0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d

Setting Up Auto-Wrap

1. Approve Wrap Strategy

First, the user needs to approve the Auto-Wrap Strategy contract on the appropriate network to spend the ERC20 token that will be needed for wrapping. For example, if you're maintaining USDCx salary streams on Polygon, you’ll approve the 0xb4afa36BAd8c76976Dc77a21c9Ad711EF720eE4b contract to spend your USDC.

We'd suggest giving maximum approval so you don't have to worry about manually approving increasing amounts over time as you open more streams. All this contract can do is wrap an ERC20 token to its equivalent Super Token (i.e. USDC to USDCx).

2. Call the createWrapSchedule() on the Manager contract

createWrapSchedule**() registers the auto-wrapping task within the Auto-Wrap Manager contract on chain.**

function createWrapSchedule(
    address superToken,
    address strategy,
    address liquidityToken,
    uint64 expiry,
    uint64 lowerLimit,
    uint64 upperLimit
) external

Parameters