VirtualIssuanceSupplyBase_v1.sol

Git Source

Inherits: IVirtualIssuanceSupplyBase_v1, ERC165Upgradeable

Author: Inverter Network

Manages a virtual issuance supply to facilitate interactions with Inverter's Funding Manager

Implements {IVirtualIssuancelSupplyBase_v1} for handling virtual issuance. Includes functions to set, get, add, and subtract virtual issuance amounts.

State Variables

virtualIssuanceSupply

The internal state variable to keep track of the virtual issuance supply.

uint internal virtualIssuanceSupply;

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);

getVirtualIssuanceSupply

Returns the current virtual issuance supply.

This function returns the virtual supply by calling the internal _getVirtualIssuanceSupply function.

function getVirtualIssuanceSupply() external view virtual returns (uint);

Returns

Name
Type
Description

<none>

uint256

The current virtual issuance supply as a uint.

setVirtualIssuanceSupply

Sets the virtual issuance supply to a new value.

This function calls the internal function _setVirtualIssuanceSupply. The function must be implemented by the downstream contract. The downstream contract should manage access control for setting the supply.

function setVirtualIssuanceSupply(uint _virtualSupply) external virtual;

Parameters

Name
Type
Description

_virtualSupply

uint256

The new value to set for the virtual issuance supply.

_addVirtualIssuanceAmount

Adds a specified amount to the virtual issuance supply. Checks for overflow and reverts if an overflow occurs.

function _addVirtualIssuanceAmount(uint _amount) internal virtual;

Parameters

Name
Type
Description

_amount

uint256

The amount to add to the virtual issuance supply.

_subVirtualIssuanceAmount

Subtracts a specified amount from the virtual issuance supply. Checks for underflow and reverts if an underflow occurs.

function _subVirtualIssuanceAmount(uint _amount) internal virtual;

Parameters

Name
Type
Description

_amount

uint256

The amount to subtract from the virtual issuance supply.

_setVirtualIssuanceSupply

Internal function to directly set the virtual issuance supply to a new value.

function _setVirtualIssuanceSupply(uint _virtualSupply) internal virtual;

Parameters

Name
Type
Description

_virtualSupply

uint256

The new value to set for the virtual issuance supply.

Last updated