编译器
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": {
"lib/aave-v3-core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol": "InitializableImmutableAdminUpgradeabilityProxy"
},
"evmVersion": "london",
"libraries": {
"lib/aave-v3-core/contracts/protocol/libraries/logic/BorrowLogic.sol:BorrowLogic": "0xfc21d6d146e6086b8359705c8b28512a983db0cb",
"lib/aave-v3-core/contracts/protocol/libraries/logic/BridgeLogic.sol:BridgeLogic": "0xf7b656c95420194b79687fc86d965fb51da4799f",
"lib/aave-v3-core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol:ConfiguratorLogic": "0xe13942e7cef74ab51d9b87c244357494dc0fda0a",
"lib/aave-v3-core/contracts/protocol/libraries/logic/EModeLogic.sol:EModeLogic": "0x62da45546a0f87b23941ffe5ca22f9d2a8fa7df3",
"lib/aave-v3-core/contracts/protocol/libraries/logic/FlashLoanLogic.sol:FlashLoanLogic": "0xa5b3b4294270c8106b599ad531e6168dd3d93b19",
"lib/aave-v3-core/contracts/protocol/libraries/logic/LiquidationLogic.sol:LiquidationLogic": "0xda135cd78a086025bcdc87b038a1c462032b510c",
"lib/aave-v3-core/contracts/protocol/libraries/logic/PoolLogic.sol:PoolLogic": "0x3b269b2548dacfe8bafa500681ddc6c4cff09401",
"lib/aave-v3-core/contracts/protocol/libraries/logic/SupplyLogic.sol:SupplyLogic": "0xe8ab45b9b0aff2cfc2bd687ccc214f1231e9ec4d"
},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 100000
},
"remappings": [
":@aave/core-v3/=lib/aave-v3-core/",
":@aave/periphery-v3/=lib/aave-address-book/lib/aave-v3-periphery/",
":@uniswap/v3-core/=lib/v3-core/",
":V2-V3-migration-helpers/=lib/V2-V3-migration-helpers/",
":aave-address-book/=lib/aave-address-book/src/",
":aave-helpers/=lib/aave-helpers/src/",
":aave-v3-core/=lib/aave-v3-core/",
":aave-v3-periphery/=lib/aave-v3-periphery/contracts/",
":ds-test/=lib/forge-std/lib/ds-test/src/",
":dss-interfaces/=lib/dss-test/lib/dss-interfaces/src/",
":dss-test/=lib/dss-test/src/",
":forge-std/=lib/forge-std/src/",
":governance-crosschain-bridges/=lib/aave-helpers/lib/governance-crosschain-bridges/",
":solidity-utils/=lib/V2-V3-migration-helpers/lib/solidity-utils/src/"
]
}
[{"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"}]