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

feat(affiliates): Add table affiliate-referee-stats and implement table methods #2685

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
46 changes: 46 additions & 0 deletions indexer/packages/postgres/__tests__/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import {
PersistentCacheCreateObject,
VaultCreateObject,
VaultStatus,
AffiliateRefereeStatsCreateObject,
} from '../../src/types';
import { denomToHumanReadableConversion } from './conversion-helpers';

Expand All @@ -72,6 +73,7 @@ export const dydxChain: string = 'dydx';
export const defaultAddress: string = 'dydx1n88uc38xhjgxzw9nwre4ep2c8ga4fjxc565lnf';
export const defaultAddress2: string = 'dydx1n88uc38xhjgxzw9nwre4ep2c8ga4fjxc575lnf';
export const defaultAddress3: string = 'dydx199tqg4wdlnu4qjlxchpd7seg454937hjrknju4';
export const defaultAddress4: string = 'dydx1wau5mja7j7zdavtfq9lu7ejef05hm6ffenlcsn';
export const blockedAddress: string = 'dydx1f9k5qldwmqrnwy8hcgp4fw6heuvszt35egvtx2';
// Vault address for vault id 0 was generated using
// script protocol/scripts/vault/get_vault.go
Expand Down Expand Up @@ -1013,6 +1015,50 @@ export const defaultKV2: PersistentCacheCreateObject = {
value: 'otherValue',
};

// ============== Affiliate Per-referee Stats Data ==============

export const affiliateStatDefaultAddrReferredByAddr2: AffiliateRefereeStatsCreateObject = {
affiliateAddress: defaultAddress2,
refereeAddress: defaultAddress,
affiliateEarnings: '12.5',
referredMakerTrades: 10,
referredTakerTrades: 20,
referredLiquidationFees: '30.5',
referredMakerFees: '2',
referredTakerFees: '20',
referredMakerRebates: '-5.5',
referralBlockHeight: '1',
referredTotalVolume: '12345.6',
};

export const affiliateStatAddr3ReferredByAddr2: AffiliateRefereeStatsCreateObject = {
affiliateAddress: defaultAddress2,
refereeAddress: defaultAddress3,
affiliateEarnings: '22.5',
referredMakerTrades: 20,
referredTakerTrades: 40,
referredLiquidationFees: '0',
referredMakerFees: '0',
referredTakerFees: '40.5',
referredMakerRebates: '0',
referralBlockHeight: '2',
referredTotalVolume: '23456.7',
};

export const affiliateStatAddr4ReferredByAddr: AffiliateRefereeStatsCreateObject = {
affiliateAddress: defaultAddress,
refereeAddress: defaultAddress4,
affiliateEarnings: '52.5',
referredMakerTrades: 20,
referredTakerTrades: 40,
referredLiquidationFees: '0',
referredMakerFees: '5.5',
referredTakerFees: '60.5',
referredMakerRebates: '0',
referralBlockHeight: '2',
referredTotalVolume: '123456.7',
};

// ============== Affiliate Info Data ==============

export const defaultAffiliateInfo: AffiliateInfoCreateObject = {
Expand Down
Loading
Loading