I am making a token for a play to earn game, and I would like that token, only to be bought with Ethereum, that it cannot be bought with any other cryptocurrency, that way I would only receive ethereum, right?

Or if a buyer buys me for example with bitcoin using a non-centralized exchange, what currency do I receive as payment for that user?

Thank you


Since you are the one making the contract for the token, you could have a function accepting the ether price, and require that it was paid on that call, no way someone can pay you with an erc20 unless you write your code like that.

What I'm saying is to create a function like this:

function buytoken(uint tokenId) public payable{
    require(msg.value >= getTokenPrice(tokenId), "You are not sending the right amount for the token");
//Your code here

This is assuming of course you handle the price with a getTokenPrice function, but that's the part of the implementation that answers the question.

  • Hello Julissa, I would like to ask you a question, how can I make a part of the purchase of the tokens go to another wallet, something like: One part for the wallet of the devs, another for the holders, etc, Nov 17 '21 at 20:54
  • Hi Hatori, check this methods: solidity-by-example.org/sending-ether the one I suggest to use is transfer that way you can distribute the funds between different wallets
    – Julissa DC
    Nov 17 '21 at 23:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.