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

switch to foundry v1 (stable) #2052

Merged
merged 6 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
foundry = {
url = "github:shazow/foundry.nix/monthly";
url = "github:shazow/foundry.nix/stable";
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
Expand Down
3 changes: 3 additions & 0 deletions packages/automation-contracts/autowrap/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ root = '../../../'
libs = ['lib']
src = 'packages/automation-contracts/autowrap'
solc_version = "0.8.23"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we also mark evm_version explicitly?

evm_version = 'paris'
optimizer = true
optimizer_runs = 200
remappings = [
'@superfluid-finance/solidity-semantic-money/src/=packages/solidity-semantic-money/src/',
'@superfluid-finance/ethereum-contracts/=packages/ethereum-contracts/',
Expand Down
8 changes: 6 additions & 2 deletions packages/automation-contracts/autowrap/test/Manager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,15 @@ contract ManagerTests is FoundrySuperfluidTester {

/// TESTS

function testFailDeploymentWithoutCFA() public {
function test_RevertWhen_DeploymentWithoutCFA() public {
vm.expectRevert(IManager.ZeroAddress.selector);
new Manager(address(0), 1, 2);
}

function testFailDeploymentWrongLimits() public {
function test_RevertWhen_DeploymentWrongLimits() public {
vm.expectRevert(
abi.encodeWithSelector(IManager.WrongLimits.selector, 2, 1)
);
new Manager(address(sf.cfa), 2, 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ contract WrapStrategyTests is FoundrySuperfluidTester {

/// TESTS

function testFailDeploymentWithoutManager() public {
function test_RevertWhen_DeploymentWithoutManager() public {
vm.expectRevert(IStrategy.ZeroAddress.selector);
new WrapStrategy(address(0));
}

Expand Down
3 changes: 3 additions & 0 deletions packages/automation-contracts/scheduler/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ root = '../../../'
libs = ['lib']
src = 'packages/automation-contracts/scheduler'
solc_version = "0.8.23"
evm_version = 'paris'
optimizer = true
optimizer_runs = 200
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

remappings = [
'@superfluid-finance/solidity-semantic-money/src/=packages/solidity-semantic-money/src/',
'@superfluid-finance/ethereum-contracts/=packages/ethereum-contracts/',
Expand Down
1 change: 1 addition & 0 deletions packages/ethereum-contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Fixed deployment of SimpleForwarder (solved an issue which caused batch operation `OPERATION_TYPE_SIMPLE_FORWARD_CALL` to always revert)
- `SuperTokenV1Library.getFlowRate` and `SuperTokenV1Library.getFlowInfo` now also allow querying the flowrate between pools and pool members
- Superfluid Pools now emit a Transfer event when changing units with `updateMemberUnits`.
- Dependency foundry updated to 1.0

### Breaking
- `SuperTokenV1Library.distributeFlow`: return `actualFlowRate` instead of a bool
Expand Down
6 changes: 3 additions & 3 deletions packages/ethereum-contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function testRevertIfDecreaseFlowRateAllowanceAndACLCreateFlow() {

#### Internal Helper Functions

See [`FoundrySuperfluidTester.sol`](test/foundry/FoundrySuperfluidTester.sol) for examples of commonly used internal helper functions.
See [`FoundrySuperfluidTester.t.sol`](test/foundry/FoundrySuperfluidTester.t.sol) for examples of commonly used internal helper functions.
If you are writing a test that requires a helper function, the helper function is prefixed with `_` and uses camelCase to indicate that it is an internal helper function. For example:

```solidity
Expand Down Expand Up @@ -199,7 +199,7 @@ In foundry, you can use the `SuperfluidFrameworkDeployer` to deploy the Superflu
import "forge-std/Test.sol";

import { ERC1820RegistryCompiled } from "@superfluid-finance/ethereum-contracts/contracts/libs/ERC1820RegistryCompiled.sol";
import { SuperfluidFrameworkDeployer } from "@superfluid-finance/ethereum-contracts/contracts/utils/SuperfluidFrameworkDeployer.sol";
import { SuperfluidFrameworkDeployer } from "@superfluid-finance/ethereum-contracts/contracts/utils/SuperfluidFrameworkDeployer.t.sol";
import { TestToken } from "@superfluid-finance/ethereum-contracts/contracts/utils/TestToken.sol";
import { SuperToken } from "@superfluid-finance/ethereum-contracts/contracts/superfluid/SuperToken.sol";

Expand All @@ -218,7 +218,7 @@ contract SomeTest is Test {
}
}
```
See [SuperfluidFrameworkDeployer.sol](contracts/utils/SuperfluidFrameworkDeployer.sol) for more details.
See [SuperfluidFrameworkDeployer.t.sol](contracts/utils/SuperfluidFrameworkDeployer.t.sol) for more details.

You can also deploy to a local blockchain (`hardhat` or `anvil`) via a forge script. For example, an example `Deploy.s.sol` file:

Expand Down
2 changes: 2 additions & 0 deletions packages/ethereum-contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ignored_error_codes = [
]
# keep in sync with truffle-config.js
evm_version = 'paris'
optimizer = true
optimizer_runs = 200
remappings = [
'@superfluid-finance/ethereum-contracts/contracts/=packages/ethereum-contracts/contracts/',
'@superfluid-finance/solidity-semantic-money/src/=packages/solidity-semantic-money/src/',
Expand Down
3 changes: 3 additions & 0 deletions packages/hot-fuzz/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
root = '../..'
src = 'packages/hot-fuzz/contracts'
solc_version = "0.8.23"
evm_version = 'shanghai'
optimizer = true
optimizer_runs = 200
remappings = [
'@superfluid-finance/ethereum-contracts/contracts/=packages/ethereum-contracts/contracts/',
'@superfluid-finance/solidity-semantic-money/src/=packages/solidity-semantic-money/src/',
Expand Down
2 changes: 2 additions & 0 deletions packages/solidity-semantic-money/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ cache_path = 'packages/solidity-semantic-money/out/default.cache'
solc_version = '0.8.26'
evm_version = 'paris' # no PUSH0 for now
deny_warnings = true
optimizer = true
optimizer_runs = 200
via_ir = false
remappings = [
'@superfluid-finance/solidity-semantic-money/src/=packages/solidity-semantic-money/src/',
Expand Down
Loading