Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Agupane committed Nov 10, 2023
1 parent 6e2c5d7 commit 1a4107a
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 78 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ GNOSIS_URL=https://rpc.gnosischain.com/
ETHERSCAN_API_KEY=
ALCHEMY_ENDPOINT_URL=https://eth-goerli.alchemyapi.io/v2/<apiKey>
TENDERLY_PROJECT=""
TENDERLY_USERNAME=""
TENDERLY_USERNAME=""
REPORT_GAS=true
54 changes: 54 additions & 0 deletions ERC1155 Architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<p align="center">
<a href="https://thebadge.xyz">
<img alt="TheBadge" src="https://thebadge.xyz/favicon.ico" width="128">
</a>
</p>

<h1 align="center">TheBadge DApp Smart-contracts</h1>

<p align="center">
<a href="https://discord.com/invite/FTxtkgbAC4"><img src="https://img.shields.io/discord/1006480637512917033?style=plastic" alt="Join to Discord"></a>
<a href="https://twitter.com/intent/user?screen_name=thebadgexyz"><img src="https://img.shields.io/twitter/follow/thebadgexyz?style=social" alt="Follow us on Twitter"></a>
</p>

For questions or request information reach out via [Discord](https://discord.gg/tVP75NqVuC).

# TheBadge: a non-dynamic data oracle for web3 certifications.

## Introduction

TheBadge is a novel decentralized platform that leverages the ERC1155 token standard to represent unique badges. These badges, referred to as SBT (Special Badges Tokens), hold distinct on-chain information for each user. Unlike traditional tokens, SBTs cannot be transferred or traded, as they embody exclusive user-specific data.

TheBadge's architecture is divided into two key components: "Badge Models" and "Badges." Badge Models are defined by badge creators and serve as templates for generating actual badges that end-users will possess. A Badge Model specifies not only the visual design of the badge but also governs how the information within it should be displayed and validated.

## Architecture Description

![SC-Architecture](assets/images/SC-Architecture.png)

### Badge Models

Badge Models play a pivotal role in TheBadge ecosystem. These models are created by the badge creators and set the standards for generating individual badges. Each Badge Model defines:

1. **Visual Design**: The appearance and layout of the badge.
2. **Information Presentation**: How the data contained within the badge should be displayed.
3. **Validation Process**: The criteria and methods for validating the information.

Presently, there are two distinct types of Badge Models within TheBadge:

#### 1. KlerosBadgeModel

These badges, also known as "Community badges," are issued based on a curated list maintained by Kleros. The KlerosBadgeModel can be challenged and potentially rejected by jurors participating in Kleros courts, following a challenge initiated by a TheBadge curator.

#### 2. ThirdPartyBadgeModel

These badges, also known as "Third-Party badges," are exclusively issued by previously registered and validated third-party companies that are part of TheBadge ecosystem. Each ThirdPartyBadgeModel operates as a TCR (Token-Curated Registry) list within the Kleros court. Importantly, these lists are non-challengeable, and only the third-party company administrators have the authority to add or remove badges from the list, including the power to revoke credentials granted to their users.

### Badge Controllers

The core of TheBadge's smart contract architecture lies in the ability to incorporate additional "Badge controllers" in the future, catering to diverse use cases. This flexibility allows for the expansion of TheBadge's capabilities, including support for various badge-related functionalities, such as zkBadges and third-party curation.

The central concept is that TheBadge comprises a significant ERC1155 contract, which is dependent on controllers. Each controller is responsible for managing the logic associated with specific badge models. By introducing more controllers, TheBadge's versatility increases, providing endless possibilities for badge-related applications.

## Conclusion

TheBadge introduces an innovative decentralized badge ecosystem based on the ERC1155 token standard. This ecosystem is designed to support various badge models and controllers, offering a dynamic and versatile platform for unique on-chain badge representation. With Badge Models catering to diverse use cases and the potential for expanding the ecosystem with new Badge controllers, TheBadge presents a promising frontier in the world of decentralized digital credentials.
46 changes: 0 additions & 46 deletions ERC1155-721 Architecture.md

This file was deleted.

52 changes: 21 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://thebadge.xyz">
<img alt="TheBadge" src="public/favicon/favicon.svg" width="128">
<img alt="TheBadge" src="https://thebadge.xyz/favicon.ico" width="128">
</a>
</p>

Expand All @@ -23,27 +23,6 @@ For questions or request information reach out via [Discord](https://discord.gg/
yarn
```

### Testing

To run the tests:

```bash
yarn build
yarn test
```

Optionally, if you want to run the ERC-4337 compatibility test, it uses a live bundler and node, so it contains some pre-requisites:

1. Define the environment variables:

```
ERC4337_TEST_BUNDLER_URL=
ERC4337_TEST_NODE_URL=
ERC4337_TEST_SINGLETON_ADDRESS=
ERC4337_TEST_SAFE_FACTORY_ADDRESS=
MNEMONIC=
```

2. Pre-fund the executor account derived from the mnemonic with some Native Token to cover the deployment of an ERC4337 module and the pre-fund of the Safe for the test operation.

### Deployments
Expand All @@ -59,8 +38,13 @@ A collection of the different contract deployments and their addresses can be fo
```
WALLET_PRIVATE_KEY=
GOERLI_URL=https://goerli.infura.io/v3/
SEPOLIA_URL=https://sepolia.infura.io/v3/
GNOSIS_URL=https://rpc.gnosischain.com/
ETHERSCAN_API_KEY=
ALCHEMY_ENDPOINT_URL=https://eth-goerli.alchemyapi.io/v2/<apiKey>
TENDERLY_PROJECT=""
TENDERLY_USERNAME=""
REPORT_GAS=true
```

#### Install Rust & Cargo
Expand Down Expand Up @@ -91,18 +75,28 @@ For troubleshooting check the [fountry installation](https://book.getfoundry.sh/
yarn deploy:goerli
```

### Upgrade

```
yarn upgrade:goerli
```

### Verify contract

This command will use the deployment artifacts to compile the contracts and compare them to the onchain code
This command will use the deployment artifacts to compile the contracts and compare them to the onchain code.
It will also verify the contracts on tenderly.

```bash
yarn hardhat --network <network> local-verify
```
yarn verify:goerli
```

This command will upload the contract source to Etherescan
### Testing

To run the tests:

```bash
yarn hardhat --network <network> etherscan-verify
yarn build
yarn test
```

## Deployments
Expand All @@ -115,10 +109,6 @@ yarn hardhat --network <network> etherscan-verify

- If you want to learn more give a look to our [docs](https://docs.thebadge.xyz/)

## Architecture

<img alt="decorative-image-3" loading="lazy" decoding="async" data-nimg="1" style="color:transparent" src="./assets/images/SC-Architecture.png">

## Security and Liability

All contracts are WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Expand Down
Binary file removed assets/images/ERC1155-721 Architecture.png
Binary file not shown.

0 comments on commit 1a4107a

Please sign in to comment.