Skip to content

Commit

Permalink
explaining relation between contracts and permission tempplate.
Browse files Browse the repository at this point in the history
  • Loading branch information
calvogenerico committed Dec 11, 2024
1 parent e503829 commit 579ff7e
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 3 deletions.
44 changes: 41 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,42 @@ In order to deploy the contracts in this repo you are going to need [foundry zks
The contracts in this repo are variations of well known standards taking adventage of the privacy and access control
provided by double zero. Each contracts has comments in the source code explaining how they work and why they work.

At the moment we have 4 example contracts, that are variations of erc20 and erc721:


### PublicSelectionErc721

This is a variation of ERC721 where where the inventory of each user is private (secured by double zewro layer)
and then each user can select a sub set of their inventory to make public.

**source code:** [PublicSelectionErc721.sol](./src/PublicSelectionErc721.sol)
**permission template:** [erc721-public-selection.yaml](./permission-templates/erc721-public-selection.yaml)

### PublicScopedBalanceErc20

Variation of ERC20 where each user can select a threshold. And then anyone can check if the user has more or less balance
than that threshold.

**source code:** [PublicScopedBalanceErc20.sol](./src/PublicScopedBalanceErc20.sol)
**permission template:** [erc20-public-scoped-balance.yaml](./permission-templates/erc20-public-scoped-balance.yaml)


### ShareBalanceErc20

Variation of ERC20 where each user can select individual addresses to share their balance with.

**source code:** [ShareBalanceErc20.sol](./src/ShareBalanceErc20.sol)
**permission template:** [erc20-share-balance-with-users.yaml](./permission-templates/erc20-share-balance-with-users.yaml)


### ShareScopedBalanceErc20

Variation of ERC20 where each user can share their balance to specific addresses, but with an upper limit.


**source code:** [ShareScopedBalanceErc20.sol](./src/ShareScopedBalanceErc20.sol)
**permission template:** [erc20-share-scoped-balance.yaml](./permission-templates/erc20-share-scoped-balance.yaml)

## Deploy

You can deploy all the contracts by running:
Expand All @@ -24,6 +60,8 @@ Once the contracts are deployed you can use the double zero explorer to check th

## Double zero permissions

Inside the `/permission-templates` folder there are several double zero permission files templates.
These are example permission restrictions for each contract to work as they re meant to work. These
can be modified to achieve different levels of privacy over each contract.
Each file inside the `/permission-templates` folder is a an example double zero configuration
for each contract in this repo:

- `erc20-public-scoped-balance.yaml` -> `PublicScopedBalanceErc20`.
- `erc20-public-scoped-balance.yaml` -> `PublicScopedBalanceErc20`.
1 change: 1 addition & 0 deletions permission-templates/erc20-public-scoped-balance.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Example configuration for `./src/PublicScopedBalanceErc20.sol`.
contracts:
- address: <addr>
methods:
Expand Down
1 change: 1 addition & 0 deletions permission-templates/erc20-share-balance-with-users.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Example configuration for `./src/Sha.sol`.
contracts:
- address: <addr>
methods:
Expand Down
1 change: 1 addition & 0 deletions permission-templates/erc20-share-scoped-balance.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Example configuration for: `./src/ShareScopedBalanceErc20.sol`
contracts:
- address: <addr>
methods:
Expand Down
1 change: 1 addition & 0 deletions permission-templates/erc721-public-selection.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Example configuration for: `./src/PublicSelectionErc721.sol`.
contracts:
- address: <addr>
methods:
Expand Down

0 comments on commit 579ff7e

Please sign in to comment.