Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
docs/nit: configs, commands, pkgs, and unused files (#79)
Browse files Browse the repository at this point in the history
* docs/nit: configs, commands, pkgs, and unused files

* nit: makefile
  • Loading branch information
jdubpark authored Feb 6, 2024
1 parent aed5821 commit 536f33b
Show file tree
Hide file tree
Showing 10 changed files with 2,154 additions and 23,558 deletions.
13 changes: 9 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
MAINNET_URL = https://eth-mainnet.g.alchemy.com/v2/1234123412341234
MAINNET_PRIVATEKEY= 12341234123412341234123412341234

# GOERLI
GOERLI_URL = https://eth-goerli.g.alchemy.com/v2/1234123412341234
GOERLI_PRIVATEKEY = 12341234123412341234123412341234
# SEPOLIA
SEPOLIA_URL = https://eth-sepolia.g.alchemy.com/v2/1234123412341234
SEPOLIA_PRIVATEKEY = 12341234123412341234123412341234

# ETHSCAN
# TENDERLY
USE_TENDERLY = false
TENDERLY_URL =
TENDERLY_PRIVATEKEY =

# ETHERSCAN APIY KEY
ETHERSCAN_API_KEY = ETHERSCANAPIKEYETHERSCANAPIKEY
38 changes: 16 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-include .env

.PHONY: all test clean coverage typechain deploy-main
.PHONY: all test clean coverage typechain format abi

all: clean install build

Expand All @@ -19,7 +19,7 @@ clean :; npx hardhat clean
# Remove modules
forge-remove :; rm -rf .gitmodules && rm -rf .git/modules/* && rm -rf lib && touch .gitmodules && git add . && git commit -m "modules"

install :; npm install
install :; yarn install

# Update Dependencies
forge-update :; forge update
Expand All @@ -37,9 +37,6 @@ slither :; slither ./contracts
format:
npx prettier --write contracts/*.sol
npx prettier --write contracts/**/*.sol
npx prettier --write contracts/**/**/*.sol
npx prettier --write contracts/**/**/**/*.sol
npx prettier --write contracts/**/**/**/**/*.sol

# generate forge coverage on pinned mainnet fork
# process lcov file, ignore test, script, and contracts/mocks folders
Expand All @@ -53,19 +50,26 @@ coverage:
abi:
mkdir -p abi
@$(call generate_abi,"AccessController",".")
@$(call generate_abi,"IPAccountImpl",".")
@$(call generate_abi,"Governance","./governance")
@$(call generate_abi,"DisputeModule","./modules/dispute-module")
@$(call generate_abi,"ArbitrationPolicySP","./modules/dispute-module/policies")
@$(call generate_abi,"LicensingModule","./modules/licensing")
@$(call generate_abi,"UMLPolicyFrameworkManager","./modules/licensing")
@$(call generate_abi,"RoyaltyModule","./modules/royalty-module")
@$(call generate_abi,"LSClaimer","./modules/royalty-module/policies")
@$(call generate_abi,"RoyaltyPolicyLS","./modules/royalty-module/policies")
@$(call generate_abi,"TaggingModule","./modules/tagging")
@$(call generate_abi,"RegistrationModule","./modules")
@$(call generate_abi,"IPAssetRenderer","./registries/metadata")
@$(call generate_abi,"IPMetadataProvider","./registries/metadata")
@$(call generate_abi,"MetadataProviderV1","./registries/metadata")
@$(call generate_abi,"IPAccountRegistry","./registries")
@$(call generate_abi,"IPRecordRegistry","./registries")
@$(call generate_abi,"IPAssetRegistry","./registries")
@$(call generate_abi,"LicenseRegistry","./registries")
@$(call generate_abi,"ModuleRegistry","./registries")
@$(call generate_abi,"IPMetadataResolver","./resolvers")
@$(call generate_abi,"IPResolver","./resolvers")
@$(call generate_abi,"KeyValueResolver","./resolvers")

# typechain:
# make abi
# rm -rf ./types-typechain
# npx typechain --target ethers-v6 ./abi/*.json --out-dir ./types-typechain
typechain :; npx hardhat typechain

# solhint should be installed globally
Expand All @@ -76,13 +80,3 @@ verify-goerli :; npx hardhat verify --network goerli ${contract}

anvil :; anvil -m 'test test test test test test test test test test test junk'

# run: RPC_URL=https://rpc.url make deploy-main
deploy-main :; forge script script/foundry/deployment/Main.s.sol:Main --rpc-url ${RPC_URL} --broadcast --verify -vvvv

deploy-main-hh:
npx hardhat run script/hardhat/deployment/00-deploy-main.ts --network ${NETWORK}

deploy-tenderly:
rm -rf deployments/hardhat/*.json
npx hardhat run script/hardhat/post-deployment/99-revert-chain.ts --network tenderly
npx hardhat run script/hardhat/deployment/00-deploy-main.ts --network tenderly
16 changes: 0 additions & 16 deletions contracts/mocks/MockERC20.sol

This file was deleted.

31 changes: 0 additions & 31 deletions contracts/mocks/MockERC721.sol

This file was deleted.

6 changes: 3 additions & 3 deletions contracts/registries/metadata/MetadataProviderV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ contract MetadataProviderV1 is MetadataProviderBase {
if (decodedMetadata.hash == "") {
revert Errors.MetadataProvider__HashInvalid();
}
if (decodedMetadata.registrationDate != uint64(block.timestamp)) {
revert Errors.MetadataProvider__RegistrationDateInvalid();
}
// if (decodedMetadata.registrationDate != uint64(block.timestamp)) {
// revert Errors.MetadataProvider__RegistrationDateInvalid();
// }
if (decodedMetadata.registrant == address(0)) {
revert Errors.MetadataProvider__RegistrantInvalid();
}
Expand Down
54 changes: 34 additions & 20 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,27 @@ import "hardhat-contract-sizer" // npx hardhat size-contracts

require("dotenv").config()

tdly.setup({
automaticVerifications: true,
})

//
// NOTE:
// To load the correct .env, you must run this at the root folder (where hardhat.config is located)
//
const MAINNET_URL = process.env.MAINNET_URL || "https://eth-mainnet"
const MAINNET_PRIVATEKEY = process.env.MAINNET_PRIVATEKEY || "0xkey"
const GOERLI_URL = process.env.GOERLI_URL || "https://eth-goerli"
const GOERLI_PRIVATEKEY = process.env.GOERLI_PRIVATEKEY || "0xkey"
const SEPOLIA_URL = process.env.SEPOLIA_URL || "https://eth-sepolia"
const SEPOLIA_PRIVATEKEY = process.env.SEPOLIA_PRIVATEKEY || "0xkey"
const TENDERLY_URL = process.env.TENDERLY_URL || "https://eth-tenderly"
const TENDERLY_PRIVATEKEY = process.env.TENDERLY_PRIVATEKEY || "0xkey"
const USE_TENDERLY = process.env.USE_TENDERLY === "true"

const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || "key"

const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY || "key"

if (USE_TENDERLY) {
tdly.setup({
automaticVerifications: true,
})
}

/** @type import('hardhat/config').HardhatUserConfig */
const config: HardhatUserConfig = {
solidity: {
Expand Down Expand Up @@ -61,16 +65,24 @@ const config: HardhatUserConfig = {
chainId: 31337,
url: "http://127.0.0.1:8545/",
},
tenderly: {
url: MAINNET_URL || "",
mainnet: {
chainId: 1,
url: MAINNET_URL || "",
accounts: [MAINNET_PRIVATEKEY],
},
goerli: {
chainId: 5,
url: GOERLI_URL || "",
accounts: [GOERLI_PRIVATEKEY],
},
...(USE_TENDERLY? ({
tenderly: {
chainId: 11155111,
url: TENDERLY_URL || "",
accounts: [TENDERLY_PRIVATEKEY],
}
}) : ({
sepolia: {
chainId: 11155111,
url: SEPOLIA_URL || "",
accounts: [SEPOLIA_PRIVATEKEY],
}
})),
},
// @ts-ignore
namedAccounts: {
Expand All @@ -91,12 +103,14 @@ const config: HardhatUserConfig = {
etherscan: {
apiKey: ETHERSCAN_API_KEY,
},
tenderly: {
project: process.env.TENDERLY_PROJECT_SLUG || "",
username: process.env.TENDERLY_USERNAME || "",
forkNetwork: 1, // fork mainnet
privateVerification: process.env.TENDERLY_PRIVATE_VERIFICATION === "true",
},
...(USE_TENDERLY? ({
tenderly: {
project: process.env.TENDERLY_PROJECT_SLUG || "",
username: process.env.TENDERLY_USERNAME || "",
forkNetwork: 1, // fork mainnet
privateVerification: process.env.TENDERLY_PRIVATE_VERIFICATION === "true",
},
}) : ({})),
typechain: {
outDir: "typechain",
target: "ethers-v6",
Expand Down
8 changes: 4 additions & 4 deletions helper-hardhat-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ export interface networkConfigInfo {
}

export const networkConfig: networkConfigInfo = {
5: {
name: "goerli",
blockConfirmations: 6,
},
31337: {
name: "hardhat",
},
11155111: {
name: "sepolia",
blockConfirmations: 6,
},
}

export const developmentChains = ["hardhat", "localhost"]
Loading

0 comments on commit 536f33b

Please sign in to comment.