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: wip merkl report type #274

Closed
wants to merge 1 commit into from
Closed
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
82 changes: 82 additions & 0 deletions src/types/merkl/analytics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { BigNumber } from 'ethers';
import { Int256 } from 'src/lib';

import { AggregatedRewardsType, MerklSupportedChainIdsType } from '.';

export type OnChainParamsType = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it a convention to add Type at the end of the name?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes it's a convention for clarity and readability

disputeToken: string;
disputeAmount: BigNumber;
disputePeriod: number;
endOfDisputePeriod: number;
disputer: string;
endRoot: string;
startRoot: string;
currentRoot: string;
};

export type DistributionChangeType = {
epoch: number;
pool: string;
poolName: string;
ratePerEpoch: number;
numRecipients: number;
rewardSymbol: string;
diff: number;
};

// export type HolderDetailsType = {
// [rewardId: string]: {
// poolName: string;
// rewardDecimals?: number;
// rewardSymbol: string;
// rewardTokenAddress?: string;

// holderDiff: number;
// diffAverageBoost?: number;
// issueSpotted?: boolean;
// percent?: number;
// };
// };

// export type HolderClaims = { [address: string]: { [symbol: string]: string } };

export type HoldersReportType = {
[holder: string]: {
[poolAddress: string]: {
details: {
[rewardId: string]: {
Copy link
Contributor

Choose a reason for hiding this comment

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

I liked the sub types too, because sometimes you only work with the sub object and you don't want to retype it

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought that for a start, it helps to have an overview of the type
once in prod, I agree that segmenting into smaller types is better

poolName: string;
rewardDecimals?: number;
rewardSymbol: string;
rewardTokenAddress?: string;

holderDiff: number;
diffAverageBoost?: number;
issueSpotted?: boolean;
percent?: number;
};
};
// aggregated
unclaimed: { [rewardSymbol: string]: Int256 }; // FIXME
negativeDiffs: { [rewardSymbol: string]: number };
overclaimed?: { [rewardSymbol: string]: number };
};
};
};

export type MerklReportType = Partial<{
Copy link
Contributor

Choose a reason for hiding this comment

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

what's this one corresponding too? I don't see the same params as in merkl-dispute

Copy link
Member Author

Choose a reason for hiding this comment

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

it was inspired from MerklReport

chainId: MerklSupportedChainIdsType;
startTime: number;
startEpoch: number;
endEpoch: number;
blockNumber: number;

params: OnChainParamsType;
startRoot: string;
startAggregatedRewards: AggregatedRewardsType;
endRoot: string;
endAggregatedRewards: AggregatedRewardsType;

poolsReport: { [poolAddress: string]: { [rewardId: string]: DistributionChangeType } };
holdersReport: HoldersReportType;
}>;
2 changes: 1 addition & 1 deletion src/types/merkl.ts → src/types/merkl/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId } from '.';
import { ChainId } from '..';

const MerklSupportedChainIds = <const>[
ChainId.ARBITRUM,
Expand Down
Loading