LogoLogo
  • Getting Started
    • Overview
    • Whitepaper V4
    • FAQ
  • What's New?
    • Isolated Pools
    • Reward Distributor
    • Peg Stability Module
    • Automatic Income Allocation
    • Token Converter
    • Venus Prime
    • Stable Rate Borrowing
  • Governance
    • VIPs
    • Tokenomics
    • Community Forum
  • Risk
    • Resilient Price Oracle
    • Interest Rate Model
    • Risk Fund and Shortfall Handling
    • Risk Management
  • Tokens
    • XVS
    • VAI
      • VAIController
      • VAIUnitroller
  • Guides
    • Venus interface
    • Supplying and borrowing
    • Liquidations
    • Governance
      • Submitting a VIP
      • Delegating & Voting
    • Vaults
    • Protocol Math
    • XVS Bridge
    • Borrowing VAI
    • Gasless Transactions on zkSync
  • Technical reference
    • Contracts Overview
    • Technical articles
      • Automatic income allocation
      • Capped Oracles
      • Contributing
      • Diamond Comptroller in the Core pool
      • Native Token Gateway
      • Omnichain Governance
      • Prime tokens
      • Shortfall and auctions
      • Token Converters
      • Two Kinks Interest Rate Curve
      • XVS Bridge
    • Core Pool
      • Comptroller
        • ComptrollerLens
        • Diamond
          • Diamond
          • DiamondConsolidated
          • Facets
            • MarketFacet
            • PolicyFacet
            • RewardFacet
            • SetterFacet
      • VToken
      • Prime
        • Prime token
        • Prime liquidity provider
        • Prime storage
      • Vaults
        • XVS
          • XVSVault
          • XVSVaultProxy
          • XVSStore
          • XVSVaultTreasury
        • VAI
          • VAIVault
          • VAIVaultProxy
      • InterestRateModels
        • JumpModel
        • TwoKinksInterestRateModel
        • WhitePaperModel
        • InterestRateModelLens
      • Liquidator
      • VTreasury
      • VenusLens
      • PSM
      • VBNBAdmin
    • Isolated Pools
      • Comptroller
        • Comptroller
        • ComptrollerStorage
      • VToken
        • VToken
        • VTokenInterfaces
      • NativeTokenGateway
      • Pool Registry
        • PoolRegistry
        • PoolRegistryInterface
      • RewardsDistributor
      • PoolLens
      • Interest Rate Models
        • InterestRateModel
        • BaseJumpRateModelV2
        • JumpRateModelV2
        • TwoKinksInterestRateModel
        • WhitePaperInterestRateModel
      • Risk Fund and Shortfall
        • Shortfall
        • ProtocolShareReserve
        • RiskFund
        • RiskFundStorage
      • Utility
        • MaxLoopsLimitHelper
        • ErrorReporter
        • ExponentialNoError
    • Oracle
      • ResilientOracle
      • BoundValidator
      • Sources
        • ChainlinkOracle
        • SequencerChainlinkOracle
        • BinanceOracle
      • Correlated token oracles
        • AnkrBNBOracle
        • CorrelatedTokenOracle
        • BNBxOracle
        • OneJumpOracle
        • PendleOracle
        • SFraxOracle
        • SFrxETHOracle
        • SlisBNBOracle
        • StkBNBOracle
        • WBETHOracle
        • WeETHOracle
        • WstETHOracle
    • Governance
      • AccessControlManager
      • GovernorBravoDelegate
      • AccessControlledV5
      • GovernorBravoDelegator
      • Timelock
      • GovernorBravoInterfaces
      • AccessControlledV8
      • BaseOmnichainControllerSrc
      • BaseOmnichainControllerDest
      • OmnichainProposalSender
      • OmnichainGovernanceExecutor
      • OmnichainExecutorOwner
    • Token Converter
      • AbstractTokenConverter
      • RiskFundConverter
      • SingleTokenConverter
      • ConverterNetwork
    • XVS Bridge
      • BaseXVSProxyOFT
      • XVSProxyOFTSrc
      • XVSProxyOFTDest
      • XVSBridgeAdmin
      • XVS
      • TokenController
  • Deployed Contracts
    • Markets
    • Funds
    • Oracles
    • Governance
    • XVS Omnichain
    • Token Converters
  • Services
    • API
    • Subgraphs
  • Links
    • Security & Audits
    • Resources
    • Community Resources
    • Brand kit
Powered by GitBook
On this page
  • MarketFacet
  • Solidity API
Export as PDF
  1. Technical reference
  2. Core Pool
  3. Comptroller
  4. Diamond
  5. Facets

MarketFacet

MarketFacet

This facet contract contains functions regarding markets

Solidity API

isComptroller

Indicator that this is a Comptroller contract (for inspection)

function isComptroller() public pure returns (bool)

getAssetsIn

Returns the assets an account has entered

function getAssetsIn(address account) external view returns (contract VToken[])

Parameters

Name
Type
Description

account

address

The address of the account to pull assets for

Return Values

Name
Type
Description

[0]

contract VToken[]

A dynamic list with the assets the account has entered


getAllMarkets

Return all of the markets

function getAllMarkets() external view returns (contract VToken[])

Return Values

Name
Type
Description

[0]

contract VToken[]

The list of market addresses


liquidateCalculateSeizeTokens

Calculate number of tokens of collateral asset to seize given an underlying amount

function liquidateCalculateSeizeTokens(address vTokenBorrowed, address vTokenCollateral, uint256 actualRepayAmount) external view returns (uint256, uint256)

Parameters

Name
Type
Description

vTokenBorrowed

address

The address of the borrowed vToken

vTokenCollateral

address

The address of the collateral vToken

actualRepayAmount

uint256

The amount of vTokenBorrowed underlying to convert into vTokenCollateral tokens

Return Values

Name
Type
Description

[0]

uint256

(errorCode, number of vTokenCollateral tokens to be seized in a liquidation)

[1]

uint256


liquidateVAICalculateSeizeTokens

Calculate number of tokens of collateral asset to seize given an underlying amount

function liquidateVAICalculateSeizeTokens(address vTokenCollateral, uint256 actualRepayAmount) external view returns (uint256, uint256)

Parameters

Name
Type
Description

vTokenCollateral

address

The address of the collateral vToken

actualRepayAmount

uint256

The amount of vTokenBorrowed underlying to convert into vTokenCollateral tokens

Return Values

Name
Type
Description

[0]

uint256

(errorCode, number of vTokenCollateral tokens to be seized in a liquidation)

[1]

uint256


checkMembership

Returns whether the given account is entered in the given asset

function checkMembership(address account, contract VToken vToken) external view returns (bool)

Parameters

Name
Type
Description

account

address

The address of the account to check

vToken

contract VToken

The vToken to check

Return Values

Name
Type
Description

[0]

bool

True if the account is in the asset, otherwise false


enterMarkets

Add assets to be included in account liquidity calculation

function enterMarkets(address[] vTokens) external returns (uint256[])

Parameters

Name
Type
Description

vTokens

address[]

The list of addresses of the vToken markets to be enabled

Return Values

Name
Type
Description

[0]

uint256[]

Success indicator for whether each corresponding market was entered


exitMarket

Removes asset from sender's account liquidity calculation

function exitMarket(address vTokenAddress) external returns (uint256)

Parameters

Name
Type
Description

vTokenAddress

address

The address of the asset to be removed

Return Values

Name
Type
Description

[0]

uint256

Whether or not the account successfully exited the market


_supportMarket

Add the market to the markets mapping and set it as listed

function _supportMarket(contract VToken vToken) external returns (uint256)

Parameters

Name
Type
Description

vToken

contract VToken

The address of the market (token) to list

Return Values

Name
Type
Description

[0]

uint256

uint256 0=success, otherwise a failure. (See enum Error for details)


updateDelegate

Grants or revokes the borrowing delegate rights to / from an account If allowed, the delegate will be able to borrow funds on behalf of the sender Upon a delegated borrow, the delegate will receive the funds, and the borrower will see the debt on their account

function updateDelegate(address delegate, bool allowBorrows) external

Parameters

Name
Type
Description

delegate

address

The address to update the rights for

allowBorrows

bool

Whether to grant (true) or revoke (false) the rights


Last updated 1 year ago