FractionERC1155DataManager
Contract for managing fractions of a Wrapper NFT using an ERC1155 token
_This contract is used to manage fractions of a Wrapper NFT using an OmnichainUpgradeableERC1155DataManager contract to provide the ERC1155 token functionality.
UserUnlockDisabled
Error thrown when user unlock enabled is false
FractionConfig
wrapper
Wrapper Contract address
nftId
Wrapped NFT id
userUnlockEnabled
Allows unlock by fraction owners burning their fractions
upperGenesisId
This is the upper limit of the genesis id. f.i. if genesis ids are 0, 1, 2, 3 then this limit is equal to 3.
Genesis ids are always the first consecutives ids up to the upper genesis limit needed.
totalSupplyGenesisIds
The total supply of all the genesis ids
onlyPrimaryChain
Modifier to check if the contract is on the primary chain
onlyIfUserUnlockEnabled
Modifier to check if fraction owners can unlock by burning their fractions
constructor
initialize
Initializes the DataManager
Parameters
Name | Type | Description |
---|---|---|
omnichainERC1155InitData | struct IFractionERC1155DataManager.OmnichainERC1155InitData | Init data for Omnichain ERC1155 DM |
beneficiary_ | address | Address which receives minted fractions |
wrapper_ | address | Address of the Wrapper contract (same as Wrapped NFT), must be 0 on secondary chains |
nftId_ | uint256 | Id of the Wrapped NFT |
amountToBeMinted_ | uint256 | Amount of fractions ot mint |
upperGenesisId_ | uint256 | The upper limit of the genesis ids |
userUnlockEnabled_ | bool | Enables Fraction owners to unlock via burning their fractions |
__OmnichainUpgradeableERC1155DataManager_init_with_struct
__FractionERC1155DataManager_init_unchained
forceUnlockNft
Can be used by contract owner to receive Wrapped NFT
Parameters
Name | Type | Description |
---|---|---|
receiver | address | who should receive NFT |
forceFullyUnlockWrappedAssets
Can be used by contract owner to receive wrapped assets (this includes burning the Wrapped NFT)
Parameters
Name | Type | Description |
---|---|---|
receiver | address | who should receive wrapped assets |
fullyUnlockWrappedAssets
Can be used by fractions owner to recieve wrapped assets in exchange to all fractions All fractions will be burned.
Parameters
Name | Type | Description |
---|---|---|
beneficiary | address | who should receive wrapped assets |
partiallyUnlockWrappedAssets
Can be used by fractions owner to recieve part of wrapped assets in exchange to his fractions Amount of assets he receives is proportional to burned fractions
Parameters
Name | Type | Description |
---|---|---|
genesisId | uint256 | the genesis id to be used |
fractionsToBurn | uint256 | amount of fractions to burn |
skipNonPercentageWtypes | bool | allows to skip non-fungible assets, where correct percentage can not be counted, otherwise if there are such wrapped assets, this call will revert |
beneficiary | address | who should receive wrapped assets |
partiallyUnlockWrappedAssetsBatch
Batch version of partially unlocking wrapped assets. Can be used by fractions owner to recieve part of wrapped assets in exchange to his fractions Amount of assets he receives is proportional to burned fractions
Parameters
Name | Type | Description |
---|---|---|
genesisIds | uint256[] | the genesis ids to be used |
fractionsToBurnforId | uint256[] | |
skipNonPercentageWtypes | bool | allows to skip non-fungible assets, where correct percentage can not be counted, otherwise if there are such wrapped assets, this call will revert |
beneficiary | address | who should receive wrapped assets |
burnMintAndPartiallyUnwrap
Allows contract owner to burn, mint and partially unwrap assets depending on specific ids and amounts
Parameters
Name | Type | Description |
---|---|---|
fractionsToHandle | uint256 | The amount of fractions to burn for burnId and mint of mintId |
burnId | uint256 | The id from which fractionsToHandle will be burnt |
mintId | uint256 | The id of which fractionsToHandle will be minted (if 0 no id is minted) |
account | address | The address from which the fractions will be burnt, to which the minted fractions will be minted and unwrapped assets will be provided |
tokens | address[] | The array of token addresses to be unwrapped |
ids | uint256[] | The array of ids to be unwrapped |
values | uint256[] | The array of values to be unwrapped |
burnFromOwnerMintToAccount
Allows contract owner to burn amount from himself/herself and mint to an account Both burnId and mintId should be genesis ids
Parameters
Name | Type | Description |
---|---|---|
fractionsToHandle | uint256 | The amount of fractions to burn for burnId and mint of mintId |
burnId | uint256 | The id from which fractionsToHandle will be burnt |
mintId | uint256 | The id of which fractionsToHandle will be minted |
account | address | The address to which the minted fractions will be minted |
burnFromOwnerUnwrapToAccount
percentageBurnMintAndPartiallyUnwrap
Allows contract owner to burn, mint and partially unwrap assets depending on a percentage
Parameters
Name | Type | Description |
---|---|---|
fractionsToHandle | uint256 | The amount of fractions to burn for burnId and mint of mintId |
burnId | uint256 | The id from which fractionsToHandle will be burnt |
mintId | uint256 | The id of which fractionsToHandle will be minted (if 0 no id is minted) |
account | address | The address from which the fractions will be burnt, to which the minted fractions will be minted and unwrapped assets will be provided |
percentageToProvide | uint256 | The percentage of the wrapped assets to be provided to the account |
execute
Allows contract owner to send messages (execute calls) on wrapped assets
Parameters
Name | Type | Description |
---|---|---|
token | address | Asset contract to send message to |
input | bytes | Message to send (abi-encoded call payload with method selector and arguments) |
onERC721Received
_Whenever an {IERC721} tokenId
token is transferred to this contract via {IERC721-safeTransferFrom}
by operator
from from
, this function is called.
It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
The selector can be obtained in Solidity with IERC721Receiver.onERC721Received.selector
._
transferOwnership
Function used to transfer ownership of the Fraction ERC1155 Data Manager
Parameters
Name | Type | Description |
---|---|---|
newOwner | address | Address of the new owner |
localMintBurnSupplyAll
Function used to get count of all minted and not burned tokens on current chain of all ids
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | Difference between tokens minted and burned on current chain of all ids |
localMintBurnSupply
Function used to get count of all minted and not burned tokens on current chain of a specific id
Parameters
Name | Type | Description |
---|---|---|
id | uint256 | Id of the token |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | Difference between tokens minted and burned on current chain of the id |
safeTransferFrom
SafeTransferFrom
Parameters
Name | Type | Description |
---|---|---|
from | address | Address to get the token from |
to | OmnichainAddress | Address to provide tokens to |
id | uint256 | The id of the token |
value | uint256 | The amount of the tokens to transfer |
data | bytes | Extra data needed |
refundAddress | address payable | Address to send native coin refund to |
mint
Mint value
tokens of id
to to
The caller must be allowed to mint
Parameters
Name | Type | Description |
---|---|---|
to | address | Address to mint tokens to |
id | uint256 | Token id to mint |
value | uint256 | Amount to mint |
data | bytes | Additional data with no specified format |
burn
Burn value
tokens from from
(of id
in ERC1155)
Parameters
Name | Type | Description |
---|---|---|
from | address | Address to burn tokens from |
id | uint256 | The tokenId to burn (only for erc1155) |
value | uint256 | Amount to burn |