Token.sol 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. pragma solidity ^0.8.9;
  2. contract Token {
  3. // Public variable of type unsigned int to keep the number of counts
  4. uint256 public count = 0;
  5. // Function that increments our counter
  6. function increment() public {
  7. count += 1;
  8. }
  9. // Not necessary getter to get the count value
  10. function getCount() public view returns (uint256) {
  11. return count;
  12. }
  13. }
  14. //SPDX-License-Identifier: UNLICENSED
  15. // Solidity files have to start with this pragma.
  16. // It will be used by the Solidity compiler to validate its version.
  17. // pragma solidity ^0.8.9;
  18. // // We import this library to be able to use console.log
  19. // import "hardhat/console.sol";
  20. // // This is the main building block for smart contracts.
  21. // contract Token {
  22. // // Some string type variables to identify the token.
  23. // string public name = "My Hardhat Token";
  24. // string public symbol = "MHT";
  25. // // The fixed amount of tokens stored in an unsigned integer type variable.
  26. // uint256 public totalSupply = 1000000;
  27. // // An address type variable is used to store ethereum accounts.
  28. // address public owner;
  29. // // A mapping is a key/value map. Here we store each account balance.
  30. // mapping(address => uint256) balances;
  31. // // The Transfer event helps off-chain aplications understand
  32. // // what happens within your contract.
  33. // event Transfer(address indexed _from, address indexed _to, uint256 _value);
  34. // /**
  35. // * Contract initialization.
  36. // */
  37. // constructor() {
  38. // // The totalSupply is assigned to the transaction sender, which is the
  39. // // account that is deploying the contract.
  40. // balances[msg.sender] = totalSupply;
  41. // owner = msg.sender;
  42. // }
  43. // /**
  44. // * A function to transfer tokens.
  45. // *
  46. // * The `external` modifier makes a function *only* callable from outside
  47. // * the contract.
  48. // */
  49. // function transfer(address to, uint256 amount) external {
  50. // // Check if the transaction sender has enough tokens.
  51. // // If `require`'s first argument evaluates to `false` then the
  52. // // transaction will revert.
  53. // require(balances[msg.sender] >= amount, "Not enough tokens");
  54. // // We can print messages and values using console.log, a feature of
  55. // // Hardhat Network:
  56. // console.log(
  57. // "Transferring from %s to %s %s tokens",
  58. // msg.sender,
  59. // to,
  60. // amount
  61. // );
  62. // // Transfer the amount.
  63. // balances[msg.sender] -= amount;
  64. // balances[to] += amount;
  65. // // Notify off-chain applications of the transfer.
  66. // emit Transfer(msg.sender, to, amount);
  67. // }
  68. // /**
  69. // * Read only function to retrieve the token balance of a given account.
  70. // *
  71. // * The `view` modifier indicates that it doesn't modify the contract's
  72. // * state, which allows us to call it without executing a transaction.
  73. // */
  74. // function balanceOf(address account) external view returns (uint256) {
  75. // return balances[account];
  76. // }
  77. // }