@@ -26,6 +26,10 @@ pub struct Contract {
26
26
donation_ids_by_recipient_id : LookupMap <AccountId , UnorderedSet <DonationId >>,
27
27
donation_ids_by_donor_id : LookupMap <AccountId , UnorderedSet <DonationId >>,
28
28
donation_ids_by_ft_id : LookupMap <AccountId , UnorderedSet <DonationId >>,
29
+ total_donations_amount : Balance , // Added total_donations_amount to track total donations amount without iterating through all donations
30
+ net_donations_amount : Balance , // Added net_donations_amount to track net donations amount (after fees) without iterating through all donations
31
+ total_protocol_fees : Balance , // Added total_protocol_fees to track total protocol fees without iterating through all donations
32
+ total_referrer_fees : Balance , // Added total_referrer_fees to track total referral fees without iterating through all donations
29
33
}
30
34
31
35
/// NOT stored in contract storage; only used for get_config response
@@ -34,6 +38,11 @@ pub struct Config {
34
38
pub protocol_fee_basis_points : u32 ,
35
39
pub referral_fee_basis_points : u32 ,
36
40
pub protocol_fee_recipient_account : AccountId ,
41
+ pub total_donations_amount : U128 ,
42
+ pub net_donations_amount : U128 ,
43
+ pub total_donations_count : U64 ,
44
+ pub total_protocol_fees : U128 ,
45
+ pub total_referrer_fees : U128 ,
37
46
}
38
47
```
39
48
@@ -45,17 +54,17 @@ _NB: Projects are automatically approved by default._
45
54
pub struct Donation {
46
55
/// Unique identifier for the donation
47
56
pub id : DonationId ,
48
- /// ID of the donor
57
+ /// ID of the donor
49
58
pub donor_id : AccountId ,
50
- /// Amount donated
59
+ /// Amount donated
51
60
pub total_amount : U128 ,
52
61
/// FT id (e.g. "near")
53
62
pub ft_id : AccountId ,
54
- /// Optional message from the donor
63
+ /// Optional message from the donor
55
64
pub message : Option <String >,
56
65
/// Timestamp when the donation was made
57
66
pub donated_at_ms : TimestampMs ,
58
- /// ID of the account receiving the donation
67
+ /// ID of the account receiving the donation
59
68
pub recipient_id : AccountId ,
60
69
/// Protocol fee
61
70
pub protocol_fee : U128 ,
@@ -181,25 +190,25 @@ Indicates that a `Donation` object has been created.
181
190
182
191
```json
183
192
{
184
- " standard" : " potlock" ,
185
- " version" : " 1.0.0" ,
186
- " event" : " donation" ,
187
- " data" : [
188
- {
189
- " donation" : {
190
- " donated_at_ms" : 1698948121940 ,
191
- " donor_id" : " lachlan.near" ,
192
- " ft_id" : " near" ,
193
- " id" : 9 ,
194
- " message" : " Go go go!" ,
195
- " protocol_fee" : " 7000000000000000000000" ,
196
- " recipient_id" : " magicbuild.near" ,
197
- " referrer_fee" : " 2000000000000000000000" ,
198
- " referrer_id" : " plugrel.near" ,
199
- " total_amount" : " 100000000000000000000000"
200
- },
201
- }
202
- ]
193
+ " standard" : " potlock" ,
194
+ " version" : " 1.0.0" ,
195
+ " event" : " donation" ,
196
+ " data" : [
197
+ {
198
+ " donation" : {
199
+ " donated_at_ms" : 1698948121940 ,
200
+ " donor_id" : " lachlan.near" ,
201
+ " ft_id" : " near" ,
202
+ " id" : 9 ,
203
+ " message" : " Go go go!" ,
204
+ " protocol_fee" : " 7000000000000000000000" ,
205
+ " recipient_id" : " magicbuild.near" ,
206
+ " referrer_fee" : " 2000000000000000000000" ,
207
+ " referrer_id" : " plugrel.near" ,
208
+ " total_amount" : " 100000000000000000000000"
209
+ }
210
+ }
211
+ ]
203
212
}
204
213
```
205
214
@@ -211,17 +220,17 @@ Indicates that `ContractSourceMetadata` object has been set/updated.
211
220
212
221
``` json
213
222
{
214
- "standard" : " potlock" ,
215
- "version" : " 1.0.0" ,
216
- "event" : " set_source_metadata" ,
217
- "data" : [
218
- {
219
- "source_metadata" : {
220
- "commit_hash" :" ec02294253b22c2d4c50a75331df23ada9eb04db" ,
221
- "link" :" https://github.com/PotLock/core" ,
222
- "version" :" 0.1.0" ,
223
- }
224
- }
225
- ]
223
+ "standard" : " potlock" ,
224
+ "version" : " 1.0.0" ,
225
+ "event" : " set_source_metadata" ,
226
+ "data" : [
227
+ {
228
+ "source_metadata" : {
229
+ "commit_hash" : " ec02294253b22c2d4c50a75331df23ada9eb04db" ,
230
+ "link" : " https://github.com/PotLock/core" ,
231
+ "version" : " 0.1.0"
232
+ }
233
+ }
234
+ ]
226
235
}
227
- ```
236
+ ```
0 commit comments