Verified contractExactMIT
TransparentUpgradeableProxy
Address0x7743e50f534a7f9f1791dde7dcd89f7783eefc39
- Balance
0 ETH
- Transactions
9,282
- Compiler
solc 0.8.26
- Same code
20 more contracts
Details
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 22,067,293
- Creation transaction
- 0xf00d9a9dd0…d465f3930b
- Proxy implementation
- 0xe4031e27…f710e8a6SavingFxUSD
- Main copy (most transactions)
- 0x6ecfa38f…4f0122e8
165 files
The source code is large: one file is shown at a time. Choose a file in the list.
- @openzeppelin/contracts-v4/proxy/transparent/TransparentUpgradeableProxy.solmain8.34 KB
- @openzeppelin/contracts-upgradeable-v4/access/AccessControlUpgradeable.sol8.87 KB
- @openzeppelin/contracts-upgradeable-v4/access/IAccessControlUpgradeable.sol2.93 KB
- @openzeppelin/contracts-upgradeable-v4/interfaces/IERC5267Upgradeable.sol749 B
- @openzeppelin/contracts-upgradeable-v4/proxy/utils/Initializable.sol6.64 KB
- @openzeppelin/contracts-upgradeable-v4/security/ReentrancyGuardUpgradeable.sol3.68 KB
- @openzeppelin/contracts-upgradeable-v4/token/ERC20/ERC20Upgradeable.sol13.49 KB
- @openzeppelin/contracts-upgradeable-v4/token/ERC20/IERC20Upgradeable.sol2.75 KB
- @openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/ERC20PermitUpgradeable.sol4.04 KB
- @openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/IERC20MetadataUpgradeable.sol716 B
- @openzeppelin/contracts-upgradeable-v4/token/ERC20/extensions/IERC20PermitUpgradeable.sol3.81 KB
- @openzeppelin/contracts-upgradeable-v4/token/ERC20/utils/SafeERC20Upgradeable.sol7.1 KB
- @openzeppelin/contracts-upgradeable-v4/utils/AddressUpgradeable.sol9.38 KB
- @openzeppelin/contracts-upgradeable-v4/utils/ContextUpgradeable.sol1.48 KB
- @openzeppelin/contracts-upgradeable-v4/utils/CountersUpgradeable.sol1.41 KB
- @openzeppelin/contracts-upgradeable-v4/utils/StringsUpgradeable.sol2.85 KB
- @openzeppelin/contracts-upgradeable-v4/utils/cryptography/ECDSAUpgradeable.sol9.16 KB
- @openzeppelin/contracts-upgradeable-v4/utils/cryptography/EIP712Upgradeable.sol8.06 KB
- @openzeppelin/contracts-upgradeable-v4/utils/introspection/ERC165Upgradeable.sol1.54 KB
- @openzeppelin/contracts-upgradeable-v4/utils/introspection/IERC165Upgradeable.sol864 B
- @openzeppelin/contracts-upgradeable-v4/utils/math/MathUpgradeable.sol12.8 KB
- @openzeppelin/contracts-upgradeable-v4/utils/math/SignedMathUpgradeable.sol1.27 KB
- @openzeppelin/contracts-upgradeable-v4/utils/structs/EnumerableSetUpgradeable.sol12.97 KB
- @openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol8.28 KB
- @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol8.91 KB
- @openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol12.47 KB
- @openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol3.2 KB
- @openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol19.4 KB
- @openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol1.19 KB
- @openzeppelin/contracts-upgradeable/utils/NoncesUpgradeable.sol2.33 KB
- @openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol4.36 KB
- @openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol8.69 KB
- @openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol1.18 KB
- @openzeppelin/contracts-v4/access/Ownable.sol2.62 KB
- @openzeppelin/contracts-v4/interfaces/IERC1967.sol667 B
- @openzeppelin/contracts-v4/interfaces/draft-IERC1822.sol879 B
- @openzeppelin/contracts-v4/proxy/ERC1967/ERC1967Proxy.sol1.29 KB
- @openzeppelin/contracts-v4/proxy/ERC1967/ERC1967Upgrade.sol6.04 KB
- @openzeppelin/contracts-v4/proxy/Proxy.sol3.25 KB
- @openzeppelin/contracts-v4/proxy/beacon/IBeacon.sol450 B
- @openzeppelin/contracts-v4/proxy/transparent/ProxyAdmin.sol2.86 KB
- @openzeppelin/contracts-v4/utils/Address.sol9.36 KB
- @openzeppelin/contracts-v4/utils/Context.sol962 B
- @openzeppelin/contracts-v4/utils/StorageSlot.sol4.11 KB
- @openzeppelin/contracts/access/AccessControl.sol7.05 KB
- @openzeppelin/contracts/access/IAccessControl.sol3.26 KB
- @openzeppelin/contracts/access/Ownable.sol3.1 KB
- @openzeppelin/contracts/access/Ownable2Step.sol1.99 KB
- @openzeppelin/contracts/interfaces/IERC5267.sol739 B
- @openzeppelin/contracts/interfaces/draft-IERC6093.sol6.53 KB
- @openzeppelin/contracts/token/ERC20/ERC20.sol11.14 KB
- @openzeppelin/contracts/token/ERC20/IERC20.sol2.78 KB
- @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol683 B
- @openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol3.8 KB
- @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol5.77 KB
- @openzeppelin/contracts/token/ERC721/IERC721.sol4.93 KB
- @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol995 B
- @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol792 B
- @openzeppelin/contracts/utils/Address.sol6.26 KB
- @openzeppelin/contracts/utils/Context.sol963 B
- @openzeppelin/contracts/utils/Strings.sol3.1 KB
- @openzeppelin/contracts/utils/cryptography/ECDSA.sol7.73 KB
- @openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol3.76 KB
- @openzeppelin/contracts/utils/introspection/ERC165.sol911 B
- @openzeppelin/contracts/utils/introspection/IERC165.sol869 B
- @openzeppelin/contracts/utils/math/Math.sol15.12 KB
- @openzeppelin/contracts/utils/math/SafeCast.sol34.69 KB
- @openzeppelin/contracts/utils/math/SignedMath.sol1.26 KB
- @openzeppelin/contracts/utils/structs/EnumerableSet.sol12.97 KB
- contracts/common/EIP2535/Diamond.sol2.51 KB
- contracts/common/EIP2535/facets/DiamondCutFacet.sol1.3 KB
- contracts/common/EIP2535/facets/DiamondLoupeFacet.sol6.34 KB
- contracts/common/EIP2535/facets/OwnershipFacet.sol744 B
- contracts/common/EIP2535/interfaces/IDiamond.sol624 B
- contracts/common/EIP2535/interfaces/IDiamondCut.sol956 B
- contracts/common/EIP2535/interfaces/IDiamondLoupe.sol1.54 KB
- contracts/common/EIP2535/interfaces/IERC165.sol528 B
- contracts/common/EIP2535/interfaces/IERC173.sol766 B
- contracts/common/EIP2535/libraries/LibDiamond.sol8.86 KB
- contracts/common/EIP2535/upgradeInitializers/DiamondInit.sol2.07 KB
- contracts/common/EIP2535/upgradeInitializers/DiamondMultiInit.sol1.14 KB
- contracts/common/ERC3156/IERC3156FlashBorrower.sol645 B
- contracts/common/ERC3156/IERC3156FlashLender.sol1.18 KB
- contracts/common/codec/WordCodec.sol4.1 KB
- contracts/common/rewards/distributor/IMultipleRewardDistributor.sol3.04 KB
- contracts/common/rewards/distributor/IRewardDistributor.sol1.11 KB
- contracts/common/rewards/distributor/LinearMultipleRewardDistributor.sol7.39 KB
- contracts/common/rewards/distributor/LinearReward.sol3.4 KB
- contracts/common/rewards/distributor/LinearRewardDistributor.sol3.69 KB
- contracts/common/utils/PermissionedSwap.sol3.34 KB
- contracts/core/FlashLoans.sol2.95 KB
- contracts/core/FxUSDBasePool.sol20.62 KB
- contracts/core/FxUSDRegeneracy.sol17.27 KB
- contracts/core/PegKeeper.sol7.75 KB
- contracts/core/PoolManager.sol24.15 KB
- contracts/core/ProtocolFees.sol14.43 KB
- contracts/core/ReservePool.sol3.72 KB
- contracts/core/pool/AaveFundingPool.sol12.21 KB
- contracts/core/pool/BasePool.sol22.87 KB
- contracts/core/pool/PoolConstant.sol1.15 KB
- contracts/core/pool/PoolErrors.sol2.34 KB
- contracts/core/pool/PoolStorage.sol19.06 KB
- contracts/core/pool/PositionLogic.sol4.92 KB
- contracts/core/pool/TickLogic.sol9.81 KB
- contracts/fund/AssetManagement.sol442 B
- contracts/helpers/EmptyContract.sol85 B
- contracts/helpers/External.sol216 B
- contracts/helpers/GaugeRewarder.sol2.2 KB
- contracts/helpers/RevenuePool.sol10.38 KB
- contracts/helpers/converter/MultiPathConverter.sol2.95 KB
- contracts/helpers/interfaces/IMultiPathConverter.sol402 B
- contracts/helpers/interfaces/ITokenConverter.sol5.63 KB
- contracts/interfaces/Aave/IAaveV3Pool.sol3.73 KB
- contracts/interfaces/Balancer/IBalancerVault.sol2.72 KB
- contracts/interfaces/Balancer/IFlashLoanRecipient.sol736 B
- contracts/interfaces/Chainlink/AggregatorV3Interface.sol729 B
- contracts/interfaces/Curve/ICurvePoolOracle.sol1.7 KB
- contracts/interfaces/Curve/ICurveStableSwapNG.sol10.83 KB
- contracts/interfaces/IAaveFundingPool.sol1.49 KB
- contracts/interfaces/IFxUSDBasePool.sol8.53 KB
- contracts/interfaces/IFxUSDRegeneracy.sol2.13 KB
- contracts/interfaces/IPegKeeper.sol2.83 KB
- contracts/interfaces/IPool.sol9.85 KB
- contracts/interfaces/IPoolManager.sol8.72 KB
- contracts/interfaces/IProtocolFees.sol4.82 KB
- contracts/interfaces/IReservePool.sol1.3 KB
- contracts/interfaces/IRewardSplitter.sol552 B
- contracts/interfaces/IWrappedEther.sol169 B
- contracts/libraries/BitMath.sol2.89 KB
- contracts/libraries/Math.sol1.03 KB
- contracts/libraries/TickBitmap.sol1.72 KB
- contracts/libraries/TickMath.sol15.2 KB
- contracts/mocks/MockAaveV3Pool.sol933 B
- contracts/mocks/MockAggregatorV3Interface.sol1.31 KB
- contracts/mocks/MockCurveStableSwapNG.sol405 B
- contracts/mocks/MockERC20.sol515 B
- contracts/mocks/MockMultiPathConverter.sol1.3 KB
- contracts/mocks/MockMultipleRewardDistributor.sol497 B
- contracts/mocks/MockPriceOracle.sol736 B
- contracts/mocks/MockRateProvider.sol408 B
- contracts/mocks/MockStakedFxUSD.sol4.05 KB
- contracts/periphery/facets/FlashLoanCallbackFacet.sol1.99 KB
- contracts/periphery/facets/FlashLoanFacetBase.sol1.81 KB
- contracts/periphery/facets/FxUSDBasePoolFacet.sol6.77 KB
- contracts/periphery/facets/MigrateFacet.sol12.12 KB
- contracts/periphery/facets/PositionOperateFlashLoanFacet.sol8.95 KB
- contracts/periphery/facets/RouterManagementFacet.sol2.65 KB
- contracts/periphery/libraries/LibRouter.sol8.41 KB
- contracts/price-oracle/LSDPriceOracleBase.sol8.1 KB
- contracts/price-oracle/SpotPriceOracleBase.sol5.01 KB
- contracts/price-oracle/StETHPriceOracle.sol1.36 KB
- contracts/price-oracle/interfaces/IPriceOracle.sol1.1 KB
- contracts/price-oracle/interfaces/ISpotPriceOracle.sol2.52 KB
- contracts/price-oracle/interfaces/ITwapOracle.sol580 B
- contracts/rate-provider/interfaces/IRateProvider.sol244 B
- contracts/v2/MarketV2.sol29.55 KB
- contracts/v2/interfaces/IFxBoostableRebalancePool.sol4.37 KB
- contracts/v2/interfaces/IFxFractionalTokenV2.sol929 B
- contracts/v2/interfaces/IFxMarketV2.sol10.22 KB
- contracts/v2/interfaces/IFxRebalancePoolRegistry.sol839 B
- contracts/v2/interfaces/IFxReservePool.sol506 B
- contracts/v2/interfaces/IFxShareableRebalancePool.sol2.74 KB
- contracts/v2/interfaces/IFxTreasuryV2.sol10.53 KB
- contracts/v2/interfaces/IFxUSD.sol7.75 KB
- contracts/voting-escrow/interfaces/ILiquidityGauge.sol5.94 KB
@openzeppelin/contracts-v4/proxy/transparent/TransparentUpgradeableProxy.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/transparent/TransparentUpgradeableProxy.sol)
pragma solidity ^0.8.0;
import "../ERC1967/ERC1967Proxy.sol";
/**
* @dev Interface for {TransparentUpgradeableProxy}. In order to implement transparency, {TransparentUpgradeableProxy}
* does not implement this interface directly, and some of its functions are implemented by an internal dispatch
* mechanism. The compiler is unaware that these functions are implemented by {TransparentUpgradeableProxy} and will not
* include them in the ABI so this interface must be used to interact with it.
*/
interface ITransparentUpgradeableProxy is IERC1967 {
function admin() external view returns (address);
function implementation() external view returns (address);
function changeAdmin(address) external;
function upgradeTo(address) external;
function upgradeToAndCall(address, bytes memory) external payable;
}
/**
* @dev This contract implements a proxy that is upgradeable by an admin.
*
* To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
* clashing], which can potentially be used in an attack, this contract uses the
* https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
* things that go hand in hand:
*
* 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
* that call matches one of the admin functions exposed by the proxy itself.
* 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
* implementation. If the admin tries to call a function on the implementation it will fail with an error that says
* "admin cannot fallback to proxy target".
*
* These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
* the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
* to sudden errors when trying to call a function from the proxy implementation.
*
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
* you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
*
* NOTE: The real interface of this proxy is that defined in `ITransparentUpgradeableProxy`. This contract does not
* inherit from that interface, and instead the admin functions are implicitly implemented using a custom dispatch
* mechanism in `_fallback`. Consequently, the compiler will not produce an ABI for this contract. This is necessary to
* fully implement transparency without decoding reverts caused by selector clashes between the proxy and the
* implementation.
*
* WARNING: It is not recommended to extend this contract to add additional external functions. If you do so, the compiler
* will not check that there are no selector conflicts, due to the note above. A selector clash between any new function
* and the functions declared in {ITransparentUpgradeableProxy} will be resolved in favor of the new one. This could
* render the admin operations inaccessible, which could prevent upgradeability. Transparency may also be compromised.
*/
contract TransparentUpgradeableProxy is ERC1967Proxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.
*/
constructor(address _logic, address admin_, bytes memory _data) payable ERC1967Proxy(_logic, _data) {
_changeAdmin(admin_);
}
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*
* CAUTION: This modifier is deprecated, as it could cause issues if the modified function has arguments, and the
* implementation provides a function with the same selector.
*/
modifier ifAdmin() {
if (msg.sender == _getAdmin()) {
_;
} else {
_fallback();
}
}
/**
* @dev If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior
*/
function _fallback() internal virtual override {
if (msg.sender == _getAdmin()) {
bytes memory ret;
bytes4 selector = msg.sig;
if (selector == ITransparentUpgradeableProxy.upgradeTo.selector) {
ret = _dispatchUpgradeTo();
} else if (selector == ITransparentUpgradeableProxy.upgradeToAndCall.selector) {
ret = _dispatchUpgradeToAndCall();
} else if (selector == ITransparentUpgradeableProxy.changeAdmin.selector) {
ret = _dispatchChangeAdmin();
} else if (selector == ITransparentUpgradeableProxy.admin.selector) {
ret = _dispatchAdmin();
} else if (selector == ITransparentUpgradeableProxy.implementation.selector) {
ret = _dispatchImplementation();
} else {
revert("TransparentUpgradeableProxy: admin cannot fallback to proxy target");
}
assembly {
return(add(ret, 0x20), mload(ret))
}
} else {
super._fallback();
}
}
/**
* @dev Returns the current admin.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function _dispatchAdmin() private returns (bytes memory) {
_requireZeroValue();
address admin = _getAdmin();
return abi.encode(admin);
}
/**
* @dev Returns the current implementation.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function _dispatchImplementation() private returns (bytes memory) {
_requireZeroValue();
address implementation = _implementation();
return abi.encode(implementation);
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*/
function _dispatchChangeAdmin() private returns (bytes memory) {
_requireZeroValue();
address newAdmin = abi.decode(msg.data[4:], (address));
_changeAdmin(newAdmin);
return "";
}
/**
* @dev Upgrade the implementation of the proxy.
*/
function _dispatchUpgradeTo() private returns (bytes memory) {
_requireZeroValue();
address newImplementation = abi.decode(msg.data[4:], (address));
_upgradeToAndCall(newImplementation, bytes(""), false);
return "";
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*/
function _dispatchUpgradeToAndCall() private returns (bytes memory) {
(address newImplementation, bytes memory data) = abi.decode(msg.data[4:], (address, bytes));
_upgradeToAndCall(newImplementation, data, true);
return "";
}
/**
* @dev Returns the current admin.
*
* CAUTION: This function is deprecated. Use {ERC1967Upgrade-_getAdmin} instead.
*/
function _admin() internal view virtual returns (address) {
return _getAdmin();
}
/**
* @dev To keep this contract fully transparent, all `ifAdmin` functions must be payable. This helper is here to
* emulate some proxy functions being non-payable while still allowing value to pass through.
*/
function _requireZeroValue() private {
require(msg.value == 0);
}
}
Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun"
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.