编译器
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": "0xb2a2c005b57ba13d2f6730abc05fb1086de75c94",
"src/core/protocol/libraries/logic/BridgeLogic.sol:BridgeLogic": "0xd0209f725637631153f1fcb3a2d869aca9afdf88",
"src/core/protocol/libraries/logic/ConfiguratorLogic.sol:ConfiguratorLogic": "0xd74d4495936b066218eb9bf20995bff93574bc8d",
"src/core/protocol/libraries/logic/EModeLogic.sol:EModeLogic": "0x4e68bcd17c6e47cd7c80d66770f80161296c4273",
"src/core/protocol/libraries/logic/FlashLoanLogic.sol:FlashLoanLogic": "0x9f3de000b98a7227348869d40e6cf739989b8b4d",
"src/core/protocol/libraries/logic/LiquidationLogic.sol:LiquidationLogic": "0xe6f87565576785693ab8ed298dfabb99efbca163",
"src/core/protocol/libraries/logic/PoolLogic.sol:PoolLogic": "0x5d9991711ebc3e8f69b1e2cf99b8cade98792c2b",
"src/core/protocol/libraries/logic/SupplyLogic.sol:SupplyLogic": "0xc981354bdca1829ac6d40ade968898703b2e0cb1"
},
"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"}]