Skip to content

Commit 349bd5a

Browse files
committed
Address comments, naming changes
1 parent 92f8a9f commit 349bd5a

File tree

24 files changed

+375
-305
lines changed

24 files changed

+375
-305
lines changed

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/affiliates.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export interface AffiliateParameters {
8181
* Maximum attributable volume for a referred user in a 30d rolling window in
8282
* notional
8383
*/
84-
maximum_30dAttributableVolumePerReferredUserNotional: Long;
84+
maximum_30dAttributableVolumePerReferredUserQuoteQuantums: Long;
8585
/** Referred user automatically gets set to this fee tier */
8686

8787
refereeMinimumFeeTierIdx: number;
@@ -99,7 +99,7 @@ export interface AffiliateParametersSDKType {
9999
* Maximum attributable volume for a referred user in a 30d rolling window in
100100
* notional
101101
*/
102-
maximum_30d_attributable_volume_per_referred_user_notional: Long;
102+
maximum_30d_attributable_volume_per_referred_user_quote_quantums: Long;
103103
/** Referred user automatically gets set to this fee tier */
104104

105105
referee_minimum_fee_tier_idx: number;
@@ -341,16 +341,16 @@ export const AffiliateWhitelist_Tier = {
341341

342342
function createBaseAffiliateParameters(): AffiliateParameters {
343343
return {
344-
maximum_30dAttributableVolumePerReferredUserNotional: Long.UZERO,
344+
maximum_30dAttributableVolumePerReferredUserQuoteQuantums: Long.UZERO,
345345
refereeMinimumFeeTierIdx: 0,
346346
maximum_30dAffiliateRevenuePerReferredUserQuoteQuantums: Long.UZERO
347347
};
348348
}
349349

350350
export const AffiliateParameters = {
351351
encode(message: AffiliateParameters, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
352-
if (!message.maximum_30dAttributableVolumePerReferredUserNotional.isZero()) {
353-
writer.uint32(8).uint64(message.maximum_30dAttributableVolumePerReferredUserNotional);
352+
if (!message.maximum_30dAttributableVolumePerReferredUserQuoteQuantums.isZero()) {
353+
writer.uint32(8).uint64(message.maximum_30dAttributableVolumePerReferredUserQuoteQuantums);
354354
}
355355

356356
if (message.refereeMinimumFeeTierIdx !== 0) {
@@ -374,7 +374,7 @@ export const AffiliateParameters = {
374374

375375
switch (tag >>> 3) {
376376
case 1:
377-
message.maximum_30dAttributableVolumePerReferredUserNotional = (reader.uint64() as Long);
377+
message.maximum_30dAttributableVolumePerReferredUserQuoteQuantums = (reader.uint64() as Long);
378378
break;
379379

380380
case 2:
@@ -396,7 +396,7 @@ export const AffiliateParameters = {
396396

397397
fromPartial(object: DeepPartial<AffiliateParameters>): AffiliateParameters {
398398
const message = createBaseAffiliateParameters();
399-
message.maximum_30dAttributableVolumePerReferredUserNotional = object.maximum_30dAttributableVolumePerReferredUserNotional !== undefined && object.maximum_30dAttributableVolumePerReferredUserNotional !== null ? Long.fromValue(object.maximum_30dAttributableVolumePerReferredUserNotional) : Long.UZERO;
399+
message.maximum_30dAttributableVolumePerReferredUserQuoteQuantums = object.maximum_30dAttributableVolumePerReferredUserQuoteQuantums !== undefined && object.maximum_30dAttributableVolumePerReferredUserQuoteQuantums !== null ? Long.fromValue(object.maximum_30dAttributableVolumePerReferredUserQuoteQuantums) : Long.UZERO;
400400
message.refereeMinimumFeeTierIdx = object.refereeMinimumFeeTierIdx ?? 0;
401401
message.maximum_30dAffiliateRevenuePerReferredUserQuoteQuantums = object.maximum_30dAffiliateRevenuePerReferredUserQuoteQuantums !== undefined && object.maximum_30dAffiliateRevenuePerReferredUserQuoteQuantums !== null ? Long.fromValue(object.maximum_30dAffiliateRevenuePerReferredUserQuoteQuantums) : Long.UZERO;
402402
return message;

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,17 @@ export interface AffiliateInfoResponse {
3737
*/
3838

3939
feeSharePpm: number;
40-
/** The affiliate's 30d referred volume in quote quantums. */
40+
/** The affiliate's all-time referred volume in quote quantums. */
41+
42+
/** @deprecated */
4143

4244
referredVolume: Uint8Array;
4345
/** The affiliate's currently staked native tokens (in whole coins). */
4446

4547
stakedAmount: Uint8Array;
48+
/** The affiliate's 30d referred volume in quote quantums. */
49+
50+
referredVolume_30dRolling: Uint8Array;
4651
}
4752
/**
4853
* AffiliateInfoResponse is the response type for the Query/AffiliateInfo RPC
@@ -64,12 +69,17 @@ export interface AffiliateInfoResponseSDKType {
6469
*/
6570

6671
fee_share_ppm: number;
67-
/** The affiliate's 30d referred volume in quote quantums. */
72+
/** The affiliate's all-time referred volume in quote quantums. */
73+
74+
/** @deprecated */
6875

6976
referred_volume: Uint8Array;
7077
/** The affiliate's currently staked native tokens (in whole coins). */
7178

7279
staked_amount: Uint8Array;
80+
/** The affiliate's 30d referred volume in quote quantums. */
81+
82+
referred_volume_30d_rolling: Uint8Array;
7383
}
7484
/** ReferredByRequest is the request type for the Query/ReferredBy RPC method. */
7585

@@ -261,7 +271,8 @@ function createBaseAffiliateInfoResponse(): AffiliateInfoResponse {
261271
tier: 0,
262272
feeSharePpm: 0,
263273
referredVolume: new Uint8Array(),
264-
stakedAmount: new Uint8Array()
274+
stakedAmount: new Uint8Array(),
275+
referredVolume_30dRolling: new Uint8Array()
265276
};
266277
}
267278

@@ -287,6 +298,10 @@ export const AffiliateInfoResponse = {
287298
writer.uint32(42).bytes(message.stakedAmount);
288299
}
289300

301+
if (message.referredVolume_30dRolling.length !== 0) {
302+
writer.uint32(50).bytes(message.referredVolume_30dRolling);
303+
}
304+
290305
return writer;
291306
},
292307

@@ -319,6 +334,10 @@ export const AffiliateInfoResponse = {
319334
message.stakedAmount = reader.bytes();
320335
break;
321336

337+
case 6:
338+
message.referredVolume_30dRolling = reader.bytes();
339+
break;
340+
322341
default:
323342
reader.skipType(tag & 7);
324343
break;
@@ -335,6 +354,7 @@ export const AffiliateInfoResponse = {
335354
message.feeSharePpm = object.feeSharePpm ?? 0;
336355
message.referredVolume = object.referredVolume ?? new Uint8Array();
337356
message.stakedAmount = object.stakedAmount ?? new Uint8Array();
357+
message.referredVolume_30dRolling = object.referredVolume_30dRolling ?? new Uint8Array();
338358
return message;
339359
}
340360

indexer/packages/v4-protos/src/codegen/dydxprotocol/stats/stats.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ export interface UserStats {
128128
/** Maker USDC in quantums */
129129

130130
makerNotional: Long;
131-
/** Affiliate revenue generated in quantums */
131+
/** Affiliate revenue generated in quantums with this user being a referee */
132132

133-
affiliateRevenueGeneratedQuantums: Long;
134-
/** Affiliate referred volume in quote quantums */
133+
affiliate_30dRevenueGeneratedQuantums: Long;
134+
/** Referred volume in quote quantums with this user being an affiliate */
135135

136-
affiliateReferredVolumeQuoteQuantums: Long;
136+
affiliate_30dReferredVolumeQuoteQuantums: Long;
137137
}
138138
/**
139139
* UserStats stores stats for a User. This is the sum of all stats for a user in
@@ -146,12 +146,12 @@ export interface UserStatsSDKType {
146146
/** Maker USDC in quantums */
147147

148148
maker_notional: Long;
149-
/** Affiliate revenue generated in quantums */
149+
/** Affiliate revenue generated in quantums with this user being a referee */
150150

151-
affiliate_revenue_generated_quantums: Long;
152-
/** Affiliate referred volume in quote quantums */
151+
affiliate_30d_revenue_generated_quantums: Long;
152+
/** Referred volume in quote quantums with this user being an affiliate */
153153

154-
affiliate_referred_volume_quote_quantums: Long;
154+
affiliate_30d_referred_volume_quote_quantums: Long;
155155
}
156156
/** CachedStakeAmount stores the last calculated total staked amount for address */
157157

@@ -502,8 +502,8 @@ function createBaseUserStats(): UserStats {
502502
return {
503503
takerNotional: Long.UZERO,
504504
makerNotional: Long.UZERO,
505-
affiliateRevenueGeneratedQuantums: Long.UZERO,
506-
affiliateReferredVolumeQuoteQuantums: Long.UZERO
505+
affiliate_30dRevenueGeneratedQuantums: Long.UZERO,
506+
affiliate_30dReferredVolumeQuoteQuantums: Long.UZERO
507507
};
508508
}
509509

@@ -517,12 +517,12 @@ export const UserStats = {
517517
writer.uint32(16).uint64(message.makerNotional);
518518
}
519519

520-
if (!message.affiliateRevenueGeneratedQuantums.isZero()) {
521-
writer.uint32(24).uint64(message.affiliateRevenueGeneratedQuantums);
520+
if (!message.affiliate_30dRevenueGeneratedQuantums.isZero()) {
521+
writer.uint32(24).uint64(message.affiliate_30dRevenueGeneratedQuantums);
522522
}
523523

524-
if (!message.affiliateReferredVolumeQuoteQuantums.isZero()) {
525-
writer.uint32(32).uint64(message.affiliateReferredVolumeQuoteQuantums);
524+
if (!message.affiliate_30dReferredVolumeQuoteQuantums.isZero()) {
525+
writer.uint32(32).uint64(message.affiliate_30dReferredVolumeQuoteQuantums);
526526
}
527527

528528
return writer;
@@ -546,11 +546,11 @@ export const UserStats = {
546546
break;
547547

548548
case 3:
549-
message.affiliateRevenueGeneratedQuantums = (reader.uint64() as Long);
549+
message.affiliate_30dRevenueGeneratedQuantums = (reader.uint64() as Long);
550550
break;
551551

552552
case 4:
553-
message.affiliateReferredVolumeQuoteQuantums = (reader.uint64() as Long);
553+
message.affiliate_30dReferredVolumeQuoteQuantums = (reader.uint64() as Long);
554554
break;
555555

556556
default:
@@ -566,8 +566,8 @@ export const UserStats = {
566566
const message = createBaseUserStats();
567567
message.takerNotional = object.takerNotional !== undefined && object.takerNotional !== null ? Long.fromValue(object.takerNotional) : Long.UZERO;
568568
message.makerNotional = object.makerNotional !== undefined && object.makerNotional !== null ? Long.fromValue(object.makerNotional) : Long.UZERO;
569-
message.affiliateRevenueGeneratedQuantums = object.affiliateRevenueGeneratedQuantums !== undefined && object.affiliateRevenueGeneratedQuantums !== null ? Long.fromValue(object.affiliateRevenueGeneratedQuantums) : Long.UZERO;
570-
message.affiliateReferredVolumeQuoteQuantums = object.affiliateReferredVolumeQuoteQuantums !== undefined && object.affiliateReferredVolumeQuoteQuantums !== null ? Long.fromValue(object.affiliateReferredVolumeQuoteQuantums) : Long.UZERO;
569+
message.affiliate_30dRevenueGeneratedQuantums = object.affiliate_30dRevenueGeneratedQuantums !== undefined && object.affiliate_30dRevenueGeneratedQuantums !== null ? Long.fromValue(object.affiliate_30dRevenueGeneratedQuantums) : Long.UZERO;
570+
message.affiliate_30dReferredVolumeQuoteQuantums = object.affiliate_30dReferredVolumeQuoteQuantums !== undefined && object.affiliate_30dReferredVolumeQuoteQuantums !== null ? Long.fromValue(object.affiliate_30dReferredVolumeQuoteQuantums) : Long.UZERO;
571571
return message;
572572
}
573573

proto/dydxprotocol/affiliates/affiliates.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ message AffiliateWhitelist {
4040
message AffiliateParameters {
4141
// Maximum attributable volume for a referred user in a 30d rolling window in
4242
// notional
43-
uint64 maximum_30d_attributable_volume_per_referred_user_notional = 1;
43+
uint64 maximum_30d_attributable_volume_per_referred_user_quote_quantums = 1;
4444

4545
// Referred user automatically gets set to this fee tier
4646
uint32 referee_minimum_fee_tier_idx = 2;

proto/dydxprotocol/affiliates/query.proto

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,25 @@ message AffiliateInfoResponse {
6363
// The affiliate's taker fee share in parts-per-million (for both VIP and
6464
// regular affiliate).
6565
uint32 fee_share_ppm = 3;
66-
// The affiliate's 30d referred volume in quote quantums.
66+
// The affiliate's all-time referred volume in quote quantums.
6767
bytes referred_volume = 4 [
6868
(gogoproto.customtype) =
6969
"github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt",
70-
(gogoproto.nullable) = false
70+
(gogoproto.nullable) = false,
71+
deprecated = true
7172
];
7273
// The affiliate's currently staked native tokens (in whole coins).
7374
bytes staked_amount = 5 [
7475
(gogoproto.customtype) =
7576
"github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt",
7677
(gogoproto.nullable) = false
7778
];
79+
// The affiliate's 30d referred volume in quote quantums.
80+
bytes referred_volume_30d_rolling = 6 [
81+
(gogoproto.customtype) =
82+
"github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt",
83+
(gogoproto.nullable) = false
84+
];
7885
}
7986

8087
// ReferredByRequest is the request type for the Query/ReferredBy RPC method.

proto/dydxprotocol/stats/stats.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ message UserStats {
6868
// Maker USDC in quantums
6969
uint64 maker_notional = 2;
7070

71-
// Affiliate revenue generated in quantums
72-
uint64 affiliate_revenue_generated_quantums = 3;
71+
// Affiliate revenue generated in quantums with this user being a referee
72+
uint64 affiliate_30d_revenue_generated_quantums = 3;
7373

74-
// Affiliate referred volume in quote quantums
75-
uint64 affiliate_referred_volume_quote_quantums = 4;
74+
// Referred volume in quote quantums with this user being an affiliate
75+
uint64 affiliate_30d_referred_volume_quote_quantums = 4;
7676
}
7777

7878
// CachedStakeAmount stores the last calculated total staked amount for address

protocol/app/testdata/default_genesis_state.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
},
4646
"affiliate_parameters": {
4747
"maximum_30d_affiliate_revenue_per_referred_user_quote_quantums": "10000000000",
48-
"maximum_30d_attributable_volume_per_referred_user_notional": "100000000000000",
48+
"maximum_30d_attributable_volume_per_referred_user_quote_quantums": "100000000000000",
4949
"referee_minimum_fee_tier_idx": 2
5050
}
5151
},

protocol/scripts/genesis/sample_pregenesis.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"affiliates": {
66
"affiliate_parameters": {
77
"maximum_30d_affiliate_revenue_per_referred_user_quote_quantums": "10000000000",
8-
"maximum_30d_attributable_volume_per_referred_user_notional": "100000000000000",
8+
"maximum_30d_attributable_volume_per_referred_user_quote_quantums": "100000000000000",
99
"referee_minimum_fee_tier_idx": 2
1010
},
1111
"affiliate_tiers": {

protocol/testing/testnet/genesis.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
},
3939
"affiliates": {
4040
"affiliate_parameters": {
41-
"maximum_30d_attributable_volume_per_referred_user_notional": "100000000000000",
41+
"maximum_30d_attributable_volume_per_referred_user_quote_quantums": "100000000000000",
4242
"referee_minimum_fee_tier_idx": 2,
4343
"maximum_30d_affiliate_revenue_per_referred_user_quote_quantums": "10000000000"
4444
}

protocol/x/affiliates/keeper/grpc_query.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ func (k Keeper) AffiliateInfo(c context.Context,
3939
}
4040

4141
userStats := k.statsKeeper.GetUserStats(ctx, addr.String())
42-
referredVolume := userStats.AffiliateReferredVolumeQuoteQuantums
42+
referredVolume := userStats.Affiliate_30DReferredVolumeQuoteQuantums
4343
stakedAmount := k.statsKeeper.GetStakedAmount(ctx, req.GetAddress())
4444

4545
return &types.AffiliateInfoResponse{
46-
IsWhitelisted: isWhitelisted,
47-
Tier: tierLevel,
48-
FeeSharePpm: feeSharePpm,
49-
ReferredVolume: dtypes.NewIntFromBigInt(lib.BigU(referredVolume)),
50-
StakedAmount: dtypes.NewIntFromBigInt(stakedAmount),
46+
IsWhitelisted: isWhitelisted,
47+
Tier: tierLevel,
48+
FeeSharePpm: feeSharePpm,
49+
StakedAmount: dtypes.NewIntFromBigInt(stakedAmount),
50+
ReferredVolume_30DRolling: dtypes.NewIntFromBigInt(lib.BigU(referredVolume)),
5151
}, nil
5252
}
5353

0 commit comments

Comments
 (0)