-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added vETH-wETH Aura SY & Adjust deployment script/docs
- Loading branch information
Showing
11 changed files
with
239 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity 0.8.17; | ||
|
||
import "@pendle/core-v2/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSYV2.sol"; | ||
import "@pendle/core-v2/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol"; | ||
|
||
contract AuraWethVethSY is PendleAuraBalancerStableLPSYV2 { | ||
address internal constant VETH = 0x4Bc3263Eb5bb2Ef7Ad9aB6FB68be80E43b43801F; | ||
address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; | ||
|
||
uint256 internal constant AURA_PID = 128; | ||
address internal constant LP = 0x156C02f3f7fEf64a3A9D80CCF7085f23ccE91D76; | ||
|
||
address internal constant COMPOSABLE_PREVIEW = 0x4239Ddd3c50463383670E86c119220849BFaF64a; | ||
|
||
bool internal constant NO_TOKENS_EXEMPT = true; | ||
bool internal constant ALL_TOKENS_EXEMPT = false; | ||
|
||
constructor( | ||
string memory _name, | ||
string memory _symbol | ||
) | ||
PendleAuraBalancerStableLPSYV2( | ||
_name, | ||
_symbol, | ||
LP, | ||
AURA_PID, | ||
ComposableStablePreview(COMPOSABLE_PREVIEW) | ||
) | ||
//solhint-disable-next-line | ||
{ | ||
|
||
} | ||
|
||
function _deposit( | ||
address tokenIn, | ||
uint256 amount | ||
) internal virtual override returns (uint256 amountSharesOut) { | ||
if (tokenIn == NATIVE) { | ||
IWETH(WETH).deposit{ value: amount }(); | ||
amountSharesOut = super._deposit(WETH, amount); | ||
} else { | ||
amountSharesOut = super._deposit(tokenIn, amount); | ||
} | ||
} | ||
|
||
function _redeem( | ||
address receiver, | ||
address tokenOut, | ||
uint256 amountSharesToRedeem | ||
) internal virtual override returns (uint256) { | ||
if (tokenOut == NATIVE) { | ||
uint256 amountTokenOut = super._redeem(address(this), WETH, amountSharesToRedeem); | ||
IWETH(WETH).withdraw(amountTokenOut); | ||
_transferOut(NATIVE, receiver, amountTokenOut); | ||
return amountTokenOut; | ||
} else { | ||
return super._redeem(receiver, tokenOut, amountSharesToRedeem); | ||
} | ||
} | ||
|
||
function _previewDeposit( | ||
address tokenIn, | ||
uint256 amountTokenToDeposit | ||
) internal view virtual override returns (uint256 amountSharesOut) { | ||
if (tokenIn == NATIVE) { | ||
amountSharesOut = super._previewDeposit(WETH, amountTokenToDeposit); | ||
} else { | ||
amountSharesOut = super._previewDeposit(tokenIn, amountTokenToDeposit); | ||
} | ||
} | ||
|
||
function _previewRedeem( | ||
address tokenOut, | ||
uint256 amountSharesToRedeem | ||
) internal view virtual override returns (uint256 amountTokenOut) { | ||
if (tokenOut == NATIVE) { | ||
amountTokenOut = super._previewRedeem(WETH, amountSharesToRedeem); | ||
} else { | ||
amountTokenOut = super._previewRedeem(tokenOut, amountSharesToRedeem); | ||
} | ||
} | ||
|
||
function _getImmutablePoolData() internal pure override returns (bytes memory ret) { | ||
ComposableStablePreview.ImmutableData memory res; | ||
res.poolTokens = _getPoolTokenAddresses(); | ||
res.rateProviders = _getRateProviders(); | ||
res.rawScalingFactors = _getRawScalingFactors(); | ||
res.isExemptFromYieldProtocolFee = _getExemption(); | ||
res.LP = LP; | ||
res.noTokensExempt = NO_TOKENS_EXEMPT; | ||
res.allTokensExempt = ALL_TOKENS_EXEMPT; | ||
res.bptIndex = _getBPTIndex(); | ||
res.totalTokens = res.poolTokens.length; | ||
|
||
return abi.encode(res); | ||
} | ||
|
||
// --------------------------------- POOL CONSTANTS --------------------------------- | ||
function _getPoolTokenAddresses() internal pure override returns (address[] memory res) { | ||
res = new address[](3); | ||
res[0] = LP; | ||
res[1] = VETH; | ||
res[2] = WETH; | ||
} | ||
|
||
function _getBPTIndex() internal pure override returns (uint256) { | ||
return 0; | ||
} | ||
|
||
function _getRateProviders() internal pure returns (address[] memory res) { | ||
res = new address[](3); | ||
res[0] = 0x0000000000000000000000000000000000000000; | ||
res[1] = 0x12589A727aeFAc3fbE5025F890f1CB97c269BEc2; | ||
res[2] = 0x0000000000000000000000000000000000000000; | ||
} | ||
|
||
function _getRawScalingFactors() internal pure returns (uint256[] memory res) { | ||
res = new uint256[](3); | ||
res[0] = res[1] = res[2] = 1e18; | ||
} | ||
|
||
function _getExemption() internal pure returns (bool[] memory res) { | ||
res = new bool[](3); | ||
res[0] = res[1] = res[2] = false; | ||
} | ||
|
||
function getTokensIn() public view virtual override returns (address[] memory res) { | ||
res = new address[](4); | ||
res[0] = LP; | ||
res[1] = WETH; | ||
res[2] = VETH; | ||
res[3] = NATIVE; | ||
} | ||
|
||
function getTokensOut() public view virtual override returns (address[] memory res) { | ||
return getTokensIn(); | ||
} | ||
|
||
function isValidTokenIn(address token) public view virtual override returns (bool) { | ||
return (token == LP || token == WETH || token == VETH || token == NATIVE); | ||
} | ||
|
||
function isValidTokenOut(address token) public view virtual override returns (bool) { | ||
return isValidTokenIn(token); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"name": "SY swETH", | ||
"symbol": "SY-swETH", | ||
"expiry": 1750896000, | ||
"scalarRoot": "112278200000000000000", | ||
"initialRateAnchor": "1087110000000000000", | ||
"doCacheIndex": true, | ||
"expiry": 1750896000, | ||
"scalarRoot": "106799962313000000000", | ||
"initialRateAnchor": "1059899851000000000", | ||
"SY": "0x4bF3B85a7ec25Ac743E4Eb21f745B1213116f4ff", | ||
"PT": "0x83DdA45D873De56967B7aaE067180b55C7635832", | ||
"YT": "0xB21a491068e99631590891b4553deC84555Fe75C", | ||
"market": "0x8F8644d86b2f09839CC9dA52358535e292466c74" | ||
"market": "0xFb3ED50aA7e997Bd588a250E6469F68a971A79DD" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; | ||
import { IStandardizedYield, SwETHSY } from '../typechain-types'; | ||
import { deploy, getContractAt } from './helper'; | ||
import { MarketConfiguration } from './configuration'; | ||
|
||
/** | ||
* @dev This function aims to deploy your SY contract | ||
* @dev The below implementation show how to deploy a SwETH SY contract | ||
* | ||
* To deploy your own SY contract, you need to: | ||
* - Change the contract name / type name in "deploy<YOUR_CONTRACT_NAME>(deployer, 'YOUR_CONTRACT_NAME', [...])" | ||
* - Change the deployment params to match your constructor arguments | ||
*/ | ||
export async function deploySY(deployer: SignerWithAddress): Promise<IStandardizedYield> { | ||
const sy = await deploy<SwETHSY>(deployer, 'SwETHSY', [ | ||
MarketConfiguration.name, | ||
MarketConfiguration.symbol, | ||
'0xf951E335afb289353dc249e82926178EaC7DEd78', // SWETH address | ||
]); | ||
|
||
return await getContractAt<IStandardizedYield>('IStandardizedYield', sy.address); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters