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
  • Isolated Pools Contracts
  • Pool
  • Oracle Contracts
  • Oracles
  • Venus Protocol
  • Lending Contracts
  • Token Contracts
  • Vault Contracts
  • Governance Contracts
Export as PDF
  1. Technical reference

Contracts Overview

Last updated 1 month ago

Venus Protocol contracts are divided in these repositories:

  • : Contains core contracts for isolated lending, including logic for supplying, borrowing, liquidations, pool and market deployments, and interest rate models.

  • : This repo has contracts for oracles that we support as well as logic for validating prices returned from those oracles.

  • : The core protocol is located in this repo. It contains logic central to lending and borrowing of the core pool.

  • : The contracts used for proposing, voting and executing changes are kept in the `governance-contracts repo.

  • : The contracts use to bridge XVS to different networks.

Isolated Pools Contracts

There are 2 categories of isolated pools contracts:

  • Pool

  • Risk Management

Pool

Pool contracts can be divided into 4 categories:

  • Configuration

  • Logic

  • Miscellaneous

Configuration

Configuration contracts are used to deploy, configure, and manage pools.

Logic contracts

Miscellaneous contracts

Isolated Pools use additional contracts such as lenses, rewards, ect.

Risk Management

Oracle Contracts

Oracles

Venus Protocol

Venus Protocol contracts can be grouped as follows:

  • Lending

  • Tokens

  • Vault

  • Lens

Lending Contracts

Token Contracts

Vault Contracts

XVS Vault

VAI Vault

Misc Contracts

ComptrollerLens

SnapshotLens

VenusLens

Governance Contracts

There are three main Governance contracts:

  • GovernorBravoDelegate

  • AccessControlManager

  • Timelock

GovernorBravoDelegate

AccessControlManager

Creating and managing pools is done by the . It can add markets to pools, update pool metadata, and return pool information.

The contract is the central contract for each lending pool. It contains functionality central to borrowing activity in the pool like supplying and borrowing assets and liquidations. Configuration values for the pool such as the liquidation incentive, close factor, and collateral factor can also be set and retrieved from the comptroller. Account liquidity and positions can also be retrieved from the comptroller.

in isolated lending play an identical role as vTokens in the Core Pool. They represent a users supplied tokens to the protocol and can be redeemed (burned) for those tokens.

Users are rewarded for borrowing and lending activities with a reward tokens. The manages these distributions using a configurable rate.

To make querying pool data easier, Isolated Pools contains a that queries and formats pool data. These calls can be gas intensive so as a general rule of thumb this contract should not be used in transactions.

Lending comes with the inherent risk that borrows will not be able to repay their loan, which is a threat to the protocol's insolvency. Venus mitigates this risk with a . A percentage of protocol revenues is transferred to the RiskFund as it is accrued. When bad debt is detected, this fund can be auctioned off and used to cover the bad debt.

When bad deb is auctioned off the contract is responsible for running the action and paying the winner.

The acts as a treasury where each isolated pool can transfer their revenue.

Venus Protocol implements secondary, primary and pivot oracles to create a validation and fallback strategy that avoids creating a single point of a failure by relying on a single source for prices. The contract is responsible for fetching and validating prices for a given vToken and managing which oracles are used for a particular vToken.

is the primary oracle. If a token isn't support by Chainlink then prices will be fetched from a secondary oracle.

is used in the Classic model (Chainlink-compatible interface) as a pivot oracle to validate prices returned by main and fallback oracles.

contract is responsible for fetching token prices from the Binance oracle. It is used as a secondary oracle.

is used as a pivot oracle to validate prices returned by primary and secondary oracles.

At the heart of the Core Pool is the comptroller. The latest version is . The comptroller is responsible for listing markets, managing user's positions in markets, liquidations, and emitting rewards. It contains setters and getters for market configuration variables such as collateral factor, close factor, and liquidation incentive. Lending actions can be be paused globally or per market from the comptroller.

Each market gets deployed with an interest rate model. The uses a linear curve to determine interest rates based on supply and demand of the asset until it reaches the kink after which there is a sharp increase in rates.

Another interest rate model that can be deployed with markets is the . It is similar to the JumpRateModel except it doesn't include a kink. Instead it contains a fixed base rate.

When a borrow becomes insolvent it may be liquidated. The handles this process. When a borrow is liquidated the seized amount is split between the liquidator and the

Revenue earned by the protocol is kept in the .

XVS is an important token in the Venus ecosystem because it powers Venus governance. The token contract defines a lockable BEP20 token with additional methods that enable voting and vote delegation. To vote, a user must first lock their XVS in the vault.

is the Venus stable coin that can be minted against collateral. Users who mint VAI are charged a fee based on the outstanding supply and price of VAI to keep its value pegged at $1. The controls the amount of VAI a user is allowed to mint which is determined by the collateral a user has provided and their liquidity.

When a user supplies a token to the protocol, vTokens are minted to represent their supply. The contract contains methods that support lending activities for the asset including lending, borrowing and liquidating

XVS can be locked in the to earn XVS and enable voting. Each XVS locked gives the locking address one vote to use or delegate.

VAI staked in the earn XVS. Staking rewards are accumulated daily.

The contains methods for fetching the liquidity of an account and the amount of tokens that can be seized for a repayable amount

The contains methods for getting the details of account for a specific market or all markets where an account is active.

Protocol level data is made available through the . It contains getters related to XVS distribution, governance, and markets.

The core logic for governance proposals is in the contract. It enables submitting proposals, moving proposals through time-gated stages, canceling and executing proposals as well as voting logic. The voting threshold as well as timelocks are set on this contract.

To enhance security of the protocol, Venus Protocol uses the to grant accounts access to call specific functions on contracts. This contract is responsible for granting and revoking those permissions. It also provides a getter to check if an address is allowed to call a specific function.

Timelock Once a proposal has succeeded its execution is managed by the contract. The Timelock can place the proposal in a queue for execution and execute the proposal. It also enables canceling the proposal.

isolated-pools
oracle
venus-protocol
governance-contracts
token-bridge
PoolRegistry
PoolRegistry
Comptroller
Comptroller
vToken
vTokens
RewardsDistributor
RewardsDistributor
PoolLens
lens
RiskFund
RiskFund
Shortfall
Shortfall
ProtocolShareReserve
ProtocolShareReserve
ResilientOracle
ResilientOracle
ChainlinkOracle
ChainLinkOracle
RedStoneOracle
RedstoneOracle
BinanceOracle
BinanceOracle
PythOracle
PythOracle
Comptroller
Comptroller
JumpRateModel
JumpRateModel
WhitePaperInterestRateModel
WhitePaperInterestRateModel
Liquidator
Liquidator
treasury
VTreasury
VTreasury
XVS
XVS
VAI
VAI
VAIController
vTokens
VToken
XVSVault
VAIVault
ComptrollerLens
SnapshotLens
VenusLens
GovernorBraveDelegate
AccessControlManager
Timelock