JOYWORLD JOYtoys
About
Stats
Public Functions
44
Event Types
12
Code Size
75,799 bytes
Library Use
Uses SafeMath for uint256.
Events (12) keyboard_arrow_up
Functions
owner keyboard_arrow_up
transferOwnership keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
supportsInterface keyboard_arrow_up
balanceOf keyboard_arrow_up
Source Code
function balanceOf(address owner) public view override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _holderTokens[owner].length();
}
ownerOf keyboard_arrow_up
name keyboard_arrow_up
symbol keyboard_arrow_up
tokenURI keyboard_arrow_up
Requirements help
null
Source Code
function tokenURI(uint256 tokenId) public view override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
return string(abi.encodePacked(_baseURI, tokenId.toString()));
}
baseURI keyboard_arrow_up
tokenOfOwnerByIndex keyboard_arrow_up
totalSupply keyboard_arrow_up
tokenByIndex keyboard_arrow_up
approve keyboard_arrow_up
Requirements help
Source Code
function approve(address to, uint256 tokenId) public virtual override {
address owner = ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
getApproved keyboard_arrow_up
Requirements help
null
Source Code
function getApproved(uint256 tokenId) public view override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
setApprovalForAll keyboard_arrow_up
Requirements help
Source Code
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
isApprovedForAll keyboard_arrow_up
transferFrom keyboard_arrow_up
Requirements help
Source Code
function transferFrom(address from, address to, uint256 tokenId) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
safeTransferFrom keyboard_arrow_up
Requirements help
Source Code
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
safeTransferFrom keyboard_arrow_up
Requirements help
Source Code
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
createJOYtoy keyboard_arrow_up
Parameters help
Modifiers help
onlyOwner checks for the following:
Source Code
function createJOYtoy(string memory artworkHash, string memory artworkType, string memory power, string memory toyName, string memory feature, uint256 editionSize, bool vendingMachine, uint256 price, uint256 royalty) public onlyOwner {
toyMintingActive[JOYtoyIndex] = true;
JOYtoyArtwork[JOYtoyIndex][1] = artworkHash;
artworkTypeMemory[JOYtoyIndex][1] = artworkType;
powerMemory[JOYtoyIndex] = power;
toyNameMemory[JOYtoyIndex] = toyName;
featuresMemory[JOYtoyIndex] = feature;
editionSizeMemory[JOYtoyIndex] = editionSize;
totalCreated[JOYtoyIndex] = 0;
totalMinted[JOYtoyIndex] = 0;
artworkSlotFilled[JOYtoyIndex][1] = true;
vendingMachineMode[JOYtoyIndex] = vendingMachine;
priceMemory[JOYtoyIndex] = price;
royaltyMemory[JOYtoyIndex] = royalty;
emit NewJOYtoyCreated(artworkHash, artworkType, power, toyName, feature, editionSize, vendingMachine, price, royalty, JOYtoyIndex);
JOYtoyIndex = JOYtoyIndex + 1;
}
addJOYtoyRoyalties keyboard_arrow_up
Parameters help
Modifiers help
onlyOwner checks for the following:
Requirements help
Source Code
function addJOYtoyRoyalties(uint256 JOYtoyId, address[] memory royaltyAddresses, uint256[] memory royaltyPercentage, string memory collaboratorNames) public onlyOwner {
require(royaltyAddresses.length == royaltyPercentage.length);
require(royaltyAddresses.length <= 5);
uint256 totalCollaboratorRoyalties;
collaboratorNamesMemory[JOYtoyId] = collaboratorNames;
for(uint256 i=0; i<royaltyAddresses.length; i++){
royaltyAddressMemory[JOYtoyId][i] = royaltyAddresses[i];
royaltyPercentageMemory[JOYtoyId][i] = royaltyPercentage[i];
totalCollaboratorRoyalties = totalCollaboratorRoyalties + royaltyPercentage[i];
}
royaltyLengthMemory[JOYtoyId] = royaltyAddresses.length;
emit AddJOYtoyRoyalties(JOYtoyId, royaltyAddresses.length);
}
getRoyalties keyboard_arrow_up
Source Code
function getRoyalties(uint256 JOYtoyId) public view returns (address[5] memory addresses, uint256[5] memory percentages) {
for(uint256 i=0; i<royaltyLengthMemory[JOYtoyId]; i++){
addresses[i] = royaltyAddressMemory[JOYtoyId][i];
percentages[i] = royaltyPercentageMemory[JOYtoyId][i];
}
}
addJOYCollector keyboard_arrow_up
Parameters help
Modifiers help
onlyOwner checks for the following:
Source Code
function addJOYCollector(uint256 JOYtoyId, uint256 joyTokenId, uint256 joyCollectorPercent, bool collectorActive) public onlyOwner {
joyCollabTokenId[JOYtoyId] = joyTokenId;
joyHolderCollaborator[JOYtoyId] = originalJOYOwner(joyTokenId);
joyHolderCollabPercent[JOYtoyId] = joyCollectorPercent;
joyHolderCollabActive[JOYtoyId] = collectorActive;
emit AddJOYCollector(JOYtoyId, joyTokenId, joyCollectorPercent, collectorActive);
}
getJoyCollaborator keyboard_arrow_up
Source Code
function getJoyCollaborator(uint256 JOYtoyId) public view returns (uint256 joyTokenId, address joyTokenHolder, uint256 joyCollectorPercent, bool collectorActive) {
joyTokenId = joyCollabTokenId[JOYtoyId];
joyTokenHolder = joyHolderCollaborator[JOYtoyId];
joyCollectorPercent = joyHolderCollabPercent[JOYtoyId];
collectorActive = joyHolderCollabActive[JOYtoyId];
}
clearRoyalties keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function clearRoyalties(uint256 JOYtoyId) public onlyOwner {
for(uint256 i=0; i<royaltyLengthMemory[JOYtoyId]; i++){
royaltyAddressMemory[JOYtoyId][i] = 0x0000000000000000000000000000000000000000;
royaltyPercentageMemory[JOYtoyId][i] = 0;
}
collaboratorNamesMemory[JOYtoyId] = "";
royaltyLengthMemory[JOYtoyId] = 0;
emit ClearRoyalties(JOYtoyId);
}
addJOYtoyArtwork keyboard_arrow_up
Parameters help
Modifiers help
onlyOwner checks for the following:
Requirements help
Source Code
function addJOYtoyArtwork(uint256 JOYtoyToUpdate, string memory artworkHash, string memory artworkType, uint256 artworkIndex) public onlyOwner{
require(artworkSlotFilled[JOYtoyToUpdate][artworkIndex] == false);
JOYtoyArtwork[JOYtoyToUpdate][artworkIndex] = artworkHash;
artworkTypeMemory[JOYtoyToUpdate][artworkIndex] = artworkType;
artworkSlotFilled[JOYtoyToUpdate][artworkIndex] = true;
emit NewArtworkAdded(JOYtoyToUpdate, artworkHash, artworkType, artworkIndex);
}
updateFeature keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function updateFeature(uint256 JOYtoyToUpdate, string memory newFeatures) public onlyOwner{
featuresMemory[JOYtoyToUpdate] = newFeatures;
emit UpdateFeature(JOYtoyToUpdate, newFeatures);
}
updatePrice keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function updatePrice(uint256 JOYtoyToUpdate, uint256 price) public onlyOwner{
priceMemory[JOYtoyToUpdate] = price;
emit UpdatePrice(JOYtoyToUpdate, price/10**18);
}
mintJOYtoy keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Requirements help
totalMinted for JOYtoyId + amountToMint
must be less than or equal to
editionSizeMemory for JOYtoyId
Source Code
function mintJOYtoy(uint256 JOYtoyId, uint256 amountToMint) public onlyOwner {
require(toyMintingActive[JOYtoyId] == true);
require(totalMinted[JOYtoyId] + amountToMint <= editionSizeMemory[JOYtoyId]);
for(uint256 i=totalMinted[JOYtoyId]; i<amountToMint + totalMinted[JOYtoyId]; i++) {
uint256 tokenId = totalSupply() + 1;
artworkJOYtoyReference[tokenId] = JOYtoyId;
editionNumberMemory[tokenId] = i + 1;
_safeMint(msg.sender, tokenId);
}
totalMinted[JOYtoyId] = totalMinted[JOYtoyId] + amountToMint;
if (totalMinted[JOYtoyId] == editionSizeMemory[JOYtoyId]) {
closeJOYtoyWindow(JOYtoyId);
}
}
JOYtoyMachine keyboard_arrow_up
Requirements help
null
Source Code
function JOYtoyMachine(uint256 JOYtoyId) public payable {
require(toyMintingActive[JOYtoyId] == true);
require(totalMinted[JOYtoyId] + 1 <= editionSizeMemory[JOYtoyId]);
require(vendingMachineMode[JOYtoyId] == true);
require(msg.value == priceMemory[JOYtoyId]);
uint256 tokenId = totalSupply() + 1;
artworkJOYtoyReference[tokenId] = JOYtoyId;
editionNumberMemory[tokenId] = totalMinted[JOYtoyId] + 1;
(address[5] memory royaltyAddress, uint256[5] memory percentage) = getRoyalties(JOYtoyId);
for(uint256 i=0; i<royaltyLengthMemory[JOYtoyId]; i++){
address payable artistWallet = address(uint160(royaltyAddress[i]));
artistWallet.transfer(msg.value/100*percentage[i]);
}
if(joyHolderCollabActive[JOYtoyId] == true){
address payable joyHolder = address(uint160(joyHolderCollaborator[JOYtoyId]));
uint256 joyHolderPercentage = joyHolderCollabPercent[JOYtoyId];
joyHolder.transfer(msg.value/100*joyHolderPercentage);
}
joyWallet.transfer(address(this).balance);
_safeMint(msg.sender, tokenId);
totalMinted[JOYtoyId] = totalMinted[JOYtoyId] + 1;
if (totalMinted[JOYtoyId] == editionSizeMemory[JOYtoyId]) {
closeJOYtoyWindow(JOYtoyId);
}
}
closeJOYtoyWindow keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function closeJOYtoyWindow(uint256 JOYtoyId) public onlyOwner {
toyMintingActive[JOYtoyId] = false;
editionSizeMemory[JOYtoyId] = totalMinted[JOYtoyId];
emit CloseJOYtoyWindow(JOYtoyId);
}
withdrawFunds keyboard_arrow_up
getJOYtoyArtworkData keyboard_arrow_up
Source Code
function getJOYtoyArtworkData(uint256 JOYtoyId, uint256 index) public view returns (string memory artworkHash, string memory artworkType, uint256 unmintedEditions) {
artworkHash = JOYtoyArtwork[JOYtoyId][index];
artworkType = artworkTypeMemory[JOYtoyId][index];
unmintedEditions = editionSizeMemory[JOYtoyId] - totalMinted[JOYtoyId];
}
getMetadata keyboard_arrow_up
Requirements help
null
Source Code
function getMetadata(uint256 tokenId) public view returns (string memory toyName, string memory power, uint256 editionSize, uint256 editionNumber, bool vendingMachine, string memory feature, uint256 price, string memory collaborators, bool toyActive) {
require(_exists(tokenId), "Token does not exist.");
uint256 JOYtoyRef = artworkJOYtoyReference[tokenId];
toyName = toyNameMemory[JOYtoyRef];
power = powerMemory[JOYtoyRef];
editionSize = editionSizeMemory[JOYtoyRef];
editionNumber = editionNumberMemory[tokenId];
vendingMachine = vendingMachineMode[JOYtoyRef];
feature = featuresMemory[JOYtoyRef];
price = priceMemory[JOYtoyRef];
collaborators = collaboratorNamesMemory[JOYtoyRef];
toyActive = toyMintingActive[JOYtoyRef];
}
getRoyaltyData keyboard_arrow_up
Requirements help
null
Source Code
function getRoyaltyData(uint256 tokenId) public view returns (address artistAddress, uint256 royaltyFeeById) {
require(_exists(tokenId), "Token does not exist.");
uint256 JOYtoyRef = artworkJOYtoyReference[tokenId];
artistAddress = joyWallet;
royaltyFeeById = royaltyMemory[JOYtoyRef];
}
getArtworkData keyboard_arrow_up
Requirements help
null
Source Code
function getArtworkData(uint256 tokenId, uint256 index) public view returns (string memory artworkHash, string memory artworkType) {
require(_exists(tokenId), "Token does not exist.");
uint256 JOYtoyRef = artworkJOYtoyReference[tokenId];
artworkHash = JOYtoyArtwork[JOYtoyRef][index];
artworkType = artworkTypeMemory[JOYtoyRef][index];
}
updateGalleryLink keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function updateGalleryLink(string memory newURL) public onlyOwner {
joyGalleryLink = newURL;
}
updatePaymentWallet keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function updatePaymentWallet(address payable newWallet) public onlyOwner {
joyWallet = newWallet;
}
updateURI keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function updateURI(string memory newURI) public onlyOwner {
_setBaseURI(newURI);
}
updateJOYtoyURI keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function updateJOYtoyURI(string memory newURI1, string memory newURI2) public onlyOwner {
JOYtoyURI1 = newURI1;
JOYtoyURI2 = newURI2;
}
JOYtoyURI keyboard_arrow_up
Requirements help
null
Source Code
function JOYtoyURI(uint256 tokenId, uint256 artworkIndex) external view returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
return string(abi.encodePacked(JOYtoyURI1, integerToString(tokenId), JOYtoyURI2, integerToString(artworkIndex)));
}
originalJOYOwner keyboard_arrow_up
updateArtworkTypeList keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function updateArtworkTypeList(string memory newArtworkTypeList) public onlyOwner {
artworkTypeList = newArtworkTypeList;
}
updateJOYContractAddress keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function updateJOYContractAddress(address newJOYaddress) public onlyOwner {
joyContractAddress = newJOYaddress;
joyWorld = JOYContract(joyContractAddress);
}