ColleCollectionUpgradeable

This contract represents a collection of unique tokens (NFTs) which mirror physical assets and extends ERC721 with additional functionality.

The contract is using OpenZeppelin contracts for most of the ERC721 functionality and has extra functions for additional needs.

nextTokenId

uint256 nextTokenId

tokenSaleMetadataIPFS

mapping(uint256 => string) tokenSaleMetadataIPFS

constructor

constructor() public

The constructor initializes the base contract.

initialize

function initialize(string _name, string _symbol) public virtual

Initializes the contract.

Parameters

Name
Type
Description

_name

string

The name of the token.

_symbol

string

The symbol of the token.

_authorizeUpgrade

Authorizes a contract upgrade.

Throws if the new implementation is not the target implementation.

Parameters

Name
Type
Description

newImplementation

address

The address of the new contract implementation.

onlyOwnerApprovedEOAOrVault

Guards ERC721 transfers to the token owner (EOA or contract), approved EOA or approved Vault.

Restricts approved non-vault contracts from transferring tokens to break 3rd party transfers of mirrored assets.

Parameters

Name
Type
Description

_tokenId

uint256

The token id to guard against.

mint

Mints a new token.

This function can only be called by a Colle.

Parameters

Name
Type
Description

_uri

string

The token URI.

_receiver

address

The address that will receive the minted token.

updateSaleMetadata

Updates the sale metadata for a token.

This function can only be called by a Colle or the owner of the token.

Parameters

Name
Type
Description

_tokenId

uint256

The ID of the token to update.

_ipfsHash

string

The new IPFS hash for the token metadata.

updateTokenURI

Updates the token metadata URI

This function can only be called by a Colle.

Parameters

Name
Type
Description

_tokenId

uint256

The ID of the token to update.

_uri

string

The new URI for the token metadata.

getSaleMetadata

Returns the sale metadata for a token.

Parameters

Name
Type
Description

_tokenId

uint256

The ID of the token to query.

Return Values

Name
Type
Description

[0]

string

The IPFS hash of the sale metadata.

isSaleMetadataSet

Checks if sale metadata is set for a token.

Parameters

Name
Type
Description

_tokenId

uint256

The ID of the token to check.

Return Values

Name
Type
Description

[0]

bool

True if the token has sale metadata set, false otherwise.

permitApprove

Approves an address to transfer a specific token.

Parameters

Name
Type
Description

_to

address

The address to approve.

_tokenId

uint256

The ID of the token to approve.

_signature

struct Signature

The signature from the approving address, the 'from', including deadline

permitSetApprovalForAll

Approves an address to transfer any tokens owned by the sender.

Parameters

Name
Type
Description

_operator

address

The address to approve.

_approve

bool

Whether to approve or revoke approval

_signature

struct Signature

The signature, deadline and signer from the owner of the token.

permitSafeTransfer

Transfers a token from one address to another, verifying the validity of a signature.

Parameters

Name
Type
Description

_to

address

The address to receive the token.

_tokenId

uint256

The ID of the token to transfer.

_signature

struct Signature

The signature, deadline and signer from the owner of the token.

getNextTokenId

Returns the ID of the next token that will be minted.

Return Values

Name
Type
Description

[0]

uint256

The ID of the next token.

supportsInterface

Checks if the contract implements an interface.

Parameters

Name
Type
Description

_interfaceId

bytes4

The ID of the interface.

Return Values

Name
Type
Description

[0]

bool

True if the contract implements the interface, false otherwise.

transferFrom

Transfers a token from one address to another.

In order to prevent mirrored assets from being traded on 3rd party markets, only direct transfer or Marketplace vault transfer cause call transferFrom.

Parameters

Name
Type
Description

_from

address

The current owner of the token.

_to

address

The address to receive the token.

_tokenId

uint256

The ID of the token to transfer.

safeTransferFrom

Safely transfers a token from one address to another.

In order to prevent mirrored assets from being traded on 3rd party markets, only direct transfer or Marketplace vault transfer cause call safeTransferFrom.

Parameters

Name
Type
Description

_from

address

The current owner of the token.

_to

address

The address to receive the token.

_tokenId

uint256

The ID of the token to transfer.

safeTransferFrom

Safely transfers a token from one address to another.

In order to prevent mirrored assets from being traded on 3rd party markets, only direct transfer or Marketplace vault transfer cause call safeTransferFrom.

Parameters

Name
Type
Description

_from

address

The current owner of the token.

_to

address

The address to receive the token.

_tokenId

uint256

The ID of the token to transfer.

_data

bytes

Additional data with no specified format.

recall

Allows relayer to forceably transfer a token from one address to another.

This function can only be called by a relayer, and a reason must be provided. This function is used to recall tokens if the NFT's association with it's physical counterpart is lost, and a user proves they are in possessio of the physical good.

Parameters

Name
Type
Description

_tokenId

uint256

The ID of the token to transfer.

_to

address

The address to receive the token.

_ipfsReason

string

The IPFS hash which leads to the reason for the recall.

_getPermitApproveHash

Internal function to get the expected EIP-712 signed hash to permit approving a token transfer

Parameters

Name
Type
Description

_signature

struct Signature

The signature, deadline and signer from the owner of the token.

_to

address

The address to approve.

_tokenId

uint256

The ID of the token to approve.

_getPermitSetApprovalForAllHash

Internal function to get the expected EIP-712 signed hash to permit approving a token transfer

Parameters

Name
Type
Description

_signature

struct Signature

The signature, deadline and signer from the owner of the tokens.

_operator

address

The address to approve.

_approve

bool

Whether to approve or revoke approval

_getPermitSafeTransferHash

Internal function to get the expected EIP-712 signed hash to permit transfering a token

Parameters

Name
Type
Description

_signature

struct Signature

The signature, deadline and signer from the owner of the tokens.

_to

address

The address to transfer to.

_tokenId

uint256

The ID of the token to transfer.

Last updated