-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPendlePTAmortizedOracleScriptBase.s.sol
More file actions
34 lines (29 loc) · 1.58 KB
/
PendlePTAmortizedOracleScriptBase.s.sol
File metadata and controls
34 lines (29 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.30;
import { DeployV2Base } from "./DeployV2Base.s.sol";
import { DeterministicDeployerLib } from "lib/v2-core/src/vendor/nexus/DeterministicDeployerLib.sol";
/// @title PendlePTAmortizedOracleScriptBase
/// @notice Shared base contract for PendlePTAmortizedOracle deployment and ownership scripts
/// @dev Contains common constants and utility functions
abstract contract PendlePTAmortizedOracleScriptBase is DeployV2Base {
/*//////////////////////////////////////////////////////////////
CONSTANTS
//////////////////////////////////////////////////////////////*/
/// @notice Contract key for PendlePTAmortizedOracle
string internal constant ORACLE_KEY = "PendlePTAmortizedOracle";
/*//////////////////////////////////////////////////////////////
INTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @notice Compute the deterministic address for PendlePTAmortizedOracle
/// @param env Environment (0 = prod, 1 = vnet, 2 = staging)
/// @param admin Admin address used during deployment
/// @return The computed deterministic address
function _computeOracleAddress(uint256 env, address admin) internal view returns (address) {
bytes memory bytecode = __getBytecode(ORACLE_KEY, env);
require(bytecode.length > 0, "BYTECODE_NOT_FOUND");
return DeterministicDeployerLib.computeAddress(
abi.encodePacked(bytecode, abi.encode(admin)),
__getSalt(ORACLE_KEY)
);
}
}