Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
77ed5fb
Update with affiliates logic
jusbar23 Sep 29, 2025
4c9699f
Update
jusbar23 Sep 30, 2025
bbae86d
Updat
jusbar23 Sep 30, 2025
9bae32b
Update
jusbar23 Sep 30, 2025
8b80727
Refine param naming
jusbar23 Sep 30, 2025
7073817
Refresh
jusbar23 Sep 30, 2025
28bb87c
Uncomment check
jusbar23 Sep 30, 2025
4a2ebdf
Merge branch 'main' into add_logic
jusbar23 Sep 30, 2025
81f688c
Update naming
jusbar23 Sep 30, 2025
408f5e9
Update
jusbar23 Sep 30, 2025
e4dfd24
Update keeper lint
jusbar23 Sep 30, 2025
744d7d5
Update
jusbar23 Sep 30, 2025
f7e0aab
Update lint
jusbar23 Oct 1, 2025
5245444
Update
jusbar23 Oct 1, 2025
cd3221a
Lint issues
jusbar23 Oct 1, 2025
5cf37e9
Update
jusbar23 Oct 1, 2025
701b510
Update with correct value
jusbar23 Oct 1, 2025
d96fdb7
Rename to be consistent
jusbar23 Oct 1, 2025
4042905
Add statskeeper
jusbar23 Oct 1, 2025
d7e5e79
Fix mapping
jusbar23 Oct 1, 2025
a6c004a
Merge branch 'add_logic' into add_user_stats
jusbar23 Oct 1, 2025
012808b
Add checks for attributed commission
jusbar23 Oct 1, 2025
07ce2bd
Update with referred commission
jusbar23 Oct 1, 2025
d2253f7
Push
jusbar23 Oct 1, 2025
074d340
Update keeper code reuse
jusbar23 Oct 2, 2025
bb7f1a4
Address comments
jusbar23 Oct 2, 2025
4fa566b
Add error checking
jusbar23 Oct 2, 2025
7357c0c
Update comments
jusbar23 Oct 2, 2025
90f2ed9
Update
jusbar23 Oct 2, 2025
9d34cb1
Lint
jusbar23 Oct 2, 2025
6596c86
Lint
jusbar23 Oct 2, 2025
68ef15b
Merge branch 'add_logic' into add_user_stats
jusbar23 Oct 2, 2025
af7514c
lint
jusbar23 Oct 2, 2025
57d5dc8
Update
jusbar23 Oct 2, 2025
547e64c
Remove referred commission
jusbar23 Oct 2, 2025
8d576b4
Update
jusbar23 Oct 3, 2025
531bff2
Remove referred commission
jusbar23 Oct 3, 2025
57bf755
Wire minimum referee tiers
jusbar23 Oct 5, 2025
f9fb181
Change calc to last 30d
jusbar23 Oct 5, 2025
1f37d35
formatting
jusbar23 Oct 5, 2025
9a9379f
Remove affiliate stats removed from window
jusbar23 Oct 5, 2025
3a165f1
Add comments to clarify
jusbar23 Oct 5, 2025
f545555
Comment update
jusbar23 Oct 5, 2025
1ee5e45
Merge branch 'add_logic' into add_user_stats
jusbar23 Oct 5, 2025
618291d
Add expiry hook to be able to adjust the 30d rolling window
jusbar23 Oct 5, 2025
328f128
Merge branch 'main' into add_logic
jusbar23 Oct 5, 2025
3a5db29
Update with github workflows
jusbar23 Oct 5, 2025
014ac1c
Format
jusbar23 Oct 5, 2025
4b3519e
Update lint
jusbar23 Oct 6, 2025
9a89c10
Fix lint
jusbar23 Oct 6, 2025
b78932b
Lint, line too long
jusbar23 Oct 6, 2025
6f9f260
Merge branch 'add_logic' into add_user_stats
jusbar23 Oct 6, 2025
5df14a4
Fix stats
jusbar23 Oct 6, 2025
5ed3071
Replace specific cli dir
jusbar23 Oct 6, 2025
7024853
Remove git branches
jusbar23 Oct 6, 2025
3b81503
Merge branch 'add_logic' into add_user_stats
jusbar23 Oct 6, 2025
b65e77d
Address comments, make hook the resulting user stats
jusbar23 Oct 6, 2025
11e6245
Address comments
jusbar23 Oct 6, 2025
ef0ff25
Address comments, readability
jusbar23 Oct 6, 2025
9785716
Update genesis
jusbar23 Oct 6, 2025
3681f56
Reorder genesis
jusbar23 Oct 6, 2025
0494e40
Change from ptr to pass by reference
jusbar23 Oct 6, 2025
be68a94
Merge branch 'add_logic' into add_user_stats
jusbar23 Oct 6, 2025
51a544b
Merge branch 'main' into add_user_stats
jusbar23 Oct 6, 2025
7477b7c
Remove nil check
jusbar23 Oct 6, 2025
cf2b247
Fix out of index bug
jusbar23 Oct 6, 2025
5921bac
Proto lint
jusbar23 Oct 7, 2025
fd45abe
Lint
jusbar23 Oct 7, 2025
66bc1d3
Lint
jusbar23 Oct 7, 2025
b4f6af2
Lint
jusbar23 Oct 7, 2025
c133bef
Take script for main
jusbar23 Oct 7, 2025
af41372
Update test cases
jusbar23 Oct 7, 2025
c5d4338
Add new test cases
jusbar23 Oct 7, 2025
e6d7a8a
Update
jusbar23 Oct 7, 2025
a26e191
Add test cases
jusbar23 Oct 7, 2025
cc2df04
Fix calc
jusbar23 Oct 7, 2025
5397dfa
Ignore if it is 0
jusbar23 Oct 7, 2025
e702ce9
Add build rules
jusbar23 Oct 8, 2025
1b412e2
Fix stats
jusbar23 Oct 8, 2025
572da05
Add comment
jusbar23 Oct 8, 2025
7e0ef0e
Lint
jusbar23 Oct 8, 2025
312a4fd
Lint
jusbar23 Oct 8, 2025
0fae476
Merge branch 'main' into add_user_stats
jusbar23 Oct 8, 2025
c91c03a
Update comment
jusbar23 Oct 8, 2025
66e9cc0
Revise aggregation to reference user stats
jusbar23 Oct 9, 2025
f571f50
Change name of affiliate revenue flag
jusbar23 Oct 9, 2025
755c7b9
Update expiry hooks
jusbar23 Oct 9, 2025
fd9439d
Address comments
jusbar23 Oct 9, 2025
a0496a0
Update
jusbar23 Oct 9, 2025
92f8a9f
Cleanup tech debt
jusbar23 Oct 9, 2025
349bd5a
Address comments, naming changes
jusbar23 Oct 10, 2025
b98a121
Update script
jusbar23 Oct 10, 2025
c8255c1
Merge branch 'main' into add_user_stats
jusbar23 Oct 10, 2025
10eb146
Remove hooks and fix tests
jusbar23 Oct 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ export interface AffiliateParameters {
* Maximum attributable volume for a referred user in a 30d rolling window in
* notional
*/
maximum_30dAttributableVolumePerReferredUserNotional: Long;
maximum_30dAttributableVolumePerReferredUserQuoteQuantums: Long;
/** Referred user automatically gets set to this fee tier */

refereeMinimumFeeTierIdx: number;
/**
* Maximum attributable revenue for a referred user in a 30d rolling window in
* Maximum affiliate revenue for a referred user in a 30d rolling window in
* quote quantums
*/

maximum_30dAttributableRevenuePerReferredUserQuoteQuantums: Long;
maximum_30dAffiliateRevenuePerReferredUserQuoteQuantums: Long;
}
/** AffiliateParameters defines the parameters for the affiliate program. */

Expand All @@ -99,16 +99,16 @@ export interface AffiliateParametersSDKType {
* Maximum attributable volume for a referred user in a 30d rolling window in
* notional
*/
maximum_30d_attributable_volume_per_referred_user_notional: Long;
maximum_30d_attributable_volume_per_referred_user_quote_quantums: Long;
/** Referred user automatically gets set to this fee tier */

referee_minimum_fee_tier_idx: number;
/**
* Maximum attributable revenue for a referred user in a 30d rolling window in
* Maximum affiliate revenue for a referred user in a 30d rolling window in
* quote quantums
*/

maximum_30d_attributable_revenue_per_referred_user_quote_quantums: Long;
maximum_30d_affiliate_revenue_per_referred_user_quote_quantums: Long;
}
/** AffiliateOverrides defines the affiliate whitelist. */

Expand Down Expand Up @@ -341,24 +341,24 @@ export const AffiliateWhitelist_Tier = {

function createBaseAffiliateParameters(): AffiliateParameters {
return {
maximum_30dAttributableVolumePerReferredUserNotional: Long.UZERO,
maximum_30dAttributableVolumePerReferredUserQuoteQuantums: Long.UZERO,
refereeMinimumFeeTierIdx: 0,
maximum_30dAttributableRevenuePerReferredUserQuoteQuantums: Long.UZERO
maximum_30dAffiliateRevenuePerReferredUserQuoteQuantums: Long.UZERO
};
}

export const AffiliateParameters = {
encode(message: AffiliateParameters, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (!message.maximum_30dAttributableVolumePerReferredUserNotional.isZero()) {
writer.uint32(8).uint64(message.maximum_30dAttributableVolumePerReferredUserNotional);
if (!message.maximum_30dAttributableVolumePerReferredUserQuoteQuantums.isZero()) {
writer.uint32(8).uint64(message.maximum_30dAttributableVolumePerReferredUserQuoteQuantums);
}

if (message.refereeMinimumFeeTierIdx !== 0) {
writer.uint32(16).uint32(message.refereeMinimumFeeTierIdx);
}

if (!message.maximum_30dAttributableRevenuePerReferredUserQuoteQuantums.isZero()) {
writer.uint32(24).uint64(message.maximum_30dAttributableRevenuePerReferredUserQuoteQuantums);
if (!message.maximum_30dAffiliateRevenuePerReferredUserQuoteQuantums.isZero()) {
writer.uint32(24).uint64(message.maximum_30dAffiliateRevenuePerReferredUserQuoteQuantums);
}

return writer;
Expand All @@ -374,15 +374,15 @@ export const AffiliateParameters = {

switch (tag >>> 3) {
case 1:
message.maximum_30dAttributableVolumePerReferredUserNotional = (reader.uint64() as Long);
message.maximum_30dAttributableVolumePerReferredUserQuoteQuantums = (reader.uint64() as Long);
break;

case 2:
message.refereeMinimumFeeTierIdx = reader.uint32();
break;

case 3:
message.maximum_30dAttributableRevenuePerReferredUserQuoteQuantums = (reader.uint64() as Long);
message.maximum_30dAffiliateRevenuePerReferredUserQuoteQuantums = (reader.uint64() as Long);
break;

default:
Expand All @@ -396,9 +396,9 @@ export const AffiliateParameters = {

fromPartial(object: DeepPartial<AffiliateParameters>): AffiliateParameters {
const message = createBaseAffiliateParameters();
message.maximum_30dAttributableVolumePerReferredUserNotional = object.maximum_30dAttributableVolumePerReferredUserNotional !== undefined && object.maximum_30dAttributableVolumePerReferredUserNotional !== null ? Long.fromValue(object.maximum_30dAttributableVolumePerReferredUserNotional) : Long.UZERO;
message.maximum_30dAttributableVolumePerReferredUserQuoteQuantums = object.maximum_30dAttributableVolumePerReferredUserQuoteQuantums !== undefined && object.maximum_30dAttributableVolumePerReferredUserQuoteQuantums !== null ? Long.fromValue(object.maximum_30dAttributableVolumePerReferredUserQuoteQuantums) : Long.UZERO;
message.refereeMinimumFeeTierIdx = object.refereeMinimumFeeTierIdx ?? 0;
message.maximum_30dAttributableRevenuePerReferredUserQuoteQuantums = object.maximum_30dAttributableRevenuePerReferredUserQuoteQuantums !== undefined && object.maximum_30dAttributableRevenuePerReferredUserQuoteQuantums !== null ? Long.fromValue(object.maximum_30dAttributableRevenuePerReferredUserQuoteQuantums) : Long.UZERO;
message.maximum_30dAffiliateRevenuePerReferredUserQuoteQuantums = object.maximum_30dAffiliateRevenuePerReferredUserQuoteQuantums !== undefined && object.maximum_30dAffiliateRevenuePerReferredUserQuoteQuantums !== null ? Long.fromValue(object.maximum_30dAffiliateRevenuePerReferredUserQuoteQuantums) : Long.UZERO;
return message;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
import { AffiliateTiers, AffiliateTiersSDKType } from "./affiliates";
import { AffiliateTiers, AffiliateTiersSDKType, AffiliateParameters, AffiliateParametersSDKType } from "./affiliates";
import * as _m0 from "protobufjs/minimal";
import { DeepPartial } from "../../helpers";
/** GenesisState defines generis state of `x/affiliates` */

export interface GenesisState {
/** The list of affiliate tiers */
affiliateTiers?: AffiliateTiers;
/** The affiliate parameters */

affiliateParameters?: AffiliateParameters;
}
/** GenesisState defines generis state of `x/affiliates` */

export interface GenesisStateSDKType {
/** The list of affiliate tiers */
affiliate_tiers?: AffiliateTiersSDKType;
/** The affiliate parameters */

affiliate_parameters?: AffiliateParametersSDKType;
}

function createBaseGenesisState(): GenesisState {
return {
affiliateTiers: undefined
affiliateTiers: undefined,
affiliateParameters: undefined
};
}

Expand All @@ -26,6 +33,10 @@ export const GenesisState = {
AffiliateTiers.encode(message.affiliateTiers, writer.uint32(10).fork()).ldelim();
}

if (message.affiliateParameters !== undefined) {
AffiliateParameters.encode(message.affiliateParameters, writer.uint32(18).fork()).ldelim();
}

return writer;
},

Expand All @@ -42,6 +53,10 @@ export const GenesisState = {
message.affiliateTiers = AffiliateTiers.decode(reader, reader.uint32());
break;

case 2:
message.affiliateParameters = AffiliateParameters.decode(reader, reader.uint32());
break;

default:
reader.skipType(tag & 7);
break;
Expand All @@ -54,6 +69,7 @@ export const GenesisState = {
fromPartial(object: DeepPartial<GenesisState>): GenesisState {
const message = createBaseGenesisState();
message.affiliateTiers = object.affiliateTiers !== undefined && object.affiliateTiers !== null ? AffiliateTiers.fromPartial(object.affiliateTiers) : undefined;
message.affiliateParameters = object.affiliateParameters !== undefined && object.affiliateParameters !== null ? AffiliateParameters.fromPartial(object.affiliateParameters) : undefined;
return message;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ export interface AffiliateInfoResponse {
feeSharePpm: number;
/** The affiliate's all-time referred volume in quote quantums. */

/** @deprecated */

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

stakedAmount: Uint8Array;
/** The affiliate's 30d referred volume in quote quantums. */

referredVolume_30dRolling: Uint8Array;
}
/**
* AffiliateInfoResponse is the response type for the Query/AffiliateInfo RPC
Expand All @@ -66,10 +71,15 @@ export interface AffiliateInfoResponseSDKType {
fee_share_ppm: number;
/** The affiliate's all-time referred volume in quote quantums. */

/** @deprecated */

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

staked_amount: Uint8Array;
/** The affiliate's 30d referred volume in quote quantums. */

referred_volume_30d_rolling: Uint8Array;
}
/** ReferredByRequest is the request type for the Query/ReferredBy RPC method. */

Expand Down Expand Up @@ -261,7 +271,8 @@ function createBaseAffiliateInfoResponse(): AffiliateInfoResponse {
tier: 0,
feeSharePpm: 0,
referredVolume: new Uint8Array(),
stakedAmount: new Uint8Array()
stakedAmount: new Uint8Array(),
referredVolume_30dRolling: new Uint8Array()
};
}

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

if (message.referredVolume_30dRolling.length !== 0) {
writer.uint32(50).bytes(message.referredVolume_30dRolling);
}

return writer;
},

Expand Down Expand Up @@ -319,6 +334,10 @@ export const AffiliateInfoResponse = {
message.stakedAmount = reader.bytes();
break;

case 6:
message.referredVolume_30dRolling = reader.bytes();
break;

default:
reader.skipType(tag & 7);
break;
Expand All @@ -335,6 +354,7 @@ export const AffiliateInfoResponse = {
message.feeSharePpm = object.feeSharePpm ?? 0;
message.referredVolume = object.referredVolume ?? new Uint8Array();
message.stakedAmount = object.stakedAmount ?? new Uint8Array();
message.referredVolume_30dRolling = object.referredVolume_30dRolling ?? new Uint8Array();
return message;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,12 @@ export interface UserStats {
/** Maker USDC in quantums */

makerNotional: Long;
/** Affiliate revenue generated in quantums */
/** Affiliate revenue generated in quantums with this user being a referee */

affiliateRevenueGeneratedQuantums: Long;
affiliate_30dRevenueGeneratedQuantums: Long;
/** Referred volume in quote quantums with this user being an affiliate */

affiliate_30dReferredVolumeQuoteQuantums: Long;
}
/**
* UserStats stores stats for a User. This is the sum of all stats for a user in
Expand All @@ -143,9 +146,12 @@ export interface UserStatsSDKType {
/** Maker USDC in quantums */

maker_notional: Long;
/** Affiliate revenue generated in quantums */
/** Affiliate revenue generated in quantums with this user being a referee */

affiliate_30d_revenue_generated_quantums: Long;
/** Referred volume in quote quantums with this user being an affiliate */

affiliate_revenue_generated_quantums: Long;
affiliate_30d_referred_volume_quote_quantums: Long;
}
/** CachedStakeAmount stores the last calculated total staked amount for address */

Expand Down Expand Up @@ -496,7 +502,8 @@ function createBaseUserStats(): UserStats {
return {
takerNotional: Long.UZERO,
makerNotional: Long.UZERO,
affiliateRevenueGeneratedQuantums: Long.UZERO
affiliate_30dRevenueGeneratedQuantums: Long.UZERO,
affiliate_30dReferredVolumeQuoteQuantums: Long.UZERO
};
}

Expand All @@ -510,8 +517,12 @@ export const UserStats = {
writer.uint32(16).uint64(message.makerNotional);
}

if (!message.affiliateRevenueGeneratedQuantums.isZero()) {
writer.uint32(24).uint64(message.affiliateRevenueGeneratedQuantums);
if (!message.affiliate_30dRevenueGeneratedQuantums.isZero()) {
writer.uint32(24).uint64(message.affiliate_30dRevenueGeneratedQuantums);
}

if (!message.affiliate_30dReferredVolumeQuoteQuantums.isZero()) {
writer.uint32(32).uint64(message.affiliate_30dReferredVolumeQuoteQuantums);
}

return writer;
Expand All @@ -535,7 +546,11 @@ export const UserStats = {
break;

case 3:
message.affiliateRevenueGeneratedQuantums = (reader.uint64() as Long);
message.affiliate_30dRevenueGeneratedQuantums = (reader.uint64() as Long);
break;

case 4:
message.affiliate_30dReferredVolumeQuoteQuantums = (reader.uint64() as Long);
break;

default:
Expand All @@ -551,7 +566,8 @@ export const UserStats = {
const message = createBaseUserStats();
message.takerNotional = object.takerNotional !== undefined && object.takerNotional !== null ? Long.fromValue(object.takerNotional) : Long.UZERO;
message.makerNotional = object.makerNotional !== undefined && object.makerNotional !== null ? Long.fromValue(object.makerNotional) : Long.UZERO;
message.affiliateRevenueGeneratedQuantums = object.affiliateRevenueGeneratedQuantums !== undefined && object.affiliateRevenueGeneratedQuantums !== null ? Long.fromValue(object.affiliateRevenueGeneratedQuantums) : Long.UZERO;
message.affiliate_30dRevenueGeneratedQuantums = object.affiliate_30dRevenueGeneratedQuantums !== undefined && object.affiliate_30dRevenueGeneratedQuantums !== null ? Long.fromValue(object.affiliate_30dRevenueGeneratedQuantums) : Long.UZERO;
message.affiliate_30dReferredVolumeQuoteQuantums = object.affiliate_30dReferredVolumeQuoteQuantums !== undefined && object.affiliate_30dReferredVolumeQuoteQuantums !== null ? Long.fromValue(object.affiliate_30dReferredVolumeQuoteQuantums) : Long.UZERO;
return message;
}

Expand Down
6 changes: 3 additions & 3 deletions proto/dydxprotocol/affiliates/affiliates.proto
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ message AffiliateWhitelist {
message AffiliateParameters {
// Maximum attributable volume for a referred user in a 30d rolling window in
// notional
uint64 maximum_30d_attributable_volume_per_referred_user_notional = 1;
uint64 maximum_30d_attributable_volume_per_referred_user_quote_quantums = 1;

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

// Maximum attributable revenue for a referred user in a 30d rolling window in
// Maximum affiliate revenue for a referred user in a 30d rolling window in
// quote quantums
uint64 maximum_30d_attributable_revenue_per_referred_user_quote_quantums = 3;
uint64 maximum_30d_affiliate_revenue_per_referred_user_quote_quantums = 3;
}

// AffiliateOverrides defines the affiliate whitelist.
Expand Down
3 changes: 3 additions & 0 deletions proto/dydxprotocol/affiliates/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/affiliates/type
message GenesisState {
// The list of affiliate tiers
AffiliateTiers affiliate_tiers = 1 [ (gogoproto.nullable) = false ];

// The affiliate parameters
AffiliateParameters affiliate_parameters = 2 [ (gogoproto.nullable) = false ];
}
9 changes: 8 additions & 1 deletion proto/dydxprotocol/affiliates/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,21 @@ message AffiliateInfoResponse {
bytes referred_volume = 4 [
(gogoproto.customtype) =
"github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt",
(gogoproto.nullable) = false
(gogoproto.nullable) = false,
deprecated = true
];
// The affiliate's currently staked native tokens (in whole coins).
bytes staked_amount = 5 [
(gogoproto.customtype) =
"github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt",
(gogoproto.nullable) = false
];
// The affiliate's 30d referred volume in quote quantums.
bytes referred_volume_30d_rolling = 6 [
(gogoproto.customtype) =
"github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt",
(gogoproto.nullable) = false
];
}

// ReferredByRequest is the request type for the Query/ReferredBy RPC method.
Expand Down
7 changes: 5 additions & 2 deletions proto/dydxprotocol/stats/stats.proto
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ message UserStats {
// Maker USDC in quantums
uint64 maker_notional = 2;

// Affiliate revenue generated in quantums
uint64 affiliate_revenue_generated_quantums = 3;
// Affiliate revenue generated in quantums with this user being a referee
uint64 affiliate_30d_revenue_generated_quantums = 3;

// Referred volume in quote quantums with this user being an affiliate
uint64 affiliate_30d_referred_volume_quote_quantums = 4;
Comment on lines +71 to +75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Preserve the existing field name to unblock protobuf CI.

Renaming field 3 from affiliate_revenue_generated_quantums to affiliate_30d_revenue_generated_quantums breaks JSON/proto compatibility and is exactly what the Protobuf pipeline failure is flagging. Please keep the original proto field identifier (and json_name) and evolve semantics via comments or a brand-new field number if you need a distinct metric. As-is, codegen/users of the published proto will break.

🧰 Tools
🪛 GitHub Actions: Protobuf

[error] 72-72: Field '3' with name 'affiliate_30d_revenue_generated_quantums' changed json_name from 'affiliateRevenueGeneratedQuantums' to 'affiliate30dRevenueGeneratedQuantums'.


[error] 72-72: Field '3' on message 'UserStats' changed name from 'affiliate_revenue_generated_quantums' to 'affiliate_30d_revenue_generated_quantums'.

🤖 Prompt for AI Agents
In proto/dydxprotocol/stats/stats.proto around lines 71 to 75, the field with
number 3 was renamed to affiliate_30d_revenue_generated_quantums which breaks
protobuf/JSON compatibility; revert that change so the field number 3 retains
its original name affiliate_revenue_generated_quantums (and its json_name) to
preserve wire/JSON compatibility, and if you need a 30-day-specific metric
instead add a new field with a new unique field number and the new name (and
update the comment to describe the semantics) rather than renaming the existing
field.

}

// CachedStakeAmount stores the last calculated total staked amount for address
Expand Down
4 changes: 1 addition & 3 deletions protocol/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -962,9 +962,6 @@ func New(
)
affiliatesModule := affiliatesmodule.NewAppModule(appCodec, app.AffiliatesKeeper)

// Register the affiliates keeper to be notified when stats expire
app.StatsKeeper.AddStatsExpirationHook(&app.AffiliatesKeeper)

app.MarketMapKeeper = *marketmapmodulekeeper.NewKeeper(
runtime.NewKVStoreService(keys[marketmapmoduletypes.StoreKey]),
appCodec,
Expand Down Expand Up @@ -996,6 +993,7 @@ func New(
},
app.AffiliatesKeeper,
*app.FeeTiersKeeper,
app.StatsKeeper,
)
revShareModule := revsharemodule.NewAppModule(appCodec, app.RevShareKeeper)
app.FeeTiersKeeper.SetRevShareKeeper(app.RevShareKeeper)
Expand Down
Loading
Loading