From 43c8e86ef3ed3668d5af92e3473034be81563a32 Mon Sep 17 00:00:00 2001 From: Ivan Herger <36133712+iherger@users.noreply.github.com> Date: Thu, 28 Nov 2024 14:45:58 +0100 Subject: [PATCH 1/4] chore: add pendle vault assets (#563) --- .changeset/flat-otters-do.md | 5 ++ packages/environment/src/assets.ts | 10 ++++ packages/environment/src/assets/ethereum.ts | 56 +++++++++++++++++++ .../environment/src/deployments/arbitrum.ts | 18 +++--- .../environment/src/deployments/ethereum.ts | 22 +++++--- .../environment/src/deployments/polygon.ts | 24 ++++---- .../environment/src/deployments/testnet.ts | 1 + packages/environment/src/environment.ts | 3 + packages/environment/src/price-feeds.ts | 15 +++++ packages/environment/src/releases.ts | 9 +++ .../test/assets/pendle-v2-pt.test.ts | 32 +++++++++++ .../test/assets/price-feed.test.ts | 8 ++- .../environment/test/assets/schema.test.ts | 5 ++ .../test/utils/contracts/PendleV2PtToken.ts | 41 ++++++++++++++ packages/environment/test/utils/schema.ts | 6 ++ 15 files changed, 224 insertions(+), 31 deletions(-) create mode 100644 .changeset/flat-otters-do.md create mode 100644 packages/environment/test/assets/pendle-v2-pt.test.ts create mode 100644 packages/environment/test/utils/contracts/PendleV2PtToken.ts diff --git a/.changeset/flat-otters-do.md b/.changeset/flat-otters-do.md new file mode 100644 index 00000000..d799f4f9 --- /dev/null +++ b/.changeset/flat-otters-do.md @@ -0,0 +1,5 @@ +--- +"@enzymefinance/environment": patch +--- + +Add pendle assets diff --git a/packages/environment/src/assets.ts b/packages/environment/src/assets.ts index 0e92c841..4518ea85 100644 --- a/packages/environment/src/assets.ts +++ b/packages/environment/src/assets.ts @@ -63,6 +63,7 @@ export type Asset = | IdleAsset | MapleV1Asset | MapleV2Asset + | PendleV2Asset | PrimitiveAsset | StaderAsset | SynthetixAsset @@ -79,6 +80,7 @@ export enum AssetType { CURVE_POOL_LP = "curve-pool-lp", CURVE_POOL_GAUGE = "curve-pool-gauge", IDLE = "idle", + PENDLE_V2_PT = "pendle-v2-pt", PRIMITIVE = "primitive", STADER = "stader", SYNTHETIX = "synthetix", @@ -323,6 +325,14 @@ export interface CurvePoolGaugeAsset extends AssetBase { readonly underlyings: Array
; } +export interface PendleV2Asset extends AssetBase { + readonly type: AssetType.PENDLE_V2_PT; + /** + * Underlying Asset. + */ + readonly underlying: Address; +} + export function defineAssetList( network: TNetwork, assets: ReadonlyArray, diff --git a/packages/environment/src/assets/ethereum.ts b/packages/environment/src/assets/ethereum.ts index fc3c2eb2..935d1eb0 100644 --- a/packages/environment/src/assets/ethereum.ts +++ b/packages/environment/src/assets/ethereum.ts @@ -7325,4 +7325,60 @@ export default defineAssetList(Network.ETHEREUM, [ address: "0x66aa5b2fdfb453f8a27f9bd1d9124947ef3886bb", }, }, + { + symbol: "SolvBTC", + name: "Solv BTC", + id: "0x7a56e1c57c7475ccf742a1832b028f0456652f97", + type: AssetType.PRIMITIVE, + releases: [sulu], + decimals: 18, + priceFeed: { + type: PriceFeedType.PRIMITIVE_REDSTONE, + aggregator: "0x24c8964338deb5204b096039147b8e8c3aea42cc", + rateAsset: RateAsset.USD, + }, + }, + { + symbol: "SolvBTC.BBN", + name: "SolvBTC Babylon", + id: "0xd9d920aa40f578ab794426f5c90f6c731d159def", + type: AssetType.PRIMITIVE, + releases: [sulu], + decimals: 18, + priceFeed: { + type: PriceFeedType.PRIMITIVE_REDSTONE, + aggregator: "0x24c8964338deb5204b096039147b8e8c3aea42cc", + rateAsset: RateAsset.USD, + peggedTo: "SolvBTC", + nonStandard: true, + }, + }, + { + symbol: "PT-LBTC-27MAR2025", + name: "PT Lombard LBTC 27MAR2025", + id: "0xec5a52c685cc3ad79a6a347abace330d69e0b1ed", + type: AssetType.PENDLE_V2_PT, + releases: [sulu], + decimals: 8, + underlying: "0x8236a87084f8b84306f72007f36f2618a5634494", + priceFeed: { + type: PriceFeedType.PRIMITIVE_PENDLE_V2, + aggregator: "0x83a017b13540a85dbfc056b66eb0b35bf72c09e3", + rateAsset: RateAsset.ETH, + }, + }, + { + symbol: "PT-corn-SolvBTC.BBN-26DEC2024", + name: "PT Corn SolvBTC Babylon 26DEC2024", + id: "0x23e479ddcda990e8523494895759bd98cd2fdbf6", + type: AssetType.PENDLE_V2_PT, + releases: [sulu], + decimals: 8, + underlying: "0xd9d920aa40f578ab794426f5c90f6c731d159def", + priceFeed: { + type: PriceFeedType.PRIMITIVE_PENDLE_V2, + aggregator: "0x65427ee55ab33c00d467923af340b8fb3e73a0cd", + rateAsset: RateAsset.USD, + }, + }, ]); diff --git a/packages/environment/src/deployments/arbitrum.ts b/packages/environment/src/deployments/arbitrum.ts index 688c6825..c46750b0 100644 --- a/packages/environment/src/deployments/arbitrum.ts +++ b/packages/environment/src/deployments/arbitrum.ts @@ -10,16 +10,16 @@ export default defineDeployment({ aaveUIIncentiveDataProvider: "0xe92cd6164ce7dc68e740765bc1f2a091b6cbc3e4", aaveV2IncentivesController: "0x0000000000000000000000000000000000000000", aaveV2LendingPoolProvider: "0x0000000000000000000000000000000000000000", - aaveV3RewardsController: "0x929ec64c34a17401f460460d4b9390518e5b473e", aaveV3LendingPoolProvider: "0xa97684ead0e402dc232d5a977953df7ecbab3cdb", aaveV3ProtocolDataProvider: "0x7f23d86ee20d869112572136221e173428dd740b", + aaveV3RewardsController: "0x929ec64c34a17401f460460d4b9390518e5b473e", aliceOrderManager: "0x0000000000000000000000000000000000000000", arrakisV2Helper: "0x0000000000000000000000000000000000000000", arrakisV2Resolver: "0x0000000000000000000000000000000000000000", - balancerMinter: "0x0000000000000000000000000000000000000000", - balancerProtocolFeesCollector: "0x0000000000000000000000000000000000000000", balancerGaugeController: "0x0000000000000000000000000000000000000000", balancerHelpers: "0x0000000000000000000000000000000000000000", + balancerMinter: "0x0000000000000000000000000000000000000000", + balancerProtocolFeesCollector: "0x0000000000000000000000000000000000000000", balancerVault: "0xba12222222228d8ba445958a75a0704d566bf2c8", chainlinkFeedsRegistry: "0x0000000000000000000000000000000000000000", compoundComptroller: "0x0000000000000000000000000000000000000000", @@ -35,23 +35,24 @@ export default defineDeployment({ gmxV2ReferralStorage: "0xe6fab3f0c7199b0d34d7fbe83394fc0e0d06e99d", kilnStaking: "0x0000000000000000000000000000000000000000", lidoWithdrawalsQueue: "0x0000000000000000000000000000000000000000", + liquityCollSurplusPool: "0x0000000000000000000000000000000000000000", liquityHintHelpers: "0x0000000000000000000000000000000000000000", liquitySortedTroves: "0x0000000000000000000000000000000000000000", liquityTroveManager: "0x0000000000000000000000000000000000000000", - liquityCollSurplusPool: "0x0000000000000000000000000000000000000000", + makerMCDPotAddress: "0x0000000000000000000000000000000000000000", + morphoBlue: "0x0000000000000000000000000000000000000000", + multicall: "0xca11bde05977b3631167028862be2a173976ca11", paraswapV5AugustusSwapper: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57", paraswapV5TokenTransferProxy: "0x216b4b4ba9f3e719726886d34a177484278bfcae", pendlePtLpOracle: "0x0000000000000000000000000000000000000000", staderStakingPoolManager: "0x0000000000000000000000000000000000000000", stakeWiseV3KeeperRewards: "0x0000000000000000000000000000000000000000", + theGraphDelegationStakingProxy: "0x00669a4cf01450b64e8a2a20e9b1fcb71e61ef03", + theGraphEpochManagerProxy: "0x5a843145c43d328b9bb7a4401d94918f131bb281", uniswapV3NonFungiblePositionManager: "0xc36442b4a4522e871399cd717abdd847ab11fe88", voteLockedConvexToken: "0x0000000000000000000000000000000000000000", votiumVoteProxy: "0x0000000000000000000000000000000000000000", zeroExExchangeProxy: "0x0000000000000000000000000000000000000000", - theGraphEpochManagerProxy: "0x5a843145c43d328b9bb7a4401d94918f131bb281", - theGraphDelegationStakingProxy: "0x00669a4cf01450b64e8a2a20e9b1fcb71e61ef03", - multicall: "0xca11bde05977b3631167028862be2a173976ca11", - makerMCDPotAddress: "0x0000000000000000000000000000000000000000", zeroExV4Exchange: "0x0000000000000000000000000000000000000000", }, inception: 230330283, @@ -64,6 +65,7 @@ export default defineDeployment({ nonStandardPriceFeedAssets: 16n, aTokens: 8n, }, + knownUintLists: {}, label: "Arbitrum", namedTokens: { bal: "0x040d1edc9569d4bab2d15287dc5a4f10f56a56b8", diff --git a/packages/environment/src/deployments/ethereum.ts b/packages/environment/src/deployments/ethereum.ts index 1f3b60a9..052de403 100644 --- a/packages/environment/src/deployments/ethereum.ts +++ b/packages/environment/src/deployments/ethereum.ts @@ -10,16 +10,16 @@ export default defineDeployment({ aaveUIIncentiveDataProvider: "0x5a40cde2b76da2bed545efb3ae15708ee56aaf9c", aaveV2IncentivesController: "0xd784927ff2f95ba542bfc824c8a8a98f3495f6b5", aaveV2LendingPoolProvider: "0xb53c1a33016b2dc2ff3653530bff1848a515c8c5", - aaveV3RewardsController: "0x8164cc65827dcfe994ab23944cbc90e0aa80bfcb", aaveV3LendingPoolProvider: "0x2f39d218133afab8f2b819b1066c7e434ad94e9e", aaveV3ProtocolDataProvider: "0x41393e5e337606dc3821075af65aee84d7688cbd", + aaveV3RewardsController: "0x8164cc65827dcfe994ab23944cbc90e0aa80bfcb", aliceOrderManager: "0x841473a19279e54a850e9083a3a57de9e6244d2e", arrakisV2Helper: "0x89e4be1f999e3a58d16096fbe405fc2a1d7f07d6", arrakisV2Resolver: "0x535c5fdf31477f799366df6e4899a12a801cc7b8", - balancerMinter: "0x239e55f427d44c3cc793f49bfb507ebe76638a2b", - balancerProtocolFeesCollector: "0xce88686553686da562ce7cea497ce749da109f9f", balancerGaugeController: "0xc128468b7ce63ea702c1f104d55a2566b13d3abd", balancerHelpers: "0x5addcca35b7a0d07c74063c48700c8590e87864e", + balancerMinter: "0x239e55f427d44c3cc793f49bfb507ebe76638a2b", + balancerProtocolFeesCollector: "0xce88686553686da562ce7cea497ce749da109f9f", balancerVault: "0xba12222222228d8ba445958a75a0704d566bf2c8", chainlinkFeedsRegistry: "0x47fb2585d2c56fe188d0e6ec628a38b74fceeedf", compoundComptroller: "0x3d9819210a31b4961b30ef54be2aed79b9c9cd3b", @@ -28,30 +28,31 @@ export default defineDeployment({ curveMinter: "0xd061d61a4d941c39e5453435b6345dc261c2fce0", curveRegistry: "0x0000000022d53366457f9d5e68ec105046fc4383", cvxCrvStaking: "0x3fe65692bfcd0e6cf84cb1e7d24108e434a7587e", - gmxV2ExchangeRouter: "0x0000000000000000000000000000000000000000", gmxV2ChainlinkPriceFeed: "0x0000000000000000000000000000000000000000", gmxV2DataStore: "0x0000000000000000000000000000000000000000", + gmxV2ExchangeRouter: "0x0000000000000000000000000000000000000000", gmxV2Reader: "0x0000000000000000000000000000000000000000", gmxV2ReferralStorage: "0x0000000000000000000000000000000000000000", kilnStaking: "0x0816df553a89c4bff7ebfd778a9706a989dd3ce3", lidoWithdrawalsQueue: "0x889edc2edab5f40e902b864ad4d7ade8e412f9b1", + liquityCollSurplusPool: "0x3d32e8b97ed5881324241cf03b2da5e2ebce5521", liquityHintHelpers: "0xe84251b93d9524e0d2e621ba7dc7cb3579f997c0", liquitySortedTroves: "0x8fdd3fbfeb32b28fb73555518f8b361bcea741a6", liquityTroveManager: "0xa39739ef8b0231dbfa0dcda07d7e29faabcf4bb2", - liquityCollSurplusPool: "0x3d32e8b97ed5881324241cf03b2da5e2ebce5521", + makerMCDPotAddress: "0x197e90f9fad81970ba7976f33cbd77088e5d7cf7", + morphoBlue: "0xbbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb", + multicall: "0xca11bde05977b3631167028862be2a173976ca11", paraswapV5AugustusSwapper: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57", paraswapV5TokenTransferProxy: "0x216b4b4ba9f3e719726886d34a177484278bfcae", pendlePtLpOracle: "0x66a1096c6366b2529274df4f5d8247827fe4cea8", staderStakingPoolManager: "0xcf5ea1b38380f6af39068375516daf40ed70d299", stakeWiseV3KeeperRewards: "0x6b5815467da09daa7dc83db21c9239d98bb487b5", + theGraphDelegationStakingProxy: "0xf55041e37e12cd407ad00ce2910b8269b01263b9", + theGraphEpochManagerProxy: "0x64f990bf16552a693dcb043bb7bf3866c5e05ddb", uniswapV3NonFungiblePositionManager: "0xc36442b4a4522e871399cd717abdd847ab11fe88", voteLockedConvexToken: "0x72a19342e8f1838460ebfccef09f6585e32db86e", votiumVoteProxy: "0xde1e6a7ed0ad3f61d531a8a78e83ccddbd6e0c49", zeroExExchangeProxy: "0x95e6f48254609a6ee006f7d493c8e5fb97094cef", - theGraphEpochManagerProxy: "0x64f990bf16552a693dcb043bb7bf3866c5e05ddb", - theGraphDelegationStakingProxy: "0xf55041e37e12cd407ad00ce2910b8269b01263b9", - multicall: "0xca11bde05977b3631167028862be2a173976ca11", - makerMCDPotAddress: "0x197e90f9fad81970ba7976f33cbd77088e5d7cf7", zeroExV4Exchange: "0xdef1c0ded9bec7f1a1670819833240f027b25eff", }, inception: 11636493, @@ -65,6 +66,9 @@ export default defineDeployment({ nonStandardPriceFeedAssets: 650n, aTokens: 463n, }, + knownUintLists: { + allowedMorphoBlueVaults: 3n, + }, label: "Ethereum", namedTokens: { aave: "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9", diff --git a/packages/environment/src/deployments/polygon.ts b/packages/environment/src/deployments/polygon.ts index b643d5f8..7dcc6db3 100644 --- a/packages/environment/src/deployments/polygon.ts +++ b/packages/environment/src/deployments/polygon.ts @@ -10,48 +10,49 @@ export default defineDeployment({ aaveUIIncentiveDataProvider: "0x5c5228ac8bc1528482514af3e27e692495148717", aaveV2IncentivesController: "0x357d51124f59836ded84c8a1730d72b749d8bc23", aaveV2LendingPoolProvider: "0xd05e3e715d945b59290df0ae8ef85c1bdb684744", - aaveV3RewardsController: "0x929ec64c34a17401f460460d4b9390518e5b473e", aaveV3LendingPoolProvider: "0xa97684ead0e402dc232d5a977953df7ecbab3cdb", aaveV3ProtocolDataProvider: "0x7f23d86ee20d869112572136221e173428dd740b", + aaveV3RewardsController: "0x929ec64c34a17401f460460d4b9390518e5b473e", aliceOrderManager: "0x0000000000000000000000000000000000000000", arrakisV2Helper: "0x89e4be1f999e3a58d16096fbe405fc2a1d7f07d6", arrakisV2Resolver: "0x535c5fdf31477f799366df6e4899a12a801cc7b8", - balancerMinter: "0x0000000000000000000000000000000000000000", - balancerProtocolFeesCollector: "0xce88686553686da562ce7cea497ce749da109f9f", balancerGaugeController: "0x0000000000000000000000000000000000000000", balancerHelpers: "0x239e55f427d44c3cc793f49bfb507ebe76638a2b", + balancerMinter: "0x0000000000000000000000000000000000000000", + balancerProtocolFeesCollector: "0xce88686553686da562ce7cea497ce749da109f9f", balancerVault: "0xba12222222228d8ba445958a75a0704d566bf2c8", chainlinkFeedsRegistry: "0x0000000000000000000000000000000000000000", - compoundV3Rewards: "0x45939657d1ca34a8fa39a924b71d28fe8431e581", compoundComptroller: "0x0000000000000000000000000000000000000000", + compoundV3Rewards: "0x45939657d1ca34a8fa39a924b71d28fe8431e581", curveChildLiquidityGaugeFactory: "0xabc000d88f23bb45525e447528dbf656a9d55bf5", curveMinter: "0x0000000000000000000000000000000000000000", curveRegistry: "0x0000000022d53366457f9d5e68ec105046fc4383", cvxCrvStaking: "0x0000000000000000000000000000000000000000", - gmxV2ExchangeRouter: "0x0000000000000000000000000000000000000000", gmxV2ChainlinkPriceFeed: "0x0000000000000000000000000000000000000000", gmxV2DataStore: "0x0000000000000000000000000000000000000000", + gmxV2ExchangeRouter: "0x0000000000000000000000000000000000000000", gmxV2Reader: "0x0000000000000000000000000000000000000000", gmxV2ReferralStorage: "0x0000000000000000000000000000000000000000", kilnStaking: "0x0000000000000000000000000000000000000000", lidoWithdrawalsQueue: "0x0000000000000000000000000000000000000000", + liquityCollSurplusPool: "0x0000000000000000000000000000000000000000", liquityHintHelpers: "0x0000000000000000000000000000000000000000", liquitySortedTroves: "0x0000000000000000000000000000000000000000", liquityTroveManager: "0x0000000000000000000000000000000000000000", - liquityCollSurplusPool: "0x0000000000000000000000000000000000000000", + makerMCDPotAddress: "0x0000000000000000000000000000000000000000", + morphoBlue: "0x0000000000000000000000000000000000000000", + multicall: "0xca11bde05977b3631167028862be2a173976ca11", staderStakingPoolManager: "0x0000000000000000000000000000000000000000", - stakeWiseV3KeeperRewards: "0x0000000000000000000000000000000000000000", paraswapV5AugustusSwapper: "0xdef171fe48cf0115b1d80b88dc8eab59176fee57", paraswapV5TokenTransferProxy: "0x216b4b4ba9f3e719726886d34a177484278bfcae", pendlePtLpOracle: "0x0000000000000000000000000000000000000000", + stakeWiseV3KeeperRewards: "0x0000000000000000000000000000000000000000", + theGraphDelegationStakingProxy: "0x0000000000000000000000000000000000000000", + theGraphEpochManagerProxy: "0x0000000000000000000000000000000000000000", uniswapV3NonFungiblePositionManager: "0xc36442b4a4522e871399cd717abdd847ab11fe88", voteLockedConvexToken: "0x0000000000000000000000000000000000000000", votiumVoteProxy: "0x0000000000000000000000000000000000000000", zeroExExchangeProxy: "0x0000000000000000000000000000000000000000", - theGraphEpochManagerProxy: "0x0000000000000000000000000000000000000000", - theGraphDelegationStakingProxy: "0x0000000000000000000000000000000000000000", - multicall: "0xca11bde05977b3631167028862be2a173976ca11", - makerMCDPotAddress: "0x0000000000000000000000000000000000000000", zeroExV4Exchange: "0xdef1c0ded9bec7f1a1670819833240f027b25eff", }, inception: 25825424, @@ -64,6 +65,7 @@ export default defineDeployment({ nonStandardPriceFeedAssets: 1383n, aTokens: 735n, }, + knownUintLists: {}, label: "Polygon", namedTokens: { aave: "0xd6df932a45c0f255f85145f286ea0b292b21c90b", diff --git a/packages/environment/src/deployments/testnet.ts b/packages/environment/src/deployments/testnet.ts index 81c284a0..fe8f67f4 100644 --- a/packages/environment/src/deployments/testnet.ts +++ b/packages/environment/src/deployments/testnet.ts @@ -18,6 +18,7 @@ export default defineDeployment({ nonStandardPriceFeedAssets: 128n, aTokens: 115n, }, + knownUintLists: {}, label: "Testnet", namedTokens: polygonDeployment.namedTokens, network: Network.POLYGON, diff --git a/packages/environment/src/environment.ts b/packages/environment/src/environment.ts index 02150930..3292cef3 100644 --- a/packages/environment/src/environment.ts +++ b/packages/environment/src/environment.ts @@ -15,6 +15,7 @@ import type { DeploymentNetwork, ExternalContractsMapping, KnownAddressListIdMapping, + KnownUintListIdMapping, Release, ReleaseDefinition, } from "./releases.js"; @@ -95,6 +96,7 @@ export class Environment; public readonly externalContracts: ExternalContractsMapping; public readonly knownAddressLists: KnownAddressListIdMapping; + public readonly knownUintLists: KnownUintListIdMapping; public readonly assets: Record = {}; public readonly adapters: Record = {}; public readonly namedTokens: DeploymentNamedAssetsTokens; @@ -141,6 +143,7 @@ export class Environment asset.network === network); diff --git a/packages/environment/src/price-feeds.ts b/packages/environment/src/price-feeds.ts index 866a3bdc..7b43d304 100644 --- a/packages/environment/src/price-feeds.ts +++ b/packages/environment/src/price-feeds.ts @@ -8,6 +8,7 @@ export enum PriceFeedType { PRIMITIVE_CHAINLINK_LIKE_YNETH = "PRIMITIVE_CHAINLINK_LIKE_YNETH", PRIMITIVE_REDSTONE = "PRIMITIVE_REDSTONE", PRIMITIVE_REDSTONE_NON_STANDARD_PRECISION = "PRIMITIVE_NON_STANDARD_PRECISION", + PRIMITIVE_PENDLE_V2 = "PRIMITIVE_PENDLE_V2", DERIVATIVE_ARRAKIS_V2 = "DERIVATIVE_ARRAKIS_V2", DERIVATIVE_BALANCER_V2_GAUGE_TOKEN = "DERIVATIVE_BALANCER_V2_GAUGE_TOKEN", DERIVATIVE_BALANCER_V2_STABLE_POOL = "DERIVATIVE_BALANCER_V2_STABLE_POOL", @@ -30,6 +31,7 @@ export const primitivePriceFeeds = [ PriceFeedType.PRIMITIVE_CHAINLINK_LIKE_YNETH, PriceFeedType.PRIMITIVE_REDSTONE, PriceFeedType.PRIMITIVE_REDSTONE_NON_STANDARD_PRECISION, + PriceFeedType.PRIMITIVE_PENDLE_V2, ]; export const derivativePriceFeeds = [ @@ -61,6 +63,7 @@ export type PriceFeed = | PrimitiveChainlinkLikeYnEthPriceFeed | PrimitiveRedstonePriceFeed | PrimitiveNonStandardPrecisionPriceFeed + | PrimitivePendleV2PriceFeed | DerivativeArrakisV2PriceFeed | DerivativeBalancerV2GaugeTokenPriceFeed | DerivativeBalancerV2StablePoolPriceFeed @@ -149,6 +152,18 @@ export interface PrimitiveNonStandardPrecisionPriceFeed extends PriceFeedBase { readonly rateAsset: RateAsset; } +export interface PrimitivePendleV2PriceFeed extends PriceFeedBase { + readonly type: PriceFeedType.PRIMITIVE_PENDLE_V2; + /** + * Aggregator address + */ + readonly aggregator: Address; + /** + * Rate Asset (ETH = 0, USD = 1) + */ + readonly rateAsset: RateAsset; +} + export interface DerivativeArrakisV2PriceFeed extends PriceFeedBase { readonly type: PriceFeedType.DERIVATIVE_ARRAKIS_V2; /** diff --git a/packages/environment/src/releases.ts b/packages/environment/src/releases.ts index de55aebe..a858c5ef 100644 --- a/packages/environment/src/releases.ts +++ b/packages/environment/src/releases.ts @@ -232,6 +232,10 @@ export interface KnownAddressListIdMapping { aTokens: bigint; } +export interface KnownUintListIdMapping { + allowedMorphoBlueVaults?: bigint; +} + export interface ExternalContractsMapping { readonly aaveUIIncentiveDataProvider: Address; readonly aaveV2IncentivesController: Address; @@ -266,6 +270,7 @@ export interface ExternalContractsMapping { readonly liquitySortedTroves: Address; readonly liquityTroveManager: Address; readonly makerMCDPotAddress: Address; + readonly morphoBlue: Address; readonly multicall: Address; readonly paraswapV5AugustusSwapper: Address; readonly paraswapV5TokenTransferProxy: Address; @@ -298,6 +303,10 @@ export interface DeploymentDefinition { * Ids for known address lists. */ readonly knownAddressLists: KnownAddressListIdMapping; + /** + * Ids for known uint lists. + */ + readonly knownUintLists: KnownUintListIdMapping; /** * The kind of the deployment (e.g. testnet or production). */ diff --git a/packages/environment/test/assets/pendle-v2-pt.test.ts b/packages/environment/test/assets/pendle-v2-pt.test.ts new file mode 100644 index 00000000..926c7db2 --- /dev/null +++ b/packages/environment/test/assets/pendle-v2-pt.test.ts @@ -0,0 +1,32 @@ +import { expect, test } from "vitest"; +import { AssetType } from "../../src/index.js"; +import { getClient } from "../utils/client.js"; +import { getSyFromPt, getYieldTokenFromSy } from "../utils/contracts/PendleV2PtToken.js"; +import { environment } from "../utils/fixtures.js"; + +const client = getClient(environment.network.id); + +const pendleV2PtAssets = environment.getAssets({ types: [AssetType.PENDLE_V2_PT] }); +const assets = environment.getAssets(); + +test.each(pendleV2PtAssets)("pendle v2 pt underlying is correct: $symbol ($name): $id", async (asset) => { + // check if deposit token is correct + const sy = await getSyFromPt(client, { asset: asset.id }); + const yieldToken = await getYieldTokenFromSy(client, { asset: sy }); + + expect(yieldToken.toLowerCase(), "Actual underlying asset does not match expected").toBe(asset.underlying); + + // Check that the underlying asset exists. + expect( + assets.filter((item) => item.id === asset.underlying).length, + "Underlying asset not found in the environment", + ).toBe(1); + + // check if underlying asset is registerd + expect( + asset.registered ? environment.getAsset(asset.underlying).registered : true, + "Underlying asset not registered", + ).toBe(true); +}); + +test.skip("empty test suite fallback"); diff --git a/packages/environment/test/assets/price-feed.test.ts b/packages/environment/test/assets/price-feed.test.ts index 70829d23..6a7fab13 100644 --- a/packages/environment/test/assets/price-feed.test.ts +++ b/packages/environment/test/assets/price-feed.test.ts @@ -73,7 +73,7 @@ suite.each(assets)("$symbol ($name): $id", (asset) => { aggregatorDecimals(client, { aggregator: asset.priceFeed.aggregator }), ]); - expect(description).toBe("Redstone Price Feed"); + expect(description).toMatch(/^Red(?:s|S)tone Price Feed(?: for SolvBTC)*$/); expect(decimals).toBe(asset.priceFeed.rateAsset === 0 ? 18 : 8); break; @@ -112,7 +112,8 @@ suite.each(assets)("$symbol ($name): $id", (asset) => { case PriceFeedType.PRIMITIVE_CHAINLINK_LIKE_WSTETH: case PriceFeedType.PRIMITIVE_CHAINLINK_LIKE_YNETH: case PriceFeedType.PRIMITIVE_REDSTONE: - case PriceFeedType.PRIMITIVE_REDSTONE_NON_STANDARD_PRECISION: { + case PriceFeedType.PRIMITIVE_REDSTONE_NON_STANDARD_PRECISION: + case PriceFeedType.PRIMITIVE_PENDLE_V2: { const [aggregator, rateAsset] = await Promise.all([ Protocol.getAggregatorForPrimitive(client, { valueInterpreter, asset: asset.id }), Protocol.getRateAssetForPrimitive(client, { valueInterpreter, asset: asset.id }), @@ -218,7 +219,8 @@ suite.each(assets)("$symbol ($name): $id", (asset) => { case PriceFeedType.PRIMITIVE_CHAINLINK_LIKE_WSTETH: case PriceFeedType.PRIMITIVE_CHAINLINK_LIKE_YNETH: case PriceFeedType.PRIMITIVE_REDSTONE: - case PriceFeedType.PRIMITIVE_REDSTONE_NON_STANDARD_PRECISION: { + case PriceFeedType.PRIMITIVE_REDSTONE_NON_STANDARD_PRECISION: + case PriceFeedType.PRIMITIVE_PENDLE_V2: { break; } diff --git a/packages/environment/test/assets/schema.test.ts b/packages/environment/test/assets/schema.test.ts index 897f3b8a..1180dc5a 100644 --- a/packages/environment/test/assets/schema.test.ts +++ b/packages/environment/test/assets/schema.test.ts @@ -17,6 +17,7 @@ import { IdleSchema, MaplePoolV1Schema, MaplePoolV2Schema, + PendleV2PtSchema, PrimitiveSchema, StaderSchema, SynthetixSchema, @@ -99,6 +100,10 @@ suite.each(assets)("$symbol ($name): $id", (asset) => { validate(ERC4626Schema, asset); break; } + case AssetType.PENDLE_V2_PT: { + validate(PendleV2PtSchema, asset); + break; + } default: Assertion.never(asset, "Unknown asset type."); } diff --git a/packages/environment/test/utils/contracts/PendleV2PtToken.ts b/packages/environment/test/utils/contracts/PendleV2PtToken.ts new file mode 100644 index 00000000..318e43bf --- /dev/null +++ b/packages/environment/test/utils/contracts/PendleV2PtToken.ts @@ -0,0 +1,41 @@ +import { Viem } from "@enzymefinance/sdk/Utils"; +import type { Address, PublicClient } from "viem"; +import { readContract } from "viem/actions"; + +const ptAbi = [ + { + inputs: [], + name: "SY", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, +] as const; + +export function getSyFromPt(client: PublicClient, args: Viem.ContractCallParameters<{ asset: Address }>) { + return readContract(client, { + ...Viem.extractBlockParameters(args), + abi: ptAbi, + functionName: "SY", + address: args.asset, + }); +} + +const syAbi = [ + { + inputs: [], + name: "yieldToken", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, +] as const; + +export function getYieldTokenFromSy(client: PublicClient, args: Viem.ContractCallParameters<{ asset: Address }>) { + return readContract(client, { + ...Viem.extractBlockParameters(args), + abi: syAbi, + functionName: "yieldToken", + address: args.asset, + }); +} diff --git a/packages/environment/test/utils/schema.ts b/packages/environment/test/utils/schema.ts index a5ce80d5..b41d6ffc 100644 --- a/packages/environment/test/utils/schema.ts +++ b/packages/environment/test/utils/schema.ts @@ -126,6 +126,11 @@ export const CurvePoolLpSchema = CommonAssetSchema.extend({ underlyings: z.array(address).min(1), }); +export const PendleV2PtSchema = CommonAssetSchema.extend({ + type: z.literal(AssetType.PENDLE_V2_PT), + underlying: address, +}); + export const AssetSchema = z.union([ PrimitiveSchema, StaderSchema, @@ -140,6 +145,7 @@ export const AssetSchema = z.union([ CurvePoolGaugeSchema, CurvePoolLpSchema, ERC4626Schema, + PendleV2PtSchema, ]); function error(result: z.SafeParseReturnType) { From 13e2cf797d6834f0b661e0603da93984766fa3cf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 14:47:40 +0100 Subject: [PATCH 2/4] chore: publish package(s) (#578) Co-authored-by: github-actions[bot] --- .changeset/flat-otters-do.md | 5 ----- packages/environment/CHANGELOG.md | 6 ++++++ packages/environment/package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/flat-otters-do.md diff --git a/.changeset/flat-otters-do.md b/.changeset/flat-otters-do.md deleted file mode 100644 index d799f4f9..00000000 --- a/.changeset/flat-otters-do.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@enzymefinance/environment": patch ---- - -Add pendle assets diff --git a/packages/environment/CHANGELOG.md b/packages/environment/CHANGELOG.md index 4fe079ec..956e89ad 100644 --- a/packages/environment/CHANGELOG.md +++ b/packages/environment/CHANGELOG.md @@ -1,5 +1,11 @@ # @enzymefinance/environment +## 6.1.3 + +### Patch Changes + +- [#563](https://github.com/enzymefinance/sdk/pull/563) [`43c8e86`](https://github.com/enzymefinance/sdk/commit/43c8e86ef3ed3668d5af92e3473034be81563a32) Thanks [@iherger](https://github.com/iherger)! - Add pendle assets + ## 6.1.2 ### Patch Changes diff --git a/packages/environment/package.json b/packages/environment/package.json index 9d9b7e54..603f679f 100644 --- a/packages/environment/package.json +++ b/packages/environment/package.json @@ -1,7 +1,7 @@ { "name": "@enzymefinance/environment", "description": "Enzyme is an Ethereum-based protocol for decentralized on-chain asset management.", - "version": "6.1.2", + "version": "6.1.3", "type": "module", "publishConfig": { "access": "public", From d69d80e7703a4d6c6764f78102847938b543ed87 Mon Sep 17 00:00:00 2001 From: Ivan Herger <36133712+iherger@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:14:36 +0100 Subject: [PATCH 3/4] feat: update 31Third adapter addresses (#579) --- .changeset/soft-buttons-fry.md | 5 +++++ packages/environment/src/deployments/arbitrum.ts | 2 +- packages/environment/src/deployments/ethereum.ts | 2 +- packages/environment/src/deployments/polygon.ts | 2 +- packages/environment/src/deployments/testnet.ts | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/soft-buttons-fry.md diff --git a/.changeset/soft-buttons-fry.md b/.changeset/soft-buttons-fry.md new file mode 100644 index 00000000..9be3f54e --- /dev/null +++ b/.changeset/soft-buttons-fry.md @@ -0,0 +1,5 @@ +--- +"@enzymefinance/environment": patch +--- + +Update 31Third adapter addresses diff --git a/packages/environment/src/deployments/arbitrum.ts b/packages/environment/src/deployments/arbitrum.ts index c46750b0..2caee478 100644 --- a/packages/environment/src/deployments/arbitrum.ts +++ b/packages/environment/src/deployments/arbitrum.ts @@ -215,7 +215,7 @@ export default defineDeployment({ TermFinanceV1LendingPositionParser: "0x0000000000000000000000000000000000000000", TheGraphDelegationPositionLib: "0x92da9df390d3e9199d105289b297eca357ecc9b7", TheGraphDelegationPositionParser: "0xc2822eca13a7760141041a173c1b9b13e22515f6", - ThreeOneThirdAdapter: "0x908c0c476c0dc8f7b6d6b6aa34f0349a714380b8", + ThreeOneThirdAdapter: "0x5a1c0e89133c4cd844a8b345370565f1368a79a8", TransferAssetsAdapter: "0xe8db4924569a3c61aadfb721bbb009e3127196bd", UintListRegistry: "0xc438e48f5d2f99eb4a2b9865f8cccfc9915f227a", UniswapV2ExchangeAdapter: "0x0000000000000000000000000000000000000000", diff --git a/packages/environment/src/deployments/ethereum.ts b/packages/environment/src/deployments/ethereum.ts index 052de403..237a3e65 100644 --- a/packages/environment/src/deployments/ethereum.ts +++ b/packages/environment/src/deployments/ethereum.ts @@ -234,7 +234,7 @@ export default defineDeployment({ TermFinanceV1LendingPositionParser: "0xa95c7bab91692df52255b8ad50c5ed2bcc9064ad", TheGraphDelegationPositionLib: "0x6fff66d55698a601e91989c44349da8a2a9a7848", TheGraphDelegationPositionParser: "0x2226d7687109d6b6a0882f8eef2b4a4c90dc677e", - ThreeOneThirdAdapter: "0x908c0c476c0dc8f7b6d6b6aa34f0349a714380b8", + ThreeOneThirdAdapter: "0x5a1c0e89133c4cd844a8b345370565f1368a79a8", TransferAssetsAdapter: "0xe0309fa2412b811a0bd40a73297093707259217f", UintListRegistry: "0x6ffd6fc068e7b365af18da4fdc39d3289159407b", UniswapV2ExchangeAdapter: "0x8c36435a653041bfd65515cc82502663c1ce6f0e", diff --git a/packages/environment/src/deployments/polygon.ts b/packages/environment/src/deployments/polygon.ts index 7dcc6db3..d1d856b0 100644 --- a/packages/environment/src/deployments/polygon.ts +++ b/packages/environment/src/deployments/polygon.ts @@ -219,7 +219,7 @@ export default defineDeployment({ TermFinanceV1LendingPositionParser: "0x0000000000000000000000000000000000000000", TheGraphDelegationPositionLib: "0x0000000000000000000000000000000000000000", TheGraphDelegationPositionParser: "0x0000000000000000000000000000000000000000", - ThreeOneThirdAdapter: "0x908c0c476c0dc8f7b6d6b6aa34f0349a714380b8", + ThreeOneThirdAdapter: "0x5a1c0e89133c4cd844a8b345370565f1368a79a8", TransferAssetsAdapter: "0x52e83a4c9a123500e8324b9f489a681ffda92a17", UintListRegistry: "0x6ddd871c1607348ebb5be250f882255390166519", UniswapV2ExchangeAdapter: "0x0000000000000000000000000000000000000000", diff --git a/packages/environment/src/deployments/testnet.ts b/packages/environment/src/deployments/testnet.ts index fe8f67f4..337a92fc 100644 --- a/packages/environment/src/deployments/testnet.ts +++ b/packages/environment/src/deployments/testnet.ts @@ -158,7 +158,7 @@ export default defineDeployment({ TermFinanceV1LendingPositionParser: "0x0000000000000000000000000000000000000000", TheGraphDelegationPositionLib: "0x0000000000000000000000000000000000000000", TheGraphDelegationPositionParser: "0x0000000000000000000000000000000000000000", - ThreeOneThirdAdapter: "0x1112a89180fc465b648866b98f0e54237b07eaee", + ThreeOneThirdAdapter: "0x0c4dc97e6c0d94327f3ca1873ae5868f5d0a6f05", TransferAssetsAdapter: "0x0000000000000000000000000000000000000000", UintListRegistry: "0xe296ea33a38108580dcae364239fb0c50c53591b", UniswapV2ExchangeAdapter: "0x0000000000000000000000000000000000000000", From d77fbd4ab3b892c7a02975ef6984a30ec515ea41 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:16:51 +0100 Subject: [PATCH 4/4] chore: publish package(s) (#580) Co-authored-by: github-actions[bot] --- .changeset/soft-buttons-fry.md | 5 ----- packages/environment/CHANGELOG.md | 6 ++++++ packages/environment/package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/soft-buttons-fry.md diff --git a/.changeset/soft-buttons-fry.md b/.changeset/soft-buttons-fry.md deleted file mode 100644 index 9be3f54e..00000000 --- a/.changeset/soft-buttons-fry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@enzymefinance/environment": patch ---- - -Update 31Third adapter addresses diff --git a/packages/environment/CHANGELOG.md b/packages/environment/CHANGELOG.md index 956e89ad..89150f58 100644 --- a/packages/environment/CHANGELOG.md +++ b/packages/environment/CHANGELOG.md @@ -1,5 +1,11 @@ # @enzymefinance/environment +## 6.1.4 + +### Patch Changes + +- [#579](https://github.com/enzymefinance/sdk/pull/579) [`d69d80e`](https://github.com/enzymefinance/sdk/commit/d69d80e7703a4d6c6764f78102847938b543ed87) Thanks [@iherger](https://github.com/iherger)! - Update 31Third adapter addresses + ## 6.1.3 ### Patch Changes diff --git a/packages/environment/package.json b/packages/environment/package.json index 603f679f..8206a033 100644 --- a/packages/environment/package.json +++ b/packages/environment/package.json @@ -1,7 +1,7 @@ { "name": "@enzymefinance/environment", "description": "Enzyme is an Ethereum-based protocol for decentralized on-chain asset management.", - "version": "6.1.3", + "version": "6.1.4", "type": "module", "publishConfig": { "access": "public",