totalOutstandingTokensOf
Contract: JBController
Interface: IJBController
- Step by step
- Code
- Bug bounty
Gets the current total amount of outstanding tokens for a project, given a reserved rate.
Definition
function totalOutstandingTokensOf(uint256 _projectId, uint256 _reservedRate)
external
view
override
returns (uint256) { ... }
- Arguments:
_projectId
is the ID of the project to get total outstanding tokens of._reservedRate
is the reserved rate to use when making the calculation.
- The view function can be accessed externally by anyone.
- The view function does not alter state on the blockchain.
- The function overrides a function definition from the
IJBController
interface. - The function returns the current total amount of outstanding tokens for the project.
Body
-
Get the total supply of tokens in circulation.
// Get the total number of tokens in circulation.
uint256 _totalSupply = tokenStore.totalSupplyOf(_projectId);Internal references:
External references:
-
Get the number of outstanding reserved tokens the project has given the provided reserved rate.
// Get the number of reserved tokens the project has.
uint256 _reservedTokenAmount = _reservedTokenAmountFrom(
_processedTokenTrackerOf[_projectId],
_reservedRate,
_totalSupply
);Internal references:
-
Return the sum of the total supply and the reserved tokens.
// Add the reserved tokens to the total supply.
return _totalSupply + _reservedTokenAmount;
/**
@notice
Gets the current total amount of outstanding tokens for a project, given a reserved rate.
@param _projectId The ID of the project to get total outstanding tokens of.
@param _reservedRate The reserved rate to use when making the calculation.
@return The current total amount of outstanding tokens for the project.
*/
function totalOutstandingTokensOf(uint256 _projectId, uint256 _reservedRate)
external
view
override
returns (uint256)
{
// Get the total number of tokens in circulation.
uint256 _totalSupply = tokenStore.totalSupplyOf(_projectId);
// Get the number of reserved tokens the project has.
uint256 _reservedTokenAmount = _reservedTokenAmountFrom(
_processedTokenTrackerOf[_projectId],
_reservedRate,
_totalSupply
);
// Add the reserved tokens to the total supply.
return _totalSupply + _reservedTokenAmount;
}
Category | Description | Reward |
---|---|---|
Optimization | Help make this operation more efficient. | 0.5ETH |
Low severity | Identify a vulnerability in this operation that could lead to an inconvenience for a user of the protocol or for a protocol developer. | 1ETH |
High severity | Identify a vulnerability in this operation that could lead to data corruption or loss of funds. | 5+ETH |