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

DelegateApproval

Functions​

initialize​

  function initialize(
  ) external

approve​

  function approve(
    address delegate,
    uint8 actions
  ) external

Parameters:​

Name
Type
Description

delegate

address

The address of delegate

actions

uint8

The actions to be approved

revoke​

  function revoke(
    address delegate,
    uint8 actions
  ) external

Parameters:​

Name
Type
Description

delegate

address

The address of delegate

actions

uint8

The actions to be revoked

getClearingHouseOpenPositionAction​

  function getClearingHouseOpenPositionAction(
  ) external returns (uint8)

Return Values:​

Name
Type
Description

action

uint8

The value of action _CLEARINGHOUSE_OPENPOSITION

getClearingHouseAddLiquidityAction​

  function getClearingHouseAddLiquidityAction(
  ) external returns (uint8)

Return Values:​

Name
Type
Description

action

uint8

The value of action _CLEARINGHOUSE_ADDLIQUIDITY

getClearingHouseRemoveLiquidityAction​

  function getClearingHouseRemoveLiquidityAction(
  ) external returns (uint8)

Return Values:​

Name
Type
Description

action

uint8

The value of action _CLEARINGHOUSE_REMOVELIQUIDITY

getApprovedActions​

  function getApprovedActions(
    address trader,
    address delegate
  ) external returns (uint8)

Parameters:​

Name
Type
Description

trader

address

The address of trader

delegate

address

The address of delegate

Return Values:​

Name
Type
Description

actions

uint8

The approved actions

hasApprovalFor​

  function hasApprovalFor(
    address trader,
    address delegate,
    uint8 actions
  ) external returns (bool)

Parameters:​

Name
Type
Description

trader

address

The address of trader

delegate

address

The address of delegate

actions

uint8

The actions to be checked

Return Values:​

Name
Type
Description

true

bool

if delegate is allowed to perform each actions for trader, otherwise false

canOpenPositionFor​

  function canOpenPositionFor(
    address trader,
    address delegate
  ) external returns (bool)

Parameters:​

Name
Type
Description

trader

address

The address of trader

delegate

address

The address of delegate

Return Values:​

Name
Type
Description

true

bool

if delegate can open position for trader, otherwise false

canAddLiquidityFor​

  function canAddLiquidityFor(
    address trader,
    address delegate
  ) external returns (bool)

Parameters:​

Name
Type
Description

trader

address

The address of trader

delegate

address

The address of delegate

Return Values:​

Name
Type
Description

true

bool

if delegate can add liquidity for trader, otherwise false

canRemoveLiquidityFor​

  function canRemoveLiquidityFor(
    address trader,
    address delegate
  ) external returns (bool)

Parameters:​

Name
Type
Description

trader

address

The address of trader

delegate

address

The address of delegate

Return Values:​

Name
Type
Description

true

bool

if delegate can remove liquidity for trader, otherwise false

Last updated 1 year ago

Was this helpful?