Skip to content

Commit

Permalink
"caculate liquidity, tick, amount in contracts"
Browse files Browse the repository at this point in the history
  • Loading branch information
MxianD committed Aug 22, 2024
1 parent 9966e84 commit dbc2b1c
Show file tree
Hide file tree
Showing 135 changed files with 29,070 additions and 64 deletions.
2 changes: 2 additions & 0 deletions lib/prb-math/.commitlintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extends:
- "@commitlint/config-conventional"
3 changes: 3 additions & 0 deletions lib/prb-math/.czrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "cz-conventional-changelog"
}
16 changes: 16 additions & 0 deletions lib/prb-math/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig http://EditorConfig.org

# top-most EditorConfig file
root = true

# All files
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.sol]
indent_size = 4
2 changes: 2 additions & 0 deletions lib/prb-math/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INFURA_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
MNEMONIC="here is where your twelve words mnemonic should be put my friend"
21 changes: 21 additions & 0 deletions lib/prb-math/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# directories
.yarn/
**/.nyc_output
**/artifacts
**/build
**/cache
**/coverage
**/coverage-contracts
**/coverage-ts
**/dist
**/node_modules
**/src/types

# files
*.env
*.log
*.tsbuildinfo
coverage.json
npm-debug.log*
yarn-debug.log*
yarn-error.log*
23 changes: 23 additions & 0 deletions lib/prb-math/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
extends:
- "eslint:recommended"
- "plugin:@typescript-eslint/eslint-recommended"
- "plugin:@typescript-eslint/recommended"
- "prettier"
parser: "@typescript-eslint/parser"
parserOptions:
project: "tsconfig.json"
plugins:
- "@typescript-eslint"
root: true
rules:
"@typescript-eslint/no-floating-promises":
- error
- ignoreIIFE: true
ignoreVoid: true
"@typescript-eslint/no-inferrable-types": "off"
"@typescript-eslint/no-namespace": "off"
"@typescript-eslint/no-non-null-assertion": "off"
"@typescript-eslint/no-unused-vars":
- error
- argsIgnorePattern: "_"
varsIgnorePattern: "_"
1 change: 1 addition & 0 deletions lib/prb-math/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: ["https://gitcoin.co/grants/1657/paulrberg-open-source-engineering"]
93 changes: 93 additions & 0 deletions lib/prb-math/.github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: "Continuous Integration"

env:
COVERAGE_GIT_BRANCH: "main"
COVERAGE_SERVICE_NAME: "github-actions-ci"
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
MNEMONIC: ${{ secrets.MNEMONIC }}

on:
pull_request:
branches:
- "main"
push:
branches:
- "main"

jobs:
run-contracts-integration:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "yarn"
node-version: "16"

- name: "Install the dependencies"
run: "yarn install --immutable"

- name: "Lint the code"
run: "yarn lint:contracts"

- name: "Compile the contracts and generate the TypeChain bindings"
run: "yarn generate:types"

- name: "Test the contracts and generate the coverage report"
run: "yarn coverage:contracts"

- name: "Prepare the coverage report"
uses: "coverallsapp/github-action@master"
with:
flag-name: "prb-math-contracts"
github-token: "${{ secrets.GITHUB_TOKEN }}"
parallel: true
path-to-lcov: "./coverage-contracts/lcov.info"

run-ts-integration:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "yarn"
node-version: "16"

- name: "Install the dependencies"
run: "yarn install --immutable"

- name: "Lint the code"
run: "yarn lint:ts"

- name: "Compile the contracts and generate the TypeChain bindings"
run: "yarn generate:types"

- name: "Test the code and generate the coverage report"
run: "yarn coverage:ts"

- name: "Prepare the coverage report"
uses: "coverallsapp/github-action@master"
with:
flag-name: "prb-math-ts"
github-token: "${{ secrets.GITHUB_TOKEN }}"
parallel: true
path-to-lcov: "./coverage-ts/lcov.info"

upload-coverage-report:
needs:
- "run-contracts-integration"
- "run-ts-integration"
runs-on: "ubuntu-latest"
steps:
- name: "Upload the coverage reports to Coveralls"
uses: "coverallsapp/github-action@master"
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
parallel-finished: true
26 changes: 26 additions & 0 deletions lib/prb-math/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# directories
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
**/.nyc_output
**/artifacts
**/build
**/cache
**/coverage
**/coverage-contracts
**/coverage-ts
**/dist
**/node_modules
**/src/types

# files
*.env
*.log
*.tsbuildinfo
coverage.json
npm-debug.log*
yarn-debug.log*
yarn-error.log*
1 change: 1 addition & 0 deletions lib/prb-math/.husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions lib/prb-math/.husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn dlx commitlint --edit $1
4 changes: 4 additions & 0 deletions lib/prb-math/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn dlx lint-staged
5 changes: 5 additions & 0 deletions lib/prb-math/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"*.{js,json,md,sol,ts,yaml,yml}": [
"prettier --config ./.prettierrc.yml --write"
]
}
8 changes: 8 additions & 0 deletions lib/prb-math/.mocharc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extension: "ts"
recursive: true
require:
- "hardhat/register"
- "ts-node/register/transpile-only"
- "./test/shared/setup.ts"
timeout: 30000
watchExtension: "ts"
12 changes: 12 additions & 0 deletions lib/prb-math/.nycrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
check-coverage: false
exclude:
- "src/constants.ts"
- "src/errors.ts"
- "src/helpers.ts"
extends: "@istanbuljs/nyc-config-typescript"
include:
- "src/**/*.ts"
report-dir: "coverage-ts"
reporter:
- "html"
- "lcov"
16 changes: 16 additions & 0 deletions lib/prb-math/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# directories
.yarn/
**/.nyc_output
**/artifacts
**/build
**/cache
**/coverage
**/coverage-contracts
**/coverage-ts
**/dist
**/node_modules
**/src/types

# files
coverage.json
LICENSE.md
16 changes: 16 additions & 0 deletions lib/prb-math/.prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
arrowParens: avoid
bracketSpacing: true
endOfLine: auto
importOrder: ["<THIRD_PARTY_MODULES>", "^[./]"]
importOrderParserPlugins: ["typescript"]
importOrderSeparation: true
importOrderSortSpecifiers: true
printWidth: 120
singleQuote: false
tabWidth: 2
trailingComma: all

overrides:
- files: "*.sol"
options:
tabWidth: 4
10 changes: 10 additions & 0 deletions lib/prb-math/.solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const shell = require("shelljs");

module.exports = {
istanbulFolder: "coverage-contracts",
istanbulReporter: ["html", "lcov"],
providerOptions: {
mnemonic: process.env.MNEMONIC,
},
skipFiles: ["test"],
};
22 changes: 22 additions & 0 deletions lib/prb-math/.solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"code-complexity": "off",
"compiler-version": ["error", ">=0.8.4"],
"const-name-snakecase": "off",
"constructor-syntax": "error",
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 132],
"no-inline-assembly": "off",
"not-rely-on-time": "off",
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
],
"reason-string": "off",
"var-name-mixedcase": "off"
}
}
3 changes: 3 additions & 0 deletions lib/prb-math/.solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# directories
**/artifacts
**/node_modules
546 changes: 546 additions & 0 deletions lib/prb-math/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

785 changes: 785 additions & 0 deletions lib/prb-math/.yarn/releases/yarn-3.2.0.cjs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions lib/prb-math/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
enableTelemetry: false

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.2.0.cjs
Loading

0 comments on commit dbc2b1c

Please sign in to comment.