123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- pragma solidity ^0.8.9;
- contract Token {
- // Public variable of type unsigned int to keep the number of counts
- uint256 public count = 0;
- // Function that increments our counter
- function increment() public {
- count += 1;
- }
- // Not necessary getter to get the count value
- function getCount() public view returns (uint256) {
- return count;
- }
- }
- //SPDX-License-Identifier: UNLICENSED
- // Solidity files have to start with this pragma.
- // It will be used by the Solidity compiler to validate its version.
- // pragma solidity ^0.8.9;
- // // We import this library to be able to use console.log
- // import "hardhat/console.sol";
- // // This is the main building block for smart contracts.
- // contract Token {
- // // Some string type variables to identify the token.
- // string public name = "My Hardhat Token";
- // string public symbol = "MHT";
- // // The fixed amount of tokens stored in an unsigned integer type variable.
- // uint256 public totalSupply = 1000000;
- // // An address type variable is used to store ethereum accounts.
- // address public owner;
- // // A mapping is a key/value map. Here we store each account balance.
- // mapping(address => uint256) balances;
- // // The Transfer event helps off-chain aplications understand
- // // what happens within your contract.
- // event Transfer(address indexed _from, address indexed _to, uint256 _value);
- // /**
- // * Contract initialization.
- // */
- // constructor() {
- // // The totalSupply is assigned to the transaction sender, which is the
- // // account that is deploying the contract.
- // balances[msg.sender] = totalSupply;
- // owner = msg.sender;
- // }
- // /**
- // * A function to transfer tokens.
- // *
- // * The `external` modifier makes a function *only* callable from outside
- // * the contract.
- // */
- // function transfer(address to, uint256 amount) external {
- // // Check if the transaction sender has enough tokens.
- // // If `require`'s first argument evaluates to `false` then the
- // // transaction will revert.
- // require(balances[msg.sender] >= amount, "Not enough tokens");
- // // We can print messages and values using console.log, a feature of
- // // Hardhat Network:
- // console.log(
- // "Transferring from %s to %s %s tokens",
- // msg.sender,
- // to,
- // amount
- // );
- // // Transfer the amount.
- // balances[msg.sender] -= amount;
- // balances[to] += amount;
- // // Notify off-chain applications of the transfer.
- // emit Transfer(msg.sender, to, amount);
- // }
- // /**
- // * Read only function to retrieve the token balance of a given account.
- // *
- // * The `view` modifier indicates that it doesn't modify the contract's
- // * state, which allows us to call it without executing a transaction.
- // */
- // function balanceOf(address account) external view returns (uint256) {
- // return balances[account];
- // }
- // }
|