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
Grant Funder allows users to create a grant proposal and receive funding. The proposal owner must put down 50% of the requested grant amount. Funds are released in 4 stages. Each proposal stage is voted on by the community. The proposal owner must show the community their progress, answer questions, and address suggestions that arise, to earn enough votes to proceed to the next stage. If a proposal does not earn enough points in the alloted time, the proposal is burned. Stage 1 releases 20%, stage 2 releases 40%, stage 3 released 70%, and stage 4 releases 100% of the approved funds.
4
+
5
+
## Design Details
6
+
7
+
1. User creates a grant proposal which mints a NFT containing information about the grant and requested XRD amount. The user will receive a receipt NFT referencing the proposal NFT id.
8
+
9
+
2. There are two vaults located in the component. Users can vote on a proposal by sending 1 XRD to the vaults. One vault represents a YES vote the other a NO vote.
10
+
11
+
3. Votes are counted and if the proposal is > 50% then the proposal NFT data stage is incremented and returned to the proposal vault.
12
+
13
+
4. The user can use the update_receipt method to see if their proposal was approved. If it was approved their proposal receipt NFT data will be updated.
14
+
15
+
5. The user can take their updated proposal receipt NFT and use it to retrieve their funds.
export PRIV_KEY1=$(echo "$OP1" | sed -nr "s/Private key: ([[:alnum:]_]+)/\1/p")
29
+
export PUB_KEY1=$(echo "$OP1" | sed -nr "s/Public key: ([[:alnum:]_]+)/\1/p")
30
+
export ACCOUNT_ADDRESS1=$(echo "$OP1" | sed -nr "s/Account component address: ([[:alnum:]_]+)/\1/p")
31
+
```
32
+
33
+
2. Lets publish the blueprint
34
+
```
35
+
PK_OP=$(resim publish ".")
36
+
echo $PK_OP
37
+
export PACKAGE=$(echo "$PK_OP" | sed -nr "s/Success! New Package: ([[:alnum:]_]+)/\1/p")
38
+
```
39
+
40
+
3. Lets fund the Grant Funder Protocal with 700 XRD and instantiate the component
41
+
```
42
+
COMPONENT_OP=$(resim call-function $PACKAGE GrantFunder new 700,$XRD)
43
+
echo $COMPONENT_OP
44
+
45
+
export COMPONENT=$(echo "$COMPONENT_OP" | sed -nr "s/.* Component: ([[:alnum:]_]+)/\1/p" | sed '1q;d')
46
+
47
+
export PROPOSAL_RECEIPT=$(echo "$COMPONENT_OP" | sed -nr "s/.* Resource: ([[:alnum:]_]+)/\1/p" | sed '3q;d')
48
+
```
49
+
50
+
4. Lets create a grant proposal for 200 XRD by putting 100 XRD down.
51
+
```
52
+
resim call-method $COMPONENT create_proposal 100,$XRD first_grant 200
53
+
```
54
+
55
+
5. Lets vote of the proposal
56
+
```
57
+
resim call-method $COMPONENT vote_yes 1,$XRD
58
+
resim call-method $COMPONENT vote_yes 1,$XRD
59
+
resim call-method $COMPONENT vote_yes 1,$XRD
60
+
resim call-method $COMPONENT vote_yes 1,$XRD
61
+
resim call-method $COMPONENT vote_yes 1,$XRD
62
+
resim call-method $COMPONENT vote_no 1,$XRD
63
+
resim call-method $COMPONENT vote_no 1,$XRD
64
+
resim call-method $COMPONENT vote_no 1,$XRD
65
+
```
66
+
67
+
6. Lets grab the proposal NFT id from inside the component
68
+
69
+
```
70
+
resim show $COMPONENT
71
+
```
72
+
73
+
7. We will use the proposal NFT id for the count_votes method. If the proposal is voted for then the proposal NFT is incremented and placed back in the component.
74
+
```
75
+
resim call-method $COMPONENT count_votes ---PASTE NFT ID HERE---
76
+
```
77
+
78
+
8. Lets see if our grant proposal was approved by running the update_receipt method. If the proposal moved forward the proposal receipt NFT stage data is incremented.
79
+
```
80
+
resim call-method $COMPONENT update_receipt 1,$PROPOSAL_RECEIPT
81
+
```
82
+
83
+
9. Lets retrieve our grant funds using the updated proposal receipt NFT.
84
+
```
85
+
resim call-method $COMPONENT collect_xrd 1,$PROPOSAL_RECEIPT
86
+
```
87
+
88
+
10. Typically the YES NO vaults will get emptied after each vote. But for this example we will run the count_votes, update_receipt, and collect_xrd method a few more times just to illustrate the life cycle of the grant proposal.
89
+
```
90
+
resim call-method $COMPONENT count_votes ---PASTE NFT ID HERE---
91
+
resim call-method $COMPONENT update_receipt 1,$PROPOSAL_RECEIPT
92
+
resim call-method $COMPONENT collect_xrd 1,$PROPOSAL_RECEIPT
0 commit comments