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
  • Purchases
  • Redemptions
  1. Developers

Purchases & Redemptions

How to enable users to purchase and redeem bonds

Purchases

Our Teller contract's purchase function takes the following parameters:

  • recipient - the address which will receive the vesting tokens (i.e. the purchaser)

  • referrer - the address to which frontend referral fees (currently disabled) will be sent if enabled (or 0x0000000000000000000000000000000000000000 if not providing an address)

  • id - the id of the market from which the bond is being purchased

  • amount - the amount being purchased

  • minAmountOut - the minimum number of payout tokens the user will receive. This protects the user against excessive slippage

  • overrides - standard override parameters, gasLimit, gasPrice etc

The values for amount and minAmountOut should be formatted taking into account their decimals:

amount = ethers.utils.parseUnits(amount.toString(), quoteDecimals)
        .toString();
        
minAmountOut = ethers.utils.parseUnits(minAmountOut.toString(), payoutDecimals)
        .toString()

So an example call would be:

tellerContract.purchase(
      recipientAddress,
      referrer,
      id,
      amount,
      minAmountOut,
      overrides
);

Redemptions

Our Teller's redeem function takes the following parameters:

  • token - the address of the vesting token

  • amount - the amount to redeem

  • overrides - standard override parameters, gasLimit, gasPrice etc

For amount we recommend using the user's full balance by default.

So an example call would be:

tellerContract.redeem(
    tokenAddress, 
    amount, 
    overrides
);
PreviousMarket CalculationsNextUser Balances

Last updated 1 year ago