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

Feature/g7 adding slot uri and improvements #22

Merged
merged 16 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
WEB3_INFURA_PROJECT_ID=YOUR_PROJECT_ID_HERE
POLYGONSCAN_TOKEN=
17 changes: 17 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"root": true,
"extends": ["eslint:recommended", "prettier"],
"env": {
"es2022": true,
"browser": true,
"node": true,
"mocha": true
},
"globals": {
"artifacts": "readonly",
"contract": "readonly",
"web3": "readonly",
"extendEnvironment": "readonly",
"expect": "readonly"
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,4 @@ prod.test.env
dev.test.env

scratch/
.idea
14 changes: 14 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"printWidth": 120,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid",
"overrides": [
{
"files": "*.sol",
"options": {
"singleQuote": false
}
}
]
}
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ The contributing guide is in progress...

First, set up a Python3 environment:

- Check if you have Python3 installed on your system: `python3 --version`.
- If the above command errors out, you need to install Python3. You can find instructions for how to
do this at https://python.org.
- Create a Python virtual environment in the root of this directory: `python3 -m venv .game7`
- Activate the virtual environment: `source .game7/bin/activate` (when you are finished working in this
code base, you can deactivate the virtual environment using the `deactivate` command).
- Install the `game7ctl` package: `pip install -e game7ctl/`
- Check if you have Python3 installed on your system: `python3 --version`.
- If the above command errors out, you need to install Python3. You can find instructions for how to
do this at https://python.org.
- Create a Python virtual environment in the root of this directory: `python3 -m venv .game7`
- Activate the virtual environment: `source .game7/bin/activate` (when you are finished working in this
code base, you can deactivate the virtual environment using the `deactivate` command).
- Install the `game7ctl` package: `pip install -e game7ctl/`

Following these steps will make the `game7ctl` command available in your shell. You can use this command-line
tool to deploy and interact with the smart contracts in this repository. For more details:
Expand All @@ -37,7 +37,7 @@ To compile the smart contracts using `brownie`, run the following command from t
brownie compile
```

To set up a *development* environment, you have to also install the developer dependencies using:
To set up a _development_ environment, you have to also install the developer dependencies using:

```
pip install -e "game7ctl/[dev]"
Expand Down Expand Up @@ -72,13 +72,13 @@ If you want to register your contract for automatic regeneration, please add it
### `game7ctl`

Once you have set up `game7ctl`, you can use it to deploy the contracts in this repository. For example,
to deploy the Inventory contract as a Diamond proxy, you would use the `game7ctl core inventory-gogogo` command.
to deploy the Inventory contract as a Diamond proxy, you would use the `game7ctl core dao` command.

To see all the parameters you can pass in the deployment, run:

```
$ game7ctl core inventory-gogogo --help
usage: game7ctl inventory-gogogo [-h] --network NETWORK [--address ADDRESS] --sender SENDER [--password PASSWORD] [--gas-price GAS_PRICE] [--max-fee-per-gas MAX_FEE_PER_GAS]
$ game7ctl dao systems --help
usage: game7ctl dao [-h] --network NETWORK [--address ADDRESS] --sender SENDER [--password PASSWORD] [--gas-price GAS_PRICE] [--max-fee-per-gas MAX_FEE_PER_GAS]
[--max-priority-fee-per-gas MAX_PRIORITY_FEE_PER_GAS] [--confirmations CONFIRMATIONS] [--nonce NONCE] [--value VALUE] [--verbose] --admin-terminus-address
ADMIN_TERMINUS_ADDRESS --admin-terminus-pool-id ADMIN_TERMINUS_POOL_ID --subject-erc721-address SUBJECT_ERC721_ADDRESS
[--diamond-cut-address DIAMOND_CUT_ADDRESS] [--diamond-address DIAMOND_ADDRESS] [--diamond-loupe-address DIAMOND_LOUPE_ADDRESS]
Expand Down Expand Up @@ -138,7 +138,7 @@ brownie networks add Polygon $NETWORK_NAME host=$JSONRPC_URL chainid=137 explore

The only keys which are not optional are `chainid` and `host`.

Then, you could pass `--network $NETWORK_NAME` as an argument to `game7ctl core inventory-gogogo`.
Then, you could pass `--network $NETWORK_NAME` as an argument to `game7ctl core dao`.

##### `--sender`

Expand All @@ -156,3 +156,14 @@ Then you can pass `--sender $ACCOUNT_NAME` to `game7ctl`.
The preferred way of using `--sender` is still by passing a keystore file.

`brownie` will always prompt you to unlock the account with a password.

##### Deployment Example:

If you follow all the explanations above, you should be able to deploy the entire Diamond proxy with the InventoryFacet

Using a command like this:

```
game7ctl dao systems --network <NETWORK> --admin-terminus-address <TERMINUS_ADMIN_ADDRESS> --admin-terminus-pool-id <POOL_ID> --sender <BROWNIE_ACCOUNT/KEYSTORE FILE PATH> --subject-erc721-address <ERC_721_CONTRACT_ADDRESS>
```

4 changes: 3 additions & 1 deletion brownie-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
dotenv: .env

dependencies:
- "OpenZeppelin/openzeppelin-contracts@4.3.2"
- "OpenZeppelin/openzeppelin-contracts@4.4.0"
- "bugout-dev/[email protected]"
- "bugout-dev/[email protected]"

Expand Down
7 changes: 4 additions & 3 deletions contracts/diamond/Diamond.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ pragma solidity ^0.8.0;
// Adapted from the Diamond 3 reference implementation by Nick Mudge:
// https://github.com/mudgen/diamond-3-hardhat

import {LibDiamond} from "./libraries/LibDiamond.sol";
import {IDiamondCut} from "./interfaces/IDiamondCut.sol";
import {LibDiamond} from "../libraries/LibDiamond.sol";
import {IDiamondCut} from "../interfaces/IDiamondCut.sol";
import {IDiamond} from "../interfaces/IDiamond.sol";

contract Diamond {
contract Diamond is IDiamond {
constructor(address _contractOwner, address _diamondCutFacet) payable {
LibDiamond.setContractOwner(_contractOwner);

Expand Down
Loading