Skip to content

Commit c462685

Browse files
committed
update Donation contract readme
1 parent eaea9e7 commit c462685

File tree

1 file changed

+45
-36
lines changed

1 file changed

+45
-36
lines changed

contracts/donation/README.md

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ pub struct Contract {
2626
donation_ids_by_recipient_id: LookupMap<AccountId, UnorderedSet<DonationId>>,
2727
donation_ids_by_donor_id: LookupMap<AccountId, UnorderedSet<DonationId>>,
2828
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
2933
}
3034

3135
/// NOT stored in contract storage; only used for get_config response
@@ -34,6 +38,11 @@ pub struct Config {
3438
pub protocol_fee_basis_points: u32,
3539
pub referral_fee_basis_points: u32,
3640
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,
3746
}
3847
```
3948

@@ -45,17 +54,17 @@ _NB: Projects are automatically approved by default._
4554
pub struct Donation {
4655
/// Unique identifier for the donation
4756
pub id: DonationId,
48-
/// ID of the donor
57+
/// ID of the donor
4958
pub donor_id: AccountId,
50-
/// Amount donated
59+
/// Amount donated
5160
pub total_amount: U128,
5261
/// FT id (e.g. "near")
5362
pub ft_id: AccountId,
54-
/// Optional message from the donor
63+
/// Optional message from the donor
5564
pub message: Option<String>,
5665
/// Timestamp when the donation was made
5766
pub donated_at_ms: TimestampMs,
58-
/// ID of the account receiving the donation
67+
/// ID of the account receiving the donation
5968
pub recipient_id: AccountId,
6069
/// Protocol fee
6170
pub protocol_fee: U128,
@@ -181,25 +190,25 @@ Indicates that a `Donation` object has been created.
181190

182191
```json
183192
{
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+
]
203212
}
204213
```
205214

@@ -211,17 +220,17 @@ Indicates that `ContractSourceMetadata` object has been set/updated.
211220

212221
```json
213222
{
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+
]
226235
}
227-
```
236+
```

0 commit comments

Comments
 (0)