Skip to content

PolicyFacet

This facet contract contains all the external pre-hook functions related to vToken

Checks if the account should be allowed to mint tokens in the given market

function mintAllowed(address vToken, address minter, uint256 mintAmount) external returns (uint256)
NameTypeDescription
vTokenaddressThe market to verify the mint against
minteraddressThe account which would get the minted tokens
mintAmountuint256The amount of underlying being supplied to the market in exchange for tokens
NameTypeDescription
[0]uint2560 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)

Validates mint, accrues interest and updates score in prime. Reverts on rejection. May emit logs.

function mintVerify(address vToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external
NameTypeDescription
vTokenaddressAsset being minted
minteraddressThe address minting the tokens
actualMintAmountuint256The amount of the underlying asset being minted
mintTokensuint256The number of tokens being minted

Checks if the account should be allowed to redeem tokens in the given market

function redeemAllowed(address vToken, address redeemer, uint256 redeemTokens) external returns (uint256)
NameTypeDescription
vTokenaddressThe market to verify the redeem against
redeemeraddressThe account which would redeem the tokens
redeemTokensuint256The number of vTokens to exchange for the underlying asset in the market
NameTypeDescription
[0]uint2560 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)

Validates redeem, accrues interest and updates score in prime. Reverts on rejection. May emit logs.

function redeemVerify(address vToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external
NameTypeDescription
vTokenaddressAsset being redeemed
redeemeraddressThe address redeeming the tokens
redeemAmountuint256The amount of the underlying asset being redeemed
redeemTokensuint256The number of tokens being redeemed

Checks if the account should be allowed to borrow the underlying asset of the given market

function borrowAllowed(address vToken, address borrower, uint256 borrowAmount) external returns (uint256)
NameTypeDescription
vTokenaddressThe market to verify the borrow against
borroweraddressThe account which would borrow the asset
borrowAmountuint256The amount of underlying the account would borrow
NameTypeDescription
[0]uint2560 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)

Validates borrow, accrues interest and updates score in prime. Reverts on rejection. May emit logs.

function borrowVerify(address vToken, address borrower, uint256 borrowAmount) external
NameTypeDescription
vTokenaddressAsset whose underlying is being borrowed
borroweraddressThe address borrowing the underlying
borrowAmountuint256The amount of the underlying asset requested to borrow

Checks if the account should be allowed to repay a borrow in the given market

function repayBorrowAllowed(address vToken, address payer, address borrower, uint256 repayAmount) external returns (uint256)
NameTypeDescription
vTokenaddressThe market to verify the repay against
payeraddressThe account which would repay the asset
borroweraddressThe account which borrowed the asset
repayAmountuint256The amount of the underlying asset the account would repay
NameTypeDescription
[0]uint2560 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)

Validates repayBorrow, accrues interest and updates score in prime. Reverts on rejection. May emit logs.

function repayBorrowVerify(address vToken, address payer, address borrower, uint256 actualRepayAmount, uint256 borrowerIndex) external
NameTypeDescription
vTokenaddressAsset being repaid
payeraddressThe address repaying the borrow
borroweraddressThe address of the borrower
actualRepayAmountuint256The amount of underlying being repaid
borrowerIndexuint256

Checks if the liquidation should be allowed to occur

function liquidateBorrowAllowed(address vTokenBorrowed, address vTokenCollateral, address liquidator, address borrower, uint256 repayAmount) external view returns (uint256)
NameTypeDescription
vTokenBorrowedaddressAsset which was borrowed by the borrower
vTokenCollateraladdressAsset which was used as collateral and will be seized
liquidatoraddressThe address repaying the borrow and seizing the collateral
borroweraddressThe address of the borrower
repayAmountuint256The amount of underlying being repaid

Validates liquidateBorrow, accrues interest and updates score in prime. Reverts on rejection. May emit logs.

function liquidateBorrowVerify(address vTokenBorrowed, address vTokenCollateral, address liquidator, address borrower, uint256 actualRepayAmount, uint256 seizeTokens) external
NameTypeDescription
vTokenBorrowedaddressAsset which was borrowed by the borrower
vTokenCollateraladdressAsset which was used as collateral and will be seized
liquidatoraddressThe address repaying the borrow and seizing the collateral
borroweraddressThe address of the borrower
actualRepayAmountuint256The amount of underlying being repaid
seizeTokensuint256The amount of collateral token that will be seized

Checks if the seizing of assets should be allowed to occur

function seizeAllowed(address vTokenCollateral, address vTokenBorrowed, address liquidator, address borrower, uint256 seizeTokens) external returns (uint256)
NameTypeDescription
vTokenCollateraladdressAsset which was used as collateral and will be seized
vTokenBorrowedaddressAsset which was borrowed by the borrower
liquidatoraddressThe address repaying the borrow and seizing the collateral
borroweraddressThe address of the borrower
seizeTokensuint256The number of collateral tokens to seize

Validates seize, accrues interest and updates score in prime. Reverts on rejection. May emit logs.

function seizeVerify(address vTokenCollateral, address vTokenBorrowed, address liquidator, address borrower, uint256 seizeTokens) external
NameTypeDescription
vTokenCollateraladdressAsset which was used as collateral and will be seized
vTokenBorrowedaddressAsset which was borrowed by the borrower
liquidatoraddressThe address repaying the borrow and seizing the collateral
borroweraddressThe address of the borrower
seizeTokensuint256The number of collateral tokens to seize

Checks if the account should be allowed to transfer tokens in the given market

function transferAllowed(address vToken, address src, address dst, uint256 transferTokens) external returns (uint256)
NameTypeDescription
vTokenaddressThe market to verify the transfer against
srcaddressThe account which sources the tokens
dstaddressThe account which receives the tokens
transferTokensuint256The number of vTokens to transfer
NameTypeDescription
[0]uint2560 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)

Validates transfer, accrues interest and updates score in prime. Reverts on rejection. May emit logs.

function transferVerify(address vToken, address src, address dst, uint256 transferTokens) external
NameTypeDescription
vTokenaddressAsset being transferred
srcaddressThe account which sources the tokens
dstaddressThe account which receives the tokens
transferTokensuint256The number of vTokens to transfer

Alias to getAccountLiquidity to support the Isolated Lending Comptroller Interface

function getBorrowingPower(address account) external view returns (uint256, uint256, uint256)
NameTypeDescription
accountaddressThe account get liquidity for
NameTypeDescription
[0]uint256(possible error code (semi-opaque), account liquidity in excess of collateral requirements, account shortfall below collateral requirements)
[1]uint256
[2]uint256

Determine the current account liquidity wrt liquidation threshold requirements

function getAccountLiquidity(address account) external view returns (uint256, uint256, uint256)
NameTypeDescription
accountaddressThe account get liquidity for
NameTypeDescription
[0]uint256(possible error code (semi-opaque), account liquidity in excess of liquidation threshold requirements, account shortfall below liquidation threshold requirements)
[1]uint256
[2]uint256

Determine what the account liquidity would be if the given amounts were redeemed/borrowed

function getHypotheticalAccountLiquidity(address account, address vTokenModify, uint256 redeemTokens, uint256 borrowAmount) external view returns (uint256, uint256, uint256)
NameTypeDescription
accountaddressThe account to determine liquidity for
vTokenModifyaddressThe market to hypothetically redeem/borrow in
redeemTokensuint256The number of tokens to hypothetically redeem
borrowAmountuint256The amount of underlying to hypothetically borrow
NameTypeDescription
[0]uint256(possible error code (semi-opaque), hypothetical account liquidity in excess of collateral requirements, hypothetical account shortfall below collateral requirements)
[1]uint256
[2]uint256

Set XVS speed for a single market

function _setVenusSpeeds(contract VToken[] vTokens, uint256[] supplySpeeds, uint256[] borrowSpeeds) external
NameTypeDescription
vTokenscontract VToken[]The market whose XVS speed to update
supplySpeedsuint256[]New XVS speed for supply
borrowSpeedsuint256[]New XVS speed for borrow