Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cyborgshead committed Oct 10, 2018
1 parent 25a7cb1 commit a1a605c
Show file tree
Hide file tree
Showing 19 changed files with 104 additions and 1,450 deletions.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Contributing list

1. @litvintech - contracts developer/maintainer
2. @pechalka - web3 app developer/maintainer
32 changes: 17 additions & 15 deletions docs/contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

Main design principle goes from ERC721 NFT tokenization of Registries (in Chaingear/Metaregistry) and Entries (in custom Registry).

In reason of Registries tokenization in Chaingear which allows token holder acts as administrator of their Registry, Chaingear acts to Registry as owner, which sets holder as administrator on creation phase, changes administrator when holder transfers token to another user, and transfers ownership when user unregister Registry in Chaingear, giving them full control to contract. Registry deep-linked to Chaingear registry token. In other words, token ownership means control of Registry. Also, Chaingear supports multiple Registry Creators (fabrics of registries), and allows Chaingear owners provide different kind and versioning of Registries.
In reason of Registries tokenization in Chaingear which allows token holder acts as administrator of their Registry, Chaingear acts to Registry as owner, which sets holder as administrator on creation phase, changes administrator when holder transfers token to another user, and transfers ownership when user unregister Registry in Chaingear, giving them full control to contract. Registry deep-linked to Chaingear registry token. In other words, token ownership means control of Registry. Also, Chaingear supports multiple Registry Builders (fabrics of registries of given type), and allows Chaingear owners provide different kind and versioning of Registries.

In reason of providing user functionality to describe their custom registry data structures and CRUD operations, the user creates their custom smart-contract, which implements the EntryInterface interface. This contract acts as inner storage, defines schema, and Registry acts them on token operations (creating and deleting). A user may deploy erroneous or vulnerable EntryCore contract, but this should not crash Chaingear-Registry NFT-token logic and Registry inner entry NFT-logic too. Even if this happens Registry crashing should not affect Chaingear/metaregistry contract. We proceed from the premise that the creator of the registry (administrator) is positive and it does not make sense for them to break his registry by initializing it with an incorrect contract.

This brings us to tokenized (**C** _RU_ **D**) operations (and inner private in EntryCore) in Registry-EntryCore and public (_C_ **R** _UD_) actions/direct EntroCore tokenized (_CR_ **U** _D_) operations.
This brings us to tokenized (**C** _RU_ **D**) operations (and inner in EntryCore) in Registry-EntryCore and public (_C_ **R** _UD_) actions/direct EntroCore tokenized (_CR_ **U** _D_) operations.

## Chaingear inheritance
![chaingear_inheritance](mermaid/contracts-chaingear_inheritance.svg)
Expand All @@ -19,30 +19,32 @@ This brings us to tokenized (**C** _RU_ **D**) operations (and inner private in
##### PS: OZ stands to Open Zeppelin contracts

### /chaingear
- **_Chaingear_** allows any user to create his own registry. Building fee is collecting by new registry creation. All builded registries are tokenized with ERC721 NFT token standard and saved in Chaingear metaregistry with registry metainformation. Creator of registry may transfer tokenized ownership of registry and destroy registry with token burning. Tokenized registries Entries may collect funds by users. Chaingear supports multiple benefitiaries witch have access to collected fees.
- **_Chaingear_** allows any user to create his own registry.
1. Building fee is collecting by new registry creation.
2. All builded registries are tokenized with ERC721 NFT token standard and saved in Chaingear metaregistry with registry metainformation.
3. Creator of registry may transfer tokenized ownership of registry and destroy registry with token burning.
4. Tokenized registries Entries may collect funds by users and Registries owner may claim them.
5. Chaingear supports multiple benefitiaries witch have access to collected fees from registries creation.
6. Also allows for owner add multiple registry builders contracts based registries on versioning or/and functionality.

- **_ChaingearCore_** holds general logic of Chaingear. Allows change chaingear's metainformation, amount of registration fee, adding multiple registry creator contracts based on versioning or/and functionality.

- **_RegistryBase_** holds struct of data with describes registry metainformation which associated with token, views function for registry metainformation.

- **_RegistryCreator_** contains the code of specified version of Registry. This code used by Chaingear for Registry creation process. Registry Creator should be added with specified version and description to Chaingear Registry Creators inner registry. Chaingear contract should be added as builder to Registry Creator with reason to allow creation calls only by Chaingear contact.
### /builder
- **_RegistryBuilder_** contains the code of specified version of Registry. This code used by Chaingear for Registry creation and deploy process. Registry Builder should be added with specified version and description to Chaingear registry builders inner registry. Chaingear contract should be added as builder to Registry Builder with reason to allow creation calls only by Chaingear contact.

### /common
- **_RegistySafe_** allows creator contract transfer ETHs to them and claim from, accounting logic holded by owner contract.

- **_SplitPaymentChangeable_** allows add beneficiaries to contract (addresses and shares amount) and change payee address. Beneficiaries can claim ETHs from contract proportionally to their shares.
- **_IEntry_**

- **_IRegistry_**

### /registry
- **_Chaingeareable_** holds basic logic of Registry as registry basic information, balance and fees amount. Contains getters and setters for registry name, description, tags, entry base address.
- **_Registry_** contract witch tokenize entries as NFT tokens via ERC721 standard. Users can create tokenized empty entries according to entry access policy setted in Registry. Registry provides tokenized (**C** _RU_ **D**) actions, after creation of token and empty registry object, user should initialize them (_CR_ **U** _D_) in EntryCore. Also users can fund entries with ETHs which send to _RegistrySafe_ with which owner of entry token can claim funds.

- **_EntryInterface_** interface for _EntryCore_. Holds entry metainformation and interfaces of functions (**C** _RU_ **D**) which should be implemented in _EntryCore_. Uses for interaction between Registry and EntryCore.
- **_RegistryAccessControl_** holds logic of controlling registry and accessing to entries creation. Policy options to entries creation are OnlyAdministrator, Whitelist, AllUsers. Chaingear acts as owner of Registry and creator of registry acts of administrator with separated policies to Registry functions.

### /schemas
- **_EntryCore_** partially code-generated contract where registry creator setup their custom entry structure and setters/getters. _EntryCore_ then initializes in Registry by their creator (as admin) and completes Registry setup process. Provides public (_C_ **RU** _D_) actions for users and inner (**C** _RU_ **D**) tokenized actions for Registry. Registry goes as owner of contract (and acts as proxy) with entries creating, token-based transferring and deleting.

- **_Registry_** contract witch tokenize entries as NFT tokens via ERC721 standard. Users can create tokenized empty entries according to entry access policy setted in Registry. Registry provides tokenized (**C** _RU_ **D**) actions, after creation of token and empty registry object, user should initialize them in EntryCore. Also users can fund entries with ETHs which send to _RegistrySafe_ where owner of entry token can claim funds.

- **_RegistryAccessControl_** holds logic of controlling registry and accessing to entries creation. Policy options to entries creation are OnlyAdministrator, AllUsers. Chaingear acts as owner of Registry and creator of registry acts of administrator with separated policies to Registry functions.

#### EntryInterface interface (should be implemented in user EntryCore contract)
```js
contract EntryInterface {
Expand Down
Loading

0 comments on commit a1a605c

Please sign in to comment.