Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OTE-693][OTE-691] Add keeper methods for affiliates #2141

Merged
merged 13 commits into from
Sep 5, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ export interface AffiliateTiersSDKType {
/** Tier defines an affiliate tier. */

export interface AffiliateTiers_Tier {
/** Level of the tier */
level: number;
/** Required all-time referred volume in quote quantums. */

reqReferredVolume: Long;
/** Required currently staked native tokens (in whole coins). */

Expand All @@ -30,10 +27,7 @@ export interface AffiliateTiers_Tier {
/** Tier defines an affiliate tier. */

export interface AffiliateTiers_TierSDKType {
/** Level of the tier */
level: number;
/** Required all-time referred volume in quote quantums. */

req_referred_volume: Long;
/** Required currently staked native tokens (in whole coins). */

Expand Down Expand Up @@ -90,7 +84,6 @@ export const AffiliateTiers = {

function createBaseAffiliateTiers_Tier(): AffiliateTiers_Tier {
return {
level: 0,
reqReferredVolume: Long.UZERO,
reqStakedWholeCoins: 0,
takerFeeSharePpm: 0
Expand All @@ -99,20 +92,16 @@ function createBaseAffiliateTiers_Tier(): AffiliateTiers_Tier {

export const AffiliateTiers_Tier = {
encode(message: AffiliateTiers_Tier, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.level !== 0) {
writer.uint32(8).uint32(message.level);
}

if (!message.reqReferredVolume.isZero()) {
writer.uint32(16).uint64(message.reqReferredVolume);
writer.uint32(8).uint64(message.reqReferredVolume);
}

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

if (message.takerFeeSharePpm !== 0) {
writer.uint32(32).uint32(message.takerFeeSharePpm);
writer.uint32(24).uint32(message.takerFeeSharePpm);
}

return writer;
Expand All @@ -128,18 +117,14 @@ export const AffiliateTiers_Tier = {

switch (tag >>> 3) {
case 1:
message.level = reader.uint32();
break;

case 2:
message.reqReferredVolume = (reader.uint64() as Long);
break;

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

case 4:
case 3:
message.takerFeeSharePpm = reader.uint32();
break;

Expand All @@ -154,7 +139,6 @@ export const AffiliateTiers_Tier = {

fromPartial(object: DeepPartial<AffiliateTiers_Tier>): AffiliateTiers_Tier {
const message = createBaseAffiliateTiers_Tier();
message.level = object.level ?? 0;
message.reqReferredVolume = object.reqReferredVolume !== undefined && object.reqReferredVolume !== null ? Long.fromValue(object.reqReferredVolume) : Long.UZERO;
message.reqStakedWholeCoins = object.reqStakedWholeCoins ?? 0;
message.takerFeeSharePpm = object.takerFeeSharePpm ?? 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1493,9 +1493,6 @@ export interface RegisterAffiliateEventV1 {
/** Address of the affiliate associated with the referee. */

affiliate: string;
/** Block number at which the affiliate was registered. */

registeredAtBlock: Long;
}
/** Event emitted when a referee is registered with an affiliate. */

Expand All @@ -1505,9 +1502,6 @@ export interface RegisterAffiliateEventV1SDKType {
/** Address of the affiliate associated with the referee. */

affiliate: string;
/** Block number at which the affiliate was registered. */

registered_at_block: Long;
}

function createBaseFundingUpdateV1(): FundingUpdateV1 {
Expand Down Expand Up @@ -3758,8 +3752,7 @@ export const LiquidityTierUpsertEventV2 = {
function createBaseRegisterAffiliateEventV1(): RegisterAffiliateEventV1 {
return {
referee: "",
affiliate: "",
registeredAtBlock: Long.UZERO
affiliate: ""
};
Comment on lines +3755 to 3756
Copy link
Contributor

Choose a reason for hiding this comment

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

Interface property removed: registeredAtBlock

The registeredAtBlock property has been removed from the RegisterAffiliateEventV1 interface. This property likely stored the block number when the affiliate was registered.

Consider the implications of this removal:

  • Is the block number information no longer needed for affiliate registration events?
  • Will this information be tracked in a different way or is it no longer relevant?

Ensure that removing this property doesn't adversely affect other parts of the system that may have depended on this information.


Corresponding change in RegisterAffiliateEventV1SDKType

The registered_at_block property has also been removed from the RegisterAffiliateEventV1SDKType interface, mirroring the change made to RegisterAffiliateEventV1.

See the previous comment for considerations around this change.

}

Expand All @@ -3773,10 +3766,6 @@ export const RegisterAffiliateEventV1 = {
writer.uint32(18).string(message.affiliate);
}

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

return writer;
},

Expand All @@ -3797,10 +3786,6 @@ export const RegisterAffiliateEventV1 = {
message.affiliate = reader.string();
break;

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

default:
reader.skipType(tag & 7);
break;
Expand All @@ -3814,7 +3799,6 @@ export const RegisterAffiliateEventV1 = {
const message = createBaseRegisterAffiliateEventV1();
message.referee = object.referee ?? "";
message.affiliate = object.affiliate ?? "";
message.registeredAtBlock = object.registeredAtBlock !== undefined && object.registeredAtBlock !== null ? Long.fromValue(object.registeredAtBlock) : Long.UZERO;
return message;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ export const UserStats = {
function createBaseCachedStakeAmount(): CachedStakeAmount {
return {
stakedAmount: new Uint8Array(),
cachedAt: Long.UZERO
cachedAt: Long.ZERO
};
}

Expand All @@ -519,7 +519,7 @@ export const CachedStakeAmount = {
}

if (!message.cachedAt.isZero()) {
writer.uint32(16).uint64(message.cachedAt);
writer.uint32(16).int64(message.cachedAt);
}

return writer;
Expand All @@ -539,7 +539,7 @@ export const CachedStakeAmount = {
break;

case 2:
message.cachedAt = (reader.uint64() as Long);
message.cachedAt = (reader.int64() as Long);
break;

default:
Expand All @@ -554,7 +554,7 @@ export const CachedStakeAmount = {
fromPartial(object: DeepPartial<CachedStakeAmount>): CachedStakeAmount {
const message = createBaseCachedStakeAmount();
message.stakedAmount = object.stakedAmount ?? new Uint8Array();
message.cachedAt = object.cachedAt !== undefined && object.cachedAt !== null ? Long.fromValue(object.cachedAt) : Long.UZERO;
message.cachedAt = object.cachedAt !== undefined && object.cachedAt !== null ? Long.fromValue(object.cachedAt) : Long.ZERO;
return message;
}

Expand Down
8 changes: 3 additions & 5 deletions proto/dydxprotocol/affiliates/affiliates.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/affiliates/type
message AffiliateTiers {
// Tier defines an affiliate tier.
message Tier {
// Level of the tier
uint32 level = 1;
// Required all-time referred volume in quote quantums.
uint64 req_referred_volume = 2;
uint64 req_referred_volume = 1;
// Required currently staked native tokens (in whole coins).
uint32 req_staked_whole_coins = 3;
uint32 req_staked_whole_coins = 2;
// Taker fee share in parts-per-million.
uint32 taker_fee_share_ppm = 4;
uint32 taker_fee_share_ppm = 3;
}
// All affiliate tiers
repeated Tier tiers = 1 [ (gogoproto.nullable) = false ];
Expand Down
2 changes: 0 additions & 2 deletions proto/dydxprotocol/indexer/events/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,4 @@ message RegisterAffiliateEventV1 {
string referee = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// Address of the affiliate associated with the referee.
string affiliate = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// Block number at which the affiliate was registered.
uint64 registered_at_block = 3;
}
4 changes: 2 additions & 2 deletions proto/dydxprotocol/stats/stats.proto
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ message CachedStakeAmount {
];
// Block time at which the calculation is cached (in Unix Epoch seconds)
// Rounded down to nearest second.
uint64 cached_at = 2;
}
int64 cached_at = 2;
}
Loading
Loading