Skip to main content

Solidity API

SlotAlreadyMinted

error SlotAlreadyMinted()

SlotOutOfBounds

error SlotOutOfBounds(uint256 slotId)

SlotTokenOutOfBounds

error SlotTokenOutOfBounds(uint256 slotId, uint256 tokenId)

ERC3525SlotEnumerableUpgradeable

SlotData

struct SlotData {
uint256 slot;
uint256[] slotTokens;
}

_slotTokensIndex

mapping(uint256 => mapping(uint256 => uint256)) _slotTokensIndex

_allSlots

struct ERC3525SlotEnumerableUpgradeable.SlotData[] _allSlots

_allSlotsIndex

mapping(uint256 => uint256) _allSlotsIndex

constructor

constructor() public

Contract constructor logic

__ERC3525SlotEnumerableUpgradeable_init

function __ERC3525SlotEnumerableUpgradeable_init(string name, string symbol) public

Contract initialization logic

supportsInterface

function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)

slotCount

function slotCount() public view virtual returns (uint256)

Get the total amount of slots stored by the contract.

NameTypeDescription
[0]uint256The total amount of slots

slotByIndex

function slotByIndex(uint256 index_) public view virtual returns (uint256)

Get the slot at the specified index of all slots stored by the contract.

NameTypeDescription
index_uint256The index in the slot list
NameTypeDescription
[0]uint256The slot at index of all slots.

_slotExists

function _slotExists(uint256 slot_) internal view virtual returns (bool)

tokenSupplyInSlot

function tokenSupplyInSlot(uint256 slot_) public view virtual returns (uint256)

Get the total amount of tokens with the same slot.

NameTypeDescription
slot_uint256The slot to query token supply for
NameTypeDescription
[0]uint256The total amount of tokens with the specified _slot

tokenInSlotByIndex

function tokenInSlotByIndex(uint256 slot_, uint256 index_) public view virtual returns (uint256)

Get the token at the specified index of all tokens with the same slot.

NameTypeDescription
slot_uint256The slot to query tokens with
index_uint256The index in the token list of the slot
NameTypeDescription
[0]uint256The token ID at _index of all tokens with _slot

_tokenExistsInSlot

function _tokenExistsInSlot(uint256 slot_, uint256 tokenId_) private view returns (bool)

_createSlot

function _createSlot(uint256 slot_) internal virtual

_beforeValueTransfer

function _beforeValueTransfer(address from_, address to_, uint256 fromTokenId_, uint256 toTokenId_, uint256 slot_, uint256 value_) internal virtual

_afterValueTransfer

function _afterValueTransfer(address from_, address to_, uint256 fromTokenId_, uint256 toTokenId_, uint256 slot_, uint256 value_) internal virtual

_addSlotToAllSlotsEnumeration

function _addSlotToAllSlotsEnumeration(struct ERC3525SlotEnumerableUpgradeable.SlotData slotData) private

_addTokenToSlotEnumeration

function _addTokenToSlotEnumeration(uint256 slot_, uint256 tokenId_) private

_removeTokenFromSlotEnumeration

function _removeTokenFromSlotEnumeration(uint256 slot_, uint256 tokenId_) private

__gap

uint256[47] __gap

This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain.

NonExistentToken

error NonExistentToken(uint256 tokenId)

NonExistentSlot

error NonExistentSlot(uint256 slotId)

InsufficientBalance

error InsufficientBalance(uint256 transferAmount, uint256 balance)

InsufficientAllowance

error InsufficientAllowance(uint256 transferAmount, uint256 allowance)

ToZeroAddress

error ToZeroAddress()

InvalidID

error InvalidID(uint256 tokenId)

AlreadyMinted

error AlreadyMinted(uint256 tokenId)

SlotsMismatch

error SlotsMismatch(uint256 fromTokenId, uint256 toTokenId)

InvalidApproval

error InvalidApproval(uint256 tokenId, address from, address to)

NotApprovedOrOwner

error NotApprovedOrOwner()

NotERC3525Receiver

error NotERC3525Receiver(address receiver)

NotERC721Receiver

error NotERC721Receiver(address receiver)

FromIncorrectOwner

error FromIncorrectOwner()

ERC3525Upgradeable

TokenData

struct TokenData {
uint256 id;
uint256 slot;
uint256 balance;
address owner;
address approved;
address[] valueApprovals;
}

AddressData

struct AddressData {
uint256[] ownedTokens;
mapping(uint256 => uint256) ownedTokensIndex;
mapping(address => bool) approvals;
}

_name

string _name

_symbol

string _symbol

_decimals

uint8 _decimals

_approvedValues

mapping(uint256 => mapping(address => uint256)) _approvedValues

tokenId => operator => units

_allTokens

struct ERC3525Upgradeable.TokenData[] _allTokens

_allTokensIndex

mapping(uint256 => uint256) _allTokensIndex

_addressData

mapping(address => struct ERC3525Upgradeable.AddressData) _addressData

tokenCounter

uint256 tokenCounter

supportsInterface

function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)

constructor

constructor() public

Contract constructor logic

__ERC3525Upgradeable_init

function __ERC3525Upgradeable_init(string name_, string symbol_) public

Contract initialization logic

name

function name() public view virtual returns (string)

Returns the token collection name.

symbol

function symbol() public view virtual returns (string)

Returns the token collection symbol.

valueDecimals

function valueDecimals() external view virtual returns (uint8 decimals)

Get the number of decimals the token uses for value - e.g. 6, means the user representation of the value of a token can be calculated by dividing it by 1,000,000. Considering the compatibility with third-party wallets, this function is defined as valueDecimals() instead of decimals() to avoid conflict with EIP-20 tokens.

NameTypeDescription
decimalsuint8The number of decimals for value

balanceOf

function balanceOf(uint256 tokenId_) public view virtual returns (uint256)

balanceOf

function balanceOf(address owner_) public view virtual returns (uint256 balance)

ownerOf

function ownerOf(uint256 tokenId_) public view virtual returns (address owner_)

slotOf

function slotOf(uint256 tokenId_) public view virtual returns (uint256)

allowance

function allowance(uint256 tokenId_, address operator_) public view virtual returns (uint256)

totalSupply

function totalSupply() public view virtual returns (uint256)

Returns the total amount of tokens stored by the contract.

tokenByIndex

function tokenByIndex(uint256 index_) public view virtual returns (uint256)

tokenOfOwnerByIndex

function tokenOfOwnerByIndex(address owner_, uint256 index_) public view virtual returns (uint256)

_isApprovedOrOwner

function _isApprovedOrOwner(address operator_, uint256 tokenId_) internal view virtual returns (bool)

_exists

function _exists(uint256 tokenId_) internal view virtual returns (bool)

approve

function approve(uint256 tokenId_, address to_, uint256 value_) external payable virtual

approve

function approve(address to_, uint256 tokenId_) public virtual

getApproved

function getApproved(uint256 tokenId_) public view virtual returns (address)

setApprovalForAll

function setApprovalForAll(address operator_, bool approved_) public virtual

isApprovedForAll

function isApprovedForAll(address owner_, address operator_) public view virtual returns (bool)

transferFrom

function transferFrom(uint256 fromTokenId_, address to_, uint256 value_) public payable virtual returns (uint256 newTokenId)

transferFrom

function transferFrom(uint256 fromTokenId_, uint256 toTokenId_, uint256 value_) public payable virtual

transferFrom

function transferFrom(address from_, address to_, uint256 tokenId_) public virtual

safeTransferFrom

function safeTransferFrom(address from_, address to_, uint256 tokenId_, bytes data_) public virtual

safeTransferFrom

function safeTransferFrom(address from_, address to_, uint256 tokenId_) public virtual

contractURI

function contractURI() public view virtual returns (string)

Returns the Uniform Resource Identifier (URI) for the current ERC3525 contract.

This function SHOULD return the URI for this contract in JSON format, starting with header data:application/json;. See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for contract URI.

NameTypeDescription
[0]stringThe JSON formatted URI of the current ERC3525 contract

tokenURI

function tokenURI(uint256 tokenId_) external view virtual returns (string)

slotURI

function slotURI(uint256 _slot) external view virtual returns (string)

Returns the Uniform Resource Identifier (URI) for the specified slot.

This function SHOULD return the URI for _slot in JSON format, starting with header data:application/json;. See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for slot URI.

NameTypeDescription
[0]stringThe JSON formatted URI of _slot

_mint

function _mint(address to_, uint256 tokenId_, uint256 slot_) internal

_mintValue

function _mintValue(address to_, uint256 slot_, uint256 value_) internal virtual returns (uint256 tokenId)

_splitValue

function _splitValue(uint256 fromToken_, uint256 value_) internal virtual returns (uint256 tokenId)

_mergeValue

function _mergeValue(uint256 fromToken_, uint256 toToken_) internal virtual

_burn

function _burn(uint256 tokenId_) internal virtual

_approve

function _approve(address to_, uint256 tokenId_) internal virtual

_approveValue

function _approveValue(uint256 tokenId_, address to_, uint256 value_) internal virtual

_spendAllowance

function _spendAllowance(address operator_, uint256 tokenId_, uint256 value_) internal virtual

_clearApprovedValues

function _clearApprovedValues(uint256 tokenId_) internal virtual

_existApproveValue

function _existApproveValue(address to_, uint256 tokenId_) internal view virtual returns (bool)

_setApprovalForAll

function _setApprovalForAll(address owner_, address operator_, bool approved_) internal virtual

_transferValue

function _transferValue(uint256 fromTokenId_, uint256 toTokenId_, uint256 value_) internal virtual

_transferTokenId

function _transferTokenId(address from_, address to_, uint256 tokenId_) internal virtual

_safeTransferTokenId

function _safeTransferTokenId(address from_, address to_, uint256 tokenId_, bytes data_) internal virtual

_beforeValueTransfer

function _beforeValueTransfer(address from_, address to_, uint256 fromTokenId_, uint256 toTokenId_, uint256 slot_, uint256 value_) internal virtual

_afterValueTransfer

function _afterValueTransfer(address from_, address to_, uint256 fromTokenId_, uint256 toTokenId_, uint256 slot_, uint256 value_) internal virtual

_checkOnERC3525Received

function _checkOnERC3525Received(uint256 fromTokenId_, uint256 toTokenId_, uint256 value_, bytes data_) private returns (bool)

_checkOnERC721Received

function _checkOnERC721Received(address from_, address to_, uint256 tokenId_, bytes data_) private returns (bool)

_createOriginalTokenId

function _createOriginalTokenId() internal virtual returns (uint256)

_addTokenToOwnerEnumeration

function _addTokenToOwnerEnumeration(address to_, uint256 tokenId_) private

_removeTokenFromOwnerEnumeration

function _removeTokenFromOwnerEnumeration(address from_, uint256 tokenId_) private

_addTokenToAllTokensEnumeration

function _addTokenToAllTokensEnumeration(struct ERC3525Upgradeable.TokenData tokenData_) private

_removeTokenFromAllTokensEnumeration

function _removeTokenFromAllTokensEnumeration(uint256 tokenId_) private

_msgSender

function _msgSender() internal view virtual returns (address sender)

checkTokenExists

function checkTokenExists(uint256 tokenId) internal view

IHyperCertMinter

Claim

struct Claim {
bytes32 claimHash;
uint64[2] workTimeframe;
uint64[2] impactTimeframe;
bytes32[] workScopes;
bytes32[] impactScopes;
bytes32[] rights;
address[] contributors;
uint256 totalUnits;
uint16 version;
bool exists;
string name;
string description;
string uri;
}

workScopes

function workScopes(bytes32 workScopeId) external view returns (string)

impactScopes

function impactScopes(bytes32 impactScopeId) external view returns (string)

rights

function rights(bytes32 rightsId) external view returns (string)

getImpactCert

function getImpactCert(uint256 claimID) external view returns (struct IHyperCertMinter.Claim)

balanceOf

function balanceOf(uint256 tokenId) external view returns (uint256)

IHyperCertSVG

generateSvgHyperCert

function generateSvgHyperCert(string name, string[] scopesOfImpact, uint64[2] workTimeframe, uint64[2] impactTimeframe, uint256 totalUnits) external view returns (string)

generateSvgFraction

function generateSvgFraction(string name, string[] scopesOfImpact, uint64[2] workTimeframe, uint64[2] impactTimeframe, uint256 units, uint256 totalUnits) external view returns (string)

HyperCertMetadata

Hypercertificate metadata creation logic

UPGRADER_ROLE

bytes32 UPGRADER_ROLE

User role required in order to upgrade the contract

_version

uint16 _version

Current version of the contract

_svgGenerator

contract IHyperCertSVG _svgGenerator

constructor

constructor() public

Contract constructor logic

initialize

function initialize(address svgGenerationAddress) public

Contract initialization logic

generateContractURI

function generateContractURI() external pure returns (string)

generateTokenURI

function generateTokenURI(uint256 slotId, uint256 tokenId) external view virtual returns (string)

generateSlotURI

function generateSlotURI(uint256 slotId) external view virtual returns (string)

_hyperCertDimensions

function _hyperCertDimensions(struct IHyperCertMinter.Claim claim) internal view returns (string)

_generateImageStringFraction

function _generateImageStringFraction(struct IHyperCertMinter.Claim claim, uint256 units, string[] impactScopes) internal view returns (string)

_generateImageStringHypercert

function _generateImageStringHypercert(struct IHyperCertMinter.Claim claim, string[] scopesOfImpact) internal view returns (string)

_propertyString

function _propertyString(string name_, string description_, string value_, bool isIntrinsic_) internal pure virtual returns (string)

_propertyString

function _propertyString(string name_, string description_, uint256 value_, bool isIntrinsic_) internal pure virtual returns (string)

_propertyStringCSV

function _propertyStringCSV(string name_, string description_, string value_, bool isIntrinsic_) internal pure virtual returns (string)

_propertyStringRange

function _propertyStringRange(string name_, string description_, uint256 value_, uint256 maxValue, bool isIntrinsic_) internal pure virtual returns (string)

_propertyString

function _propertyString(string name_, string description_, bytes32[] value_, bool isIntrinsic_) internal pure virtual returns (string)

_propertyString

function _propertyString(string name_, string description_, uint256[] array_, bool isIntrinsic_) internal pure virtual returns (string)

_propertyString

function _propertyString(string name_, string description_, uint64[2] array_, bool isIntrinsic_) internal pure virtual returns (string)

_propertyString

function _propertyString(string name_, string description_, string[] array_, bool isIntrinsic_) internal pure virtual returns (string)

_mapWorkScopesIdsToValues

function _mapWorkScopesIdsToValues(bytes32[] keys) internal view returns (string[] vals)

use keys to look up values in the supplied mapping

_mapImpactScopesIdsToValues

function _mapImpactScopesIdsToValues(bytes32[] keys) internal view returns (string[] vals)

use keys to look up values in the supplied mapping

_mapRightsIdsToValues

function _mapRightsIdsToValues(bytes32[] keys) internal view returns (string[] vals)

use keys to look up values in the supplied mapping

version

function version() public view virtual returns (uint256)

gets the current version of the contract

updateVersion

function updateVersion() external

Update the contract version number Only allowed for member of UPGRADER_ROLE

supportsInterface

function supportsInterface(bytes4 interfaceId) public view returns (bool)

Returns a flag indicating if the contract supports the specified interface

NameTypeDescription
interfaceIdbytes4Id of the interface
NameTypeDescription
[0]booltrue, if the interface is supported

_authorizeUpgrade

function _authorizeUpgrade(address) internal view

upgrade authorization logic

adds onlyRole(UPGRADER_ROLE) requirement

EmptyInput

error EmptyInput()

DuplicateScope

error DuplicateScope()

InvalidScope

error InvalidScope()

InvalidTimeframe

error InvalidTimeframe(uint64 from, uint64 to)

ConflictingClaim

error ConflictingClaim()

InvalidInput

error InvalidInput()

HyperCertMinter

Contains functions and events to initialize and issue a hypercertificate

UPGRADER_ROLE

bytes32 UPGRADER_ROLE

User role required in order to upgrade the contract

_metadata

contract IHyperCertMetadata _metadata

Hypercert metadata contract

workScopes

mapping(bytes32 => string) workScopes

Mapping of id's to work-scopes

impactScopes

mapping(bytes32 => string) impactScopes

Mapping of id's to impact-scopes

rights

mapping(bytes32 => string) rights

Mapping of id's to rights

_contributorImpacts

mapping(address => mapping(bytes32 => bool)) _contributorImpacts

_hyperCerts

mapping(uint256 => struct HyperCertMinter.Claim) _hyperCerts

Claim

struct Claim {
bytes32 claimHash;
uint64[2] workTimeframe;
uint64[2] impactTimeframe;
bytes32[] workScopes;
bytes32[] impactScopes;
bytes32[] rights;
address[] contributors;
uint256 totalUnits;
string name;
string description;
string uri;
address minter;
uint16 version;
bool exists;
}

ImpactClaimed

event ImpactClaimed(uint256 id, address minter, uint64[] fractions)

Emitted when an impact is claimed.

NameTypeDescription
iduint256Id of the claimed impact.
minteraddressAddress of cert minter.
fractionsuint64[]Units of tokens issued under the hypercert.

ImpactScopeAdded

event ImpactScopeAdded(bytes32 id, string text)

Emitted when a new impact scope is added.

NameTypeDescription
idbytes32Id of the impact scope.
textstringShort text code of the impact scope.

RightAdded

event RightAdded(bytes32 id, string text)

Emitted when a new right is added.

NameTypeDescription
idbytes32Id of the right.
textstringShort text code of the right.

WorkScopeAdded

event WorkScopeAdded(bytes32 id, string text)

Emitted when a new work scope is added.

NameTypeDescription
idbytes32Id of the work scope.
textstringShort text code of the work scope.

constructor

constructor() public

Contract constructor logic

initialize

function initialize(address metadataAddress) public

Contract initialization logic

supportsInterface

function supportsInterface(bytes4 interfaceId) public view returns (bool)

Returns a flag indicating if the contract supports the specified interface

NameTypeDescription
interfaceIdbytes4Id of the interface
NameTypeDescription
[0]booltrue, if the interface is supported

addImpactScope

function addImpactScope(string text) external

Adds a new impact scope

NameTypeDescription
textstringText representing the impact scope

addRight

function addRight(string text) external

Adds a new right

NameTypeDescription
textstringText representing the right

addWorkScope

function addWorkScope(string text) external

Adds a new work scope

NameTypeDescription
textstringText representing the work scope

mint

function mint(address account, bytes data) external virtual

Issues a new hypercertificate

NameTypeDescription
accountaddressAccount issuing the new hypercertificate
databytesData representing the parameters of the claim

split

function split(uint256 tokenId, uint256[] amounts) external

merge

function merge(uint256[] tokenIds) external

getImpactCert

function getImpactCert(uint256 claimID) external view returns (struct HyperCertMinter.Claim)

Gets the impact claim with the specified id

NameTypeDescription
claimIDuint256Id of the claim
NameTypeDescription
[0]struct HyperCertMinter.ClaimThe claim, if it doesn't exist with default values

slotURI

function slotURI(uint256 slotId_) external view returns (string)

tokenURI

function tokenURI(uint256 tokenId_) external view returns (string)

contractURI

function contractURI() public view returns (string)

Returns the Uniform Resource Identifier (URI) for the current ERC3525 contract.

This function SHOULD return the URI for this contract in JSON format, starting with header data:application/json;. See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for contract URI.

NameTypeDescription
[0]stringThe JSON formatted URI of the current ERC3525 contract

burn

function burn(uint256 tokenId_) external
function donate(uint256 tokenId_) external

_authorizeUpgrade

function _authorizeUpgrade(address) internal view

upgrade authorization logic

adds onlyRole(UPGRADER_ROLE) requirement

_authorizeAdd

function _authorizeAdd(string text, mapping(bytes32 => string) map) internal view virtual returns (bytes32 id)

Pre-add validation checks

NameTypeDescription
textstringText to be added
mapmapping(bytes32 => string)Storage mapping that will be appended

_authorizeMint

function _authorizeMint(address account, struct HyperCertMinter.Claim claim) internal view virtual

Pre-mint validation checks

NameTypeDescription
accountaddressDestination address for the mint
claimstruct HyperCertMinter.ClaimImpact claim data

_parseData

function _parseData(bytes data) internal pure returns (struct HyperCertMinter.Claim claim, uint64[])

Parse bytes to Claim and URI

This function is overridable in order to support future schema changes

NameTypeDescription
databytesByte data representing the claim
NameTypeDescription
claimstruct HyperCertMinter.ClaimThe parsed Claim struct
[1]uint64[]Claim metadata URI

_msgSender

function _msgSender() internal view returns (address sender)

setMetadataGenerator

function setMetadataGenerator(address metadataGenerator) external

HyperCertSVG

UPGRADER_ROLE

bytes32 UPGRADER_ROLE

User role required in order to upgrade the contract

_version

uint16 _version

Current version of the contract

backgrounds

mapping(uint256 => string) backgrounds

id => background

colors

mapping(uint256 => struct HyperCertSVG.SVGColors) colors

id => colors

backgroundCounter

uint256 backgroundCounter

colorsCounter

uint256 colorsCounter

SVGParams

struct SVGParams {
string name;
string[] scopesOfImpact;
uint64[2] workTimeframe;
uint64[2] impactTimeframe;
uint256 units;
uint256 totalUnits;
}

SVGColors

struct SVGColors {
string primary;
string labels;
string background;
}

BackgroundAdded

event BackgroundAdded(uint256 id)

ColorsAdded

event ColorsAdded(uint256 id, struct HyperCertSVG.SVGColors colors)

constructor

constructor() public

Contract constructor logic

initialize

function initialize() public

Contract initialization logic

addBackground

function addBackground(string svgString) external returns (uint256 id)

addColors

function addColors(string[3] _colors) external returns (uint256 id)

generateSvgHyperCert

function generateSvgHyperCert(string name, string[] scopesOfImpact, uint64[2] workTimeframe, uint64[2] impactTimeframe, uint256 totalUnits) external view virtual returns (string)

generateSvgFraction

function generateSvgFraction(string name, string[] scopesOfImpact, uint64[2] workTimeframe, uint64[2] impactTimeframe, uint256 units, uint256 totalUnits) external view virtual returns (string)

_generateHyperCert

function _generateHyperCert(struct HyperCertSVG.SVGParams params) internal view virtual returns (string)

_generateHyperCertFraction

function _generateHyperCertFraction(struct HyperCertSVG.SVGParams params) internal view virtual returns (string)

_generateBackgroundPattern

function _generateBackgroundPattern(string primaryScopeOfImpact, struct HyperCertSVG.SVGColors colors) internal view returns (string background)

_generateColors

function _generateColors(string primaryScopeOfImpact) internal view returns (struct HyperCertSVG.SVGColors _colors)

_getBackgroundIndex

function _getBackgroundIndex(string primaryScopeOfImpact) internal pure returns (uint256 index)

_getColorIndex

function _getColorIndex(string primaryScopeOfImpact) internal view returns (uint256 index)

_generateHeader

function _generateHeader(struct HyperCertSVG.SVGParams params, struct HyperCertSVG.SVGColors colors) internal pure virtual returns (string)

_generateScopeOfImpact

function _generateScopeOfImpact(struct HyperCertSVG.SVGParams params, struct HyperCertSVG.SVGColors colors) internal pure virtual returns (string)

_generateName

function _generateName(struct HyperCertSVG.SVGParams params, struct HyperCertSVG.SVGColors colors) internal pure virtual returns (string)

_generateWorkperiod

function _generateWorkperiod(struct HyperCertSVG.SVGParams params, struct HyperCertSVG.SVGColors colors) internal pure virtual returns (string)

_generateDivider

function _generateDivider(struct HyperCertSVG.SVGColors colors) internal pure virtual returns (string)

_generateFraction

function _generateFraction(struct HyperCertSVG.SVGParams params, struct HyperCertSVG.SVGColors colors) internal view virtual returns (string)

stringToBytes32

function stringToBytes32(string source) internal pure returns (bytes32 result)

bytes32ToString

function bytes32ToString(bytes32 _bytes32, uint8 cutoff) internal pure returns (string parsedString)

cutString

function cutString(string source, uint8 cutoff) internal pure returns (string cutString)

getPercent

function getPercent(uint256 part, uint256 whole) public pure returns (uint256 percent)

uint2decimal

function uint2decimal(uint256 self, uint8 decimals) internal pure returns (bytes)

supportsInterface

function supportsInterface(bytes4 interfaceId) public view returns (bool)

Returns a flag indicating if the contract supports the specified interface

NameTypeDescription
interfaceIdbytes4Id of the interface
NameTypeDescription
[0]booltrue, if the interface is supported

_authorizeUpgrade

function _authorizeUpgrade(address) internal view

upgrade authorization logic

adds onlyRole(UPGRADER_ROLE) requirement

IERC3525MetadataUpgradeable

Interfaces for any contract that wants to support query of the Uniform Resource Identifier (URI) for the ERC3525 contract as well as a specified slot. Because of the higher reliability of data stored in smart contracts compared to data stored in centralized systems, it is recommended that metadata, including contractURI, slotURI and tokenURI, be directly returned in JSON format, instead of being returned with a url pointing to any resource stored in a centralized system. See https://eips.ethereum.org/EIPS/eip-3525 Note: the ERC-165 identifier for this interface is 0xe1600902.

contractURI

function contractURI() external view returns (string)

Returns the Uniform Resource Identifier (URI) for the current ERC3525 contract.

This function SHOULD return the URI for this contract in JSON format, starting with header data:application/json;. See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for contract URI.

NameTypeDescription
[0]stringThe JSON formatted URI of the current ERC3525 contract

slotURI

function slotURI(uint256 _slot) external view returns (string)

Returns the Uniform Resource Identifier (URI) for the specified slot.

This function SHOULD return the URI for _slot in JSON format, starting with header data:application/json;. See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for slot URI.

NameTypeDescription
[0]stringThe JSON formatted URI of _slot

IERC3525Receiver

Interface for any contract that wants to be informed by EIP-3525 contracts when receiving values from other addresses. Note: the EIP-165 identifier for this interface is 0x009ce20b.

onERC3525Received

function onERC3525Received(address _operator, uint256 _fromTokenId, uint256 _toTokenId, uint256 _value, bytes _data) external returns (bytes4)

Handle the receipt of an EIP-3525 token value.

An EIP-3525 smart contract MUST check whether this function is implemented by the recipient contract, if the recipient contract implements this function, the EIP-3525 contract MUST call this function after a value transfer (i.e. transferFrom(uint256,uint256,uint256,bytes)). MUST return 0x009ce20b (i.e. bytes4(keccak256('onERC3525Received(address,uint256,uint256, uint256,bytes)'))) if the transfer is accepted. MUST revert or return any value other than 0x009ce20b if the transfer is rejected. The EIP-3525 smart contract that calls this function MUST revert the transfer transaction if the return value is not equal to 0x009ce20b.

NameTypeDescription
_operatoraddressThe address which triggered the transfer
_fromTokenIduint256The token id to transfer value from
_toTokenIduint256The token id to transfer value to
_valueuint256The transferred value
_databytesAdditional data with no specified format
NameTypeDescription
[0]bytes4bytes4(keccak256('onERC3525Received(address,uint256,uint256,uint256,bytes)')) unless the transfer is rejected.

IERC3525SlotApprovableUpgradeable

Interfaces for any contract that wants to support approval of slot level, which allows an operator to manage one's tokens with the same slot. See https://eips.ethereum.org/EIPS/eip-3525 Note: the EIP-165 identifier for this interface is 0xb688be58.

ApprovalForSlot

event ApprovalForSlot(address _owner, uint256 _slot, address _operator, bool _approved)

MUST emit when an operator is approved or disapproved to manage all of _owner's tokens with the same slot.

NameTypeDescription
_owneraddressThe address whose tokens are approved
_slotuint256The slot to approve, all of _owner's tokens with this slot are approved
_operatoraddressThe operator being approved or disapproved
_approvedboolIdentify if _operator is approved or disapproved

setApprovalForSlot

function setApprovalForSlot(address _owner, uint256 _slot, address _operator, bool _approved) external payable

Approve or disapprove an operator to manage all of _owner's tokens with the specified slot.

Caller SHOULD be _owner or an operator who has been authorized through setApprovalForAll. MUST emit ApprovalSlot event.

NameTypeDescription
_owneraddressThe address that owns the EIP-3525 tokens
_slotuint256The slot of tokens being queried approval of
_operatoraddressThe address for whom to query approval
_approvedboolIdentify if _operator would be approved or disapproved

isApprovedForSlot

function isApprovedForSlot(address _owner, uint256 _slot, address _operator) external view returns (bool)

Query if _operator is authorized to manage all of _owner's tokens with the specified slot.

NameTypeDescription
_owneraddressThe address that owns the EIP-3525 tokens
_slotuint256The slot of tokens being queried approval of
_operatoraddressThe address for whom to query approval
NameTypeDescription
[0]boolTrue if _operator is authorized to manage all of _owner's tokens with _slot, false otherwise.

IERC3525SlotEnumerableUpgradeable

Interfaces for any contract that wants to support enumeration of slots as well as tokens with the same slot. Note: the EIP-165 identifier for this interface is 0x3b741b9e.

slotCount

function slotCount() external view returns (uint256)

Get the total amount of slots stored by the contract.

NameTypeDescription
[0]uint256The total amount of slots

slotByIndex

function slotByIndex(uint256 _index) external view returns (uint256)

Get the slot at the specified index of all slots stored by the contract.

NameTypeDescription
_indexuint256The index in the slot list
NameTypeDescription
[0]uint256The slot at index of all slots.

tokenSupplyInSlot

function tokenSupplyInSlot(uint256 _slot) external view returns (uint256)

Get the total amount of tokens with the same slot.

NameTypeDescription
_slotuint256The slot to query token supply for
NameTypeDescription
[0]uint256The total amount of tokens with the specified _slot

tokenInSlotByIndex

function tokenInSlotByIndex(uint256 _slot, uint256 _index) external view returns (uint256)

Get the token at the specified index of all tokens with the same slot.

NameTypeDescription
_slotuint256The slot to query tokens with
_indexuint256The index in the token list of the slot
NameTypeDescription
[0]uint256The token ID at _index of all tokens with _slot

IERC3525Upgradeable

See https://eips.ethereum.org/EIPS/eip-3525

TransferValue

event TransferValue(uint256 _fromTokenId, uint256 _toTokenId, uint256 _value)

MUST emit when value of a token is transferred to another token with the same slot, including zero value transfers (_value == 0) as well as transfers when tokens are created (_fromTokenId == 0) or destroyed (_toTokenId == 0).

NameTypeDescription
_fromTokenIduint256The token id to transfer value from
_toTokenIduint256The token id to transfer value to
_valueuint256The transferred value

ApprovalValue

event ApprovalValue(uint256 _tokenId, address _operator, uint256 _value)

MUST emit when the approval value of a token is set or changed.

NameTypeDescription
_tokenIduint256The token to approve
_operatoraddressThe operator to approve for
_valueuint256The maximum value that _operator is allowed to manage

SlotChanged

event SlotChanged(uint256 _tokenId, uint256 _oldSlot, uint256 _newSlot)

MUST emit when the slot of a token is set or changed.

NameTypeDescription
_tokenIduint256The token of which slot is set or changed
_oldSlotuint256The previous slot of the token
_newSlotuint256The updated slot of the token

valueDecimals

function valueDecimals() external view returns (uint8)

Get the number of decimals the token uses for value - e.g. 6, means the user representation of the value of a token can be calculated by dividing it by 1,000,000. Considering the compatibility with third-party wallets, this function is defined as valueDecimals() instead of decimals() to avoid conflict with EIP-20 tokens.

NameTypeDescription
[0]uint8The number of decimals for value

balanceOf

function balanceOf(uint256 _tokenId) external view returns (uint256)

Get the value of a token.

NameTypeDescription
_tokenIduint256The token for which to query the balance
NameTypeDescription
[0]uint256The value of _tokenId

slotOf

function slotOf(uint256 _tokenId) external view returns (uint256)

Get the slot of a token.

NameTypeDescription
_tokenIduint256The identifier for a token
NameTypeDescription
[0]uint256The slot of the token

approve

function approve(uint256 _tokenId, address _operator, uint256 _value) external payable

Allow an operator to manage the value of a token, up to the _value.

MUST revert unless caller is the current owner, an authorized operator, or the approved address for _tokenId. MUST emit the ApprovalValue event.

NameTypeDescription
_tokenIduint256The token to approve
_operatoraddressThe operator to be approved
_valueuint256The maximum value of _toTokenId that _operator is allowed to manage

allowance

function allowance(uint256 _tokenId, address _operator) external view returns (uint256)

Get the maximum value of a token that an operator is allowed to manage.

NameTypeDescription
_tokenIduint256The token for which to query the allowance
_operatoraddressThe address of an operator
NameTypeDescription
[0]uint256The current approval value of _tokenId that _operator is allowed to manage

transferFrom

function transferFrom(uint256 _fromTokenId, uint256 _toTokenId, uint256 _value) external payable

Transfer value from a specified token to another specified token with the same slot.

Caller MUST be the current owner, an authorized operator or an operator who has been approved the whole _fromTokenId or part of it. MUST revert if _fromTokenId or _toTokenId is zero token id or does not exist. MUST revert if slots of _fromTokenId and _toTokenId do not match. MUST revert if _value exceeds the balance of _fromTokenId or its allowance to the operator. MUST emit TransferValue event.

NameTypeDescription
_fromTokenIduint256The token to transfer value from
_toTokenIduint256The token to transfer value to
_valueuint256The transferred value

transferFrom

function transferFrom(uint256 _fromTokenId, address _to, uint256 _value) external payable returns (uint256)

Transfer value from a specified token to an address. The caller should confirm that _to is capable of receiving EIP-3525 tokens.

This function MUST create a new EIP-3525 token with the same slot for _to, or find an existing token with the same slot owned by _to, to receive the transferred value. MUST revert if _fromTokenId is zero token id or does not exist. MUST revert if _to is zero address. MUST revert if _value exceeds the balance of _fromTokenId or its allowance to the operator. MUST emit Transfer and TransferValue events.

NameTypeDescription
_fromTokenIduint256The token to transfer value from
_toaddressThe address to transfer value to
_valueuint256The transferred value
NameTypeDescription
[0]uint256ID of the token which receives the transferred value

IHyperCertMetadata

generateContractURI

function generateContractURI() external view returns (string)

generateSlotURI

function generateSlotURI(uint256 slotId) external view returns (string)

generateTokenURI

function generateTokenURI(uint256 slotId, uint256 tokenId) external view returns (string)

DateTime

SECONDS_PER_DAY

uint256 SECONDS_PER_DAY

SECONDS_PER_HOUR

uint256 SECONDS_PER_HOUR

SECONDS_PER_MINUTE

uint256 SECONDS_PER_MINUTE

OFFSET19700101

int256 OFFSET19700101

DOW_MON

uint256 DOW_MON

DOW_TUE

uint256 DOW_TUE

DOW_WED

uint256 DOW_WED

DOW_THU

uint256 DOW_THU

DOW_FRI

uint256 DOW_FRI

DOW_SAT

uint256 DOW_SAT

DOW_SUN

uint256 DOW_SUN

_daysFromDate

function _daysFromDate(uint256 year, uint256 month, uint256 day) internal pure returns (uint256 _days)

_daysToDate

function _daysToDate(uint256 _days) internal pure returns (uint256 year, uint256 month, uint256 day)

timestampFromDate

function timestampFromDate(uint256 year, uint256 month, uint256 day) internal pure returns (uint256 timestamp)

timestampFromDateTime

function timestampFromDateTime(uint256 year, uint256 month, uint256 day, uint256 hour, uint256 minute, uint256 second) internal pure returns (uint256 timestamp)

timestampToDate

function timestampToDate(uint256 timestamp) internal pure returns (uint256 year, uint256 month, uint256 day)

timestampToDateTime

function timestampToDateTime(uint256 timestamp) internal pure returns (uint256 year, uint256 month, uint256 day, uint256 hour, uint256 minute, uint256 second)

isValidDate

function isValidDate(uint256 year, uint256 month, uint256 day) internal pure returns (bool valid)

isValidDateTime

function isValidDateTime(uint256 year, uint256 month, uint256 day, uint256 hour, uint256 minute, uint256 second) internal pure returns (bool valid)

isLeapYear

function isLeapYear(uint256 timestamp) internal pure returns (bool leapYear)

_isLeapYear

function _isLeapYear(uint256 year) internal pure returns (bool leapYear)

isWeekDay

function isWeekDay(uint256 timestamp) internal pure returns (bool weekDay)

isWeekEnd

function isWeekEnd(uint256 timestamp) internal pure returns (bool weekEnd)

getDaysInMonth

function getDaysInMonth(uint256 timestamp) internal pure returns (uint256 daysInMonth)

_getDaysInMonth

function _getDaysInMonth(uint256 year, uint256 month) internal pure returns (uint256 daysInMonth)

getDayOfWeek

function getDayOfWeek(uint256 timestamp) internal pure returns (uint256 dayOfWeek)

getYear

function getYear(uint256 timestamp) internal pure returns (uint256 year)

getMonth

function getMonth(uint256 timestamp) internal pure returns (uint256 month)

getDay

function getDay(uint256 timestamp) internal pure returns (uint256 day)

getHour

function getHour(uint256 timestamp) internal pure returns (uint256 hour)

getMinute

function getMinute(uint256 timestamp) internal pure returns (uint256 minute)

getSecond

function getSecond(uint256 timestamp) internal pure returns (uint256 second)

addYears

function addYears(uint256 timestamp, uint256 _years) internal pure returns (uint256 newTimestamp)

addMonths

function addMonths(uint256 timestamp, uint256 _months) internal pure returns (uint256 newTimestamp)

addDays

function addDays(uint256 timestamp, uint256 _days) internal pure returns (uint256 newTimestamp)

addHours

function addHours(uint256 timestamp, uint256 _hours) internal pure returns (uint256 newTimestamp)

addMinutes

function addMinutes(uint256 timestamp, uint256 _minutes) internal pure returns (uint256 newTimestamp)

addSeconds

function addSeconds(uint256 timestamp, uint256 _seconds) internal pure returns (uint256 newTimestamp)

subYears

function subYears(uint256 timestamp, uint256 _years) internal pure returns (uint256 newTimestamp)

subMonths

function subMonths(uint256 timestamp, uint256 _months) internal pure returns (uint256 newTimestamp)

subDays

function subDays(uint256 timestamp, uint256 _days) internal pure returns (uint256 newTimestamp)

subHours

function subHours(uint256 timestamp, uint256 _hours) internal pure returns (uint256 newTimestamp)

subMinutes

function subMinutes(uint256 timestamp, uint256 _minutes) internal pure returns (uint256 newTimestamp)

subSeconds

function subSeconds(uint256 timestamp, uint256 _seconds) internal pure returns (uint256 newTimestamp)

diffYears

function diffYears(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _years)

diffMonths

function diffMonths(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _months)

diffDays

function diffDays(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _days)

diffHours

function diffHours(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _hours)

diffMinutes

function diffMinutes(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _minutes)

diffSeconds

function diffSeconds(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 _seconds)

strings

slice

struct slice {
uint256 _len;
uint256 _ptr;
}

memcpy

function memcpy(uint256 dest, uint256 src, uint256 len) private pure

toSlice

function toSlice(string self) internal pure returns (struct strings.slice)

len

function len(bytes32 self) internal pure returns (uint256)

toSliceB32

function toSliceB32(bytes32 self) internal pure returns (struct strings.slice ret)

copy

function copy(struct strings.slice self) internal pure returns (struct strings.slice)

toString

function toString(struct strings.slice self) internal pure returns (string)

len

function len(struct strings.slice self) internal pure returns (uint256 l)

empty

function empty(struct strings.slice self) internal pure returns (bool)

compare

function compare(struct strings.slice self, struct strings.slice other) internal pure returns (int256)

equals

function equals(struct strings.slice self, struct strings.slice other) internal pure returns (bool)

nextRune

function nextRune(struct strings.slice self, struct strings.slice rune) internal pure returns (struct strings.slice)

nextRune

function nextRune(struct strings.slice self) internal pure returns (struct strings.slice ret)

ord

function ord(struct strings.slice self) internal pure returns (uint256 ret)

keccak

function keccak(struct strings.slice self) internal pure returns (bytes32 ret)

startsWith

function startsWith(struct strings.slice self, struct strings.slice needle) internal pure returns (bool)

beyond

function beyond(struct strings.slice self, struct strings.slice needle) internal pure returns (struct strings.slice)

endsWith

function endsWith(struct strings.slice self, struct strings.slice needle) internal pure returns (bool)

until

function until(struct strings.slice self, struct strings.slice needle) internal pure returns (struct strings.slice)

findPtr

function findPtr(uint256 selflen, uint256 selfptr, uint256 needlelen, uint256 needleptr) private pure returns (uint256)

rfindPtr

function rfindPtr(uint256 selflen, uint256 selfptr, uint256 needlelen, uint256 needleptr) private pure returns (uint256)

find

function find(struct strings.slice self, struct strings.slice needle) internal pure returns (struct strings.slice)

rfind

function rfind(struct strings.slice self, struct strings.slice needle) internal pure returns (struct strings.slice)

split

function split(struct strings.slice self, struct strings.slice needle, struct strings.slice token) internal pure returns (struct strings.slice)

split

function split(struct strings.slice self, struct strings.slice needle) internal pure returns (struct strings.slice token)

rsplit

function rsplit(struct strings.slice self, struct strings.slice needle, struct strings.slice token) internal pure returns (struct strings.slice)

rsplit

function rsplit(struct strings.slice self, struct strings.slice needle) internal pure returns (struct strings.slice token)

count

function count(struct strings.slice self, struct strings.slice needle) internal pure returns (uint256 cnt)

contains

function contains(struct strings.slice self, struct strings.slice needle) internal pure returns (bool)

concat

function concat(struct strings.slice self, struct strings.slice other) internal pure returns (string)

join

function join(struct strings.slice self, struct strings.slice[] parts) internal pure returns (string)

ArraysUpgradeable

Collection of functions related to array types.

getSum

function getSum(uint64[] array) internal pure returns (uint256)

calculate the sum of the elements of an array

toString

function toString(uint64[2] array) internal pure returns (string)

toCsv

function toCsv(uint256[] array) internal pure returns (string)

toCsv

function toCsv(string[] array) internal pure returns (string)

StringsExtensions

Collection of functions related to array types.

toString

function toString(bool value) internal pure returns (string)

returns either "true" or "false"

SlotAlreadyMinted

error SlotAlreadyMinted()

SlotOutOfBounds

error SlotOutOfBounds(uint256 slotId)

SlotTokenOutOfBounds

error SlotTokenOutOfBounds(uint256 slotId, uint256 tokenId)

ERC3525SlotEnumerableUpgradeable

SlotData

struct SlotData {
uint256 slot;
uint256[] slotTokens;
}

_slotTokensIndex

mapping(uint256 => mapping(uint256 => uint256)) _slotTokensIndex

_allSlots

struct ERC3525SlotEnumerableUpgradeable.SlotData[] _allSlots

_allSlotsIndex

mapping(uint256 => uint256) _allSlotsIndex

constructor

constructor() public

Contract constructor logic

__ERC3525SlotEnumerableUpgradeable_init

function __ERC3525SlotEnumerableUpgradeable_init(string name, string symbol) public

Contract initialization logic

supportsInterface

function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)

slotCount

function slotCount() public view virtual returns (uint256)

Get the total amount of slots stored by the contract.

NameTypeDescription
[0]uint256The total amount of slots

slotByIndex

function slotByIndex(uint256 index_) public view virtual returns (uint256)

Get the slot at the specified index of all slots stored by the contract.

NameTypeDescription
index_uint256The index in the slot list
NameTypeDescription
[0]uint256The slot at index of all slots.

_slotExists

function _slotExists(uint256 slot_) internal view virtual returns (bool)

tokenSupplyInSlot

function tokenSupplyInSlot(uint256 slot_) public view virtual returns (uint256)

Get the total amount of tokens with the same slot.

NameTypeDescription
slot_uint256The slot to query token supply for
NameTypeDescription
[0]uint256The total amount of tokens with the specified _slot

tokenInSlotByIndex

function tokenInSlotByIndex(uint256 slot_, uint256 index_) public view virtual returns (uint256)

Get the token at the specified index of all tokens with the same slot.

NameTypeDescription
slot_uint256The slot to query tokens with
index_uint256The index in the token list of the slot
NameTypeDescription
[0]uint256The token ID at _index of all tokens with _slot

_tokenExistsInSlot

function _tokenExistsInSlot(uint256 slot_, uint256 tokenId_) private view returns (bool)

_createSlot

function _createSlot(uint256 slot_) internal virtual

_beforeValueTransfer

function _beforeValueTransfer(address from_, address to_, uint256 fromTokenId_, uint256 toTokenId_, uint256 slot_, uint256 value_) internal virtual

_afterValueTransfer

function _afterValueTransfer(address from_, address to_, uint256 fromTokenId_, uint256 toTokenId_, uint256 slot_, uint256 value_) internal virtual

_addSlotToAllSlotsEnumeration

function _addSlotToAllSlotsEnumeration(struct ERC3525SlotEnumerableUpgradeable.SlotData slotData) private

_addTokenToSlotEnumeration

function _addTokenToSlotEnumeration(uint256 slot_, uint256 tokenId_) private

_removeTokenFromSlotEnumeration

function _removeTokenFromSlotEnumeration(uint256 slot_, uint256 tokenId_) private

__gap

uint256[47] __gap

This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain.

NonExistentToken

error NonExistentToken(uint256 tokenId)

NonExistentSlot

error NonExistentSlot(uint256 slotId)

InsufficientBalance

error InsufficientBalance(uint256 transferAmount, uint256 balance)

InsufficientAllowance

error InsufficientAllowance(uint256 transferAmount, uint256 allowance)

ToZeroAddress

error ToZeroAddress()

InvalidID

error InvalidID(uint256 tokenId)

AlreadyMinted

error AlreadyMinted(uint256 tokenId)

SlotsMismatch

error SlotsMismatch(uint256 fromTokenId, uint256 toTokenId)

InvalidApproval

error InvalidApproval(uint256 tokenId, address from, address to)

NotApprovedOrOwner

error NotApprovedOrOwner()

NotERC3525Receiver

error NotERC3525Receiver(address receiver)

NotERC721Receiver

error NotERC721Receiver(address receiver)

FromIncorrectOwner

error FromIncorrectOwner()

ERC3525Upgradeable

TokenData

struct TokenData {
uint256 id;
uint256 slot;
uint256 balance;
address owner;
address approved;
address[] valueApprovals;
}

AddressData

struct AddressData {
uint256[] ownedTokens;
mapping(uint256 => uint256) ownedTokensIndex;
mapping(address => bool) approvals;
}

_name

string _name

_symbol

string _symbol

_decimals

string _decimals

_approvedValues

mapping(uint256 => mapping(address => uint256)) _approvedValues

tokenId => operator => units

_allTokens

struct ERC3525Upgradeable.TokenData[] _allTokens

_allTokensIndex

mapping(uint256 => uint256) _allTokensIndex

_addressData

mapping(address => struct ERC3525Upgradeable.AddressData) _addressData

tokenCounter

uint256 tokenCounter

supportsInterface

function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)

constructor

constructor() public

Contract constructor logic

__ERC3525Upgradeable_init

function __ERC3525Upgradeable_init(string name_, string symbol_) public

Contract initialization logic

name

function name() public view virtual returns (string)

Returns the token collection name.

symbol

function symbol() public view virtual returns (string)

Returns the token collection symbol.

balanceOf

function balanceOf(uint256 tokenId_) public view virtual returns (uint256)

balanceOf

function balanceOf(address owner_) public view virtual returns (uint256 balance)

ownerOf

function ownerOf(uint256 tokenId_) public view virtual returns (address owner_)

slotOf

function slotOf(uint256 tokenId_) public view virtual returns (uint256)

allowance

function allowance(uint256 tokenId_, address operator_) public view virtual returns (uint256)

totalSupply

function totalSupply() public view virtual returns (uint256)

Returns the total amount of tokens stored by the contract.

tokenByIndex

function tokenByIndex(uint256 index_) public view virtual returns (uint256)

tokenOfOwnerByIndex

function tokenOfOwnerByIndex(address owner_, uint256 index_) public view virtual returns (uint256)

_isApprovedOrOwner

function _isApprovedOrOwner(address operator_, uint256 tokenId_) internal view virtual returns (bool)

_exists

function _exists(uint256 tokenId_) internal view virtual returns (bool)

approve

function approve(uint256 tokenId_, address to_, uint256 value_) external payable virtual

approve

function approve(address to_, uint256 tokenId_) public virtual

getApproved

function getApproved(uint256 tokenId_) public view virtual returns (address)

setApprovalForAll

function setApprovalForAll(address operator_, bool approved_) public virtual

isApprovedForAll

function isApprovedForAll(address owner_, address operator_) public view virtual returns (bool)

transferFrom

function transferFrom(uint256 fromTokenId_, address to_, uint256 value_) public payable virtual returns (uint256)

transferFrom

function transferFrom(uint256 fromTokenId_, uint256 toTokenId_, uint256 value_) public payable virtual

transferFrom

function transferFrom(address from_, address to_, uint256 tokenId_) public virtual

safeTransferFrom

function safeTransferFrom(address from_, address to_, uint256 tokenId_, bytes data_) public virtual

safeTransferFrom

function safeTransferFrom(address from_, address to_, uint256 tokenId_) public virtual

contractURI

function contractURI() public view virtual returns (string)

Returns the Uniform Resource Identifier (URI) for the current ERC3525 contract.

This function SHOULD return the URI for this contract in JSON format, starting with header data:application/json;. See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for contract URI.

NameTypeDescription
[0]stringThe JSON formatted URI of the current ERC3525 contract

_mint

function _mint(address to_, uint256 tokenId_, uint256 slot_) internal

_mintValue

function _mintValue(address to_, uint256 slot_, uint256 value_) internal virtual returns (uint256 tokenId)

_splitValue

function _splitValue(uint256 fromToken_, uint256 value_) internal virtual returns (uint256 tokenId)

_mergeValue

function _mergeValue(uint256 fromToken_, uint256 toToken_) internal virtual returns (uint256 tokenId)

_burn

function _burn(uint256 tokenId_) internal virtual

_approve

function _approve(address to_, uint256 tokenId_) internal virtual

_approveValue

function _approveValue(uint256 tokenId_, address to_, uint256 value_) internal virtual

_spendAllowance

function _spendAllowance(address operator_, uint256 tokenId_, uint256 value_) internal virtual

_clearApprovedValues

function _clearApprovedValues(uint256 tokenId_) internal virtual

_existApproveValue

function _existApproveValue(address to_, uint256 tokenId_) internal view virtual returns (bool)

_setApprovalForAll

function _setApprovalForAll(address owner_, address operator_, bool approved_) internal virtual

_transferValue

function _transferValue(uint256 fromTokenId_, uint256 toTokenId_, uint256 value_) internal virtual

_transferTokenId

function _transferTokenId(address from_, address to_, uint256 tokenId_) internal virtual

_safeTransferTokenId

function _safeTransferTokenId(address from_, address to_, uint256 tokenId_, bytes data_) internal virtual

_beforeValueTransfer

function _beforeValueTransfer(address from_, address to_, uint256 fromTokenId_, uint256 toTokenId_, uint256 slot_, uint256 value_) internal virtual

_afterValueTransfer

function _afterValueTransfer(address from_, address to_, uint256 fromTokenId_, uint256 toTokenId_, uint256 slot_, uint256 value_) internal virtual

_checkOnERC3525Received

function _checkOnERC3525Received(uint256 fromTokenId_, uint256 toTokenId_, uint256 value_, bytes data_) private returns (bool)

_checkOnERC721Received

function _checkOnERC721Received(address from_, address to_, uint256 tokenId_, bytes data_) private returns (bool)

_createOriginalTokenId

function _createOriginalTokenId() internal virtual returns (uint256)

_addTokenToOwnerEnumeration

function _addTokenToOwnerEnumeration(address to_, uint256 tokenId_) private

_removeTokenFromOwnerEnumeration

function _removeTokenFromOwnerEnumeration(address from_, uint256 tokenId_) private

_addTokenToAllTokensEnumeration

function _addTokenToAllTokensEnumeration(struct ERC3525Upgradeable.TokenData tokenData_) private

_removeTokenFromAllTokensEnumeration

function _removeTokenFromAllTokensEnumeration(uint256 tokenId_) private

_msgSender

function _msgSender() internal view virtual returns (address sender)

valueDecimals

function valueDecimals() external view virtual returns (uint8)

Get the number of decimals the token uses for value - e.g. 6, means the user representation of the value of a token can be calculated by dividing it by 1,000,000. Considering the compatibility with third-party wallets, this function is defined as valueDecimals() instead of decimals() to avoid conflict with EIP-20 tokens.

NameTypeDescription
[0]uint8The number of decimals for value

tokenURI

function tokenURI(uint256 tokenId) external view virtual returns (string)

Returns the Uniform Resource Identifier (URI) for tokenId token.

slotURI

function slotURI(uint256 _slot) external view virtual returns (string)

Returns the Uniform Resource Identifier (URI) for the specified slot.

This function SHOULD return the URI for _slot in JSON format, starting with header data:application/json;. See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for slot URI.

NameTypeDescription
[0]stringThe JSON formatted URI of _slot

IHyperCertMinter

IHyperCertSVG

HyperCertMetadata

EmptyInput

error EmptyInput()

DuplicateScope

error DuplicateScope()

InvalidScope

error InvalidScope()

InvalidTimeframe

error InvalidTimeframe(uint64 from, uint64 to)

ConflictingClaim

error ConflictingClaim()

InvalidInput

error InvalidInput()

HyperCertMinter

Contains functions and events to initialize and issue a hypercertificate

UPGRADER_ROLE

bytes32 UPGRADER_ROLE

User role required in order to upgrade the contract

_metadata

contract IHyperCertMetadata _metadata

Hypercert metadata contract

workScopes

mapping(bytes32 => string) workScopes

Mapping of id's to work-scopes

impactScopes

mapping(bytes32 => string) impactScopes

Mapping of id's to impact-scopes

rights

mapping(bytes32 => string) rights

Mapping of id's to rights

_contributorImpacts

mapping(address => mapping(bytes32 => bool)) _contributorImpacts

_hyperCerts

mapping(uint256 => struct HyperCertMinter.Claim) _hyperCerts

Claim

struct Claim {
bytes32 claimHash;
uint64[2] workTimeframe;
uint64[2] impactTimeframe;
bytes32[] workScopes;
bytes32[] impactScopes;
bytes32[] rights;
address[] contributors;
uint256 totalUnits;
uint16 version;
bool exists;
string name;
string description;
string uri;
address minter;
}

ImpactClaimed

event ImpactClaimed(uint256 id, address minter, uint64[] fractions)

Emitted when an impact is claimed.

NameTypeDescription
iduint256Id of the claimed impact.
minteraddressAddress of cert minter.
fractionsuint64[]Units of tokens issued under the hypercert.

ImpactScopeAdded

event ImpactScopeAdded(bytes32 id, string text)

Emitted when a new impact scope is added.

NameTypeDescription
idbytes32Id of the impact scope.
textstringShort text code of the impact scope.

RightAdded

event RightAdded(bytes32 id, string text)

Emitted when a new right is added.

NameTypeDescription
idbytes32Id of the right.
textstringShort text code of the right.

WorkScopeAdded

event WorkScopeAdded(bytes32 id, string text)

Emitted when a new work scope is added.

NameTypeDescription
idbytes32Id of the work scope.
textstringShort text code of the work scope.

constructor

constructor() public

Contract constructor logic

initialize

function initialize(address metadataAddress) public

Contract initialization logic

addImpactScope

function addImpactScope(string text) public

Adds a new impact scope

NameTypeDescription
textstringText representing the impact scope

addRight

function addRight(string text) public

Adds a new right

NameTypeDescription
textstringText representing the right

addWorkScope

function addWorkScope(string text) public

Adds a new work scope

NameTypeDescription
textstringText representing the work scope

mint

function mint(address account, bytes data) public virtual

Issues a new hypercertificate

NameTypeDescription
accountaddressAccount issuing the new hypercertificate
databytesData representing the parameters of the claim

split

function split(uint256 tokenId, uint256[] amounts) public

merge

function merge(uint256[] tokenIds) public

getImpactCert

function getImpactCert(uint256 claimID) public view returns (struct HyperCertMinter.Claim)

Gets the impact claim with the specified id

NameTypeDescription
claimIDuint256Id of the claim
NameTypeDescription
[0]struct HyperCertMinter.ClaimThe claim, if it doesn't exist with default values

supportsInterface

function supportsInterface(bytes4 interfaceId) public view returns (bool)

Returns a flag indicating if the contract supports the specified interface

NameTypeDescription
interfaceIdbytes4Id of the interface
NameTypeDescription
[0]booltrue, if the interface is supported

slotURI

function slotURI(uint256 slotId_) external view returns (string)

tokenURI

function tokenURI(uint256 tokenId_) public view returns (string)

contractURI

function contractURI() public view returns (string)

Returns the Uniform Resource Identifier (URI) for the current ERC3525 contract.

This function SHOULD return the URI for this contract in JSON format, starting with header data:application/json;. See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for contract URI.

NameTypeDescription
[0]stringThe JSON formatted URI of the current ERC3525 contract

burn

function burn(uint256 tokenId_) public
function donate(uint256 tokenId_) public

_authorizeUpgrade

function _authorizeUpgrade(address) internal view

upgrade authorization logic

adds onlyRole(UPGRADER_ROLE) requirement

_authorizeAdd

function _authorizeAdd(string text, mapping(bytes32 => string) map) internal view virtual returns (bytes32 id)

Pre-add validation checks

NameTypeDescription
textstringText to be added
mapmapping(bytes32 => string)Storage mapping that will be appended

_authorizeMint

function _authorizeMint(address account, struct HyperCertMinter.Claim claim) internal view virtual

Pre-mint validation checks

NameTypeDescription
accountaddressDestination address for the mint
claimstruct HyperCertMinter.ClaimImpact claim data

_parseData

function _parseData(bytes data) internal pure returns (struct HyperCertMinter.Claim claim, uint64[])

Parse bytes to Claim and URI

This function is overridable in order to support future schema changes

NameTypeDescription
databytesByte data representing the claim
NameTypeDescription
claimstruct HyperCertMinter.ClaimThe parsed Claim struct
[1]uint64[]Claim metadata URI

_storeContributorsClaims

function _storeContributorsClaims(bytes32 claimHash, address[] creators) internal

Stores contributor claims in the contributorImpacts mapping; guards against overlapping claims

NameTypeDescription
claimHashbytes32Claim data hash-code value
creatorsaddress[]Array of addresses for contributors

_hasKey

function _hasKey(mapping(bytes32 => string) map, bytes32 key) internal view returns (bool)

Checks whether the supplied mapping contains the supplied key

NameTypeDescription
mapmapping(bytes32 => string)mapping to search
keybytes32key to search
NameTypeDescription
[0]booltrue, if the key exists in the mapping

_msgSender

function _msgSender() internal view returns (address sender)

setMetadataGenerator

function setMetadataGenerator(address metadataGenerator) external

HyperCertSVG

UPGRADER_ROLE

bytes32 UPGRADER_ROLE

User role required in order to upgrade the contract

_version

uint16 _version

Current version of the contract

backgrounds

mapping(uint256 => string) backgrounds

id => background

colors

mapping(uint256 => struct HyperCertSVG.SVGColors) colors

id => colors

backgroundCounter

uint256 backgroundCounter

colorsCounter

uint256 colorsCounter

SVGParams

struct SVGParams {
string name;
string[] scopesOfImpact;
uint64[2] workTimeframe;
uint64[2] impactTimeframe;
uint256 units;
uint256 totalUnits;
}

SVGColors

struct SVGColors {
string primary;
string labels;
string background;
}

BackgroundAdded

event BackgroundAdded(uint256 id)

ColorsAdded

event ColorsAdded(uint256 id, struct HyperCertSVG.SVGColors colors)

constructor

constructor() public

Contract constructor logic

initialize

function initialize() public

Contract initialization logic

addBackground

function addBackground(string svgString) external returns (uint256 id)

addColors

function addColors(string[3] _colors) external returns (uint256 id)

generateSvgHyperCert

function generateSvgHyperCert(string name, string[] scopesOfImpact, uint64[2] workTimeframe, uint64[2] impactTimeframe, uint256 totalUnits) external view virtual returns (string)

generateSvgFraction

function generateSvgFraction(string name, string[] scopesOfImpact, uint64[2] workTimeframe, uint64[2] impactTimeframe, uint256 units, uint256 totalUnits) external view virtual returns (string)

_generateHyperCert

function _generateHyperCert(struct HyperCertSVG.SVGParams params) internal view virtual returns (string)

_generateHyperCertFraction

function _generateHyperCertFraction(struct HyperCertSVG.SVGParams params) internal view virtual returns (string)

1: Primary 2: Labels 3: Backgrounds

_generateBackgroundPattern

function _generateBackgroundPattern(string primaryScopeOfImpact, struct HyperCertSVG.SVGColors colors) internal view returns (string background)

_generateColors

function _generateColors(string primaryScopeOfImpact) internal view returns (struct HyperCertSVG.SVGColors _colors)

_getBackgroundIndex

function _getBackgroundIndex(string primaryScopeOfImpact) internal pure returns (uint256 index)

_getColorIndex

function _getColorIndex(string primaryScopeOfImpact) internal view returns (uint256 index)

_generateHeader

function _generateHeader(struct HyperCertSVG.SVGParams params, struct HyperCertSVG.SVGColors colors) internal pure virtual returns (string)

_generateScopeOfImpact

function _generateScopeOfImpact(struct HyperCertSVG.SVGParams params, struct HyperCertSVG.SVGColors colors) internal pure virtual returns (string)

_generateName

function _generateName(struct HyperCertSVG.SVGParams params, struct HyperCertSVG.SVGColors colors) internal pure virtual returns (string)

_generateWorkperiod

function _generateWorkperiod(struct HyperCertSVG.SVGParams params, struct HyperCertSVG.SVGColors colors) internal pure virtual returns (string)

_generateDivider

function _generateDivider(struct HyperCertSVG.SVGColors colors) internal pure virtual returns (string)

_generateFraction

function _generateFraction(struct HyperCertSVG.SVGParams params, struct HyperCertSVG.SVGColors colors) internal view virtual returns (string)

stringToBytes32

function stringToBytes32(string source) internal pure returns (bytes32 result)

bytes32ToString

function bytes32ToString(bytes32 _bytes32, uint8 cutoff) internal pure returns (string parsedString)

cutString

function cutString(string source, uint8 cutoff) internal pure returns (string cutString)

getPercent

function getPercent(uint256 part, uint256 whole) public pure returns (uint256 percent)

uint2decimal

function uint2decimal(uint256 self, uint8 decimals) internal pure returns (bytes)

version

function version() public view virtual returns (uint256)

gets the current version of the contract

updateVersion

function updateVersion() external

Update the contract version number Only allowed for member of UPGRADER_ROLE

supportsInterface

function supportsInterface(bytes4 interfaceId) public view returns (bool)

Returns a flag indicating if the contract supports the specified interface

NameTypeDescription
interfaceIdbytes4Id of the interface
NameTypeDescription
[0]booltrue, if the interface is supported

_authorizeUpgrade

function _authorizeUpgrade(address) internal view

upgrade authorization logic

adds onlyRole(UPGRADER_ROLE) requirement

IERC3525MetadataUpgradeable

IERC3525Receiver

IERC3525SlotApprovableUpgradeable

IERC3525SlotEnumerableUpgradeable

IERC3525Upgradeable

IHyperCertMetadata

DateTime

strings

ArraysUpgradeable

Collection of functions related to array types.

getSum

function getSum(uint64[] array) internal pure returns (uint64)

calculate the sum of the elements of an array

toString

function toString(uint64[2] array) internal pure returns (string)

toCsv

function toCsv(uint256[] array) internal pure returns (string)

toCsv

function toCsv(string[] array) internal pure returns (string)

StringsExtensions