-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(metrom-adapter): add support for megaeth and pool meta information #2512
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,6 +23,7 @@ const CHAIN_TYPE_AND_NAMES: ByChainTypeAndId<string> = { | |||||||||||||||||||||||||||||||||||
| 9_745: 'Plasma', | ||||||||||||||||||||||||||||||||||||
| 5_464: 'Saga', | ||||||||||||||||||||||||||||||||||||
| 56: 'BSC', | ||||||||||||||||||||||||||||||||||||
| 4_326: 'MegaETH', | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| aptos: { | ||||||||||||||||||||||||||||||||||||
| 1: 'Aptos', | ||||||||||||||||||||||||||||||||||||
|
|
@@ -44,6 +45,7 @@ interface BaseTarget { | |||||||||||||||||||||||||||||||||||
| interface AmmPoolLiquidityTarget extends BaseTarget { | ||||||||||||||||||||||||||||||||||||
| type: 'amm-pool-liquidity'; | ||||||||||||||||||||||||||||||||||||
| id: string; | ||||||||||||||||||||||||||||||||||||
| dex: string; | ||||||||||||||||||||||||||||||||||||
| tokens: Token[]; | ||||||||||||||||||||||||||||||||||||
| usdTvl: number; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
@@ -177,6 +179,7 @@ module.exports = { | |||||||||||||||||||||||||||||||||||
| interface ProcessedCampaign { | ||||||||||||||||||||||||||||||||||||
| symbol: string; | ||||||||||||||||||||||||||||||||||||
| underlyingTokens: string[]; | ||||||||||||||||||||||||||||||||||||
| poolMeta: string; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| function processCampaign(campaign: Campaign): ProcessedCampaign | null { | ||||||||||||||||||||||||||||||||||||
|
|
@@ -187,30 +190,61 @@ function processCampaign(campaign: Campaign): ProcessedCampaign | null { | |||||||||||||||||||||||||||||||||||
| campaign.target.tokens.map((token) => token.symbol).join(' - ') | ||||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||||
| underlyingTokens: campaign.target.tokens.map((token) => token.address), | ||||||||||||||||||||||||||||||||||||
| poolMeta: humanizeTargetProtocol('Pool on', campaign.target.dex), | ||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| case 'liquity-v2-debt': { | ||||||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||||||
| symbol: formatSymbol(campaign.target.collateral.symbol), | ||||||||||||||||||||||||||||||||||||
| underlyingTokens: [campaign.target.collateral.address], | ||||||||||||||||||||||||||||||||||||
| poolMeta: humanizeTargetProtocol('Borrow on', campaign.target.brand), | ||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| case 'liquity-v2-debt': | ||||||||||||||||||||||||||||||||||||
| case 'liquity-v2-stability-pool': { | ||||||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||||||
| symbol: formatSymbol(campaign.target.collateral.symbol), | ||||||||||||||||||||||||||||||||||||
| underlyingTokens: [campaign.target.collateral.address], | ||||||||||||||||||||||||||||||||||||
| poolMeta: humanizeTargetProtocol( | ||||||||||||||||||||||||||||||||||||
| 'Deposit to stability pool on', | ||||||||||||||||||||||||||||||||||||
| campaign.target.brand | ||||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| case 'gmx-v1-liquidity': { | ||||||||||||||||||||||||||||||||||||
| // FIXME: for now, with the current API, it's impossible to process GMX v1 | ||||||||||||||||||||||||||||||||||||
| // campaigns, address this later on | ||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| case 'aave-v3-supply': | ||||||||||||||||||||||||||||||||||||
| case 'aave-v3-borrow': | ||||||||||||||||||||||||||||||||||||
| case 'aave-v3-supply': { | ||||||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||||||
| symbol: formatSymbol(campaign.target.collateral.symbol), | ||||||||||||||||||||||||||||||||||||
| underlyingTokens: [campaign.target.collateral.address], | ||||||||||||||||||||||||||||||||||||
| poolMeta: humanizeTargetProtocol('Lend on', campaign.target.brand), | ||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| case 'aave-v3-borrow': { | ||||||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||||||
| symbol: formatSymbol(campaign.target.collateral.symbol), | ||||||||||||||||||||||||||||||||||||
| underlyingTokens: [campaign.target.collateral.address], | ||||||||||||||||||||||||||||||||||||
| poolMeta: humanizeTargetProtocol('Borrow on', campaign.target.brand), | ||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| case 'aave-v3-net-supply': { | ||||||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||||||
| symbol: formatSymbol(campaign.target.collateral.symbol), | ||||||||||||||||||||||||||||||||||||
| underlyingTokens: [campaign.target.collateral.address], | ||||||||||||||||||||||||||||||||||||
| poolMeta: humanizeTargetProtocol('Net lend on', campaign.target.brand), | ||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| default: { | ||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| function humanizeTargetProtocol(action: string, protocolSlug: string): string { | ||||||||||||||||||||||||||||||||||||
| return `${action} ${protocolSlug | ||||||||||||||||||||||||||||||||||||
| .split('-') | ||||||||||||||||||||||||||||||||||||
| .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) | ||||||||||||||||||||||||||||||||||||
| .join(' ')}`; | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+245
to
+249
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make At Line 246, Proposed fix-function humanizeTargetProtocol(action: string, protocolSlug: string): string {
- return `${action} ${protocolSlug
- .split('-')
+function humanizeTargetProtocol(
+ action: string,
+ protocolSlug?: string
+): string {
+ const normalizedSlug = protocolSlug?.trim();
+ if (!normalizedSlug) return action;
+
+ return `${action} ${normalizedSlug
+ .split(/[-_]/)
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ')}`;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @luzzif pls implement this fix to future proof
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please reduce the text too long and wont easily be seen
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stability pool - brand