Skip to content

Commit

Permalink
Add tests (#140)
Browse files Browse the repository at this point in the history
* clean up

* add NOTES.md

* fix tests

* rm Delegation Chains

* fix gh action

* rm arthera

* fix pnpm version
  • Loading branch information
julienbrg authored Nov 21, 2024
1 parent d6e6a92 commit c5395c2
Show file tree
Hide file tree
Showing 10 changed files with 3,208 additions and 2,795 deletions.
10 changes: 1 addition & 9 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Arthera Mainnet
ARTHERA_MAINNET_RPC_ENDPOINT_URL="https://rpc.arthera.net"
ARTHERA_MAINNET_PRIVATE_KEY="88888"

# Sepolia
SEPOLIA_RPC_ENDPOINT_URL="https://ethereum-sepolia.publicnode.com"
SEPOLIA_PRIVATE_KEY="88888"
Expand All @@ -10,8 +6,4 @@ ETHERSCAN_API_KEY="88888"
# OP Sepolia
OP_SEPOLIA_RPC_ENDPOINT_URL="https://sepolia.optimism.io"
OP_SEPOLIA_PRIVATE_KEY="88888"
OP_ETHERSCAN_API_KEY="88888"

# Arthera Testnet
ARTHERA_TESTNET_RPC_ENDPOINT_URL="https://rpc-test.arthera.net"
ARTHERA_TESTNET_PRIVATE_KEY="88888"
OP_ETHERSCAN_API_KEY="88888"
5 changes: 4 additions & 1 deletion workflows/node.js.yml → .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node.js CI
name: Tests

on:
push:
Expand Down Expand Up @@ -48,3 +48,6 @@ jobs:

- name: Check code formatting with Prettier
run: pnpm run prettier-check

- name: Run tests
run: pnpm test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ cache
artifacts

.env*
!.env.template
!.env.template
NOTES.md
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ The following functions are `onlyOwner`, and since the NFT contract ownership is
## Versions

- Node [v20.9.0](https://nodejs.org/uk/blog/release/v20.9.0/)
- pnpm [v8.7.5](https://pnpm.io/)
- pnpm [v9.12.2](https://pnpm.io/)
- OpenZeppelin Contracts [v5.0.1](https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v5.0.1)

## Support
Expand Down
3 changes: 0 additions & 3 deletions contracts/Gov.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";

/// @title DAO Contract
/// @notice This contract implements a voting system using OpenZeppelin's Governor framework
/// @dev Uses OpenZeppelin contracts v5.0.2
contract Gov is
Governor,
GovernorSettings,
Expand Down
112 changes: 0 additions & 112 deletions deploy/deploy-gov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,118 +50,6 @@ export default async ({ getNamedAccounts, deployments }: any) => {
})

switch (hre.network.name) {
case "arthera":
try {
console.log(
"NFT contract deployed:",
msg(nft.receipt.contractAddress)
)
console.log("\nEtherscan verification in progress...")
console.log(
"\nWaiting for 6 block confirmations (you can skip this part)"
)
await wait(90 * 1000)
await hre.run("verify:verify", {
network: network.name,
address: nft.receipt.contractAddress,
constructorArguments: [
deployer,
firstMembers,
uri,
name,
symbol
]
})
console.log("NFT contract verification done. ✅")
} catch (error) {
console.error(error)
}

try {
console.log(
"DAO contract deployed:",
msg(gov.receipt.contractAddress)
)
console.log("\nEtherscan verification in progress...")
console.log(
"\nWaiting for 6 block confirmations (you can skip this part)"
)
await hre.run("verify:verify", {
network: network.name,
address: gov.receipt.contractAddress,
constructorArguments: [
nft.address,
manifesto,
daoName,
votingDelay,
votingPeriod,
votingThreshold,
quorum
]
})
console.log("DAO contract verification done. ✅")
} catch (error) {
console.error(error)
}

break

case "arthera-testnet":
try {
console.log(
"NFT contract deployed:",
msg(nft.receipt.contractAddress)
)
console.log("\nEtherscan verification in progress...")
console.log(
"\nWaiting for 6 block confirmations (you can skip this part)"
)
await wait(12 * 1000)
await hre.run("verify:verify", {
network: network.name,
address: nft.receipt.contractAddress,
constructorArguments: [
deployer,
firstMembers,
uri,
name,
symbol
]
})
console.log("NFT contract verification done. ✅")
} catch (error) {
console.error(error)
}

try {
console.log(
"DAO contract deployed:",
msg(gov.receipt.contractAddress)
)
console.log("\nEtherscan verification in progress...")
console.log(
"\nWaiting for 6 block confirmations (you can skip this part)"
)
await hre.run("verify:verify", {
network: network.name,
address: gov.receipt.contractAddress,
constructorArguments: [
nft.address,
manifesto,
daoName,
votingDelay,
votingPeriod,
votingThreshold,
quorum
]
})
console.log("DAO contract verification done. ✅")
} catch (error) {
console.error(error)
}

break

case "sepolia":
try {
console.log(
Expand Down
24 changes: 1 addition & 23 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ const {
SEPOLIA_RPC_ENDPOINT_URL,
SEPOLIA_PRIVATE_KEY,
ETHERSCAN_API_KEY,
ARTHERA_TESTNET_RPC_ENDPOINT_URL,
ARTHERA_TESTNET_PRIVATE_KEY,
OP_SEPOLIA_RPC_ENDPOINT_URL,
OP_SEPOLIA_PRIVATE_KEY,
OP_ETHERSCAN_API_KEY,
ARTHERA_MAINNET_RPC_ENDPOINT_URL,
ARTHERA_MAINNET_PRIVATE_KEY
OP_ETHERSCAN_API_KEY
} = process.env

const config: HardhatUserConfig = {
Expand All @@ -28,14 +24,6 @@ const config: HardhatUserConfig = {
chainId: 1337,
allowUnlimitedContractSize: true
},
arthera: {
chainId: 10242,
url: ARTHERA_MAINNET_RPC_ENDPOINT_URL || "https://rpc.arthera.net",
accounts:
ARTHERA_MAINNET_PRIVATE_KEY !== undefined
? [ARTHERA_MAINNET_PRIVATE_KEY]
: []
},
sepolia: {
chainId: 11155111,
url:
Expand All @@ -53,16 +41,6 @@ const config: HardhatUserConfig = {
OP_SEPOLIA_PRIVATE_KEY !== undefined
? [OP_SEPOLIA_PRIVATE_KEY]
: []
},
"arthera-testnet": {
chainId: 10243,
url:
ARTHERA_TESTNET_RPC_ENDPOINT_URL ||
"https://rpc-test.arthera.net",
accounts:
ARTHERA_TESTNET_PRIVATE_KEY !== undefined
? [ARTHERA_TESTNET_PRIVATE_KEY]
: []
}
},
solidity: {
Expand Down
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
"scripts": {
"test": "hardhat test",
"compile": "hardhat compile",
"deploy:arthera": "hardhat deploy --network arthera --reset",
"deploy:sepolia": "hardhat deploy --network sepolia --reset",
"deploy:arthera-testnet": "hardhat deploy --network arthera-testnet && hardhat sourcify --network arthera-testnet --reset",
"deploy:op-sepolia": "hardhat deploy --network op-sepolia --reset",
"sourcify:arthera": "hardhat sourcify --network arthera",
"sourcify:arthera-testnet": "hardhat sourcify --network arthera-testnet",
"bal": "npx hardhat run scripts/check-my-balance.ts --network",
"prettier": "prettier --write \"**/*.ts\"",
"prettier-check": "prettier --check \"**/*.ts\"",
Expand Down
Loading

0 comments on commit c5395c2

Please sign in to comment.