编译器
0.8.10+commit.fc410830
文件 1 的 6:Address.sol
pragma solidity 0.8.10;
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly {
codehash := extcodehash(account)
}
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, 'Address: insufficient balance');
(bool success, ) = recipient.call{value: amount}('');
require(success, 'Address: unable to send value, recipient may have reverted');
}
}
文件 2 的 6:BaseImmutableAdminUpgradeabilityProxy.sol
pragma solidity 0.8.10;
import {BaseUpgradeabilityProxy} from '../../../dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol';
contract BaseImmutableAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
address internal immutable _admin;
constructor(address admin) {
_admin = admin;
}
modifier ifAdmin() {
if (msg.sender == _admin) {
_;
} else {
_fallback();
}
}
function admin() external ifAdmin returns (address) {
return _admin;
}
function implementation() external ifAdmin returns (address) {
return _implementation();
}
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
function upgradeToAndCall(
address newImplementation,
bytes calldata data
) external payable ifAdmin {
_upgradeTo(newImplementation);
(bool success, ) = newImplementation.delegatecall(data);
require(success);
}
function _willFallback() internal virtual override {
require(msg.sender != _admin, 'Cannot call fallback function from the proxy admin');
super._willFallback();
}
}
文件 3 的 6:BaseUpgradeabilityProxy.sol
pragma solidity 0.8.10;
import './Proxy.sol';
import '../contracts/Address.sol';
contract BaseUpgradeabilityProxy is Proxy {
event Upgraded(address indexed implementation);
bytes32 internal constant IMPLEMENTATION_SLOT =
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
function _implementation() internal view override returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
function _setImplementation(address newImplementation) internal {
require(
Address.isContract(newImplementation),
'Cannot set a proxy implementation to a non-contract address'
);
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
文件 4 的 6:InitializableImmutableAdminUpgradeabilityProxy.sol
pragma solidity 0.8.10;
import {InitializableUpgradeabilityProxy} from '../../../dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol';
import {Proxy} from '../../../dependencies/openzeppelin/upgradeability/Proxy.sol';
import {BaseImmutableAdminUpgradeabilityProxy} from './BaseImmutableAdminUpgradeabilityProxy.sol';
contract InitializableImmutableAdminUpgradeabilityProxy is
BaseImmutableAdminUpgradeabilityProxy,
InitializableUpgradeabilityProxy
{
constructor(address admin) BaseImmutableAdminUpgradeabilityProxy(admin) {
}
function _willFallback() internal override(BaseImmutableAdminUpgradeabilityProxy, Proxy) {
BaseImmutableAdminUpgradeabilityProxy._willFallback();
}
}
文件 5 的 6:InitializableUpgradeabilityProxy.sol
pragma solidity 0.8.10;
import './BaseUpgradeabilityProxy.sol';
contract InitializableUpgradeabilityProxy is BaseUpgradeabilityProxy {
function initialize(address _logic, bytes memory _data) public payable {
require(_implementation() == address(0));
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if (_data.length > 0) {
(bool success, ) = _logic.delegatecall(_data);
require(success);
}
}
}
文件 6 的 6:Proxy.sol
pragma solidity 0.8.10;
abstract contract Proxy {
fallback() external payable {
_fallback();
}
function _implementation() internal view virtual returns (address);
function _delegate(address implementation) internal {
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
function _willFallback() internal virtual {}
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
{
"compilationTarget": {
"src/core/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol": "InitializableImmutableAdminUpgradeabilityProxy"
},
"evmVersion": "london",
"libraries": {
"src/core/protocol/libraries/logic/BorrowLogic.sol:BorrowLogic": "0xee2585c8f2a1debad9f43ee764e3d0766e2a4273",
"src/core/protocol/libraries/logic/BridgeLogic.sol:BridgeLogic": "0xe3aad8bd71e9be91a60770159242325e06af86b4",
"src/core/protocol/libraries/logic/ConfiguratorLogic.sol:ConfiguratorLogic": "0x306ca8e36c1dcc1e160f94d1eb5fd97cea889871",
"src/core/protocol/libraries/logic/EModeLogic.sol:EModeLogic": "0xc8cb15bc73b7f5f95af33aece738bc9b62cb28d9",
"src/core/protocol/libraries/logic/FlashLoanLogic.sol:FlashLoanLogic": "0x486d682781a960ffb2a1feedbd3455c6fae608ea",
"src/core/protocol/libraries/logic/LiquidationLogic.sol:LiquidationLogic": "0x107a0d2b34fc76f19ad64e9a9d27340a049b4ac2",
"src/core/protocol/libraries/logic/PoolLogic.sol:PoolLogic": "0x30777a478886ecfca0dc8b023e4fd19b133d616f",
"src/core/protocol/libraries/logic/SupplyLogic.sol:SupplyLogic": "0x6253996626073f9e25d5b49feae792a45a9b9451"
},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [
":@aave/=node_modules/@aave/",
":@ensdomains/=node_modules/@ensdomains/",
":@openzeppelin/=lib/openzeppelin-contracts/contracts/",
":@siddomains/=node_modules/@siddomains/",
":ds-test/=lib/forge-std/lib/ds-test/src/",
":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
":eth-gas-reporter/=node_modules/eth-gas-reporter/",
":forge-std/=lib/forge-std/src/",
":hardhat-deploy/=node_modules/hardhat-deploy/",
":hardhat/=node_modules/hardhat/",
":openzeppelin-contracts/=lib/openzeppelin-contracts/",
":openzeppelin/=lib/openzeppelin-contracts/contracts/",
":src/=src/",
":test/=test/"
]
}
[{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_logic","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"initialize","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]