Skip to content

Commit 2053a8f

Browse files
committed
docs
1 parent 3a3dd34 commit 2053a8f

File tree

2 files changed

+85
-14
lines changed

2 files changed

+85
-14
lines changed

website/docs/intro.mdx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import DocHero from '@site/src/components/docs/DocHero';
88
import DocCard, { DocCardGrid } from '@site/src/components/docs/DocCard';
99
import Callout from '@site/src/components/ui/Callout';
1010
import FeatureGrid, { FeatureGridItem } from '@site/src/components/features/FeatureGrid';
11+
import DiamondFacetsSVG from '@site/static/img/svg/compose_diamond_facets.svg'
1112

1213
Compose is a general purpose smart contract library. It helps you create smart contract systems.
1314

@@ -30,28 +31,29 @@ So Compose is a general purpose **onchain** smart contract library.
3031

3132
## Reusable Smart Contracts
3233

33-
If you want to create a new project you might wonder how to do that without deploying new smart contracts. How does Compose enable people
34-
to create new smart contract systems without deploying contracts?
34+
If you want to create a new project you might wonder how to do that without deploying new smart contracts. How does Compose enable people to create new smart contract systems using existing onchain contracts?
3535

3636
This is where Compose's smart contract architecture comes in. Compose uses [diamond contracts](https://eips.ethereum.org/EIPS/eip-2535)
3737
to organize smart contracts and make them reusable.
3838

3939
A diamond contract is a simple, small contract that uses the code of other onchain contracts.
4040

4141
A diamond contract creates and maintains its own storage data using code from other contracts. These other "contracts" are called facets.
42-
```mermaid
43-
flowchart TD
44-
45-
A{"Diamond Contract"} --> B[Facet 1]
46-
A --> C[Facet 2]
47-
A --> D[Facet N]
48-
```
49-
<br />
50-
Let's look at a simple example of how this works. Let's say that you want to create a new ERC20 token that uses the gasless "permit" function and can be bridged to other blockchains.
5142

52-
1. Use Compose to deploy a
53-
2. The diamond contract does nothing.
54-
3.
43+
<DiamondFacetsSVG style={{ width: '800', height: 'auto' }} />
44+
45+
Using Compose you do actually deploy new contracts. Specifically you deploy a small diamond contract that uses existing onchain facets.
46+
47+
Let's look at a simple example of how this works. Let's say that you want to create a new ERC20 token that uses the gasless "permit" function and can be bridged to other blockchains. Use Compose to:
48+
49+
1. Choose the onchain facets you need. In this case you need `ERC20Facet`, `ERC20PermitFacet` and `ERC20BridgableFacet`.
50+
2. Setup initialization information such as the name of your ERC20 token, its total supply, etc.
51+
3. Deploy a diamond which initializes your ERC20 token and uses the onchain facets in step 1.
52+
53+
## Composable Contracts
54+
55+
The word "composable" means capable of being combined with other parts or elements to form a whole. As much as possible Compose facets are designed to be composable. Facets are designed to work with other facets. Facets are the building blocks of Compose.
56+
5557

5658

5759

Lines changed: 69 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)