Skip to content

Commit

Permalink
chore: init project
Browse files Browse the repository at this point in the history
  • Loading branch information
ducthotran2010 committed Sep 29, 2023
1 parent 981f976 commit 1427897
Show file tree
Hide file tree
Showing 10 changed files with 427 additions and 94 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.DS_Store

# Compiler files
cache/
out/
Expand All @@ -12,3 +14,9 @@ docs/

# Dotenv file
.env
.vscode

node_modules/
yarn-error.log
.yarn
.yarnrc.yml
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

forge build
npx lint-staged
57 changes: 13 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,35 @@
## Foundry
# rns-contracts

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
The collections of smart contracts that power the Ronin Name Service (RNS).

Foundry consists of:
## Development

- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.
### Requirement

## Documentation
- [Foundry forge@^0.2.0](https://book.getfoundry.sh/)

https://book.getfoundry.sh/
### Build & Test

## Usage

### Build

```shell
$ forge build
```

### Test

```shell
$ forge test
```

### Format
- Install packages

```shell
$ forge fmt
$ forge install
```

### Gas Snapshots
- Build contracts

```shell
$ forge snapshot
$ forge build
```

### Anvil
- Run test

```shell
$ anvil
$ forge test
```

### Deploy

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```

### Cast

```shell
$ cast <subcommand>
```

### Help

```shell
$ forge --help
$ anvil --help
$ cast --help
$ forge script <path/to/file.s.sol> -f --private-key <your_private_key>
```
21 changes: 21 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,24 @@ out = "out"
libs = ["lib"]

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options

solc = '0.8.21'
extra_output = ["devdoc", "userdoc", "storagelayout"]
evm_version = 'istanbul'
use_literal_content = true
fs_permissions = [{ access = "read-write", path = "./" }]

[fmt]
line_length = 120
tab_width = 2

[rpc_endpoints]
ronin-mainnet = "https://api.roninchain.com/rpc"
ronin-testnet = "https://saigon-archive.roninchain.com/rpc"
localhost = "http://localhost:8545"

[fuzz]
runs = 256

[invariant]
runs = 256
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "rns-contracts",
"version": "1.0.0",
"description": "RNS smart contracts.",
"author": "Axie Infinity Engineering <[email protected]>",
"license": "MIT",
"repository": "https://github.com/axieinfinity/rns-contracts.git",
"files": [
"src/**/*.sol"
],
"devDependencies": {
"husky": "^8.0.3",
"lint-staged": "^14.0.1"
},
"lint-staged": {
"{src,script,test}/**/*.sol": [
"forge fmt"
]
},
"scripts": {
"prepare": "husky install"
}
}
2 changes: 2 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/
12 changes: 0 additions & 12 deletions script/Counter.s.sol

This file was deleted.

14 changes: 0 additions & 14 deletions src/Counter.sol

This file was deleted.

24 changes: 0 additions & 24 deletions test/Counter.t.sol

This file was deleted.

Loading

0 comments on commit 1427897

Please sign in to comment.