Categories
Cryptocurrency Ethereum Mastering Development

How to verify the type/name of token received in a smart contract?

Here is a sample contract which is designed to take xyz token. How can the contract verify that the sent is the xyz token?

pragma "^0.7.0"

contract myContract {
  address public payable owner;
  uint public value;  //<<==xyz token

  constructor(uint _value) payable {
    owner = msg.sender;
    value = _value;  //<<== how does the contract verify it is the _value of xyz token?
  }
}

Leave a Reply

Your email address will not be published. Required fields are marked *