Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# true or false
FORK=false
FORKED_NETWORK=bscmainnet

# Replace with your deployer's private key
DEPLOYER_PRIVATE_KEY=

#Archive nodes - Replace <YOUR_KEY_HERE> with your actual keys and uncomment the line you need
#ARCHIVE_NODE_bsctestnet=https://bsc-testnet.nodereal.io/v1/<YOUR_KEY_HERE>
#ARCHIVE_NODE_bscmainnet=https://bsc-mainnet.nodereal.io/v1/<YOUR_KEY_HERE>
#ARCHIVE_NODE_sepolia=https://ethereum-sepolia.blockpi.network/v1/rpc/public
#ARCHIVE_NODE_ethereum=https://eth-mainnet.nodereal.io/v1/<YOUR_KEY_HERE>
#ARCHIVE_NODE_opbnbtestnet=https://opbnb-testnet.nodereal.io/v1/<YOUR_KEY_HERE>
#ARCHIVE_NODE_opbnbmainnet=https://opbnb-mainnet.nodereal.io/v1/<YOUR_KEY_HERE>
#ARCHIVE_NODE_arbitrumsepolia=https://sepolia-rollup.arbitrum.io/rpc
#ARCHIVE_NODE_arbitrumone=https://open-platform.nodereal.io/<YOUR_KEY_HERE>/arbitrum-nitro/
#ARCHIVE_NODE_zksyncsepolia=https://zksync-sepolia.g.alchemy.com/v2/<YOUR_KEY_HERE>
#ARCHIVE_NODE_zksyncmainnet=https://open-platform.nodereal.io/<YOUR_KEY_HERE>/zksync
#ARCHIVE_NODE_opsepolia=https://sepolia.optimism.io
#ARCHIVE_NODE_opmainnet=https://opt-mainnet.nodereal.io/v1/<YOUR_KEY_HERE>
#ARCHIVE_NODE_basesepolia=https://sepolia.base.org
#ARCHIVE_NODE_basemainnet=https://open-platform.nodereal.io/<YOUR_KEY_HERE>/base
#ARCHIVE_NODE_unichainsepolia=https://unichain-sepolia.g.alchemy.com/v2/<YOUR_KEY_HERE>
#ARCHIVE_NODE_unichainmainnet=https://unichain-mainnet.g.alchemy.com/v2/<YOUR_KEY_HERE>

# Uncomment the lines below if you want to deploy on mainnet using Frame Wallet
#ARCHIVE_NODE_ethereum=http://127.0.0.1:1248
#ARCHIVE_NODE_bscmainnet=http://127.0.0.1:1248

# Replace with your Etherscan API key
ETHERSCAN_API_KEY=

# Set to true or false to control gas reporting
REPORT_GAS=

# Set to true or false to deploy contracts based on timestamp or block
IS_TIME_BASED_DEPLOYMENT=false
HARDHAT_FORK_NETWORK=
4 changes: 4 additions & 0 deletions .eslint-tsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"include": ["jest.config.js", ".eslintrc.js", "tests", "scenario", "deploy", "docgen-templates", "commitlint.config.js", "./hardhat.config.zksync.ts", "type-extensions.ts", "helpers"]
}
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
artifacts
artifacts-zk
cache
cache-zk
coverage
dist
typechain
53 changes: 53 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"env": {
"browser": false,
"es2021": true,
"mocha": true,
"node": true,
},
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"project": ".eslint-tsconfig",
},
"root": true,
"rules": {
"@typescript-eslint/no-floating-promises": [
"error",
{
"ignoreIIFE": true,
"ignoreVoid": true,
},
],
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "_",
"varsIgnorePattern": "_",
},
],
"spaced-comment": [
"error",
"always",
{
"line": {
"exceptions": ["-", "+"],
"markers": ["=", "!", "/"],
},
"block": {
"exceptions": ["-", "+"],
"markers": ["=", "!", ":", "::"],
"balanced": true
}
}
]
}
}
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text eol=lf
*.pdf binary
*.sol linguist-language=Solidity
17 changes: 17 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Description

<!-- Describe your changes here -->

Resolves #<!-- issue id -->

## Checklist

<!--
Any non-WIP PR should have all the checkmarks set.
If a checkmark is not applicable to your PR, mark it as done
-->

- [ ] I have updated the documentation to account for the changes in the code.
- [ ] If I added new functionality, I added tests covering it.
- [ ] If I fixed a bug, I added a test preventing this bug from silently reappearing again.
- [ ] My contribution follows [Venus contribution guidelines](docs/CONTRIBUTING.md).
37 changes: 37 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release

on:
push:
branches:
- main
- develop

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-node@v4
with:
cache: "yarn"

- name: Install dependencies
run: yarn

- name: Build
run: yarn build

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.VENUS_TOOLS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_AUTHOR_NAME: Venus Tools
GIT_AUTHOR_EMAIL: tools@venus.io
GIT_COMMITTER_NAME: Venus Tools
GIT_COMMITTER_EMAIL: tools@venus.io
run: yarn semantic-release
127 changes: 127 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"

- name: Install dependencies
run: yarn

- name: Check linting of solidity and typescript
run: yarn lint

test:
name: Test
runs-on: ubuntu-22.04
env:
NODE_OPTIONS: --max-old-space-size=4096
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"

- name: Install deps
run: yarn

- name: Run hardhat compile and tests coverage
run: |
source .env.example
yarn hardhat:compile && yarn hardhat:coverage

- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage/cobertura-coverage.xml
badge: true
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: "50 80"

- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md

deploy:
name: Deploy
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"

- name: Install dependencies
run: yarn

- name: Build
run: yarn build

- name: Verify deployments work
run: yarn hardhat deploy

export-deployments:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.VENUS_TOOLS_TOKEN }}

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"

- name: Install dependencies
run: yarn

- name: Export deployments
run: |
for NETWORK in bsctestnet bscmainnet ethereum sepolia opbnbtestnet opbnbmainnet arbitrumsepolia arbitrumone opsepolia opmainnet basesepolia basemainnet unichainsepolia unichainmainnet; do
EXPORT=true yarn hardhat export --network ${NETWORK} --export ./deployments/${NETWORK}.json
jq -M '{name, chainId, addresses: .contracts | map_values(.address)}' ./deployments/${NETWORK}.json > ./deployments/${NETWORK}_addresses.json
done
for NETWORK in zksyncsepolia zksyncmainnet; do
EXPORT=true yarn hardhat export --network ${NETWORK} --export ./deployments/${NETWORK}.json --config hardhat.config.zksync.ts
jq -M '{name, chainId, addresses: .contracts | map_values(.address)}' ./deployments/${NETWORK}.json > ./deployments/${NETWORK}_addresses.json
done
yarn prettier

- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "feat: updating deployment files"
file_pattern: "deployments/*.json"
66 changes: 66 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
node_modules
.env
coverage
coverage.json
typechain
.openzeppelin
#Hardhat files
cache
cache-zk
artifacts
artifacts-zk

#Compound
allFiredEvents
.build-temp
build
build_
node_modules
.env
.certora*
certora_*
coverage/
coverage.json
coverageEnv/
emv-*/
formulas/
outputs/
Reports/
scTopics
test-results.xml
.tsbuilt
yarn-error.log
scenario/build/webpack.js
.scencache
.solcache
.solcachecov
scenario/.tscache
script/certora
tests/scenarios/
tests/Scenarios/
junit.xml
.build
.last_confs
node_modules_tmp
.idea

secrets.json

# yarn
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions

# Build
dist
docs

contracts/oracle/*
contracts/generated
deployments/localhost

# OSX
.DS_Store
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1} --config ./commitlint.config.js
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
hardhat.config.ts
scripts
test
12 changes: 12 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
node_modules
artifacts
artifacts-zk
cache
cache-zk
coverage*
gasReporterOutput.json
dist
scenario
typechain
contracts/oracle
CHANGELOG.md
14 changes: 14 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"arrowParens": avoid,
"bracketSpacing": true,
"endOfLine": "auto",
"importOrder": ["module-alias/register", "<THIRD_PARTY_MODULES>", "^[./]"],
"importOrderParserPlugins": ["typescript"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"printWidth": 120,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": all,
"overrides": [{ "files": "*.sol", "options": { "tabWidth": 4 } }],
}
Loading