Withdrawing Funds from the Element Protocol: A Step-by-Step Guide Using Etherscan

Introduction

In March 2022, DELV (then doing business as Element Finance, Inc.) released control of the Element Protocol to the community. In February 2023, DELV announced that it planned to discontinue its front end for accessing the Element Protocol, and placed a banner atop the website informing users that the website UI would be taken down on November 4, 2023, giving users sufficient time to remove their funds. The last term of the Protocol matured in May 2023.

In November, DELV deprecated its UI and app access to the Element Protocol. The Protocol is not administered or maintained by DELV itself, and DELV has never custodied, intermediated, or had access to user funds.

Now that the Element Protocol web UI has sunsetted, exiting your existing Element Protocol positions requires a few more steps.

To start, you can paste your wallet address on Etherscan’s search bar to check if you still have any tokens to withdraw or redeem from Element Protocol pools. See below for an example:

This is also an easy way to find the relevant smart contracts that you may need to gather data from.

This guide will walk you through how to use Etherscan for withdrawing your funds.

Interacting with the contracts through Etherscan

Requirements:

  • A browser web3 wallet

The Element Protocol pools are built on top of the Balancer Protocol’s AMM. This means that you’ll have to input some data into the Balancer Vault contract, which you will get from the Element pool smart contracts, in order to redeem your LP tokens.

As for PTs and YTs themselves, those have their own smart contract addresses, so let’s take a look at how to exit these positions in each situation.

Redeeming LP tokens

If you don’t hold any LP tokens, you can skip to the relevant section, depending on whether you hold PTs or YTs. Otherwise, follow along to redeem your LP tokens into its component assets first. See below for an example:

Balancer__Vault___Address_0xBA12222222228d8Ba445958a75a0704d566BF2C8___Etherscan

[LP] Preparation step:

Generally, you will need 2 smart contracts:

  • The smart contract for the tokens you’re holding, which you can find by searching for your wallet address on Etherscan, finding your Element LP token under TOKEN HOLDINGS, and clicking on it. They’re easily recognizable because their name starts with LP Element.
  • The Balancer Vault - 0xBA12222222228d8Ba445958a75a0704d566BF2C8.

You will go back and forth between these two contracts. You may find it helpful to keep them open on Etherscan on two separate tabs or windows.

[LP] Step 1: Find the exitPool function

  • Go to the Balancer Vault contract’s page.
  • Below the general info section, click on the Contract button.
  • Click on Write Contract.
  • Scroll down to the method called exitPool (0x8bdb3913).

You’ll see several fields that need to be filled. Here’s an example on how it’d look once filled:

  • poolid: 0x5746afd392b13946aacbda40317751db27d8b91800020000000000000000034c
  • sender: 0x882928dF24ef9Ae509C8d62E13F47CD374EB28bE
  • recipient: 0x882928dF24ef9Ae509C8d62E13F47CD374EB28bE
    request (tuple)
  • assets: [0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xB83809806A076A1413437Ea3E553d6bF41993A21]
  • minAmountsOut: [0,0]
  • userData: 0x0000000000000000000000000000000000000000000000000de0b6b3a7640000
  • toInternalBalance:

Now let’s look at how to obtain these inputs.

[LP] Step 2: poolId

  • Go to the LP token’s contract -> Contract -> Read Contract. You should already have this open from the preparation step in this guide.
  • Click on the getPoolId method.
  • Copy the poolId. It’s the long string of characters that starts with 0x.
  • Paste the poolId into the respective input field on the Balancer Vault’s exitPool method.

[LP] Step 3: sender and recipient

  • These are both just your wallet address.

[LP] Step 4: assets

  • Go to the Balancer Vault contract -> Contract -> Read Contract.
  • Click on the getPoolTokens method.
  • Input the poolId that you obtained on step 2.
  • Copy the addresses from the tokens section of the response.
  • Paste the addresses into the assets input field on the Balancer Vault’s exitPool method. Adjust the formatting: it should look like [address1,address2]. Note they’re both between square brackets and separated by a comma.

[LP] Step 5: minAmountsOut

  • Input [0,0] into this field. This just sets the minimum amount of assets you’ll receive from redeeming the LP tokens.

[LP] Step 6: userData

  • Obtain your current balance of LP Tokens:
    • Go to your LP Token’s contract -> Contract -> Read Contract. You should already have this open from the preparation step in this guide.
    • Click on the balanceOf method.
    • Input your wallet address.
    • Copy the number from the response.
  • Encode the balance using an ABI encoder.
    • User your own methods, or use this Online ABI encoder.
    • Set the Argument type to uint256.
    • Input your token balance that you copied from the balanceOf method earlier.
    • Encode it and copy the encoded number.
  • Input the encoded number into the userData field of the Balancer Vault’s exitPool method.

[LP] (Alt) Step 6: userData

Only follow these (Alt) steps if you're trying to withdraw from a v1 pool. If you're not sure, skip this step. If your transaction fails, then try this step.

You may find it helpful to make a copy of this spreadsheet for calculating your share of the pool, which you'll need to generate the input for the userData field.

[LP] (Alt) Step 6.1: Obtain your current balance of LP Tokens

  • Go to your LP Token's contract -> Contract -> Read Contract. You should already have this open from the preparation step in this guide.
  • Click on the balanceOf method.
  • Input your wallet address.
  • Copy the number from the response.
  • Paste this number into the balanceOf (your LP tokens) field of the spreadsheet.

[LP] (Alt) Step 6.2: Obtain the total balance of LP Tokens for that pool

  • In the same contract, scroll down further and click on the totalSupply method.
  • Copy the number from the response.
  • Paste this number into the totalSupply (of LP tokens) field of the spreadsheet.

[LP] (Alt) Step 6.3: Obtain the total balance of each asset in the pool

  • Go to the Balancer Vault contract -> Contract -> Read Contract.
  • Click on the getPoolTokens method.
  • Input the poolId that you obtained on step 2.
  • (Note: this is the same process we followed on step 4.)
  • Copy the numbers from the balances section of the response
  • Paste these numbers into the Asset 1 and Asset 2 fields of the spreadsheet, on the Total Tokens pooled column.
  • The spreadsheet will calculate the values on the Your Token calculated share column.

[LP] (Alt) Step 6.4: Encode the data using an ABI encoder.

  • Use your own methods, or use this Online ABI encoder.
    • Set the Argument type to uint256.
    • From the spreadsheet, copy your Asset 1 calculated shares into the Argument value field of the ABI encoder.
    • Encode it and copy the encoded number.
    • Repeat the same process to encode your Asset 2 calculated shares.

[LP] (Alt) Step 6.5: Build the userData input value

  • Paste the following into the userData field of the Balancer Vault's exitPool method:
    • The prefix 0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002.
    • Your encoded Asset 1 calculated share (from Step 6.4).
    • Your encoded Asset 2 calculated share (from Step 6.4).
  • Make sure to paste all three values one after the other, with no spaces or other separators in between.

[LP] Step 7: toInternalBalance

  • Leave this field blank.

If this field isn’t blank, the tokens will stay in the Balancer Contract

[LP] (Final Step) Step 8: call the exitPool method

  • Now that the Balancer Vault’s exitPool form is all filled up, it should look similar to the example in Step 1.
  • Click the Write button. This will prompt your browser wallet to approve a transaction. Once you’ve approved and the transaction goes through, you’ll get your original assets and Element PTs or YTs.
  • You can follow the other sections of this guide to redeem your PTs and/or YTs.

Redeeming PTs

If you hold PTs, you can withdraw them by calling the PT contract’s withdrawPrincipal method. In this guide, you’ll learn how to find all the inputs you need.

Tranche___Address_0xB83809806A076A1413437Ea3E553d6bF41993A21___Etherscan

[PT] Preparation step:

You’ll have to interact with the PT contract:

  • You can find the contract for your PTs by searching for your wallet address on Etherscan, finding your Element Principal token under TOKEN HOLDINGS, and clicking on it. They’re easily recognizable because their name starts with Element Principal.

[PT] The withdrawPrincipal function

  • Go to the Etherscan Page for the PT.
  • Below the general info section, click on the Contract button.
  • Click on Write Contract.
  • Scroll down to the method called withdrawPrincipal.

It’ll prompt you for two inputs:

_amount (uint256): You can get this number by:

  • On the contract’s Etherscan page, go to Read Contract.
  • Scroll down to the balanceOf function.
  • Input your Ethereum address.
  • Copy the number from the response and paste it into the Write Contract -> withdrawPrincipal -> _amount field

_destination (address): YOUR ADDRESS

Once done, click the Write button and approve the transaction. Congratulations, you’ve redeemed your PTs!

Redeeming YTs

If you hold YTs, you can withdraw them by calling the withdrawInterest method on the contract of the PTs associated to your YTs. In this guide you’ll learn how to find all the inputs you need.

Tranche___Address_0xB83809806A076A1413437Ea3E553d6bF41993A21___Etherscan

[YT] Preparation step:

You’ll have to interact with the contract of the PT that’s associated with your YT:

  • You can find the correct contract by searching for your wallet address on Etherscan, finding your Element Yield token under TOKEN HOLDINGS, and clicking on it. They’re easily recognizable because their name starts with Element Yield.
  • Once on the Yield Token’s contract page, go to Contract -> Read Contract
  • Scroll down to the tranche function and click on it.
  • The result is a PT contract address. Open it in a new tab.

[YT] The withdrawInterest function

  • Go to the Etherscan Page for the PT associated with your YTs.
  • Below the general info section, click on the Contract button.
  • Click on Write Contract.
  • Scroll down to the method called withdrawInterest.

It’ll prompt you for two inputs:

_amount (uint256): You can get this number by:

  • On your YT contract’s Etherscan page, go to Read Contract.
  • Scroll down to the balanceOf function.
  • Input your Ethereum address.
  • Copy the number from the response.

_destination (address): YOUR ADDRESS

Once done, click the Write button and approve the transaction. Congratulations, you’ve redeemed your YTs!


Similarly to using Etherscan, anyone is allowed to create and host their own user interface (UI) for the Element Protocol. The code for the now DELV deprecated UI and app is open-sourced for anyone to use, and is available on GitHub at https://github.com/delvtech/frontend-monorepo titled as the core-frontend app.

Please make sure to do your own due diligence as to how to withdraw your funds. To be clear, these steps are at the user’s own risk, so please be cautious. DELV has published this guide solely for informative purposes and assumes no liability by providing this information.