-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip on fork tests * Added fork test for creating an edition Updated to use foundry version from npm * moved fork test into its own file
- Loading branch information
Showing
18 changed files
with
287 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: fork tests | ||
|
||
on: push | ||
|
||
env: | ||
FOUNDRY_PROFILE: ci | ||
|
||
jobs: | ||
check: | ||
strategy: | ||
fail-fast: true | ||
|
||
name: Foundry project | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
cache: 'yarn' | ||
|
||
- name: Install project dependencies | ||
run: yarn | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Run fork tests | ||
run: | | ||
forge test -vvv --match-test fork | ||
env: | ||
FORK_TEST_CHAINS: mainnet,goerli,optimism,optimism_goerli,zora,zora_goerli,base_goerli,base | ||
ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }} | ||
id: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule forge-std
deleted from
a2edd3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Script.sol"; | ||
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; | ||
import {ZoraNFTCreatorV1} from "../src/ZoraNFTCreatorV1.sol"; | ||
import {IERC721Drop} from "../src/interfaces/IERC721Drop.sol"; | ||
|
||
/// @notice Chain configuration for constants set manually during deploy. Does not get written to after deploys. | ||
struct ChainConfig { | ||
/// @notice The user that owns the factory proxy. Allows ability to upgrade for new implementations deployed. | ||
address factoryOwner; | ||
/// @notice The user that owns the factory upgrade gate. This contract gates what existing deployed impls can upgrade to. | ||
address factoryUpgradeGateOwner; | ||
/// @notice Mint fee amount in WEI charged for each mint | ||
uint256 mintFeeAmount; | ||
/// @notice Mint fee recipient user | ||
address mintFeeRecipient; | ||
/// @notice Subscription address for operator-filterer-registry (opensea / cori) | ||
address subscriptionMarketFilterAddress; | ||
/// @notice Owner for subscription of operator-filterer-registry (opensea / cori) | ||
address subscriptionMarketFilterOwner; | ||
/// @notice Auto-approved hyperstructure on mainnet for enabling ZORA v3 with less gas. Deprecated – safe to set to address(0x) | ||
address zoraERC721TransferHelper; | ||
} | ||
|
||
/// @notice Deployment addresses – set to new deployed addresses by the scripts. | ||
struct DropDeployment { | ||
/// @notice Metadata renderer for drop style contracts | ||
address dropMetadata; | ||
/// @notice Metadata renderer for edition style contracts | ||
address editionMetadata; | ||
/// @notice Implementation contract for the drop contract | ||
address dropImplementation; | ||
/// @notice Factory upgrade gate immutable registry for allowing upgrades | ||
address factoryUpgradeGate; | ||
/// @notice Factory proxy contract that creates zora drops style NFT contracts | ||
address factory; | ||
/// @notice Factory implementation contract that is the impl for the above proxy. | ||
address factoryImpl; | ||
} | ||
|
||
/// @notice Deployment drops for base where | ||
abstract contract DeploymentConfig is StdChains, StdCheatsSafe, StdUtils, ScriptBase { | ||
using stdJson for string; | ||
|
||
/// @notice ChainID convenience getter | ||
/// @return id chainId | ||
function chainId() internal view virtual returns (uint256 id); | ||
|
||
/// @notice File used for demo metadata on verification test mint | ||
string constant DEMO_IPFS_METADATA_FILE = "ipfs://bafkreigu544g6wjvqcysurpzy5pcskbt45a5f33m6wgythpgb3rfqi3lzi"; | ||
|
||
/// | ||
// These are the JSON key constants to standardize writing and reading configuration | ||
/// | ||
|
||
string constant FACTORY_OWNER = "FACTORY_OWNER"; | ||
string constant FACTORY_UPGRADE_GATE_OWNER = "FACTORY_OWNER"; | ||
string constant MINT_FEE_AMOUNT = "MINT_FEE_AMOUNT"; | ||
string constant MINT_FEE_RECIPIENT = "MINT_FEE_RECIPIENT"; | ||
string constant SUBSCRIPTION_MARKET_FILTER_ADDRESS = "SUBSCRIPTION_MARKET_FILTER_ADDRESS"; | ||
string constant SUBSCRIPTION_MARKET_FILTER_OWNER = "SUBSCRIPTION_MARKET_FILTER_OWNER"; | ||
string constant ZORA_ERC721_TRANSFER_HELPER = "ZORA_ERC721_TRANSFER_HELPER"; | ||
|
||
string constant DROP_METADATA_RENDERER = "DROP_METADATA_RENDERER"; | ||
string constant EDITION_METADATA_RENDERER = "EDITION_METADATA_RENDERER"; | ||
string constant ERC721DROP_IMPL = "ERC721DROP_IMPL"; | ||
string constant FACTORY_UPGRADE_GATE = "FACTORY_UPGRADE_GATE"; | ||
string constant ZORA_NFT_CREATOR_PROXY = "ZORA_NFT_CREATOR_PROXY"; | ||
string constant ZORA_NFT_CREATOR_V1_IMPL = "ZORA_NFT_CREATOR_V1_IMPL"; | ||
|
||
/// @notice Return a prefixed key for reading with a ".". | ||
/// @param key key to prefix | ||
/// @return prefixed key | ||
function getKeyPrefix(string memory key) internal pure returns (string memory) { | ||
return string.concat(".", key); | ||
} | ||
|
||
/// @notice Returns the chain configuration struct from the JSON configuration file | ||
/// @return chainConfig structure | ||
function getChainConfig() internal view returns (ChainConfig memory chainConfig) { | ||
string memory json = vm.readFile(string.concat("chainConfigs/", Strings.toString(chainId()), ".json")); | ||
chainConfig.factoryOwner = json.readAddress(getKeyPrefix(FACTORY_OWNER)); | ||
chainConfig.factoryUpgradeGateOwner = json.readAddress(getKeyPrefix(FACTORY_UPGRADE_GATE_OWNER)); | ||
chainConfig.mintFeeAmount = json.readUint(getKeyPrefix(MINT_FEE_AMOUNT)); | ||
chainConfig.mintFeeRecipient = json.readAddress(getKeyPrefix(MINT_FEE_RECIPIENT)); | ||
chainConfig.subscriptionMarketFilterAddress = json.readAddress(getKeyPrefix(SUBSCRIPTION_MARKET_FILTER_ADDRESS)); | ||
chainConfig.subscriptionMarketFilterOwner = json.readAddress(getKeyPrefix(SUBSCRIPTION_MARKET_FILTER_OWNER)); | ||
chainConfig.zoraERC721TransferHelper = json.readAddress(getKeyPrefix(ZORA_ERC721_TRANSFER_HELPER)); | ||
} | ||
|
||
/// @notice Get the deployment configuration struct from the JSON configuration file | ||
/// @return dropDeployment deployment configuration structure | ||
function getDeployment() internal view returns (DropDeployment memory dropDeployment) { | ||
string memory json = vm.readFile(string.concat("addresses/", Strings.toString(chainId()), ".json")); | ||
dropDeployment.dropMetadata = json.readAddress(getKeyPrefix(DROP_METADATA_RENDERER)); | ||
dropDeployment.editionMetadata = json.readAddress(getKeyPrefix(EDITION_METADATA_RENDERER)); | ||
dropDeployment.dropImplementation = json.readAddress(getKeyPrefix(ERC721DROP_IMPL)); | ||
dropDeployment.factoryUpgradeGate = json.readAddress(getKeyPrefix(FACTORY_UPGRADE_GATE)); | ||
dropDeployment.factory = json.readAddress(getKeyPrefix(ZORA_NFT_CREATOR_PROXY)); | ||
dropDeployment.factoryImpl = json.readAddress(getKeyPrefix(ZORA_NFT_CREATOR_V1_IMPL)); | ||
} | ||
|
||
} | ||
|
||
contract ForkDeploymentConfig is DeploymentConfig { | ||
function chainId() internal view override returns (uint256 id) { | ||
return block.chainid; | ||
} | ||
} | ||
|
||
contract ScriptDeploymentConfig is DeploymentConfig { | ||
function chainId() internal view override returns (uint256 id) { | ||
assembly { | ||
id := chainid() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.