Перейти к содержимому
Проверенный контрактЧастичноеBUSL-1.1

MinimalBeaconProxy

Адрес0x7fc0354fbe14d2caf4c7c5cbad653a8ffe4e7f86
Баланс

0 ETH

 

Транзакций

3

 

Компилятор

solc 0.8.30

 

Тот же код

ещё 1 099 контрактов

 

Подробности

Компилятор
solc 0.8.30+commit.73712a01
Язык
solidity
Оптимизация
Да, 1 000 000 прогонов
Версия EVM
prague
Через IR
да
Лицензия
BUSL-1.1
Совпадение
Частичноекод создания: нет, код в сети: да
Проверен на Sourcify
Создан в блоке
25 769 162
Транзакция создания
0x2238356356…b84c16eec2
Реализация прокси
0x029b8117…9e44ae6eRoycoSeniorTranche

src/MinimalBeaconProxy.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.28;

// Fork of OpenZeppelin's BeaconProxy to remove redundant storage write to ERC-1967 beacon slot.

import {Proxy} from "@openzeppelin/contracts/proxy/Proxy.sol";
import {IBeacon} from "@openzeppelin/contracts/proxy/beacon/IBeacon.sol";

contract MinimalBeaconProxy is Proxy {
    address private immutable _beacon;

    constructor(address beacon) {
        _beacon = beacon;
    }

    function _implementation() internal view virtual override returns (address) {
        return IBeacon(_beacon).implementation();
    }
}

@openzeppelin/contracts/proxy/Proxy.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)

pragma solidity ^0.8.20;

/**
 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
 * be specified by overriding the virtual {_implementation} function.
 *
 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
 * different contract through the {_delegate} function.
 *
 * The success and return data of the delegated call will be returned back to the caller of the proxy.
 */
abstract contract Proxy {
    /**
     * @dev Delegates the current call to `implementation`.
     *
     * This function does not return to its internal call site, it will return directly to the external caller.
     */
    function _delegate(address implementation) internal virtual {
        assembly {
            // Copy msg.data. We take full control of memory in this inline assembly
            // block because it will not return to Solidity code. We overwrite the
            // Solidity scratch pad at memory position 0.
            calldatacopy(0, 0, calldatasize())

            // Call the implementation.
            // out and outsize are 0 because we don't know the size yet.
            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

            // Copy the returned data.
            returndatacopy(0, 0, returndatasize())

            switch result
            // delegatecall returns 0 on error.
            case 0 {
                revert(0, returndatasize())
            }
            default {
                return(0, returndatasize())
            }
        }
    }

    /**
     * @dev This is a virtual function that should be overridden so it returns the address to which the fallback
     * function and {_fallback} should delegate.
     */
    function _implementation() internal view virtual returns (address);

    /**
     * @dev Delegates the current call to the address returned by `_implementation()`.
     *
     * This function does not return to its internal call site, it will return directly to the external caller.
     */
    function _fallback() internal virtual {
        _delegate(_implementation());
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
     * function in the contract matches the call data.
     */
    fallback() external payable virtual {
        _fallback();
    }
}

@openzeppelin/contracts/proxy/beacon/IBeacon.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (proxy/beacon/IBeacon.sol)

pragma solidity >=0.4.16;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeacon {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {UpgradeableBeacon} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}
Настройки компилятораПоказать
{
  "viaIR": true,
  "optimizer": {
    "runs": 1000000,
    "enabled": true
  },
  "evmVersion": "prague"
}

Исходный код и метаданные: Sourcify.

Исходный код принадлежит авторам контракта.