Which Token Symbol to use in Token contract? ("MorarableToken" = "MORA")

Hi!
Regarding the tutorial “I Cloned Rarible In 24H”, in contract MorarableToken.sol, the ERC721 contract states this:
constructor () ERC721("MorarableToken", "MORA"){}

I would like to know if i can use any symbol i want ? Or do the token symbol must be compliant to the blockchain/currency it is deployed to? If i deploy the contract on Avalanche (even Fuji testnet), can i use “MORA” there or maybe “AVAX” ?

Thank you for your info…

I think that you can use any name that you want there

Thank you.
Are you sure? Because, for example, my NFT Marketplace works great (I think)… the only thing is that when i have an NFT costing 99 “MORA”, when my metamask pops up, i only see gas costs. Never a “99” anywhere or any other price for NFTs. Only gas costs. But maybe beause my smartcontracts is setup for wei price ?

Hmmmm I don’t think it’ll necessarily appear in Metamask unless you’re making a transfer directly from your wallet :thinking: but try to check whether your 99 MORA really get transfered

1 Like

you will not see that amount of ERC20 tokens in metamask, that is because first you do an approve and then the smart contract on execution will transfer those tokens, and based on the code it can also transfer a different number of tokens

1 Like

Wow! But is it not scary for normal users to not see any price displayed in Metamask? The user could think about a scam.
So, if i understand, i have to modify my smartcontract to make it displayed in Metamask. I’m going to see if i can find some info on it.

Other question:
how does it work with commissions/fees for the marketplace owner ? Because so far, this has not been explained in tuto “Cloned Rarible 24H”.
Should the commission be in the smarcontract or can i do it on the frontend?

I don’t think that you can modify the smart contract to show, first step will be for the user to approve the spending of x tokens, that part is where the user knows for how much it approved, and after that it will call a contract function again and that contract function will be able to transfer those x tokens or less than x tokens but not more

I think that the commission should be a variable in the smart contract

1 Like

OK for Question 1!

For Question 2 (commission while minting and/or reselling) :
In the smartcontract, then i think i can manipulate the data related to “askingPrice” :
itemsForSale[id].seller.transfer(msg.value);

… and call 2 money transfers, right? So when the buyer buys “100” AVAX, for i.e., a script can devide the total amount in 1 different percentage? So the buyer will have a double wallet popping up.

If you have a link for that, i would appreciate.

I think that when someone pays with 100 AVAX to the smart contract ,the smart contract will split then those 100 AVAX and send them into 2 different places

1 Like

Do you have an idea where the split occurs?
Below is my code of the smartcontract for the Morarable NFTmarketplace:

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../node_modules/openzeppelin-solidity/contracts/token/ERC721/IERC721.sol";

contract MorarableMarketContract {

    struct AuctionItem {

        uint256 id;

        address tokenAddress;

        uint256 tokenId;

        address payable seller;

        uint256 askingPrice;

        bool isSold;

    }

    AuctionItem[] public itemsForSale;

    mapping (address => mapping (uint256 => bool)) activeItems;

    event itemAdded(uint256 id, uint256 tokenId, address tokenAddress, uint256 askingPrice);

    event itemSold(uint256 id, address buyer, uint256 askingPrice);

    modifier OnlyItemOwner(address tokenAddress, uint256 tokenId){

        IERC721 tokenContract = IERC721(tokenAddress);

        require(tokenContract.ownerOf(tokenId) == msg.sender);

        _;

    }

    modifier HasTransferApproval(address tokenAddress, uint256 tokenId){

        IERC721 tokenContract = IERC721(tokenAddress);

        require(tokenContract.getApproved(tokenId) == address(this));

        _;

    }

    modifier ItemExists(uint256 id){

        require(id < itemsForSale.length && itemsForSale[id].id == id, "Could not find item.");

        _;

    }

    modifier IsForSale(uint256 id){

        require(itemsForSale[id].isSold == false, "Item is already sold.");

        _;

    }

    function addItemToMarket(uint256 tokenId, address tokenAddress, uint256 askingPrice) OnlyItemOwner(tokenAddress, tokenId) HasTransferApproval(tokenAddress, tokenId) external returns (uint256 id){

        require(activeItems[tokenAddress][tokenId] == false, "Item is already up for sale.");

        uint256 newItemId = itemsForSale.length;

        itemsForSale.push(AuctionItem(newItemId, tokenAddress, tokenId, payable(msg.sender), askingPrice, false));

        activeItems[tokenAddress][tokenId] = true;

        assert(itemsForSale[newItemId].id == newItemId);

        emit itemAdded(newItemId, tokenId, tokenAddress, askingPrice);

        return newItemId;

    }

    function buyItem(uint256 id) payable external ItemExists(id) IsForSale(id) HasTransferApproval(itemsForSale[id].tokenAddress, itemsForSale[id].tokenId){

        require(msg.value >= itemsForSale[id].askingPrice, "Not enough funds sent.");

        require(msg.sender != itemsForSale[id].seller);

        itemsForSale[id].isSold = true;

        activeItems[itemsForSale[id].tokenAddress][itemsForSale[id].tokenId] = false;

        IERC721(itemsForSale[id].tokenAddress).safeTransferFrom(itemsForSale[id].seller, msg.sender, itemsForSale[id].tokenId);

        itemsForSale[id].seller.transfer(msg.value);

        emit itemSold(id, msg.sender, itemsForSale[id].askingPrice);

    }

}

this is a transfer, but it is with native currency and not with an ERC20 token, where you could send to two different address that msg.value split

1 Like