|
2 | 2 | sidebar_position: 1
|
3 | 3 | ---
|
4 | 4 |
|
5 |
| -# Setup |
| 5 | +# Documentation |
6 | 6 |
|
7 |
| -## Welcome |
| 7 | +The tutorial to build your own Zodiac Module has moved. |
8 | 8 |
|
9 |
| -In this tutorial, you'll learn the the fundamental concepts of Zodiac modules while you build a super-simple example module. Deploying it first on a local test environment to control a mock [Gnosis Safe](http://gnosis-safe.io/), and later using it to control a real Gnosis Safe on a public test network. |
10 |
| - |
11 |
| -## Setup IDE |
12 |
| - |
13 |
| -For this tutorial, we'll make use of [Remix](https://remix.ethereum.org/), a powerful web-based IDE for building Ethereum applications. However, if you would prefer to use some other developer environment, the instructions should port easily to wherever you like to work. |
14 |
| - |
15 |
| -Start by importing [this gist](https://gist.github.com/auryn-macmillan/105ae8f09c34406997d217ee4dc0f63a). |
16 |
| - |
17 |
| - |
18 |
| - |
19 |
| -This will add three files to your working directory: `Button.sol`, `MockSafe.sol`, and `MyModule.sol`. |
20 |
| - |
21 |
| - |
22 |
| - |
23 |
| -Alternatively, you can create each of the files manually and copy the code from [the gist](https://gist.github.com/auryn-macmillan/105ae8f09c34406997d217ee4dc0f63a). |
24 |
| - |
25 |
| -`Button.sol` is a silly little contract with one function, `pushButton()`, which increments a counter, `pushes`. The `pushButton()` function is only callable by the contracts "owner", which will be our Gnosis Safe. |
26 |
| - |
27 |
| -`MockSafe.sol` is a mock of the Gnosis Safe that we'll use for simplicity as we build and test in our local environment. Later we'll replace it with a real Gnosis Safe on a public test network to make sure our module really works. |
28 |
| - |
29 |
| -`MyModule.sol` is where you'll be adding your own code to control our Gnosis Safes and make it push the button in our `Button.sol` contract. |
30 |
| - |
31 |
| -## Deploy Button and MockSafe |
32 |
| - |
33 |
| -Before we write any of our own code, we should deploy our Button and MockSafe contracts to our local environment. |
34 |
| - |
35 |
| -Navigate to the "Solidity Compiler" tab and check "Auto compile". This will re-compile your contract each time you make a change. |
36 |
| - |
37 |
| - |
38 |
| - |
39 |
| -With `Button.sol` open, navigate to the "Deploy & Run Transactions" tab, select "Button" from the contracts dropdown, and hit "deploy". Do the same for `MockSafe.sol`. |
40 |
| - |
41 |
| - |
42 |
| - |
43 |
| -You should now see two items have appeared in the "deployed contracts" section slightly below the deploy button, one each for `Button.sol` and `MockSafe.sol`. You can expand the view of either by clicking the carat to the left of the name, exposing the variables and functions for the contract. |
44 |
| - |
45 |
| -You can test that your button works by pushing the "pushes" button on your deployed Button. It should return `0`. Now push the "pushButton" button and then then "pushes" button again, this time it should return `1`. |
46 |
| - |
47 |
| - |
48 |
| - |
49 |
| -Copy the address of your `MockSafe`, expand your deployed `Button`, and call the `transferOwnership()` function, pasting in your MockSafe's address for the parameter. |
50 |
| - |
51 |
| - |
52 |
| - |
53 |
| -Now that you've transferred ownership, pushing the "pushButton" button on your Button will now fail. Rather, you'll need make your MockSafe execute the transaction. |
54 |
| - |
55 |
| -Expand your MockSafe and call the `exec` function with the following parameters: |
56 |
| - |
57 |
| -- **to:** `{address of your deployed Button contract}` |
58 |
| -- **value:** `0` |
59 |
| -- **data:** `"0x0a007972"` _(the ABI encoded function signature for the `pushButton()` function)_ |
60 |
| - |
61 |
| -Clicking the "pushes" button on your Button should now show that `pushes` has been incremented again. |
62 |
| - |
63 |
| -Your set up, huzzah! 🎉 |
64 |
| -Let's start building! |
| 9 | +Please visit: https://zodiac.wiki/index.php/Category:Custom_Module. |
0 commit comments