// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
contract ManualToken {
uint256 initialSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
// Transfer Tokens
// Subtract "from address" amount and add "to address" amount
function transfer(address from, address to, uint256 amount) public {
balanceOf[from] -= amount;
balanceOf[to] += amount;
}
/** Send _value tokens to _to on behalf of _from
*
* @param _from The address of sender
* @param _to The address of the recipient
* @param _value The amount to send
*
*/
function transferFrom(
address _from,
address _to,
uint256 _value
) public returns (bool) {
require(_value <= allowance[_from][msg.sender]);
allowance[_from][msg.sender] -= _value;
transfer(_from, _to, _value);
return true;
}
// Other Functions
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MyToken is ERC20 {
constructor(uint256 initialSupply) ERC20("MyToken", "MT") {
_mint(msg.sender, initialSupply);
}
}