LogoLogo
WebsiteGithubCommunity Docs
  • Developer Docs
  • Smart Contracts
    • Bond System
      • Auctioneer
        • Auctioneer Interfaces
        • Sequential Dutch Auctioneer (SDA)
          • Auction Pricing
          • Fixed-Term SDA
          • Fixed-Expiry SDA
        • Fixed Price Auctioneer (FPA)
          • Fixed-Term FPA
          • Fixed-Expiry FPA
        • Oracle-based Auctioneers
          • Oracle Interface
        • Oracle Fixed Discount Auctioneer (OFDA)
          • Fixed-Term OFDA
          • Fixed-Expiry OFDA
        • Oracle Sequential Dutch Auctioneer (OSDA)
          • Fixed-Term OSDA
          • Fixed-Expiry OSDA
      • Teller
        • Teller Interfaces
        • Base Teller
        • Fixed-Expiry Teller
        • Fixed-Term Teller
      • Callback
        • Callback Interface
        • Base Callback
        • Sample Callback Contract
      • Aggregator
        • Aggregator Interface
        • Aggregator Contract
      • Intended User Actions
      • Limit Orders
    • Option System
      • Fixed Strike oTokens
      • Fixed Strike Option Teller
      • Options Liquidity Mining (OLM)
        • Manual Strike OLM
        • Oracle Strike OLM
      • OLM Factories
  • Developers
    • Subgraph
    • Market Calculations
    • Purchases & Redemptions
    • User Balances
    • Options Library
      • Helper Functions
      • Types
  • References
    • Technical Resources
      • Audits
    • Community Resources
    • Brand Assets
    • Contact Us
Powered by GitBook
On this page
  • ERC-20 (Fixed-Expiry) Vesting Tokens
  • ERC-1155 (Fixed-Term) Vesting Tokens
  1. Developers

User Balances

How to load user vesting token balances

PreviousPurchases & RedemptionsNextOptions Library

Last updated 1 year ago

When a user purchases a bond from BondProtocol, they receive a vesting token. The underlying payout token is held by the Teller contract. Users can redeem their vesting tokens for the underlying payout token when the vesting period is complete.

The way our contracts work is to create a vesting token for each unique combination of underlying token + vesting date timestamp. All tokens vest at midnight UTC.

Our Fixed-Expiry markets create an ERC-20 vesting token, while our Fixed-Term markets create an ERC-1155 vesting token.

Our Teller contracts have functions which return the token address (in the case of an ERC-20) or token ID (in the case of an ERC-1155). In both cases, you must provide the address of the underlying payout token, and the vesting date timestamp.

For Fixed-Expiry markets, this is straightforward - there is only one expiry date, and as such, only one vesting token.

For Fixed-Term markets, there is a different vesting token for each day the market is open, with the vesting timestamp being the day of purchase plus the vesting term.

See below for more details.

ERC-20 (Fixed-Expiry) Vesting Tokens

You can find the vesting token address by calling the bondTokens(payoutTokenAddress, vestingTimestamp) function on the FixedExpiryTeller contract.

As the vesting token is an ERC-20 token, you can then call the vesting token's balanceOf(holderAddress) function to get the user's balance.

ERC-1155 (Fixed-Term) Vesting Tokens

The easiest way to get the data required below is from our subgraph. However, as our Ethereum Mainnet subgraph is on decentralized network, this would require you to pay query fees.

At the time of writing, other chains are available on the Graph Protocol hosted service without fees. Graph Protocol have not yet announced a timeline for migrating the other chains we support to their decentralized network.

As all tokens vest at midnight UTC, one manual alternative method of generating vesting date timestamps is, for each day your market will be open, to add the vesting term to a midnight UTC timestamp for that date.

You can find the vesting token ID by calling the getTokenId(payoutTokenAddress, vestingTimestamp) function on the FixedTermTeller contract.

As the vesting token is an ERC-1155 token, you can then call the vesting token's balanceOf(holderAddress, tokenId) function to get the user's balance.

Graph Protocol's