Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Network, PricingAdapters, ProtocolProvider, RewardSource, VAULTS } from '@lib/common';
- import { Address, getAddress } from 'viem';
- import { ConvexDivestConfigByAddress } from './divest';
- import { ConvexInvestConfigByAddress } from './invest';
- import { ConvexRewardConfigByAddress } from './rewards';
- // ============================================================================
- // Types
- // ============================================================================
- export type ConvexProtocolNames =
- | 'Convex frxUSD-sUSDS'
- | 'Convex msETH-OETH'
- | 'Convex msETH-WETH'
- | 'Convex sUSDe-crvUSD'
- | 'Convex PYUSD-crvUSD'
- | 'Convex ETH+-WETH'
- | 'Convex ETH-ETHx'
- | 'Convex uniETH-frxETH';
- type Risk = 'Lowest' | 'Low' | 'Moderate' | 'High';
- type YieldCalculationStrategy = 'Advertised';
- enum DivestAdapterType {
- EnsoConvex = 'EnsoConvex',
- }
- enum InvestAdapterType {
- EnsoConvex = 'EnsoConvex',
- }
- interface BaseConvexProtocolConfig {
- name: ConvexProtocolNames;
- poolUrl: string;
- defillamaId: string;
- operator: string;
- risk: Risk;
- protocolAddress: Address; // Curve LP token address
- }
- interface ConvexProtocolConfig {
- pricingAdapter: PricingAdapters;
- name: string;
- poolUrl: string;
- defillamaId: string;
- yieldStrategy: YieldCalculationStrategy;
- protocol: ProtocolProvider;
- operator: string;
- risk: Risk;
- network: Network;
- description: string;
- investAdapterType: InvestAdapterType;
- investConfig: { convexPool: { address: Address; name: string; symbol: string; decimals: number } };
- divestAdapterType: DivestAdapterType;
- divestConfig: {
- convexPool: { address: Address; name: string; symbol: string; decimals: number };
- curveLpToken: { address: Address; name: string; symbol: string; decimals: number };
- };
- addresses: { protocol: Address };
- rewardSource: RewardSource;
- rewardConfig: { rewardAsset: { address: Address; name: string; symbol: string; decimals: number }; minterAddress: Address };
- }
- // ============================================================================
- // Helper Function - Merges configs by convexPool address
- // ============================================================================
- function createConvexProtocol(convexPoolAddress: Address, base: BaseConvexProtocolConfig): ConvexProtocolConfig {
- const investConfig = ConvexInvestConfigByAddress[convexPoolAddress];
- const divestConfig = ConvexDivestConfigByAddress[convexPoolAddress];
- const rewardConfig = ConvexRewardConfigByAddress[convexPoolAddress];
- if (!investConfig || !divestConfig || !rewardConfig) {
- throw new Error(`Missing config for Convex pool: ${convexPoolAddress}`);
- }
- return {
- pricingAdapter: PricingAdapters.convex,
- name: base.name,
- poolUrl: base.poolUrl,
- defillamaId: base.defillamaId,
- yieldStrategy: 'Advertised',
- protocol: ProtocolProvider.CONVEX,
- operator: base.operator,
- risk: base.risk,
- network: Network.ETHEREUM_MAINNET,
- description: '',
- investAdapterType: InvestAdapterType.EnsoConvex,
- investConfig,
- divestAdapterType: DivestAdapterType.EnsoConvex,
- divestConfig,
- addresses: {
- protocol: base.protocolAddress,
- },
- rewardSource: RewardSource.CONVEX,
- rewardConfig,
- };
- }
- // ============================================================================
- // Protocol Definitions - Only base config here, rest is merged from other files
- // ============================================================================
- export const ConvexProtocols = {
- [Network.ETHEREUM_MAINNET]: {
- ['Convex frxUSD-sUSDS']: createConvexProtocol(getAddress('0x44be1A72619eDDDccAb744eE9e1E69A0B639F85f'), {
- name: 'Convex frxUSD-sUSDS',
- poolUrl: 'https://curve.convexfinance.com/stake/ethereum/430',
- defillamaId: 'e2d1f421-242a-4028-b0bb-22511e9b481c',
- operator: VAULTS.yoUSD,
- risk: 'Moderate',
- protocolAddress: getAddress('0x81A2612F6dEA269a6Dd1F6DeAb45C5424EE2c4b7'),
- }),
- ['Convex msETH-OETH']: createConvexProtocol(getAddress('0x6597d955e2510Ee86539C68fe2e4D6b01ba6374d'), {
- name: 'Convex msETH-OETH',
- poolUrl: 'https://curve.convexfinance.com/stake/ethereum/452',
- defillamaId: '361f02db-2bbc-49ec-ad35-64d20ec47cec',
- operator: VAULTS.yoETH,
- risk: 'Moderate',
- protocolAddress: getAddress('0xB5b93dde9D87563184d31F3b7f85dd58404E2ee0'),
- }),
- ['Convex msETH-WETH']: createConvexProtocol(getAddress('0x442E773FFB0043551417D5A37E10c17990fB075c'), {
- name: 'Convex msETH-WETH',
- poolUrl: 'https://curve.convexfinance.com/stake/ethereum/217',
- defillamaId: 'c130b363-10fa-46d9-8221-3b23ed8027b4',
- operator: VAULTS.yoETH,
- risk: 'Moderate',
- protocolAddress: getAddress('0xa4c567c662349BeC3D0fB94C4e7f85bA95E208e4'),
- }),
- ['Convex sUSDe-crvUSD']: createConvexProtocol(getAddress('0x0Fce355888851408F30A6ccC3C77f6D9EEe75834'), {
- name: 'Convex sUSDe-crvUSD',
- poolUrl: 'https://curve.convexfinance.com/stake/ethereum/362',
- defillamaId: '93833f3f-4033-422a-bcb3-2c00d37d594d',
- operator: VAULTS.yoUSD,
- risk: 'Moderate',
- protocolAddress: getAddress('0x57064F49Ad7123C92560882a45518374ad982e85'),
- }),
- ['Convex PYUSD-crvUSD']: createConvexProtocol(getAddress('0x79579633029a61963eDfbA1C0BE22498b6e0D33D'), {
- name: 'Convex PYUSD-crvUSD',
- poolUrl: 'https://curve.convexfinance.com/stake/ethereum/289',
- defillamaId: '443f0162-635e-493c-bc2b-4985f8f790e3',
- operator: VAULTS.yoUSD,
- risk: 'Low',
- protocolAddress: getAddress('0x625E92624Bc2D88619ACCc1788365A69767f6200'),
- }),
- ['Convex ETH+-WETH']: createConvexProtocol(getAddress('0x9e0A248528Aa933ff1F8f707ea75F61eD780836E'), {
- name: 'Convex ETH+-WETH',
- poolUrl: 'https://curve.convexfinance.com/stake/ethereum/470',
- defillamaId: '74346f6f-c7ee-4506-a204-baf48e13decb',
- operator: VAULTS.yoETH,
- risk: 'Moderate',
- protocolAddress: getAddress('0x2c683fAd51da2cd17793219CC86439C1875c353e'),
- }),
- ['Convex ETH-ETHx']: createConvexProtocol(getAddress('0x399e111c7209a741B06F8F86Ef0Fdd88fC198D20'), {
- name: 'Convex ETH-ETHx',
- poolUrl: 'https://curve.convexfinance.com/stake/ethereum/232',
- defillamaId: '65b7d01f-52de-4071-a735-698c52d3643e',
- operator: VAULTS.yoETH,
- risk: 'Moderate',
- protocolAddress: getAddress('0x59Ab5a5b5d617E478a2479B0cAD80DA7e2831492'),
- }),
- ['Convex uniETH-frxETH']: createConvexProtocol(getAddress('0x4683d23005D56fD44B67D52b62bD43318983B9C1'), {
- name: 'Convex uniETH-frxETH',
- poolUrl: 'https://curve.convexfinance.com/stake/ethereum/474',
- defillamaId: '8b175564-158f-4079-a309-9d0384b6227b',
- operator: VAULTS.yoETH,
- risk: 'Moderate',
- protocolAddress: getAddress('0x78C579A2Dcfe10Ae8B3C888A583337Beb4D91733'),
- }),
- },
- [Network.BASE_MAINNET]: {},
- [Network.UNICHAIN_MAINNET]: {},
- [Network.ARBITRUM_MAINNET]: {},
- };
Advertisement