Wrapped Gods Unchained card:
name -> Gods Unchained Cards item symbol -> iCARDWrapped CryptoKitties:
name -> CryptoKitties item symbol -> iCK
Wrapping 1 Bored Ape (which has no decimals) becomes 1000000000000000000 (1e18) wrapped Item Bored Ape.
1e18-Wrapped Item total supply
Unwrap:1) 721 wrapped: Bored Ape id 1122Bored Ape (id 1122) Wrapped Item totalSupply: 1e18A wrapped Bored Ape Item holder can unwrap the Bored Ape (id 1122) burning at least 0.51e18 Bored Ape wrapped Items2)721 wrapped: Bored Ape id 2233 unreservedBored Ape (id 2233) Wrapped Item totalSupply: 0.8e18A wrapped Bored Ape Item holder can unwrap the Bored Ape (id 2233) burning at least 0.51e18 Bored Ape wrapped ItemsRewrap:1)Bored Ape (id 1122) Wrapped Item totalSupply: 0.3e18When someone wrap again the Bored Ape (id 1122) he obtains 0.7e18 Bored Ape Wrapped Item2)Bored Ape (id 2233) Wrapped Item totalSupply: 0When someone wrap again the Bored Ape (id 2233) he obtains 1e18 Bored Ape Wrapped Item
transferFrom/safeTransferFrom
function in order to wrap the token in a Wrapped ItemtransferFrom/safeTransferFrom/transfer
function in order to unwrap the Wrapped Item and get back the original 721 tokenmintItems
function -> only for tokens that have transferFrom
onERC721Received
using the safeTransferFrom
mintItems
function, the 721 token must have the transferFrom
function. If the 721 token does not have transferFrom
you can still wrap it by sending it with safeTransferFrom
and so using the onERC721Received
.struct
CreateItem
-> data for wrapping the ERC721CreateItem
must be passed as follows: struct
Header
-> composed of address
host
, string
name
, string
symbol
and string
uri
pass empty. These parameters are automatically populated by the contract. Look here for more infobytes32
collection
-> encoded ERC721 address of the token being wrappeduint256
id
-> id of original 721 token you're wrappingaddress[]
accounts
-> address receiver of the Wrapped Item.uint256[]
amounts
-> amounts being wrappedamounts[]
array can specify the different amounts of the created wrapped Item to send to the receivers' addresses represented by the accounts[]
array. Each position of the amounts
array corresponds to the respective position of the accounts
array and so the amounts[]
and accounts[]
arrays must have the same length. If an address in the accounts[]
is passed as address(0)
, it automatically corresponds to the msg.sender
address. amount
(s) value(s) must be expressed in 18 decimals. It must be 1e18 if the current Wrapped Item totalSupply is 0, otherwise it must be 1e18-Wrapped Item total supply
.mintItems
functions, different ERC721 tokens can be wrapped in a single transaction since you can pass multiple CreateItem
structs.safeTransferFrom
sending the token to the Wrapper ERC721 contract invoking the onERC721Received
function. data
parameter of the safeTransferFrom
function must contain an encoded value that represents two parameters:Uint256[] values
Address[] receivers
values[]
array can specify different amounts of the created Item, with each amount to be sent to the receiver addresses in the accounts[]
array; the positions of the amount and the receiver address must correspond.values
and receivers
work in the same way of amounts
and accounts
parameters of the mintItems function.burn
function can be used to burn a wrapped ERC821 Item amount and retrieve the relative amount of the original ERC721.address
account
-> represents the address that holds the Item to burn. The address account can correspond to the msg.sender
or not if the burn
function is called from an approved operator
address.uint256
itemId
-> represents the id of the wrapped Item to burnuint256
amount
->represents the wrapped Item amount to burnbytes
data
-> it is an encoded value and represents six parameters: tokenAddress
, the address of the original ERC721 token to get backtokenId
, the id of the original ERC721 token to get backreceiver
, the address that will receive the original ERC721 after the burn. Pass address(0)
to set receiver as msg.sender
. It can even be an address different from the msg.sender
payload
, an optional payload that can be executed with the safeTransferFrom functionsafe
, a boolean value that represents whether safeTransferFrom will be executed (true) or transferFrom/transfer will be executed (false) withData
, a boolean value that represents whether safeTransferFrom will be executed with the additional payload (true) or without one (false). If safe is false, transferFrom without a payload will be executed, regardless of how withData is populated.burnBatch
function can be used to burn multiple wrapped ERC721 Items amounts and retrieve the relative amounts of the original ERC721 tokens.uint256[]
itemId
and uint256[]
amount
-> are arrays of values since you can unwrap multiple tokens at oncebytes
data
->The data
parameter in bytes format is an encoded value and represents a bytes[]
(one for each Item involved in the operation) containing the six parameters explained above in the burn section.