Guide: How to use the L2 Loopring Exchange | by Matthew Finestone | Loopring Protocol
Technology

Guide: How to use the L2 Loopring Exchange | by Matthew Finestone | Loopring Protocol

ethereum layer 2 scaling is now more necessary than ever. Fortunately, looping zkrollup is here to help you save gas, save time, and basically not get stuck in congested layer 1, all while maintaining the complete self-custody security of ethereum. below is a step by step guide on the looping exchange, the layer 2 dex built on top of the zkrollup looping.

first, two basic questions if you are interested.

Reading: How to connect metamask to loopring

what is loop swapping?

loopring exchange is a non-custodial ethereum exchange built on layer 2 of loopring. is an order book based and amm based exchange that replicates the high performance, low cost trading experience of centralized exchanges users can trade quickly & at low cost (without worrying about ethereum congestion or gas fees) while maintaining self-custody control of your assets. the exchange is based on the open source looping protocol.

loopring exchange is more than a dex and also acts as a payment application. users can send eth and erc20 token transfers to any ethereum address instantly, cheaply and securely on l2.

what is a zkrollup?

zkrollup is a kind of layer 2 scaling solution on ethereum, allowing for much higher performance and much lower costs, without sacrificing security. it does this by moving all the heavy lifting (calculations) off-chain, keeping applied rules and security intact through the use of sanity tests: cryptographic proofs that attest to what happened off-chain. Because ethereum verifies these tests and stores enough data to tell exactly which off-chain account owns what, zkrollups inherits the same non-custodial security as ethereum, but can run much faster. for more detailed technical information, please read our design document.

  • how to incorporate looping l2 on desktop
  • how to make instant transfers on looping
  • how to trade tokens without gas
  • how to add liquidity to a l2 amm pool
  • finding the highest winning looping pools
  • how to remove liquidity from an amm pool
  • how to trade the order books
  • how to remove from l2 to l1

You can currently access looping l2 by going to the looping exchange in a web browser, or through the looping smart wallet mobile app (currently available only for android).

We’ll focus on the looping web exchange platform in this guide, but keep in mind that all of the l2 tactics you learn here can also be applied to your looping wallet. if you are more technical, you can also interact with l2 through our relay api.

  1. Go to loop exchange. click ‘connect wallet’ and link your metamask, mew or a compatible wallet wallet.

2. with your wallet connected, you will see it say “deposit to activate layer-2”. click on that. choose an asset to deposit and the amount. confirm the transaction in your wallet to execute the deposit. after 18 ethereum commits you hit the zkrollup!

note: since depositing is an ethereum layer 1 transaction, meaning it moves from l1 to l2, this costs gas. it is approximately the gas cost of a normal token transfer. pay this gas cost one time, and then you’ll be on l2 with those assets, living without gas for as long as you want.

as mentioned, you need to deposit your assets into a smart contract to access l2. This contract receives your assets and “assigns” them to your slot in the merkle tree, which you, and only you, control. you can withdraw your assets from the contract whenever you want, even if looping disappeared or turned evil (ethereum only needs to exist for your assets to be safe).

pro tip: some people are afraid to pay a gas fee just to get on l2. but the truth is that it is cheaper to deposit in l2 once than to make a uniswap operation. depositing eth and most erc20 tokens on looping costs ~60k gas, while a trade on uniswap costs around ~120k gas per trade. And you only need to migrate once! the rest of your token swaps are gas free!

3. there should be an “unlock” button. go ahead and click on that. this asks your wallet for a signature to unlock your l2 account. it’s a signature, not a transaction, so there’s no gas fee!

See Also:  How To Pair Your Hoverboard&39s Bluetooth To Your Devices

This “unlock” button will appear every time you access your l2 account from now on. it’s the equivalent of logging in, but you only need your ethereum address to sign a transaction with a single click.

Once you’re logged in, you can check your l2 looping balances, deposit other assets, or withdraw back to l1 by clicking the “account” tab.

for other tanks, you just do this same process again (which costs gas since it’s l1). When you deposit any asset besides ETH (any ERC20 token), the deposit contract will first ask for your permission, also known as “token approval”, allowing you to interact with your respective token. you might be familiar with this pattern from all other ethereum apps. this costs gas as it is an l1 operation, but this token approval tx happens only once per token. future deposits of the same token will only have the tx of the deposit, not the approval.

The “account” tab is also where you can send assets on l2 to any other ethereum address, whether they have used l2 looping before or not. It is ideal for payments, especially frequent to many people!

All you need is someone’s ethereum address or ens name, choose the asset and amount, and you can send them an instant, gas-free transfer on l2. you can even add a note. click ‘transfer’, sign the application and it is submitted.

note: transfers are currently free on looping unless the transfer is to a “new” account that has never interacted with l2. only in this case there is a small flat fee of a few cents to cover the cost of activating the account. eventually, there will be a very small flat fee of a few cents for all transfers.

loopring l2 supports both types of ethereum dex “market structures”: order books and automated market makers (amms). Let’s first see how to change the ammeter.

in the loop exchange, click on the “exchange” tab at the top. choose your pool (each pool has two assets you can trade between) and which way you are trading. choose your amount to redeem.

See also: Relationships with toddlers: ideas & tips | Raising Children Network

the amm group will automatically show you the exchange rate.

You will also see the minimum amount you are guaranteed to receive from the exchange. you can adjust the slip tolerance by clicking the gear near the top right. just beware of price impact on some illiquid pools!

Currently, loop fees are 0.25% for the exchange. 0.15% of that goes to liquidity providers (lps), the remaining 0.1% goes to relay and protocol fee. fees are taken from the token you are buying. remember: no gas fees!

once you’re ready, click “change” and your transaction will be executed instantly. no delays, no gas fee. your l2 balance will be updated. You can see your trading history and the fees you paid in the “orders” tab.

Liquidity Providers (LPS) currently earn a 0.15% commission on all trades in the pools they provide liquidity to, proportional to their stake in that pool. to become an lp, like uniswap and other amms, simply deposit equal value of both assets into the pool.

To become a looping lp, go to the “pool” tab at the top and choose which pool you want to provide liquidity to from the dropdown menu. click ‘add’.

To add liquidity to a pool, you need an equal value of both assets, which is deposited into the pool at that pool’s prevailing exchange rate. ie if you want to become an lp in the lrc-eth pool you would need $100 in lrc and $100 in eth. in the future, you will be able to deposit with a single asset. we’re working on that!

choose the amount you want to add of one asset or another. the user interface will automatically ask you to deposit the other amount of assets given the exchange rate at that time to ensure equal value. then click ‘add’.

See Also:  How to Connect Your AirPods to a Chromebook in 6 Steps

your deposit will be executed immediately.

While depositing into a pool does not require gas, there is a small fee associated with the transaction. This is because the operation, even if performed on l2, has a lower corresponding gas cost l1. so the cost varies with gasoline prices in l1. at time of writing, it is 0.008 eth.

Your position in the group will be represented by lp tokens you have in l2. you can see your lp tokens for a given pool and the percentage it represents on the “pool” page. you can also see your lp tokens in your ‘balance’ under ‘account’ as it is effectively an asset like any other. the name of an lp token for the lrc-eth group, for example, would be lp-lrc-eth.

To view the history of your amm pool’s add/remove liquidity operations, click on “account” and then “amm transactions”.

note: being an lp is not risk free. you face the potential risk of “temporary loss” just like with most other mma.

In the “amm information” tab, click on “amm groups”. here you will see the liquidity in each pool, volume, fees earned and and if there are any lrc liquidity pull programs or other incentive programss.

all of this finally leads to an apy (annualized percentage yield) column, so you can see the expected return you would get for being an lp in that pool.

for more information on liquidity mining in looping l2, please read this. there are liquidity incentives provided in lrc and other tokens for certain amm pools. these incentive campaigns change in 14 day cycles, so keep an eye on the amm groups page and our discord for updated cycles and cycles.

If you’re interested in liquidity mining, all you have to do is be an lp in the appropriate pools. There is nothing more to do. just wait!

Liquidity mining rewards are automatically sent to accounts in l2 at the end of the 14-day cycle.

note: there are also rewards for merchants! Users with a high trading volume in a given pool are rewarded. Click on ‘Amm Trade Tournament’ to find out which pools are being incentivized and with how much in rewards. this also changes in 14-day cycles.

In the ‘group’ tab, you’ll see ‘my groups’, which shows you the groups that you currently have active. you can go ahead and click ‘delete’.

See also: Movado | Connect 2.0 How To Information

You will be asked to decide how much of your assets you want to withdraw from that pool. decide the amount, which means redeeming your lp tokens for that part of the two underlying tokens.

you will see the amount of each token you will receive in exchange. Please note that there is a very small fee when withdrawing liquidity from a pool!

Note: This amount you are removing includes any fees you have earned throughout your time providing liquidity. LP fees (0.15%) automatically accumulate in the pool every time someone trades with that pool. this widens the pool for all lps, so when you remove your liquidity, you take your share of the fees.

there is a fee to withdraw liquidity from the amm pool. This is because the operation, even if performed on l2, has a lower corresponding gas cost l1. so the cost varies with gasoline prices in l1. at time of writing, it is 0.0073 eth.

loopring is more than just amm. it is also a dex order book. so if you prefer to “trade” a pair into the books instead of the pool, head over to the “trade” tab.

There you will see the familiar layout of the order book, showing bids and asks, a price graph, price history, etc. especially stablecoin to stablecoin pairs.

The order books support limit orders, which means you can enter the price you want to buy or sell at and leave it on the books. someone can come and complete your order. this way you are guaranteed to get the price you want.

See Also:  How To Connect Samsung Soundbar To Tv [Step-by-Step Guide]

manufacturers receive rebates on their orders that are filled in the books. the reduction is 0.02% (2 bps). so any rest limit order you have that another user takes, you earn 0.02% of that amount, i.e. a negative fee!

There are currently no market orders (buy or sell at the highest bid or ask price). however, if you want to place a market order, it’s pretty easy to replicate. simply click on one of the orders you would like to take and it will automatically fill in those details in the order placement area. make sure you select whether you want to buy or sell that asset. click buy or sell, and that’s it.

Note that in addition to manufacturer rebates, there is also often liquidity mining for order book pairs. this incentivizes users (especially market makers or algorithmic traders) to place tight rest limit orders on the books and be rewarded for providing that liquidity (being a maker) for others to take. Learn more about how order book liquidity mining works here. if you want to connect to order books to trade or mm programmatically, here is the api. you may also want to connect to existing market making software that is connected to a looping exchange, such as hummingbot.

In the ‘account’ tab, you can withdraw assets from your loopring l2 account to ethereum l1. remember, a great virtue of zkrollups is that you can withdraw money at any time: your funds can never be stolen, frozen or seized by looping.

select the asset you want to withdraw and the amount. you can pick up to an address other than your own; not just going from your l2 to your l1, but from your l2 to a different l1. either a different address than yours, or a friend, etc.

but by default, your own address is entered. click “withdraw” and you will be prompted to sign a message, and that’s it.

due to the addition of a zkrollup, and since it is an l2 to l1 interaction, rollbacks can take a while until the “train wants to leave the station from l2 to l1”.

It can take anywhere from 5-30 minutes to pull out or a few hours depending on a couple of variables. with more activity on l2, it will actually be much shorter as trains will leave the station more frequently as seats fill up much faster and more consistently.

there is a fee to process a withdrawal, as the looping repeater has costs in processing these withdrawals (computing power for zk tests and general gas cost to post a cumulative block on ethereum). this fee fluctuates with l1 gas fees and is typically less than half the cost of transferring tokens on l1.

If you’re in a hurry to get from l2 to l1, we’ve just enabled “fast withdrawals”. this was a much requested feature that allows you to withdraw to l1 on the next ethereum block, you just pay a higher fee for the convenience.

Layer 2 is the present and the future of ethereum scaling. and it will actually be magnified by the release of eth 2.0, not replaced by it. l2s will support a lot of economic activity, while l1 will be where rollups sit their large batches of txs that represent all off-chain user activity. l1 will be the settlement layer (or for whale movements), l2 will be the environments where most users ‘live’ and use the applications.

if you completed this tactic, then you are ahead of the pack to see what the future of finance looks like.

If you are an android user, you can check out the mobile smart wallet and have the power of l2 looping in your pocket. ios will be out any day.

thanks, have fun on l2!

See also: How to Link Your Discord and PlayStation Accounts

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button