Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into sp-invariant
Browse files Browse the repository at this point in the history
  • Loading branch information
danielattilasimon committed May 3, 2024
2 parents 377e2d4 + 08e0822 commit 629e881
Show file tree
Hide file tree
Showing 239 changed files with 13,347 additions and 3,333 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/contracts-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defaults:

env:
FOUNDRY_PROFILE: ci
FOUNDRY_VERSION: nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9
FOUNDRY_VERSION: nightly
CI: true
FORCE_COLOR: true

Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
cache-dependency-path: "pnpm-lock.yaml"

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

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
cache-dependency-path: "pnpm-lock.yaml"

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

- name: harhdat coverage
run: pnpm coverage
Expand Down
51 changes: 43 additions & 8 deletions .github/workflows/testnet-deployment.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Testnet Deployment

# This workflow:
# - Deploys the contracts to the Liquity v2 Testnet (currently disabled)
# - Deploys the app to Vercel (only for the main branch, not PRs)
# - Deploys the contracts to the Liquity v2 Testnet
# - Deploys the app to Vercel (main branch only, not PRs)
# - Deploys the gallery to Vercel (main branch only, not PRs)

on:
push:
Expand All @@ -17,9 +18,9 @@ on:
- "contracts/**"

env:
CI: true
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
FOUNDRY_VERSION: nightly-f625d0fa7c51e65b4bf1e8f7931cd1c6e2e285e9
FOUNDRY_VERSION: nightly

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -48,7 +49,7 @@ jobs:
cache-dependency-path: "pnpm-lock.yaml"

- name: Install dependencies
run: pnpm install
run: pnpm install --frozen-lockfile
working-directory: ./contracts

- name: Install Foundry
Expand All @@ -59,6 +60,7 @@ jobs:
- name: Run deployment tool
working-directory: ./contracts
run: ./deploy liquity-testnet --verify
timeout-minutes: 2
env:
DEPLOYER: ${{ secrets.DEPLOYER }}

Expand All @@ -73,6 +75,8 @@ jobs:
runs-on: ubuntu-latest
needs: deploy-contracts
if: ${{ github.event_name != 'pull_request' }}
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
steps:
- name: Git checkout
uses: actions/checkout@v4
Expand All @@ -83,7 +87,7 @@ jobs:
version: 8

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

- name: Install Vercel CLI
run: pnpm install --global vercel@canary
Expand All @@ -95,9 +99,9 @@ jobs:
path: ./contracts

- name: Prepare Environment from Latest Deployment Context
working-directory: contracts
working-directory: ./contracts
env:
APP_ENV_FILE: ../frontend/.env.local
APP_ENV_FILE: ../frontend/app/.env.local
DEPLOYMENT_CONTEXT_FILE: ./deployment-context-latest.json
run: |
echo 'NEXT_PUBLIC_CHAIN_ID=1337' >> $APP_ENV_FILE
Expand All @@ -118,3 +122,34 @@ jobs:

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}

deploy-gallery:
name: Deploy gallery
runs-on: ubuntu-latest
needs: deploy-contracts
if: ${{ github.event_name != 'pull_request' }}
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_GALLERY_PROJECT_ID }}
steps:
- name: Git checkout
uses: actions/checkout@v4

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

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

- name: Install Vercel CLI
run: pnpm install --global vercel@canary

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}

- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"editor.defaultFormatter": "dprint.dprint",
"dprint.path": "node_modules/.bin/dprint"
"dprint.path": "node_modules/.bin/dprint",
"solidity.compileUsingRemoteVersion": "v0.8.18+commit.87f61d96"
}
3 changes: 3 additions & 0 deletions contracts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ cache_hardhat

coverage/
coverage.json

.venv

mochaOutput.json
testMatrix.json
/deployment-context-latest.json
27 changes: 23 additions & 4 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,29 @@ $ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --pri
$ cast <subcommand>
```

### Help
## Slither

Create a local Python env:

```shell
python3 -m venv .venv
```

Install slither:

```shell
pip3 install -r requirements.txt
```

Install and use Solidity compiler:

```shell
solc-select install 0.8.18
solc-select use 0.8.18
```

Run slither:

```shell
$ forge --help
$ anvil --help
$ cast --help
slither src
```
6 changes: 3 additions & 3 deletions contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "bold-contracts",
"name": "@liquity2/contracts",
"version": "1.0.0",
"description": "Bold decentralized stablecoin",
"main": "index.js",
Expand Down Expand Up @@ -39,8 +39,8 @@
"ts-node": ">=8.0.0",
"tsx": "^4.7.1",
"typechain": "^8.1.0",
"typescript": ">=4.5.0",
"zod": "^3.22.4",
"typescript": "^5.4.5",
"zod": "^3.23.0",
"zx": "^7.2.3"
}
}
2 changes: 2 additions & 0 deletions contracts/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
slither-analyzer==0.10.0
slitherin==0.5.0
4 changes: 4 additions & 0 deletions contracts/slither.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"detectors_to_exclude": "naming-convention,similar-names,incorrect-equality,uninitialized-local,solc-version,reentrancy-no-eth,reentrancy-benign,reentrancy-events,timestamp,pess-unprotected-setter,pess-readonly-reentrancy",
"filter_paths": "lib|test|TestContracts|Dependencies|Integrations|Interfaces"
}
16 changes: 13 additions & 3 deletions contracts/src/ActivePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,21 @@ contract ActivePool is Ownable, CheckContract, IActivePool {
function receiveETH(uint256 _amount) external {
_requireCallerIsBorrowerOperationsOrDefaultPool();

uint256 newETHBalance = ETHBalance + _amount;
ETHBalance = newETHBalance;
_accountForReceivedETH(_amount);

// Pull ETH tokens from sender
ETH.safeTransferFrom(msg.sender, address(this), _amount);
}

function accountForReceivedETH(uint256 _amount) public {
_requireCallerIsBorrowerOperationsOrDefaultPool();

_accountForReceivedETH(_amount);
}

function _accountForReceivedETH(uint256 _amount) internal {
uint256 newETHBalance = ETHBalance + _amount;
ETHBalance = newETHBalance;

emit ActivePoolETHBalanceUpdated(newETHBalance);
}
Expand Down Expand Up @@ -228,7 +238,7 @@ contract ActivePool is Ownable, CheckContract, IActivePool {
_changeAggWeightedDebtSum(newWeightedRecordedTroveDebt, oldWeightedRecordedTroveDebt);
}

function mintAggInterestNoTroveChange() external returns (uint256) {
function mintAggInterestNoTroveChange() external override {
_requireCallerIsSP();
aggRecordedDebt = _mintAggInterestNoTroveChange();
}
Expand Down
Loading

0 comments on commit 629e881

Please sign in to comment.