Skip to content

Commit 91bff51

Browse files
init
0 parents  commit 91bff51

13 files changed

+415
-0
lines changed

.github/workflows/test.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
env:
9+
FOUNDRY_PROFILE: ci
10+
11+
jobs:
12+
check:
13+
strategy:
14+
fail-fast: true
15+
16+
name: Foundry project
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
submodules: recursive
22+
23+
- name: Install Foundry
24+
uses: foundry-rs/foundry-toolchain@v1
25+
26+
- name: Show Forge version
27+
run: |
28+
forge --version
29+
30+
- name: Run Forge fmt
31+
run: |
32+
forge fmt --check
33+
id: fmt
34+
35+
- name: Run Forge build
36+
run: |
37+
forge build --sizes
38+
id: build
39+
40+
- name: Run Forge tests
41+
run: |
42+
forge test -vvv
43+
id: test

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Compiler files
2+
cache/
3+
out/
4+
5+
# Ignores development broadcast logs
6+
!/broadcast
7+
/broadcast/*/31337/
8+
/broadcast/**/dry-run/
9+
10+
# Docs
11+
docs/
12+
13+
# Dotenv file
14+
.env

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[submodule "lib/forge-std"]
2+
path = lib/forge-std
3+
url = https://github.com/foundry-rs/forge-std
4+
[submodule "lib/openzeppelin-contracts-upgradeable"]
5+
path = lib/openzeppelin-contracts-upgradeable
6+
url = https://github.com/openzeppelin/openzeppelin-contracts-upgradeable
7+
[submodule "lib/openzeppelin-contracts"]
8+
path = lib/openzeppelin-contracts
9+
url = https://github.com/openzeppelin/openzeppelin-contracts

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
## Foundry
2+
3+
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
4+
5+
Foundry consists of:
6+
7+
- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
8+
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
9+
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
10+
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.
11+
12+
## Documentation
13+
14+
https://book.getfoundry.sh/
15+
16+
## Usage
17+
18+
### Build
19+
20+
```shell
21+
$ forge build
22+
```
23+
24+
### Test
25+
26+
```shell
27+
$ forge test
28+
```
29+
30+
### Format
31+
32+
```shell
33+
$ forge fmt
34+
```
35+
36+
### Gas Snapshots
37+
38+
```shell
39+
$ forge snapshot
40+
```
41+
42+
### Anvil
43+
44+
```shell
45+
$ anvil
46+
```
47+
48+
### Deploy
49+
50+
```shell
51+
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
52+
```
53+
54+
### Cast
55+
56+
```shell
57+
$ cast <subcommand>
58+
```
59+
60+
### Help
61+
62+
```shell
63+
$ forge --help
64+
$ anvil --help
65+
$ cast --help
66+
```

foundry.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[profile.default]
2+
auto_detect_solc = false
3+
# NOTE: by excluding the metadata hash we make sure future contracts can be partially modified without altering their bytecode.
4+
bytecode_hash = "none" # Disables the metadata
5+
cbor_metadata = false # Diasbles the metadata
6+
evm_version = "cancun"
7+
libs = ["lib"]
8+
optimizer = true
9+
optimizer-runs = 200
10+
out = "out"
11+
script = "script"
12+
solc = "0.8.28"
13+
src = "src"
14+
test = "test"
15+
16+
[fmt]
17+
bracket_spacing = true
18+
contract_new_lines = false
19+
int_types = "long"
20+
line_length = 120
21+
multiline_func_header = "all"
22+
number_underscore = "thousands"
23+
quote_style = "double"
24+
sort_imports = true
25+
tab_width = 4
26+
wrap_comments = true

lib/forge-std

Submodule forge-std added at 77041d2

lib/openzeppelin-contracts

Submodule openzeppelin-contracts added at e4f7021

remappings.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/
2+
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
3+
erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/
4+
forge-std/=lib/forge-std/src/
5+
halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/
6+
openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/
7+
openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/

script/TokenDeployer.s.sol

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.13;
3+
4+
import { Distribution, EnsoToken } from "../src/EnsoToken.sol";
5+
import { Script } from "forge-std/Script.sol";
6+
import { ERC1967Proxy } from "openzeppelin-contracts/proxy/ERC1967/ERC1967Proxy.sol";
7+
8+
contract TokenDeployer is Script {
9+
address public OWNER = 0x0676675F4fddC2f572cf0CdDaAf0a6b31841CDaC; // TODO
10+
address public COINLIST = 0x6969696969696969696969696969696969696969; // TODO
11+
12+
uint256 WEI = 10 ** 18;
13+
uint256 TOTAL_SUPPLY = 100_000_000 * WEI;
14+
uint256 BASIS_POINTS = 10_000;
15+
uint256 COINLIST_SHARE = (TOTAL_SUPPLY * 440) / BASIS_POINTS;
16+
uint256 OWNER_SHARE = TOTAL_SUPPLY - COINLIST_SHARE;
17+
18+
function deploy() public returns (ERC1967Proxy token, EnsoToken implementation) {
19+
implementation = new EnsoToken();
20+
Distribution[] memory nullDistribution = new Distribution[](0);
21+
implementation.initialize("", "", address(implementation), nullDistribution);
22+
23+
string memory name = "Enso";
24+
string memory symbol = "ENSO";
25+
Distribution[] memory distribution = new Distribution[](2);
26+
distribution[0] = Distribution(OWNER, OWNER_SHARE);
27+
distribution[1] = Distribution(COINLIST, COINLIST_SHARE);
28+
bytes memory initializationCall =
29+
abi.encodeWithSelector(EnsoToken.initialize.selector, name, symbol, OWNER, distribution);
30+
token = new ERC1967Proxy(address(implementation), initializationCall);
31+
}
32+
33+
function run() public returns (ERC1967Proxy token, EnsoToken implementation) {
34+
vm.startBroadcast();
35+
36+
(token, implementation) = deploy();
37+
38+
vm.stopBroadcast();
39+
}
40+
}

0 commit comments

Comments
 (0)