SOCI4L

One number each

Step 1 of 4
0 of 2 goals

Give everyone their own slot

total knows the sum and nothing else. Two people deposit and it cannot tell you who holds what.

Add this beside it:

mapping(address => uint256) public balances;

Read it as a lookup: hand it an address, get a number back.

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

contract Ledger {
    uint256 public total;

    function deposit(uint256 amount) external {
        total += amount;
    }

    function balanceOf(address who) external view returns (uint256) {
        return 0;
    }
}

Goals

The contract compiles
nothing to compile yet
Declare `balances`
no state variables declared yet

Contract storage

Write a contract and it will deploy itself here.