Element Protocol Docs
GovernanceCommunityXForum
  • Element Protocol Documentation Portal
  • Getting Started
    • Buying Fixed Rate Assets
    • Earning Variable Rates
    • Providing Liquidity
    • FAQ
    • Glossary
  • Element Protocol
    • Concepts Overview
    • Principal Tokens
      • Use Cases
    • Yield Tokens
      • Use Cases
    • Market Forces
    • Providing Liquidity
    • Element Protocol Smart Contracts
      • Core Protocol Contracts
        • Wrapped Position
        • Tranche
        • Tranche Factory
        • Interest Token
        • User Proxy
      • Integration Contracts
        • Yearn Vault Asset Proxy
      • Custom Balancer Curve
        • Convergent Curve Pool
        • Convergent Curve Pool Factory
  • Developers
    • Public Release Changelog
    • Elf SDK
    • Deployment Guide
    • Security
      • Oracles
    • Github
  • Governance (Council)
    • Council Protocol Overview
      • Voting Vaults and Delegation
      • Governance Steering Council (GSC)
    • Council Protocol Interface
      • Overview
      • Proposals
        • Guide: Voting on a Proposal
      • Delegate
        • Guide: Delegating Voting Power
          • DAO (Social) Proposal Template
          • Protocol (Executable) Proposal Template
    • Element Governance Proposal Framework
      • Guidelines of the Element Governance Proposal Framework (EGPF)
      • Venues For Participating in Governance & Discussion
      • What Governance Controls Today
        • Current Protocol Parameters
        • Current Governance Parameters
      • Current Governance Roles
      • The Governance Process
        • Proposals & Proposal Types
        • The Proposal Process Overview
        • The Proposal Lifecycles
          • DAO (Social) Proposal Lifecycle Breakdown & Criteria
          • Protocol (Executable) Proposal Lifecycle Breakdown & Criteria
        • Off-chain Voting Information (Snapshot)
        • On-chain Voting Information
    • Council Protocol Smart Contracts
      • Core Voting
      • Voting Vaults
        • Locking Vault
        • Vesting Vault
        • Governance Steering Council (GSC) Vault
      • Timelock
      • Treasury
      • Spender
      • Optimistic Grants
      • Optimistic Rewards
      • Simple Proxy
    • Airdrop
      • Storage
      • Guide: Discord ZK Claim Flow
      • History
    • Glossary (Governance)
    • Audits
    • Deployed Contract Addresses
  • ELFIVERSE
    • Guide: Mint Your ELF NFT
  • Community
    • Discord
    • Blog
    • X
    • Telegram Announcements
    • Youtube (Community Calls and Video Guides)
Powered by GitBook
On this page
  • 1. Overview
  • Glossary
  • 2. Contract Details
  • Key Functionality:
  • 3. Key Mechanisms & Concepts
  • 4. Gotchas (Potential source of user error)

Was this helpful?

  1. Element Protocol
  2. Element Protocol Smart Contracts
  3. Core Protocol Contracts

Wrapped Position

PreviousCore Protocol ContractsNextTranche

Last updated 2 years ago

Was this helpful?

  • Contract Name: WrappedPosition

  • Type/Category: Core

  • Associated System Diagram: n/a

  • Contract Source:

1. Overview

The Wrapped Position is an abstract contract that wraps a yield-bearing Asset (YBA) such as Yearn shares.

Glossary

  • Yield Bearning Asset (YBA): An asset that increases in value, for example, Yearn Vault shares.

  • Underlying token: The token used by the yield-bearing asset to generate yield. (eg: USDC for USDC yearn vault shares)

  • Wrapped position token: The token minted by the Wrapped position contract after depositing.

2. Contract Details

Key Functionality:

  • deposit: The Entry point. It receives the underlying token and mints ERC20 tokens equal to the YBA shares received from that deposit. The caller must approve the wrapped position contract to use the underlying token before a call to deposit. Note that the vault deposit does not happen here. It is delegated to the extending contract

  • prefundedDeposit: Functions like the deposit function, except it assumes the underlying tokens were transferred to the wrapped position contract before this function was called. We do not need to approve the wrapped position contract to use the underlying tokens in this case.

  • withdraw: The Exit point. It burns wrapped position tokens to return underlying tokens. The actual contract interaction logic is delegated to the extending contract.

Storage: There is no stored state other than the underlying token.

3. Key Mechanisms & Concepts

The WrappedPosition contract abstractifies deposit and withdrawal logic associated with the WrappedPosition ERC20, however, it is an abstract contract and therefore cannot be used on its own.

4. Gotchas (Potential source of user error)

PrefundedDeposit will use all underlying tokens available to the Wrapped Position at that time, therefore the call that transfers the shares must be called in the same transaction as the ERC20 transaction which funds a deposit or the funds could be unintentionally stolen by the next call to this function.

https://github.com/delvtech/elf-contracts/blob/main/contracts/WrappedPosition.sol