SOCI4L

Not everyone gets to

Step 1 of 3
0 of 2 goals

Remember who deployed it

Right now a stranger can set the rate to anything. Watch: the second call lands and rate ends at 99.

Record the deployer, using a constructor that runs once at deploy:

address public owner;
constructor() {
    owner = msg.sender;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

contract Treasury {
    uint256 public rate;

    function setRate(uint256 newRate) external {
        rate = newRate;
    }

    function reset() external {
        rate = 0;
    }
}

Goals

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

Contract storage

Write a contract and it will deploy itself here.