Skip to content

Commit 8e40dba

Browse files
committed
chore: standardized names of events and event fields
1 parent 605a78b commit 8e40dba

File tree

26 files changed

+1648
-1260
lines changed

26 files changed

+1648
-1260
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
syntax = "proto3";
2+
package sentinel.deposit.v2;
3+
4+
import "gogoproto/gogo.proto";
5+
6+
option go_package = "github.com/sentinel-official/sentinelhub/v12/x/deposit/types/v2";
7+
option (gogoproto.equal_all) = false;
8+
option (gogoproto.goproto_getters_all) = false;
9+
10+
message EventAdd {
11+
string acc_address = 1;
12+
string value = 2;
13+
}
14+
15+
message EventSubtract {
16+
string acc_address = 1;
17+
string value = 2;
18+
}

proto/sentinel/lease/v1/events.proto

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ option (gogoproto.equal_all) = false;
88
option (gogoproto.goproto_getters_all) = false;
99

1010
message EventCreate {
11-
uint64 id = 1 [(gogoproto.customname) = "ID"];
11+
uint64 lease_id = 1 [(gogoproto.customname) = "LeaseID"];
1212
string node_address = 2;
1313
string prov_address = 3;
1414
int64 max_hours = 4;
@@ -17,38 +17,36 @@ message EventCreate {
1717
}
1818

1919
message EventEnd {
20-
uint64 id = 1 [(gogoproto.customname) = "ID"];
20+
uint64 lease_id = 1 [(gogoproto.customname) = "LeaseID"];
2121
string node_address = 2;
2222
string prov_address = 3;
2323
}
2424

2525
message EventPay {
26-
uint64 id = 1 [(gogoproto.customname) = "ID"];
26+
uint64 lease_id = 1 [(gogoproto.customname) = "LeaseID"];
2727
string node_address = 2;
2828
string prov_address = 3;
29-
string amount = 4;
29+
string payment = 4;
3030
string staking_reward = 5;
3131
}
3232

3333
message EventRefund {
34-
uint64 id = 1 [(gogoproto.customname) = "ID"];
34+
uint64 lease_id = 1 [(gogoproto.customname) = "LeaseID"];
3535
string prov_address = 2;
36-
string amount = 3;
36+
string value = 3;
3737
}
3838

3939
message EventRenew {
40-
uint64 id = 1 [(gogoproto.customname) = "ID"];
40+
uint64 lease_id = 1 [(gogoproto.customname) = "LeaseID"];
4141
string node_address = 2;
4242
string prov_address = 3;
4343
int64 max_hours = 4;
4444
string price = 5;
4545
}
4646

47-
message EventUpdate {
48-
uint64 id = 1 [(gogoproto.customname) = "ID"];
47+
message EventUpdateDetails {
48+
uint64 lease_id = 1 [(gogoproto.customname) = "LeaseID"];
4949
string node_address = 2;
5050
string prov_address = 3;
51-
int64 hours = 4;
52-
string renewal_price_policy = 5;
53-
string payout_at = 6;
51+
string renewal_price_policy = 4;
5452
}

proto/sentinel/node/v3/events.proto

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ message EventCreate {
1515
}
1616

1717
message EventPay {
18-
uint64 id = 1 [(gogoproto.customname) = "ID"];
18+
uint64 session_id = 1 [(gogoproto.customname) = "SessionID"];
1919
string acc_address = 2;
2020
string node_address = 3;
21-
string amount = 4;
21+
string payment = 4;
2222
string staking_reward = 5;
2323
}
2424

2525
message EventRefund {
26-
uint64 id = 1 [(gogoproto.customname) = "ID"];
26+
uint64 session_id = 1 [(gogoproto.customname) = "SessionID"];
2727
string acc_address = 2;
28-
string amount = 3;
28+
string value = 3;
2929
}
3030

3131
message EventUpdateDetails {
@@ -41,7 +41,7 @@ message EventUpdateStatus {
4141
}
4242

4343
message EventCreateSession {
44-
uint64 id = 1 [(gogoproto.customname) = "ID"];
44+
uint64 session_id = 1 [(gogoproto.customname) = "SessionID"];
4545
string acc_address = 2;
4646
string node_address = 3;
4747
string price = 4;

proto/sentinel/oracle/v1/events.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ message EventDelete {
1818
string denom = 2;
1919
}
2020

21-
message EventUpdate {
21+
message EventUpdateDetails {
2222
string denom = 2;
2323
int64 decimals = 3;
2424
string base_asset_denom = 4;

proto/sentinel/plan/v3/events.proto

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@ option (gogoproto.equal_all) = false;
88
option (gogoproto.goproto_getters_all) = false;
99

1010
message EventCreate {
11-
uint64 id = 1 [(gogoproto.customname) = "ID"];
11+
uint64 plan_id = 1 [(gogoproto.customname) = "PlanID"];
1212
string prov_address = 2;
1313
int64 gigabytes = 3;
1414
int64 hours = 4;
1515
string prices = 5;
1616
}
1717

1818
message EventLinkNode {
19-
uint64 id = 1 [(gogoproto.customname) = "ID"];
19+
uint64 plan_id = 1 [(gogoproto.customname) = "PlanID"];
2020
string prov_address = 2;
2121
string node_address = 3;
2222
}
2323

2424
message EventUnlinkNode {
25-
uint64 id = 1 [(gogoproto.customname) = "ID"];
25+
uint64 plan_id = 1 [(gogoproto.customname) = "PlanID"];
2626
string prov_address = 2;
2727
string node_address = 3;
2828
}
2929

30-
message EventUpdate {
31-
uint64 id = 1 [(gogoproto.customname) = "ID"];
30+
message EventUpdateStatus {
31+
uint64 plan_id = 1 [(gogoproto.customname) = "PlanID"];
3232
string prov_address = 2;
3333
string status = 3;
3434
}

proto/sentinel/session/v3/events.proto

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,14 @@ option go_package = "github.com/sentinel-official/sentinelhub/v12/x/session/type
77
option (gogoproto.equal_all) = false;
88
option (gogoproto.goproto_getters_all) = false;
99

10-
message EventPay {
11-
uint64 id = 1 [(gogoproto.customname) = "ID"];
10+
message EventEnd {
11+
uint64 session_id = 1 [(gogoproto.customname) = "SessionID"];
1212
string acc_address = 2;
1313
string node_address = 3;
14-
string payment = 4;
15-
string staking_reward = 5;
16-
}
17-
18-
message EventRefund {
19-
uint64 id = 1 [(gogoproto.customname) = "ID"];
20-
string acc_address = 2;
21-
string amount = 3;
2214
}
2315

2416
message EventUpdateDetails {
25-
uint64 id = 1 [(gogoproto.customname) = "ID"];
17+
uint64 session_id = 1 [(gogoproto.customname) = "SessionID"];
2618
string acc_address = 2;
2719
string node_address = 3;
2820
string download_bytes = 4;
@@ -31,9 +23,8 @@ message EventUpdateDetails {
3123
}
3224

3325
message EventUpdateStatus {
34-
uint64 id = 1 [(gogoproto.customname) = "ID"];
26+
uint64 session_id = 1 [(gogoproto.customname) = "SessionID"];
3527
string acc_address = 2;
3628
string node_address = 3;
3729
string status = 4;
38-
string status_at = 5;
3930
}

proto/sentinel/subscription/v3/events.proto

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,34 @@ option (gogoproto.equal_all) = false;
88
option (gogoproto.goproto_getters_all) = false;
99

1010
message EventAllocate {
11-
uint64 id = 1 [(gogoproto.customname) = "ID"];
11+
uint64 subscription_id = 1 [(gogoproto.customname) = "SubscriptionID"];
1212
string acc_address = 2;
1313
string granted_bytes = 3;
1414
string utilised_bytes = 4;
1515
}
1616

1717
message EventCreate {
18-
uint64 id = 1 [(gogoproto.customname) = "ID"];
18+
uint64 subscription_id = 1 [(gogoproto.customname) = "SubscriptionID"];
1919
uint64 plan_id = 2 [(gogoproto.customname) = "PlanID"];
2020
string acc_address = 3;
21-
string prov_address = 4;
22-
string price = 5;
21+
string price = 4;
2322
}
2423

2524
message EventCreateSession {
26-
uint64 id = 1 [(gogoproto.customname) = "ID"];
25+
uint64 session_id = 1 [(gogoproto.customname) = "SessionID"];
26+
uint64 subscription_id = 4 [(gogoproto.customname) = "SubscriptionID"];
2727
string acc_address = 2;
2828
string node_address = 3;
29-
uint64 subscription_id = 4 [(gogoproto.customname) = "SubscriptionID"];
29+
}
30+
31+
message EventEnd {
32+
uint64 subscription_id = 1 [(gogoproto.customname) = "SubscriptionID"];
33+
uint64 plan_id = 2 [(gogoproto.customname) = "PlanID"];
34+
string acc_address = 3;
3035
}
3136

3237
message EventPay {
33-
uint64 id = 1 [(gogoproto.customname) = "ID"];
38+
uint64 subscription_id = 1 [(gogoproto.customname) = "SubscriptionID"];
3439
uint64 plan_id = 2 [(gogoproto.customname) = "PlanID"];
3540
string acc_address = 3;
3641
string prov_address = 4;
@@ -39,19 +44,22 @@ message EventPay {
3944
}
4045

4146
message EventRenew {
42-
uint64 id = 1 [(gogoproto.customname) = "ID"];
47+
uint64 subscription_id = 1 [(gogoproto.customname) = "SubscriptionID"];
4348
uint64 plan_id = 2 [(gogoproto.customname) = "PlanID"];
4449
string acc_address = 3;
45-
string prov_address = 4;
46-
string price = 5;
50+
string price = 4;
4751
}
4852

49-
message EventUpdate {
50-
uint64 id = 1 [(gogoproto.customname) = "ID"];
53+
message EventUpdateDetails {
54+
uint64 subscription_id = 1 [(gogoproto.customname) = "SubscriptionID"];
5155
uint64 plan_id = 2 [(gogoproto.customname) = "PlanID"];
5256
string acc_address = 3;
5357
string renewal_price_policy = 4;
54-
string status = 5;
55-
string inactive_at = 6;
56-
string status_at = 7;
58+
}
59+
60+
message EventUpdateStatus {
61+
uint64 subscription_id = 1 [(gogoproto.customname) = "SubscriptionID"];
62+
uint64 plan_id = 2 [(gogoproto.customname) = "PlanID"];
63+
string acc_address = 3;
64+
string status = 4;
5765
}

x/deposit/keeper/deposit.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
"github.com/sentinel-official/sentinelhub/v12/x/deposit/types"
77
"github.com/sentinel-official/sentinelhub/v12/x/deposit/types/v1"
8+
"github.com/sentinel-official/sentinelhub/v12/x/deposit/types/v2"
89
)
910

1011
// SetDeposit stores a deposit in the module's KVStore.
@@ -112,9 +113,9 @@ func (k *Keeper) SendCoinsFromAccountToDeposit(ctx sdk.Context, fromAddr, toAddr
112113

113114
k.SetDeposit(ctx, deposit)
114115
ctx.EventManager().EmitTypedEvent(
115-
&v1.EventAdd{
116-
Address: toAddr.String(),
117-
Coins: coins.String(),
116+
&v2.EventAdd{
117+
AccAddress: toAddr.String(),
118+
Value: coins.String(),
118119
},
119120
)
120121

@@ -140,9 +141,9 @@ func (k *Keeper) SendCoinsFromDepositToAccount(ctx sdk.Context, fromAddr, toAddr
140141

141142
k.SetDeposit(ctx, deposit)
142143
ctx.EventManager().EmitTypedEvent(
143-
&v1.EventSubtract{
144-
Address: fromAddr.String(),
145-
Coins: coins.String(),
144+
&v2.EventSubtract{
145+
AccAddress: fromAddr.String(),
146+
Value: coins.String(),
146147
},
147148
)
148149

@@ -168,9 +169,9 @@ func (k *Keeper) SendCoinsFromDepositToModule(ctx sdk.Context, fromAddr sdk.AccA
168169

169170
k.SetDeposit(ctx, deposit)
170171
ctx.EventManager().EmitTypedEvent(
171-
&v1.EventSubtract{
172-
Address: fromAddr.String(),
173-
Coins: coins.String(),
172+
&v2.EventSubtract{
173+
AccAddress: fromAddr.String(),
174+
Value: coins.String(),
174175
},
175176
)
176177

0 commit comments

Comments
 (0)