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

Full review #5

Closed
wants to merge 24 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
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Your Etherscan API key for contract source code verification.
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
# Your infura.io project ID for deploying to Ethereum networks.
INFURA_ID=73157d26f55d413eb06614f4ead1de461
# The private key of your address for deploying contracts on public networks.
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
artifacts
cache
coverage
*.js
25 changes: 25 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
env: {
browser: false,
es2021: true,
mocha: true,
node: true
},
plugins: ["@typescript-eslint"],
extends: ["airbnb-base", "prettier", "plugin:node/recommended"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 12
},
rules: {
"func-names": "off",
"no-console": "off",
"import/no-extraneous-dependencies": ["error", { devDependencies: true }],
"node/no-unpublished-import": "off",
"node/no-unsupported-features/es-syntax": ["error", { ignores: ["modules"] }],
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error"
}
};
65 changes: 65 additions & 0 deletions .github/workflows/contract-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Code checks

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: "18"
cache: "npm"

- name: Cache node modules
uses: actions/cache@v3
id: cache
with:
path: "**/node_modules"
key: npm-v1-${{ hashFiles('**/package-lock.json') }}
restore-keys: npm-v1-

- name: Install dependencies
run: npm ci
if: steps.cache.outputs.cache-hit != 'true'

- name: Lint contracts
run: npm run lint-contracts

- name: Lint scripts
run: npm run lint-ts

tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: "18"
cache: "npm"

- name: Cache node modules
uses: actions/cache@v3
id: cache
with:
path: "**/node_modules"
key: npm-v1-${{ hashFiles('**/package-lock.json') }}
restore-keys: npm-v1-

- name: Install dependencies
run: npm ci
if: steps.cache.outputs.cache-hit != 'true'

- name: Run tests
run: npm test
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
.env
coverage
coverage.json
typechain

#Hardhat files
cache
artifacts
209 changes: 209 additions & 0 deletions .openzeppelin/mainnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
{
"manifestVersion": "3.2",
"proxies": [
{
"address": "0x6ee2dD02FBFb71F518827042B6aDca242F1ba0B2",
"txHash": "0x5e8f65bb51025ed2570a7d2a306de5efccdd7431a3657ee3a930866c37a261fb",
"kind": "uups"
}
],
"impls": {
"db621ba457a52498bb334e34303ac90c51d026c208fe64771a9a277b77c33124": {
"address": "0xc3563655d35397b77228c07a7F5301b0e0Fa417D",
"txHash": "0x28932920b3788303723d4e3cfd427ab568b9c80f50ffdfc9ec2c8278f9662774",
"layout": {
"solcVersion": "0.8.19",
"storage": [
{
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63",
"retypedFrom": "bool"
},
{
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68"
},
{
"label": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage",
"contract": "ERC1967UpgradeUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:169"
},
{
"label": "__gap",
"offset": 0,
"slot": "51",
"type": "t_array(t_uint256)50_storage",
"contract": "UUPSUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:111"
},
{
"label": "__gap",
"offset": 0,
"slot": "101",
"type": "t_array(t_uint256)50_storage",
"contract": "ContextUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36"
},
{
"label": "_owner",
"offset": 0,
"slot": "151",
"type": "t_address",
"contract": "OwnableUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22"
},
{
"label": "__gap",
"offset": 0,
"slot": "152",
"type": "t_array(t_uint256)49_storage",
"contract": "OwnableUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94"
},
{
"label": "treasury",
"offset": 0,
"slot": "201",
"type": "t_address_payable",
"contract": "TreasuryManager",
"src": "contracts/utils/TreasuryManager.sol:10"
},
{
"label": "fee",
"offset": 0,
"slot": "202",
"type": "t_uint256",
"contract": "TreasuryManager",
"src": "contracts/utils/TreasuryManager.sol:12"
},
{
"label": "__gap",
"offset": 0,
"slot": "203",
"type": "t_array(t_uint256)48_storage",
"contract": "TreasuryManager",
"src": "contracts/utils/TreasuryManager.sol:15"
},
{
"label": "validSigner",
"offset": 0,
"slot": "251",
"type": "t_address",
"contract": "GuildRewardNFTFactory",
"src": "contracts/GuildRewardNFTFactory.sol:20"
},
{
"label": "nftImplementations",
"offset": 0,
"slot": "252",
"type": "t_mapping(t_enum(ContractType)6428,t_address)",
"contract": "GuildRewardNFTFactory",
"src": "contracts/GuildRewardNFTFactory.sol:22"
},
{
"label": "deployedTokenContracts",
"offset": 0,
"slot": "253",
"type": "t_mapping(t_address,t_array(t_struct(Deployment)6434_storage)dyn_storage)",
"contract": "GuildRewardNFTFactory",
"src": "contracts/GuildRewardNFTFactory.sol:23"
},
{
"label": "__gap",
"offset": 0,
"slot": "254",
"type": "t_array(t_uint256)47_storage",
"contract": "GuildRewardNFTFactory",
"src": "contracts/GuildRewardNFTFactory.sol:26"
}
],
"types": {
"t_address": {
"label": "address",
"numberOfBytes": "20"
},
"t_address_payable": {
"label": "address payable",
"numberOfBytes": "20"
},
"t_array(t_struct(Deployment)6434_storage)dyn_storage": {
"label": "struct IGuildRewardNFTFactory.Deployment[]",
"numberOfBytes": "32"
},
"t_array(t_uint256)47_storage": {
"label": "uint256[47]",
"numberOfBytes": "1504"
},
"t_array(t_uint256)48_storage": {
"label": "uint256[48]",
"numberOfBytes": "1536"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]",
"numberOfBytes": "1568"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]",
"numberOfBytes": "1600"
},
"t_bool": {
"label": "bool",
"numberOfBytes": "1"
},
"t_enum(ContractType)6428": {
"label": "enum IGuildRewardNFTFactory.ContractType",
"members": [
"BASIC_NFT"
],
"numberOfBytes": "1"
},
"t_mapping(t_address,t_array(t_struct(Deployment)6434_storage)dyn_storage)": {
"label": "mapping(address => struct IGuildRewardNFTFactory.Deployment[])",
"numberOfBytes": "32"
},
"t_mapping(t_enum(ContractType)6428,t_address)": {
"label": "mapping(enum IGuildRewardNFTFactory.ContractType => address)",
"numberOfBytes": "32"
},
"t_struct(Deployment)6434_storage": {
"label": "struct IGuildRewardNFTFactory.Deployment",
"members": [
{
"label": "contractAddress",
"type": "t_address",
"offset": 0,
"slot": "0"
},
{
"label": "contractType",
"type": "t_enum(ContractType)6428",
"offset": 20,
"slot": "0"
}
],
"numberOfBytes": "32"
},
"t_uint256": {
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint8": {
"label": "uint8",
"numberOfBytes": "1"
}
}
}
}
}
}
Loading