Skip to content

Commit

Permalink
Merge branch 'main' into apply_and_mint_interest_rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
bingen authored Apr 4, 2024
2 parents 8f52365 + 5c9f2f6 commit 253786e
Show file tree
Hide file tree
Showing 22 changed files with 7,200 additions and 6,965 deletions.
36 changes: 23 additions & 13 deletions .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,28 @@ jobs:
with:
submodules: recursive

- uses: actions/setup-node@v3
- name: Install pnpm
uses: pnpm/action-setup@v3.0.0
with:
node-version: 16
version: 8

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'pnpm'
cache-dependency-path: 'contracts/pnpm-lock.yaml'

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Test contracts
run: yarn test
run: pnpm test

coverage:
name: Coverage
Expand Down Expand Up @@ -125,20 +133,22 @@ jobs:
# id: coverage_filter

# Hardhat
- uses: actions/setup-node@v3
- name: Install pnpm
uses: pnpm/action-setup@v3.0.0
with:
node-version: 16
cache: yarn
cache-dependency-path: "./contracts/yarn.lock"
env:
# Workaround for https://github.com/actions/setup-node/issues/317
FORCE_COLOR: 0
version: 8

- uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'pnpm'
cache-dependency-path: 'contracts/pnpm-lock.yaml'

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install

- name: harhdat coverage
run: yarn coverage
run: pnpm coverage
continue-on-error: true
env:
NODE_OPTIONS: --max-old-space-size=4096
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
2 changes: 2 additions & 0 deletions contracts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ node_modules

coverage/
coverage.json
mochaOutput.json
testMatrix.json
25 changes: 25 additions & 0 deletions contracts/.solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
// Improve performance by skipping statements and functions. Tool still checks lines of code and branches:
// https://github.com/sc-forks/solidity-coverage/blob/master/docs/advanced.md
//measureStatementCoverage: false,
//measureFunctionCoverage: false,

skipFiles: [
"GasPool",
"test/",
"TestContracts/",
"Interfaces/",
"Dependencies/IERC20.sol",
"Dependencies/IERC2612.sol",
"Dependencies/Math.sol",
"Dependencies/Ownable.sol",
"Dependencies/",
"Integrations/"
],
// https://github.com/sc-forks/solidity-coverage/blob/master/docs/advanced.md#skipping-tests
mocha: {
grep: "@skip-on-coverage", // Find everything with this tag
invert: true // Run the grep's inverse set.
},
contractsDir: "src/",
};
15 changes: 12 additions & 3 deletions contracts/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
require("@nomicfoundation/hardhat-foundry");
require("@nomicfoundation/hardhat-toolbox");
require("@nomiclabs/hardhat-truffle5");
require("solidity-coverage");

const accounts = require("./hardhatAccountsList2k.js");
const accountsList = accounts.accountsList;
function accounts() {
const { accountsList } = require("./hardhatAccountsList2k.js");
const balanceStr = process.env.ACCOUNTS_BALANCE?.trim();
return balanceStr
? accountsList.map((account) => ({
...account,
balance: String(BigInt(balanceStr) * 10n ** 18n),
}))
: accountsList;
}

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
Expand All @@ -22,7 +31,7 @@ module.exports = {
},
networks: {
hardhat: {
accounts: accountsList,
accounts: accounts(),
gas: 10000000,
blockGasLimit: 15000000,
gasPrice: 20000000000,
Expand Down
2 changes: 1 addition & 1 deletion contracts/hardhatAccountsList2k.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const _1e36Str = "1000000000000000000000000000000000000"
const _1e36Str = String(10n ** 36n)

const accountsList =

Expand Down
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"decimal.js": "^10.4.3",
"hardhat": "^2.14.0",
"hardhat-gas-reporter": "^1.0.8",
"solidity-coverage": "^0.8.1",
"solidity-coverage": "^0.8.8",
"ts-node": ">=8.0.0",
"typechain": "^8.1.0",
"typescript": ">=4.5.0"
Expand Down
Loading

0 comments on commit 253786e

Please sign in to comment.