Skip to content

Commit

Permalink
refactor: init project with helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
0xMaharishi committed Feb 1, 2022
1 parent 420d278 commit 4bcfa20
Show file tree
Hide file tree
Showing 49 changed files with 6,348 additions and 2,699 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
Expand Down
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ coverage.json
npm-debug.log*
yarn-debug.log*
yarn-error.log*


#convex
**/convex-platform/**/*
26 changes: 26 additions & 0 deletions .github/workflows/lint-sol.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on: ["push"]
name: Lint Solidity
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
token: ${{ secrets.ACCESS_TOKEN }}
- uses: actions/setup-node@v1
with:
node-version: 14.16.1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn lint:sol
27 changes: 27 additions & 0 deletions .github/workflows/lint-ts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on: ["push"]
name: Lint Typescript
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
token: ${{ secrets.ACCESS_TOKEN }}
- uses: actions/setup-node@v1
with:
node-version: 14.16.1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn compile
- run: yarn lint:ts
27 changes: 27 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on: ["push", "pull_request"]
name: Test
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
token: ${{ secrets.ACCESS_TOKEN }}
- uses: actions/setup-node@v1
with:
node-version: 14.16.1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn
- run: yarn compile
- run: yarn test
11 changes: 3 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_*
# directories
.yarn/*
!.yarn/patches
Expand All @@ -23,13 +24,7 @@ coverage.json
npm-debug.log*
yarn-debug.log*
yarn-error.log*
contracts.json

# types
src/types/*
!src/types/common.ts
!src/types/Greeter.ts

# factories
!src/types/factories
src/types/factories/*
!src/types/factories/Greeter__factory.ts
types/generated/**/*
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "convex-platform"]
path = convex-platform
url = https://github.com/aurafinance/convex-platform
8 changes: 4 additions & 4 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ bracketSpacing: true
endOfLine: auto
printWidth: 120
singleQuote: false
tabWidth: 2
tabWidth: 4
trailingComma: all

overrides:
- files: "*.sol"
options:
tabWidth: 4
- files: "*.sol"
options:
tabWidth: 4
42 changes: 33 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

My favorite setup for writing Solidity smart contracts.

- [Hardhat](https://github.com/nomiclabs/hardhat): compile and run the smart contracts on a local development network
- [TypeChain](https://github.com/ethereum-ts/TypeChain): generate TypeScript types for smart contracts
- [Ethers](https://github.com/ethers-io/ethers.js/): renowned Ethereum library and wallet implementation
- [Waffle](https://github.com/EthWorks/Waffle): tooling for writing comprehensive smart contract tests
- [Solhint](https://github.com/protofire/solhint): linter
- [Solcover](https://github.com/sc-forks/solidity-coverage): code coverage
- [Prettier Plugin Solidity](https://github.com/prettier-solidity/prettier-plugin-solidity): code formatter
- [Hardhat](https://github.com/nomiclabs/hardhat): compile and run the smart contracts on a local development network
- [TypeChain](https://github.com/ethereum-ts/TypeChain): generate TypeScript types for smart contracts
- [Ethers](https://github.com/ethers-io/ethers.js/): renowned Ethereum library and wallet implementation
- [Waffle](https://github.com/EthWorks/Waffle): tooling for writing comprehensive smart contract tests
- [Solhint](https://github.com/protofire/solhint): linter
- [Solcover](https://github.com/sc-forks/solidity-coverage): code coverage
- [Prettier Plugin Solidity](https://github.com/prettier-solidity/prettier-plugin-solidity): code formatter

This is a GitHub template, which means you can reuse it as many times as you want. You can do that by clicking the "Use this
template" button at the top of the page.
Expand Down Expand Up @@ -106,9 +106,33 @@ compiler version is to add the following fields to your VSCode user settings:

```json
{
"solidity.compileUsingRemoteVersion": "v0.8.4+commit.c7e474f2",
"solidity.defaultCompiler": "remote"
"solidity.compileUsingRemoteVersion": "v0.8.4+commit.c7e474f2",
"solidity.defaultCompiler": "remote"
}
```

Where of course `v0.8.4+commit.c7e474f2` can be replaced with any other version.

## Local Fork

This runs a local node on your system, that can be used with Metamask, etc.

Run a local fork:

```
npx hardhat node --fork https://eth-mainnet.alchemyapi.io/v2/<API_KEY> --port <PORT>
```

Task to get some ETH, CVX, CRV, crvMUSD

```
export NODE_URL=<LOCAL_NODE_URL>
yarn task curveTokens --account <YOUR_ADDRESS> --network forking
```

Once you stake or lock CVX you may want to progress timestamps to check rewards stuff

```
export NODE_URL=<LOCAL_NODE_URL>
yarn task timeTravel --duration 69420 --network forking
```
Loading

0 comments on commit 4bcfa20

Please sign in to comment.