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.

This guide will walk you through how to use Etherscan and ABI Ninja to withdraw your funds.

Tools

Requirements:

  • A browser web3 wallet

Finding your Element assets (Etherscan)

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:

image

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

Interacting with the relevant contracts (ABI Ninja)

You can use ABI Ninja to send the actual transactions to the Element Protocol smart contracts.

ABI_Ninja

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.

The Element Protocol pools are built on top of the Balancer Protocol’s AMM, so we'll use the Balancer vault's smart contract to redeem the LP position's underlying assets.

[LP] Preparation step:

Generally, you will need the following pages:

ABI_Ninja
  • 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.
image
  • If the LP contract was not Verified on Etherscan, you won't be able to see the contract functions and will have to use ABI Ninja to interact with it:
  1. Go to https://abi.ninja/.
  2. Paste the contract address in the input field. It will show you a field to Manually import the ABI.
  3. Go to https://etherscan.io/token/0x63E9B50DD3eB63BfBF93B26F57b9EFB574e59576#code (this is a verified LP from an different Element Protocol pool).
  4. Scroll all the way down to the Contract ABI section.
  5. Click the Copy to Clipboard button (see image).
  6. Back on ABI Ninja, paste the ABI into the field to Manually import the ABI, and click on Import ABI
image

You should now be able to interact with the contract through ABI Ninja.

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

image

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

[LP] Step 1: 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 2: sender and recipient

  • These are both just your wallet address.

[LP] Step 3: assets

  • Go to the getPoolTokens method of the Balancer Vault contract.
  • Input the poolId that you obtained on step 1.
  • 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 that they’re both enclosed in square brackets [, that each value is enclosed in quotations ", and that they're separated by a comma. Don't forget to delete the \ characters.

[LP] Step 4: 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 5: 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.
      • Note: The number should be a uint256 number, that is, it should have no decimal point. If the UI shows you a decimal number, you must multiply it by 1e18 before encoding.
  • Encode the balance using an ABI encoder.
    • Use 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.
    • In the userData field of the Balancer Vault’s exitPool method type 0x and paste the encoded number.
image

[LP] Step 6: toInternalBalance

  • Input false into this field.

[LP] Final Step: 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.
IntroductionIn_March_2022__DEL_-_HackMD

[LP] (Alt) Step 5: 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 come back and 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 5.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 5.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 5.3: Obtain the total balance of each asset in the pool

  • Go to the getPoolTokens method in the Balancer Vault contract.
  • Input the poolId that you obtained on step 1.
    • (Note: this is the same process we followed on step 3.)
  • Copy the numbers from the balances section of the response
    • These are the two numbers enclosed in quotations and brackets, and separated by a comma, like so: "[12345678,23456789]"
  • Paste these numbers into the Asset 1 and Asset 2 fields of the spreadsheet, respectively, on the Total Tokens pooled column.
  • The spreadsheet will calculate the values on the Your Token calculated share column.

[LP] (Alt) Step 5.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 5.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 5.4).
    • Your encoded Asset 2 calculated share (from Step 5.4).
  • Make sure to paste all three values one after the other, with no spaces or other separators in between.

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.

image

[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.

image

[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 or ABI Ninja, 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.