Perp v2
Perp v2
  • About Perpetual Protocol
    • Social Links
    • Governance
    • v2 Era Ecosystem
    • PERP Token
  • Terms of Service
  • General
    • Wallets
    • Transfering Assets
    • Deposit & Withdrawal
    • Perpetual + Uniswap
    • FAQs
    • Guides
    • Legacy Reward Programs
    • Security
  • Hot Tub
  • Trading on Perp v2
    • How It Works
    • UI Overview
    • Perpetual Futures Basics
    • Trading Quick-start
    • Opening and Closing Positions
    • Account Value & More
    • Funding Payments
    • Order Types
    • Trading Fees and Gas Fees
    • Managing Risk
    • Multi-collateral
    • More docs
  • Providing Liquidity
    • Basics
    • Introduction to Maker UI
    • Add / Remove Liquidity
    • Estimated Fees and Rewards APR
    • More on LPing
    • Tools for LPs
  • Perp v2 Specs
  • Developer Docs
    • Developer FAQs
    • Source Code
    • Protocol Attributes
    • Contract guide
      • AccountBalance
      • BaseToken
      • ClearingHouse
      • CollateralManager
      • DelegateApproval
      • Exchange
      • InsuranceFund
      • MarketRegistry
      • OrderBook
      • QuoteToken
      • Vault
      • VirtualToken
    • Interface Contracts
      • IAccountBalance
      • IBaseToken
      • IClearingHouse
      • IClearingHouseConfig
      • IClearingHouseConfigEvent
      • ICollateralManager
      • IDelegateApproval
      • IERC20Metadata
      • IExchange
      • IIndexPrice
      • IInsuranceFund
      • IMarketRegistry
      • IOrderBook
      • IVault
      • IVirtualToken
    • Integration guide
    • Dev tools
Powered by GitBook
On this page

Was this helpful?

  1. Developer Docs
  2. Contract guide

BaseToken

Last updated 1 year ago

Was this helpful?

Functions

initialize

  function initialize(
  ) external

pause

  function pause(
  ) external

close

  function close(
  ) external

close

  function close(
  ) external

setPriceFeed

  function setPriceFeed(
  ) external

priceFeed is now priceFeedDispatcher, which dispatches either Chainlink or UniswapV3 price

  function cacheTwap(
  ) external
  function getPriceFeed(
  ) external returns (address)

Get the price feed address

priceFeed is now priceFeedDispatcher, which dispatches either Chainlink or UniswapV3 price

Name
Type
Description

priceFeed

address

the current price feed

  function isOpen(
  ) external returns (bool)
  function isPaused(
  ) external returns (bool)
  function isClosed(
  ) external returns (bool)
  function getPausedTimestamp(
  ) external returns (uint256)
  function getPausedIndexPrice(
  ) external returns (uint256)
  function getClosedPrice(
  ) external returns (uint256)
  function getIndexPrice(
    uint256 interval
  ) public returns (uint256)

Returns the index price of the token.

we overwrite the index price in BaseToken depending on the status

 1. Open: the price is from the price feed
 2. Paused or Closed: the price is twap when the token was paused
Name
Type
Description

interval

uint256

The interval represents twap interval.

Name
Type
Description

indexPrice

uint256

Twap price with interval

cacheTwap

getPriceFeed

Return Values:

isOpen

isPaused

isClosed

getPausedTimestamp

getPausedIndexPrice

getClosedPrice

getIndexPrice

Parameters:

Return Values:

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​