ItemsTransferFacet
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes _data) external
Transfers
_value
amount of an _id
from the _from
address to the _to
address specified (with safety call). @dev Caller must be approved to manage the tokens being transferred out of the _from
account (see "Approval" section of the standard). MUST revert if _to
is the zero address. MUST revert if balance of holder for token _id
is lower than the _value
sent. MUST revert on any other error. MUST emit the TransferSingle
event to reflect the balance change (see "Safe Transfer Rules" section of the standard). After the above conditions are met, this function MUST check if _to
is a smart contract (e.g. code size > 0). If so, it MUST call onERC1155Received
on _to
and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address @param _to Target address @param _id ID of the token type @param _value Transfer amount @param _data Additional data with no specified format, MUST be sent unaltered in call to onERC1155Received
on _to
function safeBatchTransferFrom(address _from, address _to, uint256[] _ids, uint256[] _values, bytes _data) external
Transfers
_values
amount(s) of _ids
from the _from
address to the _to
address specified (with safety call). @dev Caller must be approved to manage the tokens being transferred out of the _from
account (see "Approval" section of the standard). MUST revert if _to
is the zero address. MUST revert if length of _ids
is not the same as length of _values
. MUST revert if any of the balance(s) of the holder(s) for token(s) in _ids
is lower than the respective amount(s) in _values
sent to the recipient. MUST revert on any other error.
MUST emit TransferSingle
or TransferBatch
event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard). Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc). After the above conditions for the transfer(s) in the batch are met, this function MUST check if _to
is a smart contract (e.g. code size > 0). If so, it MUST call the relevant ERC1155TokenReceiver
hook(s) on _to
and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address @param _to Target address @param _ids IDs of each token type (order and length must match _values array) @param _values Transfer amounts per token type (order and length must match _ids array) @param _data Additional data with no specified format, MUST be sent unaltered in call to the ERC1155TokenReceiver
hook(s) on _to
function transferToParent(address _from, address _toContract, uint256 _toTokenId, uint256 _id, uint256 _value) external
Transfer token from owner address to a token
Name | Type | Description |
---|---|---|
_from | address | The owner address |
_toContract | address | The ERC721 contract of the receiving token |
_toTokenId | uint256 | The receiving token |
_id | uint256 | ID of the token |
_value | uint256 | The amount of tokens to transfer |
function batchBatchTransferToParent(address _from, address _toContract, uint256[] _toTokenIds, uint256[][] _ids, uint256[][] _values) external
Transfer ERC1155 tokens from owner address to a set of parent ERC721 tokens
Name | Type | Description |
---|---|---|
_from | address | The owner address |
_toContract | address | The ERC721 contract of the receiving token //will be the same for all the tokenIDs |
_toTokenIds | uint256[] | IDs of the tokens receiving |
_ids | uint256[][] | IDs of the tokens to transfer |
_values | uint256[][] | The amounts of tokens to transfer |
function batchTransferToParent(address _from, address _toContract, uint256 _toTokenId, uint256[] _ids, uint256[] _values) public
Transfer ERC1155 tokens from owner address to a parent ERC721 token
Name | Type | Description |
---|---|---|
_from | address | The owner address |
_toContract | address | The ERC721 contract of the receiving token |
_toTokenId | uint256 | ID of the token receiving |
_ids | uint256[] | IDs of the tokens to transfer |
_values | uint256[] | The amounts of tokens to transfer |
function transferFromParent(address _fromContract, uint256 _fromTokenId, address _to, uint256 _id, uint256 _value) external
Transfer token from a token to an address
Name | Type | Description |
---|---|---|
_fromContract | address | The address of the owning contract |
_fromTokenId | uint256 | The owning token |
_to | address | The address the token is transferred to |
_id | uint256 | ID of the token |
_value | uint256 | The amount of tokens to transfer |
function batchTransferFromParent(address _fromContract, uint256 _fromTokenId, address _to, uint256[] _ids, uint256[] _values) external
Transfer tokens from a token to an address
Name | Type | Description |
---|---|---|
_fromContract | address | The address of the owning contract |
_fromTokenId | uint256 | The owning token |
_to | address | The address the token is transferred to |
_ids | uint256[] | IDs of the tokens to be transferred out |
_values | uint256[] | Values of the tokens to be transferred out |
function transferAsChild(address _fromContract, uint256 _fromTokenId, address _toContract, uint256 _toTokenId, uint256 _id, uint256 _value) external
Transfer item from an ERC721 parent token to another ERC721 parent token
Name | Type | Description |
---|---|---|
_fromContract | address | The ERC721 contract of the sending token |
_fromTokenId | uint256 | ID of the sending token |
_toContract | address | The ERC721 contract of the receiving token |
_toTokenId | uint256 | The ID of the receiving token |
_id | uint256 | |
_value | uint256 | The amount of tokens to transfer |
function batchTransferAsChild(address _fromContract, uint256 _fromTokenId, address _toContract, uint256 _toTokenId, uint256[] _ids, uint256[] _values) external
Transfer items from an ERC721 parent token to another ERC721 parent token
Name | Type | Description |
---|---|---|
_fromContract | address | The ERC721 contract of the sending token |
_fromTokenId | uint256 | ID of the sending token |
_toContract | address | The ERC721 contract of the receiving token |
_toTokenId | uint256 | |
_ids | uint256[] | The IDs of the tokens to send |
_values | uint256[] | The amounts of tokens to transfer |
function onERC1155Received(address, address, uint256, uint256, bytes) external pure returns (bytes4)
Handle the receipt of a single ERC1155 token type. @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a
safeTransferFrom
after the balance has been updated.
This function MUST return bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))
(i.e. 0xf23a6e61) if it accepts the transfer. This function MUST revert if it rejects the transfer. Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller. @return bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))
function onERC1155BatchReceived(address, address, uint256[], uint256[], bytes) external pure returns (bytes4)
Handle the receipt of multiple ERC1155 token types. @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a
safeBatchTransferFrom
after the balances have been updated.
This function MUST return bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))
(i.e. 0xbc197c81) if it accepts the transfer(s). This function MUST revert if it rejects the transfer(s). Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller. @return bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))
function extractItemsFromSacrificedGotchi(address _to, uint256 _tokenId, uint256[] _itemIds, uint256[] _values) external
Used to extract items that have been accidentally burned with Aavegotchis
function extractItemsFromDiamond(address _to, uint256[] _itemIds, uint256[] _values) external
Used to extract items that have been accidentally sent to the Diamond contract