Skip to content
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

feat: deploy PTweETHOracle #254

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions broadcast/PTweETHOracle.s.sol/1/run-1713426235.json

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions broadcast/PTweETHOracle.s.sol/1/run-1713426341.json

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions broadcast/PTweETHOracle.s.sol/1/run-1713426446.json

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions broadcast/PTweETHOracle.s.sol/1/run-1713426471.json

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions broadcast/PTweETHOracle.s.sol/1/run-latest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/oracle/BaseOraclePTPendle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ abstract contract BaseOraclePTPendle {
/// - getPtToSy() should be used if the underlying token is tradable,
/// - getPtToAsset() if not
/// @dev https://docs.pendle.finance/Developers/Contracts/StandardizedYield#asset-of-sy--assetinfo-function
function _pendlePTPrice() internal view returns (uint256) {
function _pendlePTPrice() internal view virtual returns (uint256) {
return PendlePtOracleLib.getPtToAssetRate(IPMarket(market()), twapDuration);
}

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"scripts": {
"hardhat:compile": "hardhat compile",
"foundry:compile": "forge build",
"foundry:deploy:mainnet": "forge script --rpc-url mainnet --broadcast --verify -vvvv",
"foundry:deploy:polygon": "forge script --rpc-url polygon --broadcast --verify -vvvv",
"deploy": "forge script --skip test --broadcast --verify --slow -vvvv --rpc-url",
"deploy:fork": "FOUNDRY_PROFILE=dev forge script --skip test --slow --fork-url fork --broadcast -vvvv",
"check-upgradeability": "hardhat run scripts/upgradeability.ts",
"coverage": "hardhat coverage",
"coverage:foundry": "forge coverage --report lcov",
"deploy": "hardhat deploy --tags coreMerkl --network ",
"deploy:hardhat": "hardhat deploy --tags coreMerkl --network ",
"etherscan": "hardhat etherscan-verify --network",
"foundry:deploy": "forge script --broadcast --verify -vvvv --rpc-url",
"generate-types-from-abis": "typechain --target ethers-v5 --out-dir typechain './export/abi/*.json'",
Expand Down
34 changes: 34 additions & 0 deletions scripts/foundry/mainnet/PTweETHOracle.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;

import "forge-std/Script.sol";
import { console } from "forge-std/console.sol";
import { MorphoFeedPTweETH } from "borrow-contracts/oracle/morpho/mainnet/MorphoFeedPTweETH.sol";
import "utils/src/CommonUtils.sol";
import { IAccessControlManager } from "borrow-contracts/interfaces/IAccessControlManager.sol";

contract PTweETHOracleDeploy is Script, CommonUtils {
function run() external {
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
address deployer = vm.addr(deployerPrivateKey);
vm.startBroadcast(deployerPrivateKey);

// TODO
uint256 chainId = CHAIN_ETHEREUM;
address coreBorrow = 0x5bc6BEf80DA563EBf6Df6D6913513fa9A7ec89BE;
uint32 _TWAP_DURATION = 30 minutes;
uint256 _MAX_IMPLIED_RATE = 0.5 ether;
// end TODO

MorphoFeedPTweETH oracle = new MorphoFeedPTweETH(
IAccessControlManager(address(coreBorrow)),
_MAX_IMPLIED_RATE,
_TWAP_DURATION
);
(, int256 answer, , , ) = oracle.latestRoundData();
console.log("oracle value ", uint256(answer));
console.log("Successfully deployed PT-weETH: ", address(oracle));

vm.stopBroadcast();
}
Comment on lines +11 to +33

Check warning

Code scanning / Slither

Unused return Medium

}
Loading