FractionERC20DataManager
Contract for managing fractions of a Wrapper NFT using an ERC20 token
_This contract is used to manage fractions of a Wrapper NFT using an OmnichainUpgradeableERC20DataManager contract to provide the ERC20 token functionality.
UserUnlockDisabled
Error thrown when user unlock enabled is false
wrapper
Wrapper Contract address
nftId
Wrapped NFT id
userUnlockEnabled
allows unlock by fraction owners burning their fractions
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 |
---|---|---|
dataPoint_ | bytes32 | DataPoint used for the project |
beneficiary_ | address | |
wrapper_ | address | Address of the Wrapper contract (same as Wrapped NFT), must be 0 on secondary chains |
dataIndex_ | address | Address of DataIndex implementation |
dataObject_ | address | Data Object used to store balance data (use OmnichainFungibleTokenWithLocalMintBurnSupplyDO) |
name_ | string | Name of the Fraction token |
symbol_ | string | Symbol of the Fraction token |
nftId_ | uint256 | Id of the Wrapped NFT |
amountToBeMinted_ | uint256 | Amount of fractions to mint |
userUnlockEnabled_ | bool | Enables Fraction owners to unlock via burning their fractions |
__FractionERC20DataManager_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 |
---|---|---|
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 |
burnFromOwnerUnwrapToAccount
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 ERC20 Data Manager
Parameters
Name | Type | Description |
---|---|---|
newOwner | address | Address of the new owner |
localMintBurnSupply
Function used to get count of all minted and not burned tokens on current chain of all ids
This function returns 0 in secondary chains
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | Difference between tokens minted and burned on current chain of all ids |
transferFrom
transferFrom
Parameters
Name | Type | Description |
---|---|---|
from | address | Address to get the token from |
to | OmnichainAddress | Address to provide tokens to |
value | uint256 | The amount of the tokens to transfer |
refundAddress | address payable | Address to send native coin refund to |
mint
Mint value
tokens to to
The caller must be allowed to mint
Parameters
Name | Type | Description |
---|---|---|
to | address | Address to mint tokens to |
value | uint256 | Amount to mint |
burn
Burn value
tokens from from
(of id
in ERC1155)
Parameters
Name | Type | Description |
---|---|---|
from | address | Address to burn tokens from |
uint256 | ||
value | uint256 | Amount to burn |