You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* added a sample contract for calling x/warden
* finalized the smart contract guide + small fixes
* coderabbit
* consolidated improvements in precompile docs
Copy file name to clipboardExpand all lines: docs/developer-docs/docs/build-an-app/deploy-smart-contracts-on-warden/deploy-an-evm-contract.md
+7-23Lines changed: 7 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,16 +72,6 @@ To deploy an EVM contract locally, you need to run a local chain and make sure i
72
72
</TabItem>
73
73
</Tabs>
74
74
75
-
5. You'll also need your chain ID. Run the following and note down the value from the `network` field:
76
-
77
-
```bash
78
-
wardend status
79
-
```
80
-
81
-
:::tip
82
-
If you used our `just` script to run the node with default settings, the chain ID is `warden_1337-1`.
83
-
:::
84
-
85
75
### Option 2. Connect to Chiado
86
76
87
77
To deploy an EVM contract on [Chiado testnet](/operate-a-node/chiado-testnet/chiado-overview), you need to install its binary and fund your key, as shown in the following steps:
@@ -134,22 +124,16 @@ To deploy an EVM contract on [Chiado testnet](/operate-a-node/chiado-testnet/chi
134
124
135
125
## 2. Create an EVM project
136
126
137
-
1. Create a new directory `/warden-smart-contract` for your project and navigate there:
138
-
139
-
```bash
140
-
mkdir warden-smart-contract
141
-
cd warden-smart-contract
142
-
```
143
-
144
-
2. Initialize a new Foundry project:
127
+
Initialize a new Foundry project and navigate to its directory:
145
128
146
-
```bash
147
-
forge init --no-commit
148
-
```
129
+
```bash
130
+
forge init warden-smart-contract --no-commit
131
+
cd warden-smart-contract
132
+
```
149
133
150
134
## 3. Create a smart contract
151
135
152
-
After you initialize a Foundry project, the script will automatically create a sample contract named `Counter`in the `/src` directory:
136
+
After you initialize a Foundry project, the script will automatically create a sample contract named `Counter.sol` in the `/src` directory:
@@ -9,37 +9,91 @@ import TabItem from '@theme/TabItem';
9
9
10
10
## Overview
11
11
12
-
This guide shows how to prepare an EVM smart contract for interacting with [Warden Protocol modules](/category/warden-protocol-modules).
12
+
You can interact with [Warden Protocol modules](/category/warden-protocol-modules) in your EVM smart contract by calling [Warden precompiles](/category/precompiles).
13
13
14
-
You're going to call modules from your contract by using functions from the available [Warden precompiles](/category/precompiles).
14
+
This guide shows how to deploy a simple EVM contract calling the [`spaceById()`](../precompiles/x-warden#query-a-space-by-id) function of the [`x/warden`](../precompiles/x-warden) module. After that, you'll be able to expand your contract code with other functions, which are documented in the subsections below.
15
+
16
+
To learn the basics of deploying contracts on Warden, refer to [Deploy an EVM contract](../deploy-smart-contracts-on-warden/deploy-an-evm-contract).
15
17
16
18
## Prerequisites
17
19
18
20
Before you start, complete the following prerequisites:
19
21
20
-
1.[Install Foundry](https://book.getfoundry.sh/getting-started/installation) by running this command:
22
+
-[Install Foundry](https://book.getfoundry.sh/getting-started/installation) by running this command:
21
23
22
24
```bash
23
25
curl -L https://foundry.paradigm.xyz | bash \
24
26
foundryup
25
27
```
26
28
27
-
2.[Prepare the chain](../deploy-smart-contracts-on-warden/deploy-an-evm-contract#1-prepare-the-chain), setting up your private key.
29
+
-Prepare the chain, setting up your private key. You can either run a local chain or join the Chiado testnet, as shown in [Deploy an EVM smart contract](../deploy-smart-contracts-on-warden/deploy-an-evm-contract#1-prepare-the-chain).
28
30
29
-
## 1. Create a project and contract
31
+
## 1. Create your project and contract
30
32
31
33
1. Initialize a new Foundry project and navigate to its directory:
32
-
34
+
33
35
```bash
34
36
forge init warden-smart-contract --no-commit
35
37
cd warden-smart-contract
36
38
```
39
+
40
+
Alternatively, you can use an existing project – for example, the one you created when following the [Deploy an EVM contract](../deploy-smart-contracts-on-warden/deploy-an-evm-contract) guide.
37
41
38
42
2. In the `/src` directory, create a new contract named `Warden.sol`.
39
43
40
-
3. Finally, prepare the contract code. You can use code samples from the following sections:
44
+
To call a precompile in your contract, do this::
41
45
42
-
-[Interact with x/warden](/category/interact-with-xwarden)
46
+
- Define an `interface` for interacting with a [Warden precompile](/category/precompiles).
47
+
- Add a `contract` with functions calling the precompile.
48
+
- In the `contract` section, you should also reference the precompile address.
49
+
50
+
You can use the example contract below. It calls the [`spaceById()`](../precompiles/x-warden#query-a-space-by-id) function of [`x/warden`](../precompiles/x-warden) to return a Space and its creator by Space ID:
Copy file name to clipboardExpand all lines: docs/developer-docs/docs/build-an-app/interact-with-warden-modules/interact-with-x-warden/manage-key-requests.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,8 @@ This article explains how to use `x/warden` to manage [key requests](/learn/glos
13
13
To understand how to set up and deploy your project, see [Get started](../get-started.md).
14
14
15
15
:::tip
16
-
For an overview of `x/warden` functions, refer to [Precompiles: x/warden](../../precompiles/x-warden#key-requests)
16
+
- For an overview of `x/warden` functions, refer to [Precompiles: x/warden](../../precompiles/x-warden#key-requests).
17
+
- The precompile address is `0x0000000000000000000000000000000000000900`.
Copy file name to clipboardExpand all lines: docs/developer-docs/docs/build-an-app/interact-with-warden-modules/interact-with-x-warden/manage-keychains.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,8 @@ This article explains how to use `x/warden` to manage [Keychains](/learn/glossar
13
13
To understand how to set up and deploy your project, see [Get started](../get-started.md).
14
14
15
15
:::tip
16
-
For an overview of `x/warden` functions, refer to [Precompiles: x/warden](../../precompiles/x-warden#keychains)
16
+
- For an overview of `x/warden` functions, refer to [Precompiles: x/warden](../../precompiles/x-warden#keychains).
17
+
- The precompile address is `0x0000000000000000000000000000000000000900`.
Copy file name to clipboardExpand all lines: docs/developer-docs/docs/build-an-app/interact-with-warden-modules/interact-with-x-warden/manage-signature-requests.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,8 @@ This article explains how to use `x/warden` to manage [signature requests](/lear
13
13
To understand how to set up and deploy your project, see [Get started](../get-started.md).
14
14
15
15
:::tip
16
-
For an overview of `x/warden` functions, refer to [Precompiles: x/warden](../../precompiles/x-warden#signature-requests)
16
+
- For an overview of `x/warden` functions, refer to [Precompiles: x/warden](../../precompiles/x-warden#signature-requests).
17
+
- The precompile address is `0x0000000000000000000000000000000000000900`.
Copy file name to clipboardExpand all lines: docs/developer-docs/docs/build-an-app/interact-with-warden-modules/interact-with-x-warden/manage-spaces.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,8 @@ This article explains how to use `x/warden` to manage [Spaces](/learn/glossary#s
13
13
To understand how to set up and deploy your project, see [Get started](../get-started.md).
14
14
15
15
:::tip
16
-
For an overview of `x/warden` functions, refer to [Precompiles: x/warden](../../precompiles/x-warden#spaces)
16
+
- For an overview of `x/warden` functions, refer to [Precompiles: x/warden](../../precompiles/x-warden#spaces).
17
+
- The precompile address is `0x0000000000000000000000000000000000000900`.
17
18
:::
18
19
19
20
## Create a new Space
@@ -22,11 +23,11 @@ To create a new Space, use the following code in your contract. It calls the [`n
22
23
23
24
```solidity
24
25
function newSpace(
25
-
uint64 approveAdminTemplateId,
26
-
uint64 rejectAdminTemplateId,
27
-
uint64 approveSignTemplateId,
28
-
uint64 rejectSignTemplateId,
29
-
address[] calldata additionalOwners
26
+
uint64 approveAdminTemplateId,
27
+
uint64 rejectAdminTemplateId,
28
+
uint64 approveSignTemplateId,
29
+
uint64 rejectSignTemplateId,
30
+
address[] calldata additionalOwners
30
31
) external returns (uint64 id);
31
32
32
33
contract wardenSpace {
@@ -311,13 +312,13 @@ contract SpaceQuery {
311
312
warden = IWarden(WARDEN_ADDRESS);
312
313
}
313
314
314
-
function getSpaceById(uint64 spaceId) external view returns (IWarden.Space memory) {
315
-
return warden.spaceById(spaceId);
315
+
function getSpaceById(uint64 id) external view returns (IWarden.Space memory) {
316
+
return warden.spaceById(id);
316
317
}
317
318
}
318
319
```
319
320
320
-
After deploying your contract, you can interact with it by calling the `spaceById()` function:
321
+
After deploying your contract, you can interact with it by calling the `getSpaceById()` function:
You can interact with [Warden Protocol modules](/category/warden-protocol-modules) in your EVM smart contract by calling [Warden precompiles](/category/precompiles).
8
+
9
+
To familiarize yourself with precompiles, take the following steps:
10
+
11
+
1. Deploy a simple EVM contract by following the [Get started](get-started) guide.
12
+
3. After that, you can expand your contract code as shown in these subsections:
13
+
-[Interact with x/warden](/category/interact-with-xwarden)
14
+
-*Other modules: coming soon*
15
+
4. For an overview of available functions, refer to the [Precompiles](/category/precompiles) section.
16
+
17
+
In this table, you can find all the resources you'll need to interact with each precompile:
0 commit comments