From f9ce33f831ad47455ec8ad971f6e8e8999d3f738 Mon Sep 17 00:00:00 2001 From: Teddy Ding Date: Tue, 10 Sep 2024 14:52:05 -0400 Subject: [PATCH] [OTE-791] Add proto for affiliate whitelist (#2232) --- .../dydxprotocol/affiliates/affiliates.ts | 138 +++++ .../affiliates/query.rpc.Query.ts | 16 +- .../codegen/dydxprotocol/affiliates/query.ts | 159 +++++- .../dydxprotocol/affiliates/affiliates.proto | 15 + proto/dydxprotocol/affiliates/query.proto | 30 +- protocol/x/affiliates/keeper/grpc_query.go | 7 + protocol/x/affiliates/types/affiliates.pb.go | 444 ++++++++++++++++- protocol/x/affiliates/types/query.pb.go | 470 ++++++++++++++++-- 8 files changed, 1193 insertions(+), 86 deletions(-) diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/affiliates.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/affiliates.ts index 2fcc10ae611..f6ded433c8a 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/affiliates.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/affiliates.ts @@ -36,6 +36,44 @@ export interface AffiliateTiers_TierSDKType { taker_fee_share_ppm: number; } +/** + * AffiliateWhitelist specifies the whitelisted affiliates. + * If an address is in the whitelist, then the affiliate fee share in + * this object will override fee share from the regular affiliate tiers above. + */ + +export interface AffiliateWhitelist { + /** All affiliate whitelist tiers. */ + tiers: AffiliateWhitelist_Tier[]; +} +/** + * AffiliateWhitelist specifies the whitelisted affiliates. + * If an address is in the whitelist, then the affiliate fee share in + * this object will override fee share from the regular affiliate tiers above. + */ + +export interface AffiliateWhitelistSDKType { + /** All affiliate whitelist tiers. */ + tiers: AffiliateWhitelist_TierSDKType[]; +} +/** Tier defines an affiliate whitelist tier. */ + +export interface AffiliateWhitelist_Tier { + /** List of unique whitelisted addresses. */ + addresses: string[]; + /** Taker fee share in parts-per-million. */ + + takerFeeSharePpm: number; +} +/** Tier defines an affiliate whitelist tier. */ + +export interface AffiliateWhitelist_TierSDKType { + /** List of unique whitelisted addresses. */ + addresses: string[]; + /** Taker fee share in parts-per-million. */ + + taker_fee_share_ppm: number; +} function createBaseAffiliateTiers(): AffiliateTiers { return { @@ -145,4 +183,104 @@ export const AffiliateTiers_Tier = { return message; } +}; + +function createBaseAffiliateWhitelist(): AffiliateWhitelist { + return { + tiers: [] + }; +} + +export const AffiliateWhitelist = { + encode(message: AffiliateWhitelist, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.tiers) { + AffiliateWhitelist_Tier.encode(v!, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AffiliateWhitelist { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAffiliateWhitelist(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.tiers.push(AffiliateWhitelist_Tier.decode(reader, reader.uint32())); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): AffiliateWhitelist { + const message = createBaseAffiliateWhitelist(); + message.tiers = object.tiers?.map(e => AffiliateWhitelist_Tier.fromPartial(e)) || []; + return message; + } + +}; + +function createBaseAffiliateWhitelist_Tier(): AffiliateWhitelist_Tier { + return { + addresses: [], + takerFeeSharePpm: 0 + }; +} + +export const AffiliateWhitelist_Tier = { + encode(message: AffiliateWhitelist_Tier, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.addresses) { + writer.uint32(10).string(v!); + } + + if (message.takerFeeSharePpm !== 0) { + writer.uint32(16).uint32(message.takerFeeSharePpm); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AffiliateWhitelist_Tier { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAffiliateWhitelist_Tier(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.addresses.push(reader.string()); + break; + + case 2: + message.takerFeeSharePpm = reader.uint32(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): AffiliateWhitelist_Tier { + const message = createBaseAffiliateWhitelist_Tier(); + message.addresses = object.addresses?.map(e => e) || []; + message.takerFeeSharePpm = object.takerFeeSharePpm ?? 0; + return message; + } + }; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.rpc.Query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.rpc.Query.ts index 51a635f7a99..4815a3585df 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.rpc.Query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.rpc.Query.ts @@ -1,7 +1,7 @@ import { Rpc } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { AffiliateInfoRequest, AffiliateInfoResponse, ReferredByRequest, ReferredByResponse, AllAffiliateTiersRequest, AllAffiliateTiersResponse } from "./query"; +import { AffiliateInfoRequest, AffiliateInfoResponse, ReferredByRequest, ReferredByResponse, AllAffiliateTiersRequest, AllAffiliateTiersResponse, AffiliateWhitelistRequest, AffiliateWhitelistResponse } from "./query"; /** Query defines the gRPC querier service. */ export interface Query { @@ -13,6 +13,9 @@ export interface Query { /** Query AllAffiliateTiers returns all affiliate tiers. */ allAffiliateTiers(request?: AllAffiliateTiersRequest): Promise; + /** Query AffiliateWhitelist returns the affiliate whitelist. */ + + affiliateWhitelist(request?: AffiliateWhitelistRequest): Promise; } export class QueryClientImpl implements Query { private readonly rpc: Rpc; @@ -22,6 +25,7 @@ export class QueryClientImpl implements Query { this.affiliateInfo = this.affiliateInfo.bind(this); this.referredBy = this.referredBy.bind(this); this.allAffiliateTiers = this.allAffiliateTiers.bind(this); + this.affiliateWhitelist = this.affiliateWhitelist.bind(this); } affiliateInfo(request: AffiliateInfoRequest): Promise { @@ -42,6 +46,12 @@ export class QueryClientImpl implements Query { return promise.then(data => AllAffiliateTiersResponse.decode(new _m0.Reader(data))); } + affiliateWhitelist(request: AffiliateWhitelistRequest = {}): Promise { + const data = AffiliateWhitelistRequest.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.affiliates.Query", "AffiliateWhitelist", data); + return promise.then(data => AffiliateWhitelistResponse.decode(new _m0.Reader(data))); + } + } export const createRpcQueryExtension = (base: QueryClient) => { const rpc = createProtobufRpcClient(base); @@ -57,6 +67,10 @@ export const createRpcQueryExtension = (base: QueryClient) => { allAffiliateTiers(request?: AllAffiliateTiersRequest): Promise { return queryService.allAffiliateTiers(request); + }, + + affiliateWhitelist(request?: AffiliateWhitelistRequest): Promise { + return queryService.affiliateWhitelist(request); } }; diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts index 1662fc5772d..1cdebd2f257 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts @@ -1,4 +1,4 @@ -import { AffiliateTiers, AffiliateTiersSDKType } from "./affiliates"; +import { AffiliateTiers, AffiliateTiersSDKType, AffiliateWhitelist, AffiliateWhitelistSDKType } from "./affiliates"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; /** @@ -23,9 +23,18 @@ export interface AffiliateInfoRequestSDKType { */ export interface AffiliateInfoResponse { - /** The affiliate's tier. */ + /** Whether the address is a whitelisted affiliate (VIP). */ + isWhitelisted: boolean; + /** + * If `is_whiteslisted == false`, the affiliate's tier qualified through + * regular affiliate program. + */ + tier: number; - /** The affiliate's taker fee share in parts-per-million. */ + /** + * The affiliate's taker fee share in parts-per-million (for both VIP and + * regular affiliate). + */ feeSharePpm: number; /** The affiliate's all-time referred volume in quote quantums. */ @@ -41,9 +50,18 @@ export interface AffiliateInfoResponse { */ export interface AffiliateInfoResponseSDKType { - /** The affiliate's tier. */ + /** Whether the address is a whitelisted affiliate (VIP). */ + is_whitelisted: boolean; + /** + * If `is_whiteslisted == false`, the affiliate's tier qualified through + * regular affiliate program. + */ + tier: number; - /** The affiliate's taker fee share in parts-per-million. */ + /** + * The affiliate's taker fee share in parts-per-million (for both VIP and + * regular affiliate). + */ fee_share_ppm: number; /** The affiliate's all-time referred volume in quote quantums. */ @@ -107,6 +125,34 @@ export interface AllAffiliateTiersResponseSDKType { /** All affiliate tiers information. */ tiers?: AffiliateTiersSDKType; } +/** + * AffiliateWhitelistRequest is the request type for the + * Query/AffiliateWhitelist RPC method. + */ + +export interface AffiliateWhitelistRequest {} +/** + * AffiliateWhitelistRequest is the request type for the + * Query/AffiliateWhitelist RPC method. + */ + +export interface AffiliateWhitelistRequestSDKType {} +/** + * AffiliateWhitelistResponse is the response type for the + * Query/AffiliateWhitelist RPC method. + */ + +export interface AffiliateWhitelistResponse { + whitelist?: AffiliateWhitelist; +} +/** + * AffiliateWhitelistResponse is the response type for the + * Query/AffiliateWhitelist RPC method. + */ + +export interface AffiliateWhitelistResponseSDKType { + whitelist?: AffiliateWhitelistSDKType; +} function createBaseAffiliateInfoRequest(): AffiliateInfoRequest { return { @@ -155,6 +201,7 @@ export const AffiliateInfoRequest = { function createBaseAffiliateInfoResponse(): AffiliateInfoResponse { return { + isWhitelisted: false, tier: 0, feeSharePpm: 0, referredVolume: new Uint8Array(), @@ -164,20 +211,24 @@ function createBaseAffiliateInfoResponse(): AffiliateInfoResponse { export const AffiliateInfoResponse = { encode(message: AffiliateInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.isWhitelisted === true) { + writer.uint32(8).bool(message.isWhitelisted); + } + if (message.tier !== 0) { - writer.uint32(8).uint32(message.tier); + writer.uint32(16).uint32(message.tier); } if (message.feeSharePpm !== 0) { - writer.uint32(16).uint32(message.feeSharePpm); + writer.uint32(24).uint32(message.feeSharePpm); } if (message.referredVolume.length !== 0) { - writer.uint32(26).bytes(message.referredVolume); + writer.uint32(34).bytes(message.referredVolume); } if (message.stakedAmount.length !== 0) { - writer.uint32(34).bytes(message.stakedAmount); + writer.uint32(42).bytes(message.stakedAmount); } return writer; @@ -193,18 +244,22 @@ export const AffiliateInfoResponse = { switch (tag >>> 3) { case 1: - message.tier = reader.uint32(); + message.isWhitelisted = reader.bool(); break; case 2: - message.feeSharePpm = reader.uint32(); + message.tier = reader.uint32(); break; case 3: - message.referredVolume = reader.bytes(); + message.feeSharePpm = reader.uint32(); break; case 4: + message.referredVolume = reader.bytes(); + break; + + case 5: message.stakedAmount = reader.bytes(); break; @@ -219,6 +274,7 @@ export const AffiliateInfoResponse = { fromPartial(object: DeepPartial): AffiliateInfoResponse { const message = createBaseAffiliateInfoResponse(); + message.isWhitelisted = object.isWhitelisted ?? false; message.tier = object.tier ?? 0; message.feeSharePpm = object.feeSharePpm ?? 0; message.referredVolume = object.referredVolume ?? new Uint8Array(); @@ -395,4 +451,83 @@ export const AllAffiliateTiersResponse = { return message; } +}; + +function createBaseAffiliateWhitelistRequest(): AffiliateWhitelistRequest { + return {}; +} + +export const AffiliateWhitelistRequest = { + encode(_: AffiliateWhitelistRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AffiliateWhitelistRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAffiliateWhitelistRequest(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): AffiliateWhitelistRequest { + const message = createBaseAffiliateWhitelistRequest(); + return message; + } + +}; + +function createBaseAffiliateWhitelistResponse(): AffiliateWhitelistResponse { + return { + whitelist: undefined + }; +} + +export const AffiliateWhitelistResponse = { + encode(message: AffiliateWhitelistResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.whitelist !== undefined) { + AffiliateWhitelist.encode(message.whitelist, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AffiliateWhitelistResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAffiliateWhitelistResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.whitelist = AffiliateWhitelist.decode(reader, reader.uint32()); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): AffiliateWhitelistResponse { + const message = createBaseAffiliateWhitelistResponse(); + message.whitelist = object.whitelist !== undefined && object.whitelist !== null ? AffiliateWhitelist.fromPartial(object.whitelist) : undefined; + return message; + } + }; \ No newline at end of file diff --git a/proto/dydxprotocol/affiliates/affiliates.proto b/proto/dydxprotocol/affiliates/affiliates.proto index 83f3cb3fae7..aba3335b9d4 100644 --- a/proto/dydxprotocol/affiliates/affiliates.proto +++ b/proto/dydxprotocol/affiliates/affiliates.proto @@ -18,4 +18,19 @@ message AffiliateTiers { } // All affiliate tiers repeated Tier tiers = 1 [ (gogoproto.nullable) = false ]; +} + +// AffiliateWhitelist specifies the whitelisted affiliates. +// If an address is in the whitelist, then the affiliate fee share in +// this object will override fee share from the regular affiliate tiers above. +message AffiliateWhitelist { + // Tier defines an affiliate whitelist tier. + message Tier { + // List of unique whitelisted addresses. + repeated string addresses = 1; + // Taker fee share in parts-per-million. + uint32 taker_fee_share_ppm = 2; + } + // All affiliate whitelist tiers. + repeated Tier tiers = 1 [ (gogoproto.nullable) = false ]; } \ No newline at end of file diff --git a/proto/dydxprotocol/affiliates/query.proto b/proto/dydxprotocol/affiliates/query.proto index 21d81e2bb29..16fdb2f2428 100644 --- a/proto/dydxprotocol/affiliates/query.proto +++ b/proto/dydxprotocol/affiliates/query.proto @@ -16,7 +16,11 @@ service Query { // Query AllAffiliateTiers returns all affiliate tiers. rpc AllAffiliateTiers(AllAffiliateTiersRequest) returns (AllAffiliateTiersResponse); + // Query AffiliateWhitelist returns the affiliate whitelist. + rpc AffiliateWhitelist(AffiliateWhitelistRequest) + returns (AffiliateWhitelistResponse); } + // AffiliateInfoRequest is the request type for the Query/AffiliateInfo RPC // method. message AffiliateInfoRequest { @@ -26,18 +30,22 @@ message AffiliateInfoRequest { // AffiliateInfoResponse is the response type for the Query/AffiliateInfo RPC // method. message AffiliateInfoResponse { - // The affiliate's tier. - uint32 tier = 1; - // The affiliate's taker fee share in parts-per-million. - uint32 fee_share_ppm = 2; + // Whether the address is a whitelisted affiliate (VIP). + bool is_whitelisted = 1; + // If `is_whiteslisted == false`, the affiliate's tier qualified through + // regular affiliate program. + uint32 tier = 2; + // The affiliate's taker fee share in parts-per-million (for both VIP and + // regular affiliate). + uint32 fee_share_ppm = 3; // The affiliate's all-time referred volume in quote quantums. - bytes referred_volume = 3 [ + bytes referred_volume = 4 [ (gogoproto.customtype) = "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", (gogoproto.nullable) = false ]; // The affiliate's currently staked native tokens (in whole coins). - bytes staked_amount = 4 [ + bytes staked_amount = 5 [ (gogoproto.customtype) = "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", (gogoproto.nullable) = false @@ -59,10 +67,18 @@ message ReferredByResponse { // AllAffiliateTiersRequest is the request type for the Query/AllAffiliateTiers // RPC method. message AllAffiliateTiersRequest {} - // AllAffiliateTiersResponse is the response type for the // Query/AllAffiliateTiers RPC method. message AllAffiliateTiersResponse { // All affiliate tiers information. AffiliateTiers tiers = 1 [ (gogoproto.nullable) = false ]; } + +// AffiliateWhitelistRequest is the request type for the +// Query/AffiliateWhitelist RPC method. +message AffiliateWhitelistRequest {} +// AffiliateWhitelistResponse is the response type for the +// Query/AffiliateWhitelist RPC method. +message AffiliateWhitelistResponse { + AffiliateWhitelist whitelist = 1 [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/protocol/x/affiliates/keeper/grpc_query.go b/protocol/x/affiliates/keeper/grpc_query.go index 7fc5be0ac36..fff1a962958 100644 --- a/protocol/x/affiliates/keeper/grpc_query.go +++ b/protocol/x/affiliates/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "errors" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -73,3 +74,9 @@ func (k Keeper) AllAffiliateTiers(c context.Context, Tiers: affiliateTiers, }, nil } + +func (k Keeper) AffiliateWhitelist(c context.Context, + req *types.AffiliateWhitelistRequest) (*types.AffiliateWhitelistResponse, error) { + // TODO(OTE-791): Implement `AffiliateWhitelist` RPC method. + return nil, errors.New("not implemented") +} diff --git a/protocol/x/affiliates/types/affiliates.pb.go b/protocol/x/affiliates/types/affiliates.pb.go index e25b3a10212..66011198889 100644 --- a/protocol/x/affiliates/types/affiliates.pb.go +++ b/protocol/x/affiliates/types/affiliates.pb.go @@ -133,9 +133,114 @@ func (m *AffiliateTiers_Tier) GetTakerFeeSharePpm() uint32 { return 0 } +// AffiliateWhitelist specifies the whitelisted affiliates. +// If an address is in the whitelist, then the affiliate fee share in +// this object will override fee share from the regular affiliate tiers above. +type AffiliateWhitelist struct { + // All affiliate whitelist tiers. + Tiers []AffiliateWhitelist_Tier `protobuf:"bytes,1,rep,name=tiers,proto3" json:"tiers"` +} + +func (m *AffiliateWhitelist) Reset() { *m = AffiliateWhitelist{} } +func (m *AffiliateWhitelist) String() string { return proto.CompactTextString(m) } +func (*AffiliateWhitelist) ProtoMessage() {} +func (*AffiliateWhitelist) Descriptor() ([]byte, []int) { + return fileDescriptor_7de5ba9c426e9350, []int{1} +} +func (m *AffiliateWhitelist) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AffiliateWhitelist) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AffiliateWhitelist.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AffiliateWhitelist) XXX_Merge(src proto.Message) { + xxx_messageInfo_AffiliateWhitelist.Merge(m, src) +} +func (m *AffiliateWhitelist) XXX_Size() int { + return m.Size() +} +func (m *AffiliateWhitelist) XXX_DiscardUnknown() { + xxx_messageInfo_AffiliateWhitelist.DiscardUnknown(m) +} + +var xxx_messageInfo_AffiliateWhitelist proto.InternalMessageInfo + +func (m *AffiliateWhitelist) GetTiers() []AffiliateWhitelist_Tier { + if m != nil { + return m.Tiers + } + return nil +} + +// Tier defines an affiliate whitelist tier. +type AffiliateWhitelist_Tier struct { + // List of unique whitelisted addresses. + Addresses []string `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` + // Taker fee share in parts-per-million. + TakerFeeSharePpm uint32 `protobuf:"varint,2,opt,name=taker_fee_share_ppm,json=takerFeeSharePpm,proto3" json:"taker_fee_share_ppm,omitempty"` +} + +func (m *AffiliateWhitelist_Tier) Reset() { *m = AffiliateWhitelist_Tier{} } +func (m *AffiliateWhitelist_Tier) String() string { return proto.CompactTextString(m) } +func (*AffiliateWhitelist_Tier) ProtoMessage() {} +func (*AffiliateWhitelist_Tier) Descriptor() ([]byte, []int) { + return fileDescriptor_7de5ba9c426e9350, []int{1, 0} +} +func (m *AffiliateWhitelist_Tier) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AffiliateWhitelist_Tier) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AffiliateWhitelist_Tier.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AffiliateWhitelist_Tier) XXX_Merge(src proto.Message) { + xxx_messageInfo_AffiliateWhitelist_Tier.Merge(m, src) +} +func (m *AffiliateWhitelist_Tier) XXX_Size() int { + return m.Size() +} +func (m *AffiliateWhitelist_Tier) XXX_DiscardUnknown() { + xxx_messageInfo_AffiliateWhitelist_Tier.DiscardUnknown(m) +} + +var xxx_messageInfo_AffiliateWhitelist_Tier proto.InternalMessageInfo + +func (m *AffiliateWhitelist_Tier) GetAddresses() []string { + if m != nil { + return m.Addresses + } + return nil +} + +func (m *AffiliateWhitelist_Tier) GetTakerFeeSharePpm() uint32 { + if m != nil { + return m.TakerFeeSharePpm + } + return 0 +} + func init() { proto.RegisterType((*AffiliateTiers)(nil), "dydxprotocol.affiliates.AffiliateTiers") proto.RegisterType((*AffiliateTiers_Tier)(nil), "dydxprotocol.affiliates.AffiliateTiers.Tier") + proto.RegisterType((*AffiliateWhitelist)(nil), "dydxprotocol.affiliates.AffiliateWhitelist") + proto.RegisterType((*AffiliateWhitelist_Tier)(nil), "dydxprotocol.affiliates.AffiliateWhitelist.Tier") } func init() { @@ -143,28 +248,31 @@ func init() { } var fileDescriptor_7de5ba9c426e9350 = []byte{ - // 327 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xb1, 0x4e, 0xc2, 0x40, - 0x18, 0xc7, 0x7b, 0x80, 0x0e, 0x67, 0x34, 0xa6, 0x18, 0x25, 0x0c, 0x27, 0x61, 0xea, 0x20, 0x6d, - 0x22, 0x8e, 0x2e, 0x62, 0x62, 0x8c, 0x93, 0x14, 0x83, 0x89, 0xcb, 0xa5, 0xb4, 0x5f, 0x69, 0x63, - 0xcb, 0xb5, 0x77, 0x57, 0x84, 0xb7, 0x30, 0xf1, 0x5d, 0x7c, 0x06, 0x46, 0x46, 0x27, 0x63, 0xe0, - 0x45, 0xcc, 0x1d, 0xa8, 0x30, 0xb8, 0x5c, 0xbe, 0xf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x29, 0x70, 0x9f, 0xa5, 0x9d, 0xfe, 0x6c, 0x41, 0xd0, 0x7c, 0x41, 0xd0, 0xd7, 0x82, 0xa0, 0xd7, - 0x25, 0x31, 0xe6, 0x4b, 0x62, 0x7c, 0x2c, 0x89, 0xf1, 0x74, 0x39, 0x8c, 0x65, 0x54, 0x0c, 0x6c, - 0x9f, 0xa5, 0xce, 0xd6, 0x4d, 0xc6, 0x17, 0x2d, 0x3f, 0xf2, 0xe2, 0x91, 0xf3, 0x9b, 0x4c, 0x36, - 0xef, 0x24, 0xa7, 0x19, 0x88, 0xc1, 0xae, 0x86, 0xed, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb4, - 0x55, 0x6e, 0x5c, 0xcf, 0x01, 0x00, 0x00, + // 384 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x4f, 0x6b, 0xe2, 0x40, + 0x18, 0xc6, 0x33, 0xea, 0x2e, 0x38, 0xcb, 0x2e, 0x4b, 0x5c, 0x76, 0x45, 0x96, 0xac, 0x78, 0xca, + 0x61, 0x4d, 0x96, 0x75, 0x8f, 0x7b, 0x59, 0x17, 0x4a, 0x29, 0x3d, 0xd4, 0x58, 0x14, 0x7a, 0x19, + 0x62, 0xf2, 0xc6, 0x0c, 0x4d, 0x9c, 0x64, 0x66, 0x62, 0xf5, 0x5b, 0x14, 0xfa, 0x5d, 0xda, 0xaf, + 0xe0, 0xd1, 0x63, 0x4f, 0xa5, 0xe8, 0x17, 0x29, 0x13, 0xad, 0x7f, 0x40, 0xe9, 0x65, 0x78, 0x79, + 0x7e, 0xcf, 0xfb, 0x64, 0xf2, 0x30, 0xd8, 0xf4, 0xa7, 0xfe, 0x24, 0xe1, 0x4c, 0x32, 0x8f, 0x45, + 0xb6, 0x1b, 0x04, 0x34, 0xa2, 0xae, 0x04, 0xb1, 0x33, 0x5a, 0x39, 0xd6, 0xbf, 0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dd, 0x03, 0xed, 0x74, 0xd7, 0xe5, 0x7c, 0xc7, 0x65, 0xd7, 0xf7, 0x39, 0x08, + 0x01, 0xab, 0xe4, 0xb2, 0xb3, 0x15, 0x8e, 0xdd, 0xbc, 0x70, 0xf8, 0xe6, 0xed, 0xde, 0x6c, 0x61, + 0xa0, 0xf9, 0xc2, 0x40, 0xcf, 0x0b, 0x03, 0xdd, 0x2e, 0x0d, 0x6d, 0xbe, 0x34, 0xb4, 0xc7, 0xa5, + 0xa1, 0x5d, 0xfd, 0x1d, 0x52, 0x19, 0x66, 0x03, 0xcb, 0x63, 0xb1, 0xbd, 0xf7, 0x9a, 0xc6, 0x7f, + 0x9a, 0x5e, 0xe8, 0xd2, 0x91, 0xbd, 0x51, 0x26, 0xbb, 0x2f, 0x4c, 0x4e, 0x13, 0x10, 0x83, 0xf7, + 0x39, 0x6c, 0xbd, 0x04, 0x00, 0x00, 0xff, 0xff, 0xc7, 0x32, 0xb9, 0x71, 0x89, 0x02, 0x00, 0x00, } func (m *AffiliateTiers) Marshal() (dAtA []byte, err error) { @@ -242,6 +350,80 @@ func (m *AffiliateTiers_Tier) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *AffiliateWhitelist) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AffiliateWhitelist) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AffiliateWhitelist) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Tiers) > 0 { + for iNdEx := len(m.Tiers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Tiers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAffiliates(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *AffiliateWhitelist_Tier) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AffiliateWhitelist_Tier) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AffiliateWhitelist_Tier) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TakerFeeSharePpm != 0 { + i = encodeVarintAffiliates(dAtA, i, uint64(m.TakerFeeSharePpm)) + i-- + dAtA[i] = 0x10 + } + if len(m.Addresses) > 0 { + for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Addresses[iNdEx]) + copy(dAtA[i:], m.Addresses[iNdEx]) + i = encodeVarintAffiliates(dAtA, i, uint64(len(m.Addresses[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintAffiliates(dAtA []byte, offset int, v uint64) int { offset -= sovAffiliates(v) base := offset @@ -286,6 +468,39 @@ func (m *AffiliateTiers_Tier) Size() (n int) { return n } +func (m *AffiliateWhitelist) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Tiers) > 0 { + for _, e := range m.Tiers { + l = e.Size() + n += 1 + l + sovAffiliates(uint64(l)) + } + } + return n +} + +func (m *AffiliateWhitelist_Tier) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Addresses) > 0 { + for _, s := range m.Addresses { + l = len(s) + n += 1 + l + sovAffiliates(uint64(l)) + } + } + if m.TakerFeeSharePpm != 0 { + n += 1 + sovAffiliates(uint64(m.TakerFeeSharePpm)) + } + return n +} + func sovAffiliates(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -483,6 +698,191 @@ func (m *AffiliateTiers_Tier) Unmarshal(dAtA []byte) error { } return nil } +func (m *AffiliateWhitelist) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAffiliates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AffiliateWhitelist: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AffiliateWhitelist: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tiers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAffiliates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAffiliates + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAffiliates + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tiers = append(m.Tiers, AffiliateWhitelist_Tier{}) + if err := m.Tiers[len(m.Tiers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAffiliates(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAffiliates + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AffiliateWhitelist_Tier) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAffiliates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Tier: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Tier: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAffiliates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAffiliates + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAffiliates + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TakerFeeSharePpm", wireType) + } + m.TakerFeeSharePpm = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAffiliates + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TakerFeeSharePpm |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipAffiliates(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAffiliates + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipAffiliates(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/protocol/x/affiliates/types/query.pb.go b/protocol/x/affiliates/types/query.pb.go index c8287362400..dccbda4dc84 100644 --- a/protocol/x/affiliates/types/query.pb.go +++ b/protocol/x/affiliates/types/query.pb.go @@ -79,14 +79,18 @@ func (m *AffiliateInfoRequest) GetAddress() string { // AffiliateInfoResponse is the response type for the Query/AffiliateInfo RPC // method. type AffiliateInfoResponse struct { - // The affiliate's tier. - Tier uint32 `protobuf:"varint,1,opt,name=tier,proto3" json:"tier,omitempty"` - // The affiliate's taker fee share in parts-per-million. - FeeSharePpm uint32 `protobuf:"varint,2,opt,name=fee_share_ppm,json=feeSharePpm,proto3" json:"fee_share_ppm,omitempty"` + // Whether the address is a whitelisted affiliate (VIP). + IsWhitelisted bool `protobuf:"varint,1,opt,name=is_whitelisted,json=isWhitelisted,proto3" json:"is_whitelisted,omitempty"` + // If `is_whiteslisted == false`, the affiliate's tier qualified through + // regular affiliate program. + Tier uint32 `protobuf:"varint,2,opt,name=tier,proto3" json:"tier,omitempty"` + // The affiliate's taker fee share in parts-per-million (for both VIP and + // regular affiliate). + FeeSharePpm uint32 `protobuf:"varint,3,opt,name=fee_share_ppm,json=feeSharePpm,proto3" json:"fee_share_ppm,omitempty"` // The affiliate's all-time referred volume in quote quantums. - ReferredVolume github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,3,opt,name=referred_volume,json=referredVolume,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"referred_volume"` + ReferredVolume github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,4,opt,name=referred_volume,json=referredVolume,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"referred_volume"` // The affiliate's currently staked native tokens (in whole coins). - StakedAmount github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,4,opt,name=staked_amount,json=stakedAmount,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"staked_amount"` + StakedAmount github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,5,opt,name=staked_amount,json=stakedAmount,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"staked_amount"` } func (m *AffiliateInfoResponse) Reset() { *m = AffiliateInfoResponse{} } @@ -122,6 +126,13 @@ func (m *AffiliateInfoResponse) XXX_DiscardUnknown() { var xxx_messageInfo_AffiliateInfoResponse proto.InternalMessageInfo +func (m *AffiliateInfoResponse) GetIsWhitelisted() bool { + if m != nil { + return m.IsWhitelisted + } + return false +} + func (m *AffiliateInfoResponse) GetTier() uint32 { if m != nil { return m.Tier @@ -313,6 +324,90 @@ func (m *AllAffiliateTiersResponse) GetTiers() AffiliateTiers { return AffiliateTiers{} } +// AffiliateWhitelistRequest is the request type for the +// Query/AffiliateWhitelist RPC method. +type AffiliateWhitelistRequest struct { +} + +func (m *AffiliateWhitelistRequest) Reset() { *m = AffiliateWhitelistRequest{} } +func (m *AffiliateWhitelistRequest) String() string { return proto.CompactTextString(m) } +func (*AffiliateWhitelistRequest) ProtoMessage() {} +func (*AffiliateWhitelistRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2edc1b3ea39b05a9, []int{6} +} +func (m *AffiliateWhitelistRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AffiliateWhitelistRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AffiliateWhitelistRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AffiliateWhitelistRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AffiliateWhitelistRequest.Merge(m, src) +} +func (m *AffiliateWhitelistRequest) XXX_Size() int { + return m.Size() +} +func (m *AffiliateWhitelistRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AffiliateWhitelistRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AffiliateWhitelistRequest proto.InternalMessageInfo + +// AffiliateWhitelistResponse is the response type for the +// Query/AffiliateWhitelist RPC method. +type AffiliateWhitelistResponse struct { + Whitelist AffiliateWhitelist `protobuf:"bytes,1,opt,name=whitelist,proto3" json:"whitelist"` +} + +func (m *AffiliateWhitelistResponse) Reset() { *m = AffiliateWhitelistResponse{} } +func (m *AffiliateWhitelistResponse) String() string { return proto.CompactTextString(m) } +func (*AffiliateWhitelistResponse) ProtoMessage() {} +func (*AffiliateWhitelistResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2edc1b3ea39b05a9, []int{7} +} +func (m *AffiliateWhitelistResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AffiliateWhitelistResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AffiliateWhitelistResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AffiliateWhitelistResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AffiliateWhitelistResponse.Merge(m, src) +} +func (m *AffiliateWhitelistResponse) XXX_Size() int { + return m.Size() +} +func (m *AffiliateWhitelistResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AffiliateWhitelistResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AffiliateWhitelistResponse proto.InternalMessageInfo + +func (m *AffiliateWhitelistResponse) GetWhitelist() AffiliateWhitelist { + if m != nil { + return m.Whitelist + } + return AffiliateWhitelist{} +} + func init() { proto.RegisterType((*AffiliateInfoRequest)(nil), "dydxprotocol.affiliates.AffiliateInfoRequest") proto.RegisterType((*AffiliateInfoResponse)(nil), "dydxprotocol.affiliates.AffiliateInfoResponse") @@ -320,6 +415,8 @@ func init() { proto.RegisterType((*ReferredByResponse)(nil), "dydxprotocol.affiliates.ReferredByResponse") proto.RegisterType((*AllAffiliateTiersRequest)(nil), "dydxprotocol.affiliates.AllAffiliateTiersRequest") proto.RegisterType((*AllAffiliateTiersResponse)(nil), "dydxprotocol.affiliates.AllAffiliateTiersResponse") + proto.RegisterType((*AffiliateWhitelistRequest)(nil), "dydxprotocol.affiliates.AffiliateWhitelistRequest") + proto.RegisterType((*AffiliateWhitelistResponse)(nil), "dydxprotocol.affiliates.AffiliateWhitelistResponse") } func init() { @@ -327,39 +424,44 @@ func init() { } var fileDescriptor_2edc1b3ea39b05a9 = []byte{ - // 506 bytes of a gzipped FileDescriptorProto + // 583 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0x8e, 0x43, 0x0a, 0x62, 0xda, 0x00, 0x59, 0x05, 0xe1, 0xfa, 0xe0, 0x56, 0xe6, 0x40, 0x04, - 0x8a, 0x2d, 0x02, 0x47, 0x0e, 0xc4, 0x08, 0x41, 0x39, 0x81, 0x83, 0x7a, 0x80, 0x83, 0x71, 0xe2, - 0x71, 0x62, 0x61, 0x7b, 0x9d, 0xdd, 0x75, 0xd5, 0xf4, 0x29, 0x78, 0x15, 0x24, 0x1e, 0xa2, 0xc7, - 0x8a, 0x13, 0xea, 0xa1, 0x42, 0xc9, 0x8b, 0x20, 0xff, 0xe4, 0x8f, 0x62, 0x11, 0x44, 0x6f, 0xe3, - 0x99, 0xef, 0x67, 0x3c, 0x33, 0x36, 0xdc, 0x77, 0x27, 0xee, 0x71, 0xcc, 0xa8, 0xa0, 0x03, 0x1a, - 0x18, 0x8e, 0xe7, 0xf9, 0x81, 0xef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32, 0x53, 0x2b, 0x67, 0x33, 0xb5, 0xf2, 0x63, 0xa6, 0x56, 0x3e, 0x3c, 0xdb, 0xfc, - 0xd4, 0x8f, 0x57, 0xff, 0x31, 0xd9, 0xd9, 0xf7, 0xaf, 0x67, 0xc5, 0x27, 0xbf, 0x02, 0x00, 0x00, - 0xff, 0xff, 0x31, 0x96, 0xc3, 0xe2, 0xfa, 0x04, 0x00, 0x00, + 0x10, 0x8e, 0xfb, 0x03, 0x74, 0xda, 0x14, 0xba, 0x2a, 0xc2, 0x35, 0x92, 0x5b, 0x19, 0x21, 0x22, + 0xaa, 0x3a, 0x22, 0xe5, 0xc8, 0x81, 0x04, 0x21, 0x28, 0x17, 0xc0, 0x41, 0x45, 0x82, 0x83, 0x71, + 0xe2, 0x71, 0xb2, 0xc2, 0xf6, 0x3a, 0xde, 0x4d, 0x69, 0x2a, 0xf1, 0x0e, 0x3c, 0x0c, 0x0f, 0xd1, + 0x63, 0xc5, 0xa9, 0x70, 0xa8, 0x50, 0xf2, 0x22, 0x28, 0xf6, 0xc6, 0x49, 0x48, 0xa3, 0x26, 0x82, + 0xdb, 0x7a, 0xbe, 0x99, 0xef, 0x1b, 0xef, 0x37, 0xb3, 0x70, 0xcf, 0xed, 0xb8, 0xc7, 0x51, 0xcc, + 0x04, 0xab, 0x33, 0xbf, 0xe8, 0x78, 0x1e, 0xf5, 0xa9, 0x23, 0x90, 0x17, 0x5b, 0x6d, 0x8c, 0x3b, + 0x66, 0x82, 0x90, 0x3b, 0xa3, 0x49, 0xe6, 0x30, 0x49, 0xdb, 0xaa, 0x33, 0x1e, 0x30, 0x6e, 0x27, + 0x58, 0x31, 0xfd, 0x48, 0x6b, 0xb4, 0xcd, 0x06, 0x6b, 0xb0, 0x34, 0xde, 0x3f, 0xc9, 0x68, 0x61, + 0x9a, 0xdc, 0xf0, 0x98, 0x66, 0x1a, 0xaf, 0x60, 0xb3, 0x3c, 0x88, 0x1d, 0x84, 0x1e, 0xb3, 0xb0, + 0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0xe7, 0xaa, + 0x49, 0xe5, 0x2b, 0x87, 0xa7, 0x5d, 0x5d, 0x39, 0xeb, 0xea, 0xca, 0xef, 0xae, 0xae, 0x7c, 0xeb, + 0xe9, 0xb9, 0xb3, 0x9e, 0x9e, 0x3b, 0xef, 0xe9, 0xb9, 0x0f, 0x4f, 0x66, 0xdf, 0xfa, 0xe3, 0xd1, + 0x57, 0x39, 0x79, 0x01, 0x6a, 0xd7, 0x12, 0x70, 0xff, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfa, + 0xb5, 0x23, 0xef, 0x2c, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -380,6 +482,8 @@ type QueryClient interface { ReferredBy(ctx context.Context, in *ReferredByRequest, opts ...grpc.CallOption) (*ReferredByResponse, error) // Query AllAffiliateTiers returns all affiliate tiers. AllAffiliateTiers(ctx context.Context, in *AllAffiliateTiersRequest, opts ...grpc.CallOption) (*AllAffiliateTiersResponse, error) + // Query AffiliateWhitelist returns the affiliate whitelist. + AffiliateWhitelist(ctx context.Context, in *AffiliateWhitelistRequest, opts ...grpc.CallOption) (*AffiliateWhitelistResponse, error) } type queryClient struct { @@ -417,6 +521,15 @@ func (c *queryClient) AllAffiliateTiers(ctx context.Context, in *AllAffiliateTie return out, nil } +func (c *queryClient) AffiliateWhitelist(ctx context.Context, in *AffiliateWhitelistRequest, opts ...grpc.CallOption) (*AffiliateWhitelistResponse, error) { + out := new(AffiliateWhitelistResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.affiliates.Query/AffiliateWhitelist", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Query AffiliateInfo returns the affiliate info for a given address. @@ -425,6 +538,8 @@ type QueryServer interface { ReferredBy(context.Context, *ReferredByRequest) (*ReferredByResponse, error) // Query AllAffiliateTiers returns all affiliate tiers. AllAffiliateTiers(context.Context, *AllAffiliateTiersRequest) (*AllAffiliateTiersResponse, error) + // Query AffiliateWhitelist returns the affiliate whitelist. + AffiliateWhitelist(context.Context, *AffiliateWhitelistRequest) (*AffiliateWhitelistResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -440,6 +555,9 @@ func (*UnimplementedQueryServer) ReferredBy(ctx context.Context, req *ReferredBy func (*UnimplementedQueryServer) AllAffiliateTiers(ctx context.Context, req *AllAffiliateTiersRequest) (*AllAffiliateTiersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AllAffiliateTiers not implemented") } +func (*UnimplementedQueryServer) AffiliateWhitelist(ctx context.Context, req *AffiliateWhitelistRequest) (*AffiliateWhitelistResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AffiliateWhitelist not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -499,6 +617,24 @@ func _Query_AllAffiliateTiers_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Query_AffiliateWhitelist_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AffiliateWhitelistRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AffiliateWhitelist(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.affiliates.Query/AffiliateWhitelist", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AffiliateWhitelist(ctx, req.(*AffiliateWhitelistRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "dydxprotocol.affiliates.Query", HandlerType: (*QueryServer)(nil), @@ -515,6 +651,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "AllAffiliateTiers", Handler: _Query_AllAffiliateTiers_Handler, }, + { + MethodName: "AffiliateWhitelist", + Handler: _Query_AffiliateWhitelist_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "dydxprotocol/affiliates/query.proto", @@ -579,7 +719,7 @@ func (m *AffiliateInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a { size := m.ReferredVolume.Size() i -= size @@ -589,15 +729,25 @@ func (m *AffiliateInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 if m.FeeSharePpm != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.FeeSharePpm)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x18 } if m.Tier != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.Tier)) i-- + dAtA[i] = 0x10 + } + if m.IsWhitelisted { + i-- + if m.IsWhitelisted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil @@ -719,6 +869,62 @@ func (m *AllAffiliateTiersResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *AffiliateWhitelistRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AffiliateWhitelistRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AffiliateWhitelistRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *AffiliateWhitelistResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AffiliateWhitelistResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AffiliateWhitelistResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Whitelist.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -749,6 +955,9 @@ func (m *AffiliateInfoResponse) Size() (n int) { } var l int _ = l + if m.IsWhitelisted { + n += 2 + } if m.Tier != 0 { n += 1 + sovQuery(uint64(m.Tier)) } @@ -808,6 +1017,26 @@ func (m *AllAffiliateTiersResponse) Size() (n int) { return n } +func (m *AffiliateWhitelistRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *AffiliateWhitelistResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Whitelist.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -926,6 +1155,26 @@ func (m *AffiliateInfoResponse) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsWhitelisted", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsWhitelisted = bool(v != 0) + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Tier", wireType) } @@ -944,7 +1193,7 @@ func (m *AffiliateInfoResponse) Unmarshal(dAtA []byte) error { break } } - case 2: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field FeeSharePpm", wireType) } @@ -963,7 +1212,7 @@ func (m *AffiliateInfoResponse) Unmarshal(dAtA []byte) error { break } } - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ReferredVolume", wireType) } @@ -996,7 +1245,7 @@ func (m *AffiliateInfoResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StakedAmount", wireType) } @@ -1347,6 +1596,139 @@ func (m *AllAffiliateTiersResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *AffiliateWhitelistRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AffiliateWhitelistRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AffiliateWhitelistRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AffiliateWhitelistResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AffiliateWhitelistResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AffiliateWhitelistResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Whitelist", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Whitelist.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0