VirtualCollateralSupplyBase_v1.sol
Inherits: IVirtualCollateralSupplyBase_v1, ERC165Upgradeable
Author: Inverter Network
Manages a virtual collateral supply to facilitate interactions with Inverter's Funding Manager
Implements {IVirtualCollateralSupplyBase_v1} for handling virtual collateral. Includes functions to set, get, add, and subtract virtual collateral amounts.
State Variables
virtualCollateralSupply
The internal state variable to keep track of the virtual collateral supply.
uint internal virtualCollateralSupply;
MAX_UINT
Maximum unsigned integer value for overflow checks.
uint private constant MAX_UINT = type(uint).max;
__gap
Storage gap for future upgrades.
uint[50] private __gap;
Functions
supportsInterface
See {IERC165-supportsInterface}.
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165Upgradeable)
returns (bool);
getVirtualCollateralSupply
Returns the current virtual collateral supply.
This function returns the virtual supply by calling the internal _getVirtualCollateralSupply
function.
function getVirtualCollateralSupply() external view virtual returns (uint);
Returns
<none>
uint256
The current virtual collateral supply as a uint.
setVirtualCollateralSupply
Sets the virtual collateral supply to a new value.
This function should call the internal function _setVirtualCollateralSupply
. The function must be implemented by the downstream contract. The downstream contract should manage access control for setting the supply.
function setVirtualCollateralSupply(uint _virtualSupply) external virtual;
Parameters
_virtualSupply
uint256
The new value to set for the virtual collateral supply.
_addVirtualCollateralAmount
Adds a specified amount to the virtual collateral supply. Checks for overflow and reverts if an overflow occurs.
function _addVirtualCollateralAmount(uint _amount) internal virtual;
Parameters
_amount
uint256
The amount to add to the virtual collateral supply.
_subVirtualCollateralAmount
Subtracts a specified amount from the virtual collateral supply. Checks for underflow and reverts if an underflow occurs.
function _subVirtualCollateralAmount(uint _amount) internal virtual;
Parameters
_amount
uint256
The amount to subtract from the virtual collateral supply.
_setVirtualCollateralSupply
Internal function to directly set the virtual collateral supply to a new value.
function _setVirtualCollateralSupply(uint _virtualSupply) internal virtual;
Parameters
_virtualSupply
uint256
The new value to set for the virtual collateral supply.
Last updated