Blockwell

JOYWORLD JOYtoys

About

Stats

Public Functions 44
Event Types 12
Code Size 75,799 bytes

Library Use

Uses SafeMath for uint256.

AddJOYCollector Event

Parameters help
JOYtoyId
uint256 help
joyTokenId
uint256 help
joyCollectorPercent
uint256 help
collectorActive
bool help

AddJOYtoyRoyalties Event

Parameters help
JOYtoyId
uint256 help
count
uint256 help

Approval Event

Parameters help
owner
address help
approved
address help
tokenId
uint256 help

ApprovalForAll Event

Parameters help
owner
address help
operator
address help
approved
bool help

ClearRoyalties Event

Parameters help
JOYtoyId
uint256 help

CloseJOYtoyWindow Event

Parameters help
JOYtoyId
uint256 help

NewArtworkAdded Event

Parameters help
JOYtoyToUpdate
uint256 help
artworkHash
string help
artworkType
string help
artworkIndex
uint256 help

NewJOYtoyCreated Event

Parameters help
artworkHash
string help
artworkType
string help
power
string help
toyName
string help
feature
string help
editionSize
uint256 help
vendingMachine
bool help
price
uint256 help
royalty
uint256 help
JOYtoyIndex
uint256 help

OwnershipTransferred Event

Parameters help
previousOwner
address help
newOwner
address help

Transfer Event

Parameters help
from
address help
to
address help
tokenId
uint256 help

UpdateFeature Event

Parameters help
JOYtoyToUpdate
uint256 help
newFeatures
string help

UpdatePrice Event

Parameters help
JOYtoyToUpdate
uint256 help
price
uint256 help

Functions Expand All Collapse All

owner keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
    function owner() public view returns (address) {
        return _owner;
    }

transferOwnership keyboard_arrow_up

Parameters help

Name Type
newOwner
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

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

Parameters help

Name Type
interfaceId
bytes4 help

Properties

Visibility help public
Mutability help view
Source Code
    function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
        return _supportedInterfaces[interfaceId];
    }

balanceOf keyboard_arrow_up

Parameters help

Name Type
owner
address help

Properties

Visibility help public
Mutability help view

Requirements help

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

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
    function ownerOf(uint256 tokenId) public view override returns (address) {
        return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
    }

name keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
    function name() public view override returns (string memory) {
        return _name;
    }

symbol keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
    function symbol() public view override returns (string memory) {
        return _symbol;
    }

tokenURI keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view

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

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
    function baseURI() public view returns (string memory) {
        return _baseURI;
    }

tokenOfOwnerByIndex keyboard_arrow_up

Parameters help

Name Type
owner
address help
index
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
    function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) {
        return _holderTokens[owner].at(index);
    }

totalSupply keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
    function totalSupply() public view override returns (uint256) {
        // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
        return _tokenOwners.length();
    }

tokenByIndex keyboard_arrow_up

Parameters help

Name Type
index
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
    function tokenByIndex(uint256 index) public view override returns (uint256) {
        (uint256 tokenId, ) = _tokenOwners.at(index);
        return tokenId;
    }

approve keyboard_arrow_up

Parameters help

Name Type
to
address help
tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
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

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view

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

Parameters help

Name Type
operator
address help
approved
bool help

Properties

Visibility help public
Mutability help transaction

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

Parameters help

Name Type
owner
address help
operator
address help

Properties

Visibility help public
Mutability help view
Source Code
    function isApprovedForAll(address owner, address operator) public view override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

transferFrom keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
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

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

safeTransferFrom keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
tokenId
uint256 help
_data
bytes help

Properties

Visibility help public
Mutability help transaction
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

Name Type
artworkHash
string help
artworkType
string help
power
string help
toyName
string help
feature
string help
editionSize
uint256 help
vendingMachine
bool help
price
uint256 help
royalty
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

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

Name Type
JOYtoyId
uint256 help
royaltyAddresses
address[] help
royaltyPercentage
uint256[] help
collaboratorNames
string help

Properties

Visibility help public
Mutability help transaction

Modifiers 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

Parameters help

Name Type
JOYtoyId
uint256 help

Properties

Visibility help public
Mutability help view
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

Name Type
JOYtoyId
uint256 help
joyTokenId
uint256 help
joyCollectorPercent
uint256 help
collectorActive
bool help

Properties

Visibility help public
Mutability help transaction

Modifiers help

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

Parameters help

Name Type
JOYtoyId
uint256 help

Properties

Visibility help public
Mutability help view
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

Parameters help

Name Type
JOYtoyId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

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

Name Type
JOYtoyToUpdate
uint256 help
artworkHash
string help
artworkType
string help
artworkIndex
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers 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

Parameters help

Name Type
JOYtoyToUpdate
uint256 help
newFeatures
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function updateFeature(uint256 JOYtoyToUpdate, string memory newFeatures) public onlyOwner{
        featuresMemory[JOYtoyToUpdate] = newFeatures; 
        
        emit UpdateFeature(JOYtoyToUpdate, newFeatures);
    }

updatePrice keyboard_arrow_up

Parameters help

Name Type
JOYtoyToUpdate
uint256 help
price
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function updatePrice(uint256 JOYtoyToUpdate, uint256 price) public onlyOwner{
        priceMemory[JOYtoyToUpdate] = price;
        
        emit UpdatePrice(JOYtoyToUpdate, price/10**18);
    }

mintJOYtoy keyboard_arrow_up

Parameters help

Name Type
JOYtoyId
uint256 help
amountToMint
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

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

Parameters help

Name Type
JOYtoyId
uint256 help

Properties

Visibility help public
Mutability help payable

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

Parameters help

Name Type
JOYtoyId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function closeJOYtoyWindow(uint256 JOYtoyId) public onlyOwner {
        toyMintingActive[JOYtoyId] = false;
        editionSizeMemory[JOYtoyId] = totalMinted[JOYtoyId];
        
        emit CloseJOYtoyWindow(JOYtoyId); 
    }

withdrawFunds keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function withdrawFunds() public onlyOwner {
        msg.sender.transfer(address(this).balance);
    }

getJOYtoyArtworkData keyboard_arrow_up

Parameters help

Name Type
JOYtoyId
uint256 help
index
uint256 help

Properties

Visibility help public
Mutability help view
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

getRoyaltyData keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view

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

Parameters help

Name Type
tokenId
uint256 help
index
uint256 help

Properties

Visibility help public
Mutability help view

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

updatePaymentWallet keyboard_arrow_up

Parameters help

Name Type
newWallet
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function updatePaymentWallet(address payable newWallet) public onlyOwner {
        joyWallet = newWallet;
    }

updateURI keyboard_arrow_up

Parameters help

Name Type
newURI
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function updateURI(string memory newURI) public onlyOwner {
        _setBaseURI(newURI);
    }

updateJOYtoyURI keyboard_arrow_up

Parameters help

Name Type
newURI1
string help
newURI2
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function updateJOYtoyURI(string memory newURI1, string memory newURI2) public onlyOwner {
        JOYtoyURI1 = newURI1;
        JOYtoyURI2 = newURI2;
    }

JOYtoyURI keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help
artworkIndex
uint256 help

Properties

Visibility help public
Mutability help view

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

Parameters help

Name Type
joyTokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
    function originalJOYOwner(uint256 joyTokenId) public view returns (address ownerOfJOY) {
        ownerOfJOY = joyWorld.ownerOf(joyTokenId);        
    }

updateArtworkTypeList keyboard_arrow_up

Parameters help

Name Type
newArtworkTypeList
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function updateArtworkTypeList(string memory newArtworkTypeList) public onlyOwner {
        artworkTypeList = newArtworkTypeList; 
    }

updateJOYContractAddress keyboard_arrow_up

Parameters help

Name Type
newJOYaddress
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function updateJOYContractAddress(address newJOYaddress) public onlyOwner {
        joyContractAddress = newJOYaddress;
        joyWorld = JOYContract(joyContractAddress);
    }