SOCI4L

A token is a mapping

Step 1 of 4
0 of 2 goals

Somebody has to hold it first

totalSupply says 1000 but every balance is zero. The supply is a number nobody owns.

In the constructor, credit the deployer:

balanceOf[msg.sender] = totalSupply;

There is no minting machinery in ERC-20. Creating tokens is writing a number into a mapping.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

contract Token {
    string public name = "Academy";
    string public symbol = "ACAD";
    uint8 public constant decimals = 18;

    uint256 public totalSupply;
    mapping(address => uint256) public balanceOf;

    event Transfer(address indexed from, address indexed to, uint256 value);

    constructor() {
        totalSupply = 1000;
    }

    function transfer(address to, uint256 amount) external returns (bool) {
        return true;
    }
}

Goals

The contract compiles
nothing to compile yet
`alice at the start` reads back 1000
the contract has not run yet

Contract storage

Write a contract and it will deploy itself here.