Skip to content

Commit

Permalink
Release v2.6.0 (#564)
Browse files Browse the repository at this point in the history
### Description

- cCOP Stable Token
- cGHS Pilot Stable Token
- GoodDollar 
- Celo contracts are replaced by @celo/contracts NPM package
- Refactoring and various small improvements
  • Loading branch information
bowd authored Dec 6, 2024
2 parents 56f9f94 + fb659b7 commit 1979c6a
Show file tree
Hide file tree
Showing 247 changed files with 12,971 additions and 13,362 deletions.
3 changes: 1 addition & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
CELOSCAN_API_KEY=
CELO_MAINNET_RPC_URL=https://forno.celo.org
BAKLAVA_RPC_URL=https://baklava-forno.celo-testnet.org
ALFAJORES_RPC_URL=https://alfajores-forno.celo-testnet.org
ALFAJORES_RPC_URL=https://alfajores-forno.celo-testnet.org
21 changes: 19 additions & 2 deletions .github/workflows/echidna.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,32 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: recursive

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

- name: "Install the Node.js dependencies"
run: "yarn install --immutable"

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

- name: "Build for echidna"
run: forge build --build-info --skip */test/**/*.t.sol */script/**
run: |
forge build --build-info --skip \
"test/fork/**/*" \
"test/integration/**/*" \
"test/unit/**/*" \
"test/utils/**/*" \
"contracts/**/*"
- name: "Run Echidna"
uses: crytic/echidna-action@v2
with:
files: .
solc-version: 0.5.17
contract: ${{ matrix.contract }}
config: echidna.yaml
test-mode: assertion
43 changes: 43 additions & 0 deletions .github/workflows/fork-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "ForkTests"

env:
FOUNDRY_PROFILE: "fork-tests"
ALFAJORES_RPC_URL: ${{secrets.ALFAJORES_RPC_URL}}
CELO_MAINNET_RPC_URL: ${{secrets.CELO_MAINNET_RPC_URL}}

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *" # everyday at midnight

jobs:
test:
name: Run fork tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
ref: develop

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

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

- name: "Install the Node.js dependencies"
run: "yarn install --immutable"

- name: "Show the Foundry config"
run: "forge config"

- name: "Run the tests"
run: "forge test"

- name: "Add test summary"
run: |
echo "## Tests" >> $GITHUB_STEP_SUMMARY
52 changes: 27 additions & 25 deletions .github/workflows/lint_test.yaml
Original file line number Diff line number Diff line change
@@ -1,57 +1,59 @@
name: "CI"
name: CI

env:
FOUNDRY_PROFILE: "ci"
FOUNDRY_PROFILE: ci
ALFAJORES_RPC_URL: ${{secrets.ALFAJORES_RPC_URL}}
CELO_MAINNET_RPC_URL: ${{secrets.CELO_MAINNET_RPC_URL}}

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

permissions: read-all

jobs:
lint_and_test:
name: Lint & Test
runs-on: "ubuntu-latest"
runs-on: ubuntu-latest
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
- name: Check out the repo
uses: actions/checkout@v3
with:
submodules: "recursive"
submodules: recursive

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

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

- name: "Install the Node.js dependencies"
run: "yarn install --immutable"
- name: Install the Node.js dependencies
run: yarn install --immutable

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

- name: "Add lint summary"
- name: Add lint summary
run: |
echo "## Lint" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
- name: "Show the Foundry config"
run: "forge config"
- name: Show the Foundry config
run: forge config

- name: "Run the tests"
run: "forge test"
- name: Run the tests
run: forge test

- name: "Build the contracts"
run: |
forge --version
forge build --sizes
- name: Check contract sizes
run: yarn run check-contract-sizes

- name: "Add test summary"
- name: Add test summary
run: |
echo "## Tests" >> $GITHUB_STEP_SUMMARY
24 changes: 12 additions & 12 deletions .github/workflows/slither.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ jobs:
uses: "actions/checkout@v3"
with:
submodules: "recursive"
- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "yarn"
node-version: "20"

- name: "Install the Node.js dependencies"
run: "yarn install --immutable"
- name: Run Slither
uses: crytic/slither-action@v0.3.1
uses: crytic/slither-action@v0.4.0
id: slither
with:
sarif: results.sarif
# continue-on-error: true
# -----------------------
# Ideally, we'd like to continue on error to allow uploading the SARIF file here.
# But we're often running into GitHub's API Rate Limit when uploading the SARIF file
# which would lead to lots of failed pipelines even if slither works fine:
# https://github.com/mento-protocol/mento-core/actions/runs/7167865576/job/19514794782
#
# So for now it's better to just let the slither task fail directly so we at least
# know it failed.
# -----------------------
fail-on: "low"
continue-on-error: true
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{ steps.slither.outputs.sarif }}
17 changes: 12 additions & 5 deletions .github/workflows/storage-layout.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
name: "Storage Layout"

env:
FOUNDRY_PROFILE: "ci"

on:
workflow_dispatch:
push:
Expand All @@ -14,15 +18,10 @@ jobs:
fail-fast: false
matrix:
contract:
- contracts/legacy/ReserveSpenderMultiSig.sol:ReserveSpenderMultiSig
- contracts/legacy/StableToken.sol:StableToken
- contracts/legacy/Exchange.sol:Exchange
- contracts/legacy/GrandaMento.sol:GrandaMento
- contracts/swap/Broker.sol:Broker
- contracts/swap/BiPoolManager.sol:BiPoolManager
- contracts/swap/Reserve.sol:Reserve
- contracts/oracles/BreakerBox.sol:BreakerBox
- contracts/common/SortedOracles.sol:SortedOracles
- contracts/tokens/StableTokenV2.sol:StableTokenV2
steps:
- uses: actions/checkout@v3
Expand All @@ -32,6 +31,14 @@ jobs:
uses: onbjerg/foundry-toolchain@v1
with:
version: "nightly"
- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "yarn"
node-version: "20"

- name: "Install the Node.js dependencies"
run: "yarn install --immutable"
- name: Check storage layout
uses: Rubilmax/[email protected]
with:
Expand Down
12 changes: 6 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/celo-foundry"]
path = lib/celo-foundry
url = https://github.com/bowd/celo-foundry
[submodule "lib/openzeppelin-contracts-next"]
path = lib/openzeppelin-contracts-next
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/forge-std-next"]
path = lib/forge-std-next
url = https://github.com/foundry-rs/forge-std
[submodule "lib/safe-contracts"]
path = lib/safe-contracts
url = https://github.com/safe-global/safe-contracts
Expand All @@ -23,3 +17,9 @@
branch = "release-v4"
path = lib/prb-math
url = https://github.com/PaulRBerg/prb-math
[submodule "lib/mento-std"]
path = lib/mento-std
url = https://github.com/mento-protocol/mento-std
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
3 changes: 2 additions & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint:check
yarn lint
yarn todo
36 changes: 24 additions & 12 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,36 @@ singleQuote: false
tabWidth: 2
trailingComma: all

plugins: [prettier-plugin-solidity]

overrides:
# General Config
- files: ["*.sol"]
options:
compiler: 0.5.17
tabWidth: 2
printWidth: 120
- files: [contracts/tokens/patched/*.sol]
options:
compiler: 0.8.18
- files: [contracts/tokens/StableTokenV2.sol]
options:
compiler: 0.8.18
- files: [contracts/governance/**/*.sol]
options:
compiler: 0.8.18
- files: [test/**/*.sol]
options:
compiler: ""
- files: [contracts/oracles/Chainlink*.sol]

# File-specific Config
- files:
[
contracts/common/IERC20MintableBurnable.sol,
contracts/common/SafeERC20MintableBurnable.sol,
contracts/goodDollar/**/*.sol,
contracts/governance/**/*.sol,
contracts/interfaces/*.sol,
contracts/libraries/TradingLimits.sol,
contracts/oracles/Chainlink*.sol,
contracts/swap/Broker.sol,
contracts/tokens/patched/*.sol,
contracts/tokens/StableTokenV2.sol,
]
options:
compiler: 0.8.18
- files:
- contracts/interfaces/IBrokerAdmin.sol
- contracts/interfaces/ICeloToken.sol
- contracts/interfaces/IExchange.sol
options:
compiler: 0.5.17
14 changes: 6 additions & 8 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
"code-complexity": ["error", 8],
"compiler-version": ["error", ">=0.5.13"],
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 120],
"not-rely-on-time": "off",
"function-max-lines": ["error", 120],
"gas-custom-errors": "off",
"max-line-length": ["error", 121],
"no-console": "off",
"no-empty-blocks": "off",
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
],
"no-global-import": "off",
"not-rely-on-time": "off",
"prettier/prettier": ["error", { "endOfLine": "auto" }],
"reason-string": ["warn", { "maxLength": 64 }]
}
}
Loading

0 comments on commit 1979c6a

Please sign in to comment.