Blockwell

VNFT

About

Stats

Public Functions 63
Event Types 18
Code Size 169,167 bytes

Library Use

Uses Counters for Counters.Counter.

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

BurnPercentageChanged Event

Parameters help
percentage
uint256 help

CareTakerAdded Event

Parameters help
nftId
uint256 help
_to
address help

CareTakerRemoved Event

Parameters help
nftId
uint256 help

ClaimedMiningRewards Event

Parameters help
who
uint256 help
owner
address help
amount
uint256 help

ItemCreated Event

Parameters help
id
uint256 help
name
string help
price
uint256 help
points
uint256 help

LifeGiven Event

Parameters help
forSupportedNFT
address help
id
uint256 help

OwnershipTransferred Event

Parameters help
previousOwner
address help
newOwner
address help

Paused Event

Parameters help
account
address help

RoleGranted Event

Parameters help
role
bytes32 help
account
address help
sender
address help

RoleRevoked Event

Parameters help
role
bytes32 help
account
address help
sender
address help

Transfer Event

Parameters help
from
address help
to
address help
tokenId
uint256 help

Unpaused Event

Parameters help
account
address help

Unwrapped Event

Parameters help
nftId
uint256 help

VnftConsumed Event

Parameters help
nftId
uint256 help
giver
address help
itemId
uint256 help

VnftFatalized Event

Parameters help
nftId
uint256 help
killer
address help

VnftMinted Event

Parameters help
to
address help

VNFTObj Event

Members
token
address help
id
uint256 help
standard
uint256 help

NFTInfo Event

Members
token
address help
active
bool help
standard
uint256 help

Functions Expand All Collapse All

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];
    }

onERC1155Received keyboard_arrow_up

Parameters help

Name Type
address help
address help
uint256 help
uint256 help
bytes help

Properties

Visibility help public
Mutability help transaction
Source Code
    function onERC1155Received(address, address, uint256, uint256, bytes memory) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

onERC1155BatchReceived keyboard_arrow_up

Parameters help

Name Type
address help
address help
uint256[] help
uint256[] help
bytes help

Properties

Visibility help public
Mutability help transaction
Source Code
    function onERC1155BatchReceived(address, address, uint256[] memory, uint256[] memory, bytes memory) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }

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;
    }

renounceOwnership keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

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;
    }

recoverERC20 keyboard_arrow_up

Parameters help

Name Type
tokenAddress
address help
tokenAmount
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function recoverERC20(address tokenAddress, uint256 tokenAmount)
        public
        onlyOwner
    {
        IERC20(tokenAddress).transfer(owner(), tokenAmount);
    }

paused keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
    function paused() public view returns (bool) {
        return _paused;
    }

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");

        string memory _tokenURI = _tokenURIs[tokenId];

        // If there is no base URI, return the token URI.
        if (bytes(_baseURI).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(_baseURI, _tokenURI));
        }
        // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
        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);
    }

burn keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
    function burn(uint256 tokenId) public virtual {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
        _burn(tokenId);
    }

hasRole keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help
account
address help

Properties

Visibility help public
Mutability help view
Source Code
    function hasRole(bytes32 role, address account) public view returns (bool) {
        return _roles[role].members.contains(account);
    }

getRoleMemberCount keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help

Properties

Visibility help public
Mutability help view
Source Code
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

getRoleMember keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help
index
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
    function getRoleMember(bytes32 role, uint256 index)
        public
        view
        returns (address)
    {
        return _roles[role].members.at(index);
    }

getRoleAdmin keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help

Properties

Visibility help public
Mutability help view
Source Code
    function getRoleAdmin(bytes32 role) public view returns (bytes32) {
        return _roles[role].adminRole;
    }

grantRole keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help
account
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
    function grantRole(bytes32 role, address account) public virtual {
        require(
            hasRole(_roles[role].adminRole, _msgSender()),
            "AccessControl: sender must be an admin to grant"
        );

        _grantRole(role, account);
    }

revokeRole keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help
account
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
    function revokeRole(bytes32 role, address account) public virtual {
        require(
            hasRole(_roles[role].adminRole, _msgSender()),
            "AccessControl: sender must be an admin to revoke"
        );

        _revokeRole(role, account);
    }

renounceRole keyboard_arrow_up

Parameters help

Name Type
role
bytes32 help
account
address help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
    function renounceRole(bytes32 role, address account) public virtual {
        require(
            account == _msgSender(),
            "AccessControl: can only renounce roles for self"
        );

        _revokeRole(role, account);
    }

mint keyboard_arrow_up

Parameters help

Name Type
player
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyMinter checks for the following:
null
Source Code
    function mint(address player) public override onlyMinter {
        //pet minted has 3 days until it starves at first
        timeUntilStarving[_tokenIds.current()] = block.timestamp.add(3 days);
        timeVnftBorn[_tokenIds.current()] = block.timestamp;

        vnftDetails[_tokenIds.current()] = VNFTObj(
            address(this),
            _tokenIds.current(),
            721
        );
        super._mint(player, _tokenIds.current());
        _tokenIds.increment();
        emit VnftMinted(msg.sender);
    }

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
    function pause() public virtual {
        require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to pause");
        _pause();
    }

unpause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Requirements help

null
Source Code
    function unpause() public virtual {
        require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to unpause");
        _unpause();
    }

contractURI keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help pure
Source Code
    function contractURI() public pure returns (string memory) {
        return "https://gallery.verynifty.io/api";
    }

pauseGame keyboard_arrow_up

Parameters help

Name Type
_pause
bool help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
    function pauseGame(bool _pause) external onlyOperator {
        gameStopped = _pause;
    }

changeBurnPercentage keyboard_arrow_up

Parameters help

Name Type
percentage
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null

Requirements help

Source Code
    function changeBurnPercentage(uint256 percentage) external onlyOperator {
        require(percentage <= 100);
        burnPercentage = burnPercentage;
        emit BurnPercentageChanged(burnPercentage);
    }

changeGiveLifePrice keyboard_arrow_up

Parameters help

Name Type
_newPrice
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
    function changeGiveLifePrice(uint256 _newPrice) external onlyOperator {
        giveLifePrice = _newPrice * 10**18;
    }

changeMaxDevAllocation keyboard_arrow_up

Parameters help

Name Type
amount
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
    function changeMaxDevAllocation(uint256 amount) external onlyOperator {
        maxDevAllocation = amount;
    }

itemExists keyboard_arrow_up

Parameters help

Name Type
itemId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
    function itemExists(uint256 itemId) public view returns (bool) {
        if (bytes(itemName[itemId]).length > 0) {
            return true;
        }
    }

isVnftAlive keyboard_arrow_up

Parameters help

Name Type
_nftId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
    function isVnftAlive(uint256 _nftId) public view returns (bool) {
        uint256 _timeUntilStarving = timeUntilStarving[_nftId];
        if (_timeUntilStarving != 0 && _timeUntilStarving >= block.timestamp) {
            return true;
        }
    }

getVnftScore keyboard_arrow_up

Parameters help

Name Type
_nftId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
    function getVnftScore(uint256 _nftId) public view returns (uint256) {
        return vnftScore[_nftId];
    }

getItemInfo keyboard_arrow_up

Parameters help

Name Type
_itemId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
    function getItemInfo(uint256 _itemId)
        public
        view
        returns (
            string memory _name,
            uint256 _price,
            uint256 _points,
            uint256 _timeExtension
        )
    {
        _name = itemName[_itemId];
        _price = itemPrice[_itemId];
        _timeExtension = itemTimeExtension[_itemId];
        _points = itemPoints[_itemId];
    }

getVnftInfo keyboard_arrow_up

Parameters help

Name Type
_nftId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
    function getVnftInfo(uint256 _nftId)
        public
        view
        returns (
            uint256 _vNFT,
            bool _isAlive,
            uint256 _score,
            uint256 _level,
            uint256 _expectedReward,
            uint256 _timeUntilStarving,
            uint256 _lastTimeMined,
            uint256 _timeVnftBorn,
            address _owner,
            address _token,
            uint256 _tokenId,
            uint256 _fatalityReward
        )
    {
        _vNFT = _nftId;
        _isAlive = this.isVnftAlive(_nftId);
        _score = this.getVnftScore(_nftId);
        _level = this.level(_nftId);
        _expectedReward = this.getRewards(_nftId);
        _timeUntilStarving = timeUntilStarving[_nftId];
        _lastTimeMined = lastTimeMined[_nftId];
        _timeVnftBorn = timeVnftBorn[_nftId];
        _owner = this.ownerOf(_nftId);
        _token = vnftDetails[_nftId].token;
        _tokenId = vnftDetails[_nftId].id;
        _fatalityReward = getFatalityReward(_nftId);
    }

editCurves keyboard_arrow_up

Parameters help

Name Type
_la
uint256 help
_lb
uint256 help
_ra
uint256 help
_rb
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
    function editCurves(
        uint256 _la,
        uint256 _lb,
        uint256 _ra,
        uint256 _rb
    ) external onlyOperator {
        la = _la;
        lb = _lb;
        ra = _ra;
        lb = _rb;
    }

level keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
    function level(uint256 tokenId) external view returns (uint256) {
        // This is the formula L(x) = 2 * sqrt(x * 2)
        uint256 _score = vnftScore[tokenId].div(100);
        if (_score == 0) {
            return 1;
        }
        uint256 _level = sqrtu(_score.mul(la));
        return (_level.mul(lb));
    }

getRewards keyboard_arrow_up

Parameters help

Name Type
tokenId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
    function getRewards(uint256 tokenId) external view returns (uint256) {
        // This is the formula to get token rewards R(level)=(level)*6/7+6
        uint256 _level = this.level(tokenId);
        if (_level == 1) {
            return 6 ether;
        }
        _level = _level.mul(1 ether).mul(ra).div(rb);
        return (_level.add(5 ether));
    }

editItem keyboard_arrow_up

Parameters help

Name Type
_id
uint256 help
_price
uint256 help
_points
uint256 help
_name
string help
_timeExtension
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
    function editItem(
        uint256 _id,
        uint256 _price,
        uint256 _points,
        string calldata _name,
        uint256 _timeExtension
    ) external onlyOperator {
        itemPrice[_id] = _price;
        itemPoints[_id] = _points;
        itemName[_id] = _name;
        itemTimeExtension[_id] = _timeExtension;
    }

claimMiningRewards keyboard_arrow_up

Parameters help

Name Type
nftId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

null
Source Code
    function claimMiningRewards(uint256 nftId) external notPaused {
        require(isVnftAlive(nftId), "Your vNFT is dead, you can't mine");
        require(
            block.timestamp >= lastTimeMined[nftId].add(1 days) ||
                lastTimeMined[nftId] == 0,
            "Current timestamp is over the limit to claim the tokens"
        );
        require(
            ownerOf(nftId) == msg.sender ||
                careTaker[nftId][ownerOf(nftId)] == msg.sender,
            "You must own the vNFT to claim rewards"
        );

        //reset last start mined so can't remine and cheat
        lastTimeMined[nftId] = block.timestamp;
        uint256 _reward = this.getRewards(nftId);
        muse.mint(msg.sender, _reward);
        emit ClaimedMiningRewards(nftId, msg.sender, _reward);
    }

buyAccesory keyboard_arrow_up

Parameters help

Name Type
nftId
uint256 help
itemId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function buyAccesory(uint256 nftId, uint256 itemId) external notPaused {
        require(itemExists(itemId), "This item doesn't exist");
        uint256 amount = itemPrice[itemId];
        require(
            ownerOf(nftId) == msg.sender ||
                careTaker[nftId][ownerOf(nftId)] == msg.sender,
            "You must own the vNFT or be a care taker to buy items"
        );
        // require(isVnftAlive(nftId), "Your vNFT is dead");
        uint256 amountToBurn = amount.mul(burnPercentage).div(100);

        if (!isVnftAlive(nftId)) {
            vnftScore[nftId] = itemPoints[itemId];
            timeUntilStarving[nftId] = block.timestamp.add(
                itemTimeExtension[itemId]
            );
        } else {
            //recalculate timeUntilStarving.
            timeUntilStarving[nftId] = block.timestamp.add(
                itemTimeExtension[itemId]
            );
            vnftScore[nftId] = vnftScore[nftId].add(itemPoints[itemId]);
        }
        // burn 90% so they go back to community mining and staking, and send 10% to devs

        if (devAllocation <= maxDevAllocation) {
            devAllocation = devAllocation.add(amount.sub(amountToBurn));
            muse.transferFrom(msg.sender, address(this), amount);
            // burn 90% of token, 10% stay for dev and community fund
            muse.burn(amountToBurn);
        } else {
            muse.burnFrom(msg.sender, amount);
        }
        emit VnftConsumed(nftId, msg.sender, itemId);
    }

setBaseURI keyboard_arrow_up

Parameters help

Name Type
baseURI_
string help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
    function setBaseURI(string memory baseURI_) public onlyOperator {
        _setBaseURI(baseURI_);
    }

fatality keyboard_arrow_up

Parameters help

Name Type
_deadId
uint256 help
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
    function fatality(uint256 _deadId, uint256 _tokenId) external notPaused {
        require(
            !isVnftAlive(_deadId),
            "The vNFT has to be starved to claim his points"
        );
        vnftScore[_tokenId] = vnftScore[_tokenId].add(
            (vnftScore[_deadId].mul(60).div(100))
        );
        // delete vnftDetails[_deadId];
        _burn(_deadId);
        emit VnftFatalized(_deadId, msg.sender);
    }

getFatalityReward keyboard_arrow_up

Parameters help

Name Type
_deadId
uint256 help

Properties

Visibility help public
Mutability help view
Source Code
    function getFatalityReward(uint256 _deadId) public view returns (uint256) {
        if (isVnftAlive(_deadId)) {
            return 0;
        } else {
            return (vnftScore[_deadId].mul(60).div(100));
        }
    }

createItem keyboard_arrow_up

Parameters help

Name Type
name
string help
price
uint256 help
points
uint256 help
timeExtension
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
    function createItem(
        string calldata name,
        uint256 price,
        uint256 points,
        uint256 timeExtension
    ) external onlyOperator returns (bool) {
        _itemIds.increment();
        uint256 newItemId = _itemIds.current();
        itemName[newItemId] = name;
        itemPrice[newItemId] = price * 10**18;
        itemPoints[newItemId] = points;
        itemTimeExtension[newItemId] = timeExtension;
        emit ItemCreated(newItemId, name, price, points);
    }

addNft keyboard_arrow_up

Parameters help

Name Type
_nftToken
address help
_type
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
    function addNft(address _nftToken, uint256 _type) public onlyOperator {
        supportedNfts.push(
            NFTInfo({token: _nftToken, active: true, standard: _type})
        );
    }

supportedNftLength keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help view
Source Code
    function supportedNftLength() external view returns (uint256) {
        return supportedNfts.length;
    }

updateSupportedNFT keyboard_arrow_up

Parameters help

Name Type
index
uint256 help
_active
bool help
_address
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
    function updateSupportedNFT(
        uint256 index,
        bool _active,
        address _address
    ) public onlyOperator {
        supportedNfts[index].active = _active;
        supportedNfts[index].token = _address;
    }

giveLife keyboard_arrow_up

Parameters help

Name Type
index
uint256 help
_id
uint256 help
nftType
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function giveLife(
        uint256 index,
        uint256 _id,
        uint256 nftType
    ) external notPaused {
        uint256 amountToBurn = giveLifePrice.mul(burnPercentage).div(100);

        if (devAllocation <= maxDevAllocation) {
            devAllocation = devAllocation.add(giveLifePrice.sub(amountToBurn));
            muse.transferFrom(msg.sender, address(this), giveLifePrice);
            // burn 90% of token, 10% stay for dev and community fund
            muse.burn(amountToBurn);
        } else {
            muse.burnFrom(msg.sender, giveLifePrice);
        }

        if (nftType == 721) {
            IERC721(supportedNfts[index].token).transferFrom(
                msg.sender,
                address(this),
                _id
            );
        } else if (nftType == 1155) {
            IERC1155(supportedNfts[index].token).safeTransferFrom(
                msg.sender,
                address(this),
                _id,
                1, //the amount of tokens to transfer which always be 1
                "0x0"
            );
        }

        // mint a vNFT
        vnftDetails[_tokenIds.current()] = VNFTObj(
            supportedNfts[index].token,
            _id,
            nftType
        );

        timeUntilStarving[_tokenIds.current()] = block.timestamp.add(3 days);
        timeVnftBorn[_tokenIds.current()] = block.timestamp;

        super._mint(msg.sender, _tokenIds.current());
        _tokenIds.increment();
        emit LifeGiven(supportedNfts[index].token, _id);
    }

unwrap keyboard_arrow_up

Parameters help

Name Type
_vnftId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function unwrap(uint256 _vnftId) external {
        require(isVnftAlive(_vnftId), "Your vNFT is dead, you can't unwrap it");
        transferFrom(msg.sender, address(this), _vnftId);
        VNFTObj memory details = vnftDetails[_vnftId];
        timeUntilStarving[_vnftId] = 1;
        vnftScore[_vnftId] = 0;
        emit Unwrapped(_vnftId);
        _withdraw(details.id, details.token, msg.sender, details.standard);
    }

withdraw keyboard_arrow_up

Parameters help

Name Type
_id
uint256 help
_contractAddr
address help
_to
address help
_type
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

onlyOperator checks for the following:
null
Source Code
    function withdraw(
        uint256 _id,
        address _contractAddr,
        address _to,
        uint256 _type
    ) external onlyOperator {
        _withdraw(_id, _contractAddr, _to, _type);
    }

addCareTaker keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help
_careTaker
address help

Properties

Visibility help public
Mutability help transaction
Source Code
    function addCareTaker(uint256 _tokenId, address _careTaker) external {
        require(
            hasRole(OPERATOR_ROLE, _msgSender()) ||
                ownerOf(_tokenId) == msg.sender,
            "Roles: caller does not have the OPERATOR role"
        );
        careTaker[_tokenId][msg.sender] = _careTaker;
        emit CareTakerAdded(_tokenId, _careTaker);
    }

clearCareTaker keyboard_arrow_up

Parameters help

Name Type
_tokenId
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function clearCareTaker(uint256 _tokenId) external {
        require(
            hasRole(OPERATOR_ROLE, _msgSender()) ||
                ownerOf(_tokenId) == msg.sender,
            "Roles: caller does not have the OPERATOR role"
        );
        delete careTaker[_tokenId][msg.sender];
        emit CareTakerRemoved(_tokenId);
    }