Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
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 @@ -21,9 +21,19 @@ export interface BlockStats_Fill {
/** Maker wallet address */

maker: string;
/** Notional USDC filled in quantums */
/**
* Notional USDC filled in quantums
* Used to calculate fee tier, and affiliate revenue attributed for taker
*/

notional: Long;
/**
* Affiliate fee generated in quantums of the taker fee for the affiliate
* Used to calculate affiliate revenue attributed for taker. This is dynamic
* per affiliate tier
*/

affiliateFeeGeneratedQuantums: Long;
}
/** Fill records data about a fill on this block. */

Expand All @@ -33,9 +43,19 @@ export interface BlockStats_FillSDKType {
/** Maker wallet address */

maker: string;
/** Notional USDC filled in quantums */
/**
* Notional USDC filled in quantums
* Used to calculate fee tier, and affiliate revenue attributed for taker
*/

notional: Long;
/**
* Affiliate fee generated in quantums of the taker fee for the affiliate
* Used to calculate affiliate revenue attributed for taker. This is dynamic
* per affiliate tier
*/

affiliate_fee_generated_quantums: Long;
}
/** StatsMetadata stores metadata for the x/stats module */

Expand Down Expand Up @@ -85,35 +105,47 @@ export interface EpochStats_UserWithStatsSDKType {
user: string;
stats?: UserStatsSDKType;
}
/** GlobalStats stores global stats */
/** GlobalStats stores global stats for the rolling window (default 30d). */

export interface GlobalStats {
/** Notional USDC traded in quantums */
notionalTraded: Long;
}
/** GlobalStats stores global stats */
/** GlobalStats stores global stats for the rolling window (default 30d). */

export interface GlobalStatsSDKType {
/** Notional USDC traded in quantums */
notional_traded: Long;
}
/** UserStats stores stats for a User */
/**
* UserStats stores stats for a User. This is the sum of all stats for a user in
* the rolling window (default 30d).
*/

export interface UserStats {
/** Taker USDC in quantums */
takerNotional: Long;
/** Maker USDC in quantums */

makerNotional: Long;
/** Affiliate revenue generated in quantums */

affiliateRevenueGeneratedQuantums: Long;
}
/** UserStats stores stats for a User */
/**
* UserStats stores stats for a User. This is the sum of all stats for a user in
* the rolling window (default 30d).
*/

export interface UserStatsSDKType {
/** Taker USDC in quantums */
taker_notional: Long;
/** Maker USDC in quantums */

maker_notional: Long;
/** Affiliate revenue generated in quantums */

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

Expand Down Expand Up @@ -189,7 +221,8 @@ function createBaseBlockStats_Fill(): BlockStats_Fill {
return {
taker: "",
maker: "",
notional: Long.UZERO
notional: Long.UZERO,
affiliateFeeGeneratedQuantums: Long.UZERO
};
}

Expand All @@ -207,6 +240,10 @@ export const BlockStats_Fill = {
writer.uint32(24).uint64(message.notional);
}

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

return writer;
},

Expand All @@ -231,6 +268,10 @@ export const BlockStats_Fill = {
message.notional = (reader.uint64() as Long);
break;

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

default:
reader.skipType(tag & 7);
break;
Expand All @@ -245,6 +286,7 @@ export const BlockStats_Fill = {
message.taker = object.taker ?? "";
message.maker = object.maker ?? "";
message.notional = object.notional !== undefined && object.notional !== null ? Long.fromValue(object.notional) : Long.UZERO;
message.affiliateFeeGeneratedQuantums = object.affiliateFeeGeneratedQuantums !== undefined && object.affiliateFeeGeneratedQuantums !== null ? Long.fromValue(object.affiliateFeeGeneratedQuantums) : Long.UZERO;
return message;
}

Expand Down Expand Up @@ -453,7 +495,8 @@ export const GlobalStats = {
function createBaseUserStats(): UserStats {
return {
takerNotional: Long.UZERO,
makerNotional: Long.UZERO
makerNotional: Long.UZERO,
affiliateRevenueGeneratedQuantums: Long.UZERO
};
}

Expand All @@ -467,6 +510,10 @@ export const UserStats = {
writer.uint32(16).uint64(message.makerNotional);
}

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

return writer;
},

Expand All @@ -487,6 +534,10 @@ export const UserStats = {
message.makerNotional = (reader.uint64() as Long);
break;

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

default:
reader.skipType(tag & 7);
break;
Expand All @@ -500,6 +551,7 @@ 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;
return message;
}

Expand Down
14 changes: 12 additions & 2 deletions proto/dydxprotocol/stats/stats.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ message BlockStats {
string maker = 2;

// Notional USDC filled in quantums
// Used to calculate fee tier, and affiliate revenue attributed for taker
uint64 notional = 3;

// Affiliate fee generated in quantums of the taker fee for the affiliate
// Used to calculate affiliate revenue attributed for taker. This is dynamic
// per affiliate tier
uint64 affiliate_fee_generated_quantums = 4;
}

// The fills that occured on this block.
Expand Down Expand Up @@ -47,19 +53,23 @@ message EpochStats {
repeated UserWithStats stats = 2;
}

// GlobalStats stores global stats
// GlobalStats stores global stats for the rolling window (default 30d).
message GlobalStats {
// Notional USDC traded in quantums
uint64 notional_traded = 1;
}

// UserStats stores stats for a User
// UserStats stores stats for a User. This is the sum of all stats for a user in
// the rolling window (default 30d).
message UserStats {
// Taker USDC in quantums
uint64 taker_notional = 1;

// Maker USDC in quantums
uint64 maker_notional = 2;

// Affiliate revenue generated in quantums
uint64 affiliate_revenue_generated_quantums = 3;
}

// CachedStakeAmount stores the last calculated total staked amount for address
Expand Down
3 changes: 3 additions & 0 deletions protocol/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,9 @@ 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
2 changes: 1 addition & 1 deletion protocol/app/testdata/default_genesis_state.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{
"req_referred_volume_quote_quantums": "50000000000000",
"req_staked_whole_coins": 1e+08,
"taker_fee_share_ppm": 200000
"taker_fee_share_ppm": 250000
}
]
}
Expand Down
29 changes: 15 additions & 14 deletions protocol/mocks/ClobKeeper.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 15 additions & 14 deletions protocol/mocks/MemClobKeeper.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading