ODCdataManagersomnichainERC1155

OmnichainUpgradeableERC1155DataManager

Contract for managing an Upgradeable Omnichain ERC1155 token using a Omnichain Fungible Fractions Data Object

_This contract is used to manage an Upgradeable Omnichain ERC1155 token where a Data Object contract is used to store the token data.

 NOTE: This contract and the Data Object contract MUST be approved in the Data Index contract to interact with the given
 Data Point

 For the correct functioning of this contract, it must be registered as a handler in the Omnichain Fungible
 Fractions Data Object through the registerOmnichainIncreaseBalanceHandler function._

WrongParameters

error WrongParameters()

Error thrown when the parameters are wrong

OmnichainMintBurnNotSupported

error OmnichainMintBurnNotSupported()

Error thrown when the from or to address is the zero address in a transfer

UnauthorizedCaller

error UnauthorizedCaller()

Error thrown when the caller is not the Omnichain Fungible Fractions Data Object

NotRegisteredAsOmnichainIncreaseBalanceHandler

error NotRegisteredAsOmnichainIncreaseBalanceHandler()

Error thrown when the contract is not registered as an Omnichain Increase Balance handler

_isRegisteredAsOmnichainIncreaseBalanceHandler

bool _isRegisteredAsOmnichainIncreaseBalanceHandler

Variable to know if the contract is registered as an Omnichain Increase Balance handler

_datapoint

DataPoint _datapoint

The Data Point identifier for the Omnichain Fungible Fractions Data Object

fungibleFractionsDO

contract IDataObject fungibleFractionsDO

The Omnichain Fungible Fractions Data Object

dataIndex

contract IDataIndex dataIndex

The Data Index implementation

constructor

constructor() public

initialize

function initialize(bytes32 dataPoint_, address dataIndex_, address dataObject_, string name_, string symbol_) external

__OmnichainUpgradeableERC1155DataManager_init

function __OmnichainUpgradeableERC1155DataManager_init(bytes32 datapoint_, address dataIndex_, address fungibleFractionsDO_, string name_, string symbol_) internal

registerOmnichainIncreaseBalanceHandler

function registerOmnichainIncreaseBalanceHandler() public

Function to register this contract as an omnichain increase balance handler NOTE: This function must be called after the contract is deployed

afterOmnichainFungibleFractionsIncreaseBalanceOnTargetChain

function afterOmnichainFungibleFractionsIncreaseBalanceOnTargetChain(OmnichainAddress from, address to, uint256 id, uint256 value) external returns (bool)

This function is called by the Omnichain Fungible Fractions Data Object to perform necessary checks and emit events

afterOmnichainFungibleFractionsIncreaseBalanceOnTargetChain

function afterOmnichainFungibleFractionsIncreaseBalanceOnTargetChain(OmnichainAddress from, address to, uint256[] ids, uint256[] values) external returns (bool)

This function is called by the Omnichain Fungible Fractions Data Object to perform necessary checks and emit events

afterOmnichainFungibleFractionsFailedRefund

function afterOmnichainFungibleFractionsFailedRefund(OmnichainAddress, OmnichainAddress to, address, uint256[] ids, uint256[] values) external virtual

Function called if normal token refund procedure failed and balance of this contract (the one which is called) is increased

Parameters

NameTypeDescription
OmnichainAddress
toOmnichainAddressThe address to which the token was originally transferred
address
idsuint256[]Ids of the tokens
valuesuint256[]The amounts of the tokens transferred

recoverTokens

function recoverTokens(address to, uint256[] ids, uint256[] values) external virtual

Allows contract owner to transfer tokens which was sent to this contract Can be used to recover failed refunds

If onERC1155Received will be added in an overriding contract, it should also override this function and maybe afterOmnichainFungibleFractionsFailedRefund to implement more sophisticated refund mechanics.

Parameters

NameTypeDescription
toaddressDestination address
idsuint256[]Array of token IDs
valuesuint256[]Array of amounts of tokens to transfer

supportsInterface

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

_Returns true if this contract implements the interface defined by interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] to learn more about how these ids are created.

This function call must use less than 30 000 gas._

setURI

function setURI(uint256 tokenId, string tokenURI) external

Set the URI for a token id

Parameters

NameTypeDescription
tokenIduint256The token id
tokenURIstringThe URI to set

setBaseURI

function setBaseURI(string baseURI) external

Set the base URI for all token ids

Parameters

NameTypeDescription
baseURIstringThe base URI to set

setDefaultURI

function setDefaultURI(string defaultURI) external

Set the default URI for all token ids

Parameters

NameTypeDescription
defaultURIstringThe default URI to set

totalSupply

function totalSupply() public view returns (uint256)

Returns the total supply of all tokens

Return Values

NameTypeDescription
[0]uint256The total supply

totalSupply

function totalSupply(uint256 id) public view returns (uint256)

Returns the total supply of a specific token id

Parameters

NameTypeDescription
iduint256The token id

Return Values

NameTypeDescription
[0]uint256The total supply of the token id

balanceOf

function balanceOf(address account, uint256 id) public view returns (uint256)

Returns the value of tokens of token type id owned by account.

balanceOfBatch

function balanceOfBatch(address[] accounts, uint256[] ids) public view returns (uint256[])

_xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.

Requirements:

  • accounts and ids must have the same length._

_checkMinter

function _checkMinter() internal view

SHOULD throw an error if the sender is not allowed to mint

_writeTransfer

function _writeTransfer(address from, address to, uint256 id, uint256 value) internal virtual

_writeTransfer

function _writeTransfer(address from, OmnichainAddress to, uint256 id, uint256 value, address payable refundAddress) internal virtual

_writeTransferBatch

function _writeTransferBatch(address from, address to, uint256[] ids, uint256[] values) internal virtual

_writeTransferBatch

function _writeTransferBatch(address from, OmnichainAddress to, uint256[] ids, uint256[] values, address payable refundAddress) internal virtual

_msgSender

function _msgSender() internal view virtual returns (address)

_msgData

function _msgData() internal view virtual returns (bytes)

_contextSuffixLength

function _contextSuffixLength() internal view virtual returns (uint256)