Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: yarn & foundry config #68

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
6a150c2
queue multiple fcs
mejango Aug 21, 2023
0fa9447
cant replace a queued funding cycle once it's been approved
mejango Aug 21, 2023
889916b
bug fix
mejango Aug 21, 2023
ca91ede
removed comment
mejango Aug 21, 2023
6fee6bc
better ballot states for indicating intent
mejango Aug 22, 2023
d127fb3
haven't yet solved failed fc dependency
mejango Aug 22, 2023
1944e14
loop test fails
mejango Aug 22, 2023
b2de425
cleaner
mejango Aug 22, 2023
270bd8f
docs
mejango Aug 23, 2023
22abeeb
launch projects, launch funding cycles, and reconfigure funding cycle…
mejango Sep 11, 2023
41ac91e
natspec
mejango Sep 11, 2023
c728e82
more natspec
mejango Sep 11, 2023
9883fda
imports
mejango Sep 11, 2023
d3d80aa
done
mejango Sep 11, 2023
0756477
fixed return val
mejango Sep 11, 2023
f89b7a8
allow overriding an APPROVAL_EXPECTED FC
mejango Sep 15, 2023
8132c7c
natspec
mejango Sep 15, 2023
154d019
test: Same block multiple config overwriting ApprovalExpected(s)
simplemachine92 Sep 27, 2023
6b8f587
fix: comments, some extra assertions, test name
simplemachine92 Sep 27, 2023
c92834e
test: mixed mustStartAtOrAfter fc queueing
simplemachine92 Sep 29, 2023
1154b6d
test: hacky Controller3_2 TestDelegates test for review
simplemachine92 Oct 1, 2023
fb85503
Revert "test: hacky Controller3_2 TestDelegates test for review"
simplemachine92 Oct 4, 2023
c597384
Merge pull request #63 from simplemachine92/queued-fc-changes
mejango Oct 4, 2023
f91a397
chore: TestBase pretty
simplemachine92 Oct 6, 2023
97cb244
feat: controller3_2 default
simplemachine92 Oct 6, 2023
18b38e0
feat: update JBController for tests
simplemachine92 Oct 6, 2023
a51e44f
feat: JBController3_2 refactor of launchProjectFor() and reconfigureF…
simplemachine92 Oct 6, 2023
e8cf686
chore: JBController & IJBController 3_2 diff
simplemachine92 Oct 9, 2023
0fb295e
feat: JBController bump in baseW, tests refactored accordingly, & def…
simplemachine92 Oct 9, 2023
84b0d41
chore: sunset old tokenpaymentterminalstore
simplemachine92 Oct 9, 2023
c53afa4
chore: remove default cycle config, reduced readability per test file…
simplemachine92 Oct 12, 2023
2fe950d
Merge pull request #10 from simplemachine92/feature/multiple-queued-fc
mejango Oct 12, 2023
bffb708
unit tests fixed
mejango Oct 16, 2023
a02e511
get rid of unused internals
mejango Oct 16, 2023
df7e575
chore: remove backups and update gitignore
xBA5ED Oct 26, 2023
9b33420
chore: remove test backups
xBA5ED Oct 26, 2023
00d41e7
ci: configure actions
xBA5ED Oct 26, 2023
fd1cc0c
ci: change action node version
xBA5ED Oct 26, 2023
58253c1
Merge pull request #13 from Bananapus/ci/configure-actions
xBA5ED Oct 26, 2023
c17c302
flattened
mejango Nov 3, 2023
d41d2d6
controller units consolidated
mejango Nov 3, 2023
3000acb
small
mejango Nov 3, 2023
118e4ae
small
mejango Nov 3, 2023
74ff71a
fixed some tests
mejango Nov 4, 2023
6c56ca9
removed unused test
mejango Nov 4, 2023
f000bcf
fixed redemption tests
mejango Nov 4, 2023
c6b6955
fixed another test
mejango Nov 4, 2023
452dca8
fixed testMultipleTerminal
mejango Nov 4, 2023
fec88d0
fixed testAllocation_should_emit_event_with_correct_reason_when_rever…
mejango Nov 4, 2023
28784ab
fixed testHeldFeeReimburse
mejango Nov 4, 2023
c78810b
all tests pass
mejango Nov 4, 2023
2ecd316
adjusted
mejango Nov 4, 2023
8e31fc1
more cycle tests
mejango Nov 4, 2023
d1decc2
remove only
mejango Nov 4, 2023
095d12b
unit tests are a go
mejango Nov 5, 2023
ab7cb95
fix: max duration in ballot constructor
simon-something Nov 13, 2023
129e2df
feat: ballot test
simon-something Nov 13, 2023
1cf7851
fix: lint
simon-something Nov 13, 2023
8f10dec
fix: typo
simon-something Nov 13, 2023
591ae46
fix: error uppercase
simon-something Nov 13, 2023
6c94c32
Merge pull request #28 from Bananapus/feature/multiple-queued-fc-flat
mejango Nov 13, 2023
d37ae62
feat: config
simon-something Nov 14, 2023
14fe4cb
feat: PR template
simon-something Nov 14, 2023
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
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Description

*What does this PR: do, how, why?*

## Limitations & risks

*Are there any trade-off or new vulnarbility surface based on theses changes?*

# Check-list
- [ ] Tests are covering the new feature
- [ ] Code is [natspec'd](https://docs.soliditylang.org/en/v0.8.17/natspec-format.html)
- [ ] Code is [linted and formatted](https://docs.soliditylang.org/en/v0.8.17/style-guide.html)
- [ ] I have run the test locally (and they pass)
- [ ] I have rebased to the latest main commit (and tests still pass)

# Interactions
These changes will impact the following contracts:
- Directly:

- Indirectly:
26 changes: 13 additions & 13 deletions .github/workflows/publish.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
name: juice-contracts-publish
name: juice-contracts-template-lint
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
publish:
forge-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-node@v1
with:
node-version: 14
Expand All @@ -32,14 +37,9 @@ jobs:
key: ${{ runner.os }}-${{ steps.nvm.outputs.NVMRC }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ steps.nvm.outputs.NVMRC }}-nodemodules-
- name: Install JS dependencies
if: |
steps.cache-yarn-cache.outputs.cache-hit != 'true' ||
steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --prefer-offline
# Publish deploy artifacts NPM packages. This will only run if there are new deploys.
- name: Publish NPM package
uses: JS-DevTools/npm-publish@v1
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
token: ${{ secrets.NPM_TOKEN }}
access: "public"
version: nightly
- name: Check linting
run: forge fmt --check
45 changes: 9 additions & 36 deletions .github/workflows/system-test.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,29 @@
name: juice-contracts-system-tests
name: juice-contracts-template-tests
on:
pull_request:
branches:
- main
- test/system-tests
push:
branches:
- main
- test/system-tests
jobs:
forge-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-node@v1
- uses: actions/setup-node@v3
with:
node-version: 14
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore cached yarn cache
uses: actions/cache@v2
id: cache-yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Restore cached node_modules
id: cache-node-modules
uses: actions/cache@v2
with:
path: |
./node_modules
./packages/hardhat/node_modules
key: ${{ runner.os }}-${{ steps.nvm.outputs.NVMRC }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ steps.nvm.outputs.NVMRC }}-nodemodules-
node-version: 16
- uses: bahmutov/npm-install@v1
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
- name: Install JS dependencies
if: |
steps.cache-yarn-cache.outputs.cache-hit != 'true' ||
steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --prefer-offline
- name: install libraries
run: git submodule update --init
- name: Run system tests (JBControllerV3)
run: JBX_CONTROLLER_VERSION=3_0 forge build --sizes && forge test
- name: Run system tests (JBControllerV3_1)
run: JBX_CONTROLLER_VERSION=3_1 forge build --sizes && forge test
- name: Run tests
run: FOUNDRY_PROFILE=default forge snapshot # TODO: Change to fork once fork tests can be run
- name: Check contract sizes
run: forge build --sizes
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules
.env
*.txt
!remappings.txt
yarn-error.log

# Foundry
out
Expand All @@ -17,7 +18,10 @@ deployments/localhost/**
# Code coverage reports
coverage/
coverage.json
lcov.info

# VSCode
workspace.code-workspace
.vscode/

backup/
113 changes: 57 additions & 56 deletions contracts/JBChainlinkV3PriceFeed.sol
Original file line number Diff line number Diff line change
@@ -1,63 +1,64 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import {AggregatorV3Interface} from '@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol';
import {IJBPriceFeed} from './interfaces/IJBPriceFeed.sol';
import {JBFixedPointNumber} from './libraries/JBFixedPointNumber.sol';
import {AggregatorV3Interface} from
"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import {IJBPriceFeed} from "./interfaces/IJBPriceFeed.sol";
import {JBFixedPointNumber} from "./libraries/JBFixedPointNumber.sol";

/// @notice A generalized price feed for the Chainlink AggregatorV3Interface.
contract JBChainlinkV3PriceFeed is IJBPriceFeed {
// A library that provides utility for fixed point numbers.
using JBFixedPointNumber for uint256;

//*********************************************************************//
// --------------------------- custom errors ------------------------- //
//*********************************************************************//
error STALE_PRICE();
error INCOMPLETE_ROUND();
error NEGATIVE_PRICE();

//*********************************************************************//
// ---------------- public stored immutable properties --------------- //
//*********************************************************************//

/// @notice The feed that prices are reported from.
AggregatorV3Interface public immutable feed;

//*********************************************************************//
// ------------------------- external views -------------------------- //
//*********************************************************************//

/// @notice Gets the current price from the feed, normalized to the specified number of decimals.
/// @param _decimals The number of decimals the returned fixed point price should include.
/// @return The current price of the feed, as a fixed point number with the specified number of decimals.
function currentPrice(uint256 _decimals) external view override returns (uint256) {
// Get the latest round information.
(uint80 roundId, int256 _price, , uint256 updatedAt, uint80 answeredInRound) = feed
.latestRoundData();

// Make sure the price isn't stale.
if (answeredInRound < roundId) revert STALE_PRICE();

// Make sure the round is finished.
if (updatedAt == 0) revert INCOMPLETE_ROUND();

// Make sure the price is positive.
if (_price < 0) revert NEGATIVE_PRICE();

// Get a reference to the number of decimals the feed uses.
uint256 _feedDecimals = feed.decimals();

// Return the price, adjusted to the target decimals.
return uint256(_price).adjustDecimals(_feedDecimals, _decimals);
}

//*********************************************************************//
// -------------------------- constructor ---------------------------- //
//*********************************************************************//

/// @param _feed The feed to report prices from.
constructor(AggregatorV3Interface _feed) {
feed = _feed;
}
// A library that provides utility for fixed point numbers.
using JBFixedPointNumber for uint256;

//*********************************************************************//
// --------------------------- custom errors ------------------------- //
//*********************************************************************//
error STALE_PRICE();
error INCOMPLETE_ROUND();
error NEGATIVE_PRICE();

//*********************************************************************//
// ---------------- public stored immutable properties --------------- //
//*********************************************************************//

/// @notice The feed that prices are reported from.
AggregatorV3Interface public immutable feed;

//*********************************************************************//
// ------------------------- external views -------------------------- //
//*********************************************************************//

/// @notice Gets the current price from the feed, normalized to the specified number of decimals.
/// @param _decimals The number of decimals the returned fixed point price should include.
/// @return The current price of the feed, as a fixed point number with the specified number of decimals.
function currentPrice(uint256 _decimals) external view override returns (uint256) {
// Get the latest round information.
(uint80 roundId, int256 _price,, uint256 updatedAt, uint80 answeredInRound) =
feed.latestRoundData();

// Make sure the price isn't stale.
if (answeredInRound < roundId) revert STALE_PRICE();

// Make sure the round is finished.
if (updatedAt == 0) revert INCOMPLETE_ROUND();

// Make sure the price is positive.
if (_price < 0) revert NEGATIVE_PRICE();

// Get a reference to the number of decimals the feed uses.
uint256 _feedDecimals = feed.decimals();

// Return the price, adjusted to the target decimals.
return uint256(_price).adjustDecimals(_feedDecimals, _decimals);
}

//*********************************************************************//
// -------------------------- constructor ---------------------------- //
//*********************************************************************//

/// @param _feed The feed to report prices from.
constructor(AggregatorV3Interface _feed) {
feed = _feed;
}
}
Loading
Loading