julien/lovepublic Fork 0
1c407d31e7da917c5d28adfdef1299af24795bd2
Commits
Clone
git clone https://git.rickub.com/julien/love.git
git clone ssh://git@rickub.com/julien/love.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

README.md · 97 lines · 2.8 KBmarkdown Blame HistoryRaw
document setup b1c9b0d julienbrg 10h ago1# love
2
3A [Foundry](https://getfoundry.sh) project.
4
update docs for erc20 69c46a2 julienbrg 10h ago5`Love` (`LOVE`, 18 decimals) is a basic ERC-20 built on
6[OpenZeppelin](https://github.com/OpenZeppelin/openzeppelin-contracts), with one
7deliberate twist: `mint` has **no access control**.
8
9```solidity
10function mint(address to, uint256 amount) external;
11```
12
13Anyone can mint any amount to any address. Supply starts at zero and is
14unbounded, so the token carries no economic value — it is a faucet / demo token.
15Do not deploy it to mainnet expecting otherwise.
document setup b1c9b0d julienbrg 10h ago16
17## Setup
18
19```shell
20forge install
21cp .env.example .env
22```
23
24## Usage
25
26```shell
27forge build # compile
28forge test # run tests
29forge test -vvv # with traces
30forge fmt # format
31forge coverage # coverage report
32forge snapshot # gas snapshot
33anvil # local node
34```
35
36## Deploy
37
document create2 deployment 1c407d3 julienbrg 9h ago38`Love` is deployed with CREATE2 through the canonical
39[deterministic deployer](https://github.com/Arachnid/deterministic-deployment-proxy)
40at `0x4e59b44847b379578588920cA78FbF26c0B4956C`, so it gets **the same address on
41every EVM network**. The address derives from the salt and the creation code
42only — not from the deployer account or its nonce.
43
44Check the address before spending gas:
45
46```shell
47forge script script/Love.s.sol:LoveScript --sig 'predict()'
48```
49
50Then deploy:
51
document setup b1c9b0d julienbrg 10h ago52```shell
53forge script script/Love.s.sol:LoveScript \
54 --rpc-url base_sepolia \
55 --account "$DEPLOYER_ACCOUNT" \
56 --broadcast \
57 --verify
58```
59
document create2 deployment 1c407d3 julienbrg 9h ago60Drop `--broadcast` for a dry run. Re-running against a network where the token
61already exists is a no-op.
62
63The salt defaults to `keccak256("LOVE")`; override it — to mine a vanity address,
64say — with `SALT=0x… forge script …`. The same salt must be used on every
65network.
66
67### Keeping the address stable
68
69The creation code, and therefore the address, changes if any of these change:
70
71- the contract source (`src/Love.sol`) or its OpenZeppelin version,
72- `solc` (pinned to 0.8.30 in `foundry.toml`),
73- optimizer settings (`optimizer = true`, `optimizer_runs = 200`, `via_ir = false`),
74- `bytecode_hash` (set to `none`, which keeps the metadata hash out of the
75 bytecode so paths and compiler metadata don't leak into the address).
76
77Treat those as frozen once the token is deployed anywhere.
78
79Chains lacking the deterministic deployer — zkSync-style chains in particular,
80where CREATE2 addresses are computed differently — cannot match this address.
document setup b1c9b0d julienbrg 10h ago81
82## Layout
83
84| Path | Contents |
85| --------- | ------------------- |
86| `src/` | Contracts |
87| `test/` | Tests |
88| `script/` | Deployment scripts |
89| `lib/` | Dependencies |
update docs for erc20 69c46a2 julienbrg 10h ago90
91## Mint
92
93```shell
94cast send <LOVE_ADDRESS> "mint(address,uint256)" <RECIPIENT> 1000000000000000000 \
95 --rpc-url base_sepolia \
96 --account "$DEPLOYER_ACCOUNT"
97```