0x0x230x

Untitled

Jan 1st, 2026
33
0
Never
4
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.00 KB | None | 0 0
  1. import { Network, PricingAdapters, ProtocolProvider, RewardSource, VAULTS } from '@lib/common';
  2. import { Address, getAddress } from 'viem';
  3. import { ConvexDivestConfigByAddress } from './divest';
  4. import { ConvexInvestConfigByAddress } from './invest';
  5. import { ConvexRewardConfigByAddress } from './rewards';
  6.  
  7. // ============================================================================
  8. // Types
  9. // ============================================================================
  10.  
  11. export type ConvexProtocolNames =
  12. | 'Convex frxUSD​-sUSDS'
  13. | 'Convex msETH-OETH'
  14. | 'Convex msETH-WETH'
  15. | 'Convex sUSDe-crvUSD'
  16. | 'Convex PYUSD-crvUSD'
  17. | 'Convex ETH+-WETH'
  18. | 'Convex ETH-ETHx'
  19. | 'Convex uniETH-frxETH';
  20.  
  21. type Risk = 'Lowest' | 'Low' | 'Moderate' | 'High';
  22.  
  23. type YieldCalculationStrategy = 'Advertised';
  24.  
  25. enum DivestAdapterType {
  26. EnsoConvex = 'EnsoConvex',
  27. }
  28.  
  29. enum InvestAdapterType {
  30. EnsoConvex = 'EnsoConvex',
  31. }
  32.  
  33. interface BaseConvexProtocolConfig {
  34. name: ConvexProtocolNames;
  35. poolUrl: string;
  36. defillamaId: string;
  37. operator: string;
  38. risk: Risk;
  39. protocolAddress: Address; // Curve LP token address
  40. }
  41.  
  42. interface ConvexProtocolConfig {
  43. pricingAdapter: PricingAdapters;
  44. name: string;
  45. poolUrl: string;
  46. defillamaId: string;
  47. yieldStrategy: YieldCalculationStrategy;
  48. protocol: ProtocolProvider;
  49. operator: string;
  50. risk: Risk;
  51. network: Network;
  52. description: string;
  53. investAdapterType: InvestAdapterType;
  54. investConfig: { convexPool: { address: Address; name: string; symbol: string; decimals: number } };
  55. divestAdapterType: DivestAdapterType;
  56. divestConfig: {
  57. convexPool: { address: Address; name: string; symbol: string; decimals: number };
  58. curveLpToken: { address: Address; name: string; symbol: string; decimals: number };
  59. };
  60. addresses: { protocol: Address };
  61. rewardSource: RewardSource;
  62. rewardConfig: { rewardAsset: { address: Address; name: string; symbol: string; decimals: number }; minterAddress: Address };
  63. }
  64.  
  65. // ============================================================================
  66. // Helper Function - Merges configs by convexPool address
  67. // ============================================================================
  68.  
  69. function createConvexProtocol(convexPoolAddress: Address, base: BaseConvexProtocolConfig): ConvexProtocolConfig {
  70. const investConfig = ConvexInvestConfigByAddress[convexPoolAddress];
  71. const divestConfig = ConvexDivestConfigByAddress[convexPoolAddress];
  72. const rewardConfig = ConvexRewardConfigByAddress[convexPoolAddress];
  73.  
  74. if (!investConfig || !divestConfig || !rewardConfig) {
  75. throw new Error(`Missing config for Convex pool: ${convexPoolAddress}`);
  76. }
  77.  
  78. return {
  79. pricingAdapter: PricingAdapters.convex,
  80. name: base.name,
  81. poolUrl: base.poolUrl,
  82. defillamaId: base.defillamaId,
  83. yieldStrategy: 'Advertised',
  84. protocol: ProtocolProvider.CONVEX,
  85. operator: base.operator,
  86. risk: base.risk,
  87. network: Network.ETHEREUM_MAINNET,
  88. description: '',
  89. investAdapterType: InvestAdapterType.EnsoConvex,
  90. investConfig,
  91. divestAdapterType: DivestAdapterType.EnsoConvex,
  92. divestConfig,
  93. addresses: {
  94. protocol: base.protocolAddress,
  95. },
  96. rewardSource: RewardSource.CONVEX,
  97. rewardConfig,
  98. };
  99. }
  100.  
  101. // ============================================================================
  102. // Protocol Definitions - Only base config here, rest is merged from other files
  103. // ============================================================================
  104.  
  105. export const ConvexProtocols = {
  106. [Network.ETHEREUM_MAINNET]: {
  107. ['Convex frxUSD​-sUSDS']: createConvexProtocol(getAddress('0x44be1A72619eDDDccAb744eE9e1E69A0B639F85f'), {
  108. name: 'Convex frxUSD​-sUSDS',
  109. poolUrl: 'https://curve.convexfinance.com/stake/ethereum/430',
  110. defillamaId: 'e2d1f421-242a-4028-b0bb-22511e9b481c',
  111. operator: VAULTS.yoUSD,
  112. risk: 'Moderate',
  113. protocolAddress: getAddress('0x81A2612F6dEA269a6Dd1F6DeAb45C5424EE2c4b7'),
  114. }),
  115.  
  116. ['Convex msETH-OETH']: createConvexProtocol(getAddress('0x6597d955e2510Ee86539C68fe2e4D6b01ba6374d'), {
  117. name: 'Convex msETH-OETH',
  118. poolUrl: 'https://curve.convexfinance.com/stake/ethereum/452',
  119. defillamaId: '361f02db-2bbc-49ec-ad35-64d20ec47cec',
  120. operator: VAULTS.yoETH,
  121. risk: 'Moderate',
  122. protocolAddress: getAddress('0xB5b93dde9D87563184d31F3b7f85dd58404E2ee0'),
  123. }),
  124.  
  125. ['Convex msETH-WETH']: createConvexProtocol(getAddress('0x442E773FFB0043551417D5A37E10c17990fB075c'), {
  126. name: 'Convex msETH-WETH',
  127. poolUrl: 'https://curve.convexfinance.com/stake/ethereum/217',
  128. defillamaId: 'c130b363-10fa-46d9-8221-3b23ed8027b4',
  129. operator: VAULTS.yoETH,
  130. risk: 'Moderate',
  131. protocolAddress: getAddress('0xa4c567c662349BeC3D0fB94C4e7f85bA95E208e4'),
  132. }),
  133.  
  134. ['Convex sUSDe-crvUSD']: createConvexProtocol(getAddress('0x0Fce355888851408F30A6ccC3C77f6D9EEe75834'), {
  135. name: 'Convex sUSDe-crvUSD',
  136. poolUrl: 'https://curve.convexfinance.com/stake/ethereum/362',
  137. defillamaId: '93833f3f-4033-422a-bcb3-2c00d37d594d',
  138. operator: VAULTS.yoUSD,
  139. risk: 'Moderate',
  140. protocolAddress: getAddress('0x57064F49Ad7123C92560882a45518374ad982e85'),
  141. }),
  142.  
  143. ['Convex PYUSD-crvUSD']: createConvexProtocol(getAddress('0x79579633029a61963eDfbA1C0BE22498b6e0D33D'), {
  144. name: 'Convex PYUSD-crvUSD',
  145. poolUrl: 'https://curve.convexfinance.com/stake/ethereum/289',
  146. defillamaId: '443f0162-635e-493c-bc2b-4985f8f790e3',
  147. operator: VAULTS.yoUSD,
  148. risk: 'Low',
  149. protocolAddress: getAddress('0x625E92624Bc2D88619ACCc1788365A69767f6200'),
  150. }),
  151.  
  152. ['Convex ETH+-WETH']: createConvexProtocol(getAddress('0x9e0A248528Aa933ff1F8f707ea75F61eD780836E'), {
  153. name: 'Convex ETH+-WETH',
  154. poolUrl: 'https://curve.convexfinance.com/stake/ethereum/470',
  155. defillamaId: '74346f6f-c7ee-4506-a204-baf48e13decb',
  156. operator: VAULTS.yoETH,
  157. risk: 'Moderate',
  158. protocolAddress: getAddress('0x2c683fAd51da2cd17793219CC86439C1875c353e'),
  159. }),
  160.  
  161. ['Convex ETH-ETHx']: createConvexProtocol(getAddress('0x399e111c7209a741B06F8F86Ef0Fdd88fC198D20'), {
  162. name: 'Convex ETH-ETHx',
  163. poolUrl: 'https://curve.convexfinance.com/stake/ethereum/232',
  164. defillamaId: '65b7d01f-52de-4071-a735-698c52d3643e',
  165. operator: VAULTS.yoETH,
  166. risk: 'Moderate',
  167. protocolAddress: getAddress('0x59Ab5a5b5d617E478a2479B0cAD80DA7e2831492'),
  168. }),
  169.  
  170. ['Convex uniETH-frxETH']: createConvexProtocol(getAddress('0x4683d23005D56fD44B67D52b62bD43318983B9C1'), {
  171. name: 'Convex uniETH-frxETH',
  172. poolUrl: 'https://curve.convexfinance.com/stake/ethereum/474',
  173. defillamaId: '8b175564-158f-4079-a309-9d0384b6227b',
  174. operator: VAULTS.yoETH,
  175. risk: 'Moderate',
  176. protocolAddress: getAddress('0x78C579A2Dcfe10Ae8B3C888A583337Beb4D91733'),
  177. }),
  178. },
  179. [Network.BASE_MAINNET]: {},
  180. [Network.UNICHAIN_MAINNET]: {},
  181. [Network.ARBITRUM_MAINNET]: {},
  182. };
  183.  
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment