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

foundry test setup #11273

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 4 additions & 0 deletions contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ src = 'src/v0.8/functions/dev/v1_X'
test = 'src/v0.8/functions/tests/v1_X'
gas_price = 3_000_000_000 # 3 gwei

[profile.automationexp]
auto_detect_solc = true
src = 'src/v0.8/automation/'

[profile.vrf]
optimizer_runs = 1000
src = 'src/v0.8/vrf'
Expand Down
13 changes: 13 additions & 0 deletions contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ let config = {
),
hardfork: 'merge',
},
optimism_goerli: {
url: 'https://op.getblock.io/608a6708-d787-4ba8-bcbd-493001ea7fd9/goerli/',
},
},
solidity: {
compilers: [
Expand Down Expand Up @@ -141,6 +144,16 @@ if (process.env.NETWORK_NAME && process.env.EXPLORER_API_KEY) {
apiKey: {
[process.env.NETWORK_NAME]: process.env.EXPLORER_API_KEY,
},
customChains: [
{
network: 'optimism_goerli',
chainId: 420,
urls: {
apiURL: 'https://api-goerli-optimistic.etherscan.io/api',
browserURL: 'https://goerli-optimism.etherscan.io/',
},
},
],
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/remappings.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ds-test/=foundry-lib/forge-std/lib/ds-test/src
forge-std/=foundry-lib/forge-std/src

@openzeppelin/=node_modules/@openzeppelin/
@openzeppelin/=src/v0.8/vendor/openzeppelin-solidity/v4.9.3
hardhat/=node_modules/hardhat/
@eth-optimism/=node_modules/@eth-optimism
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity 0.8.6;

import {Cron as CronInternal, Spec} from "../internal/Cron.sol";
import {ICron as CronInternal, Spec} from "../internal/ICron.sol";

/**
* @title The Cron library
Expand All @@ -10,7 +10,7 @@ import {Cron as CronInternal, Spec} from "../internal/Cron.sol";
* @dev this is the external version of the library, which relies on the internal library
* by the same name.
*/
library Cron {
library ECron {
using CronInternal for Spec;
using CronInternal for string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct Field {
* abstraction called a Spec. The library also includes a spec function, nextTick(), which
* determines the next time a cron job should fire based on the current block timestamp.
*/
library Cron {
library ICron {
using strings for *;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

pragma solidity 0.8.6;

import {Cron as CronInternal, Spec} from "../libraries/internal/Cron.sol";
import {Cron as CronExternal} from "../libraries/external/Cron.sol";
import {ICron as CronInternal, Spec} from "../libraries/internal/ICron.sol";
import {ECron as CronExternal} from "../libraries/external/ECron.sol";

/**
* @title The CronInternalTestHelper contract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
pragma solidity 0.8.6;

import "../upkeeps/CronUpkeep.sol";
import {Cron, Spec} from "../libraries/internal/Cron.sol";
import {ICron, Spec} from "../libraries/internal/ICron.sol";

/**
* @title The CronUpkeepTestHelper contract
* @notice This contract exposes core functionality of the CronUpkeep contract.
* It is only intended for use in tests.
*/
contract CronUpkeepTestHelper is CronUpkeep {
using Cron for Spec;
using Cron for string;
using ICron for Spec;
using ICron for string;

constructor(
address owner,
Expand Down
4 changes: 2 additions & 2 deletions contracts/src/v0.8/automation/upkeeps/CronUpkeep.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "../../shared/access/ConfirmedOwner.sol";
import "../KeeperBase.sol";
import "../interfaces/KeeperCompatibleInterface.sol";
import {Cron as CronInternal, Spec} from "../libraries/internal/Cron.sol";
import {Cron as CronExternal} from "../libraries/external/Cron.sol";
import {ICron as CronInternal, Spec} from "../libraries/internal/ICron.sol";
import {ECron as CronExternal} from "../libraries/external/ECron.sol";

/**
* @title The CronUpkeep contract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
pragma solidity 0.8.6;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {Cron, Spec} from "../libraries/internal/Cron.sol";
import {ICron, Spec} from "../libraries/internal/ICron.sol";

/**
* @title The CronUpkeepDelegate contract
Expand All @@ -13,7 +13,7 @@ import {Cron, Spec} from "../libraries/internal/Cron.sol";
*/
contract CronUpkeepDelegate {
using EnumerableSet for EnumerableSet.UintSet;
using Cron for Spec;
using ICron for Spec;

address private s_owner; // from ConfirmedOwner
address private s_delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity 0.8.6;
import "./CronUpkeep.sol";
import "./CronUpkeepDelegate.sol";
import "../../shared/access/ConfirmedOwner.sol";
import {Spec, Cron as CronExternal} from "../libraries/external/Cron.sol";
import {Spec, ECron as CronExternal} from "../libraries/external/ECron.sol";

/**
* @title The CronUpkeepFactory contract
Expand Down
Loading