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

fix(new): schema #233

Merged
merged 8 commits into from
Oct 2, 2023
Merged
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
200 changes: 196 additions & 4 deletions packages/indexer-nibi/src/defaultObjects.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
import {
Block,
Delegation,
DistributionCommission,
GovDeposit,
GovProposal,
GovVote,
Governance,
MarkPriceCandle,
OracleEntry,
OraclePrice,
PerpLeaderboard,
PerpMarket,
PerpPosition,
PerpPositionChange,
Redelegation,
SpotLpPosition,
SpotPool,
SpotPoolCreated,
SpotPoolExited,
SpotPoolJoined,
SpotPoolSwap,
StatsFees,
StatsPerpOpenInterest,
StatsPerpPnl,
StatsTotals,
StatsTvl,
StatsUsers,
StatsVolume,
Token,
Unbonding,
User,
Validator,
ValidatorStatus,
Expand Down Expand Up @@ -154,7 +169,7 @@ export const defaultGovVote: GovVote = {
sender: defaultUser,
}

export const defaultMarkPriceCandlesObject: MarkPriceCandle = {
export const defaultMarkPriceCandles: MarkPriceCandle = {
close: 0,
high: 0,
low: 0,
Expand All @@ -163,3 +178,180 @@ export const defaultMarkPriceCandlesObject: MarkPriceCandle = {
period: 0,
periodStartTs: "",
}

export const defaultPerpPositionChanges: PerpPositionChange = {
badDebt: defaultToken,
block: defaultBlock,
changeReason: "",
eventSeqNo: 0,
exchangedNotional: 0,
exchangedSize: 0,
fundingPayment: 0,
latestCumulativePremiumFraction: 0,
margin: 0,
marginToUser: 0,
openNotional: 0,
pair: "",
positionNotional: 0,
realizedPnl: 0,
size: 0,
traderAddress: "",
transactionFee: defaultToken,
txSeqNo: 0,
}

export const defaultPerpLeaderboard: PerpLeaderboard = {
avg_pct_pnl_rank: 0,
avg_pct_pnl: 0,
input_margin: 0,
raw_pnl: 0,
raw_pnl_with_unrealized: 0,
trader_address: "",
}

export const defaultGovernance: Governance = {
govDeposits: [defaultGovDeposit],
govProposals: [defaultGovProposal],
govVotes: [defaultGovVote],
}

export const defaultDistributionCommission: DistributionCommission = {
commission: [defaultToken],
validator: defaultValidator,
}

export const defaultDelegations: Delegation = {
amount: 0,
delegator: defaultUser,
validator: defaultValidator,
}

export const defaultRedelegations: Redelegation = {
amount: 0,
delegator: defaultUser,
source_validator: defaultValidator,
destination_validator: defaultValidator,
completion_time: "",
creation_block: defaultBlock,
}

export const defaultSpotLpPosition: SpotLpPosition = {
created_block: defaultBlock,
pool: defaultPool,
pool_shares: defaultToken,
user: defaultUser,
}

export const defaultSpotPoolSwap: SpotPoolSwap = {
block: defaultBlock,
pool: defaultPool,
token_in: defaultToken,
token_out: defaultToken,
user: defaultUser,
}

export const defaultStatsFees: StatsFees = {
feesLiquidations: 0,
feesLiquidationsCumulative: 0,
feesPerp: 0,
feesPerpCumulative: 0,
feesSwap: 0,
feesSwapCumulative: 0,
feesTotal: 0,
feesTotalCumulative: 0,
period: 0,
periodStartTs: "",
}

export const defaultPerpOpenInterest: StatsPerpOpenInterest = {
openInterestLong: 0,
openInterestShort: 0,
openInterestTotal: 0,
period: 0,
periodStartTs: "",
}

export const defaultPerpPnl: StatsPerpPnl = {
loss: 0,
lossCumulative: 0,
netPnl: 0,
netPnlCumulative: 0,
period: 0,
periodStartTs: "",
profit: 0,
profitCumulative: 0,
}

export const defaultTotals: StatsTotals = {
period: 0,
periodStartTs: "",
totalPerp: 0,
totalFeesPerp: 0,
totalFeesLiquidations: 0,
totalOpenInterest: 0,
totalSwap: 0,
totalTvl: 0,
}

export const defaultTvl: StatsTvl = {
period: 0,
periodStartTs: "",
tvlPerp: 0,
tvlStablecoin: 0,
tvlStaking: 0,
tvlSwap: 0,
tvlTotal: 0,
}

export const defaultUsers: StatsUsers = {
newUsersLp: 0,
newUsersLpCumulative: 0,
newUsersPerp: 0,
newUsersPerpCumulative: 0,
newUsersSwap: 0,
newUsersSwapCumulative: 0,
newUsersTotal: 0,
newUsersTotalCumulative: 0,
period: 0,
periodStartTs: "",
userActionsPerp: 0,
uniqueUsersLp: 0,
uniqueUsersPerp: 0,
uniqueUsersSwap: 0,
uniqueUsersTotal: 0,
userActionsLp: 0,
userActionsSwap: 0,
userActionsTotal: 0,
}

export const defaultVolume: StatsVolume = {
volumePerp: 0,
volumePerpCumulative: 0,
volumeSwap: 0,
volumeSwapCumulative: 0,
volumeTotal: 0,
volumeTotalCumulative: 0,
period: 0,
periodStartTs: "",
}

export const defaultUnbondings: Unbonding = {
amount: 0,
completion_time: "",
creation_block: defaultBlock,
delegator: defaultUser,
validator: defaultValidator,
}

export const defaultOraclePrice: OraclePrice = {
block: defaultBlock,
eventSeqNo: 0,
pair: "",
price: 0,
txSeqNo: 0,
}

export const defaultOracleEntry: OracleEntry = {
numVotes: 0,
validator: defaultValidator,
}
Loading