Wrap docstrings to 120 chars (#4600)
This commit is contained in:
@ -16,8 +16,8 @@ contract ERC1967Proxy is Proxy {
|
||||
/**
|
||||
* @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation`.
|
||||
*
|
||||
* If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be an encoded
|
||||
* function call, and allows initializing the storage of the proxy like a Solidity constructor.
|
||||
* If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
|
||||
* encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
@ -30,8 +30,8 @@ contract ERC1967Proxy is Proxy {
|
||||
/**
|
||||
* @dev Returns the current implementation address.
|
||||
*
|
||||
* 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.
|
||||
* 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 _implementation() internal view virtual override returns (address) {
|
||||
|
||||
@ -101,8 +101,8 @@ library ERC1967Utils {
|
||||
/**
|
||||
* @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.
|
||||
* 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 getAdmin() internal view returns (address) {
|
||||
|
||||
@ -45,8 +45,8 @@ abstract contract Proxy {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev This is a virtual function that should be overridden so it returns the address to which the fallback function
|
||||
* and {_fallback} should delegate.
|
||||
* @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);
|
||||
|
||||
|
||||
@ -10,15 +10,15 @@ import {ERC1967Utils} from "../ERC1967/ERC1967Utils.sol";
|
||||
/**
|
||||
* @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.
|
||||
*
|
||||
* The beacon address can only be set once during construction, and cannot be changed afterwards. It is stored in an immutable
|
||||
* variable to avoid unnecessary storage reads, and also in the beacon storage slot specified by
|
||||
* The beacon address can only be set once during construction, and cannot be changed afterwards. It is stored in an
|
||||
* immutable variable to avoid unnecessary storage reads, and also in the beacon storage slot specified by
|
||||
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967] so that it can be accessed externally.
|
||||
*
|
||||
* CAUTION: Since the beacon address can never be changed, you must ensure that you either control the beacon, or trust the
|
||||
* beacon to not upgrade the implementation maliciously.
|
||||
* CAUTION: Since the beacon address can never be changed, you must ensure that you either control the beacon, or trust
|
||||
* the beacon to not upgrade the implementation maliciously.
|
||||
*
|
||||
* IMPORTANT: Do not use the implementation logic to modify the beacon storage slot. Doing so would leave the proxy in an
|
||||
* inconsistent state where the beacon storage slot does not match the beacon address.
|
||||
* IMPORTANT: Do not use the implementation logic to modify the beacon storage slot. Doing so would leave the proxy in
|
||||
* an inconsistent state where the beacon storage slot does not match the beacon address.
|
||||
*/
|
||||
contract BeaconProxy is Proxy {
|
||||
// An immutable address for the beacon to avoid unnecessary SLOADs before each delegate call.
|
||||
|
||||
@ -28,35 +28,34 @@ interface ITransparentUpgradeableProxy is IERC1967 {
|
||||
*
|
||||
* 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
|
||||
* that call matches the {ITransparentUpgradeableProxy-upgradeToAndCall} function exposed by the proxy itself.
|
||||
* 2. If the admin calls the proxy, it can call the `upgradeToAndCall` function but any other call won't be forwarded to the
|
||||
* implementation. If the admin tries to call a function on the implementation it will fail with an error indicating the
|
||||
* proxy admin cannot fallback to the target implementation.
|
||||
* 2. If the admin calls the proxy, it can call the `upgradeToAndCall` function but any other call won't be forwarded to
|
||||
* the implementation. If the admin tries to call a function on the implementation it will fail with an error indicating
|
||||
* the proxy admin cannot fallback to the target implementation.
|
||||
*
|
||||
* These properties mean that the admin account can only be used for upgrading the proxy, 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. For this reason, the proxy deploys an instance of {ProxyAdmin} and allows upgrades
|
||||
* only if they come through it.
|
||||
* You should think of the `ProxyAdmin` instance as the administrative interface of the proxy, including the ability to
|
||||
* change who can trigger upgrades by transferring ownership.
|
||||
* These properties mean that the admin account can only be used for upgrading the proxy, 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. For this reason, the proxy deploys an instance of {ProxyAdmin} and
|
||||
* allows upgrades only if they come through it. You should think of the `ProxyAdmin` instance as the administrative
|
||||
* interface of the proxy, including the ability to change who can trigger upgrades by transferring ownership.
|
||||
*
|
||||
* NOTE: The real interface of this proxy is that defined in `ITransparentUpgradeableProxy`. This contract does not
|
||||
* inherit from that interface, and instead `upgradeToAndCall` is 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
|
||||
* inherit from that interface, and instead `upgradeToAndCall` is 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.
|
||||
*
|
||||
* NOTE: This proxy does not inherit from {Context} deliberately. The {ProxyAdmin} of this contract won't send a
|
||||
* meta-transaction in any way, and any other meta-transaction setup should be made in the implementation contract.
|
||||
*
|
||||
* IMPORTANT: This contract avoids unnecessary storage reads by setting the admin only during construction as an immutable variable,
|
||||
* preventing any changes thereafter. However, the admin slot defined in ERC-1967 can still be overwritten by the implementation
|
||||
* logic pointed to by this proxy. In such cases, the contract may end up in an undesirable state where the admin slot is different
|
||||
* from the actual admin.
|
||||
* IMPORTANT: This contract avoids unnecessary storage reads by setting the admin only during construction as an
|
||||
* immutable variable, preventing any changes thereafter. However, the admin slot defined in ERC-1967 can still be
|
||||
* overwritten by the implementation logic pointed to by this proxy. In such cases, the contract may end up in an
|
||||
* undesirable state where the admin slot is different from the actual admin.
|
||||
*
|
||||
* 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 `upgradeToAndCall` function inaccessible, preventing upgradeability and compromising transparency.
|
||||
* 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 `upgradeToAndCall` function inaccessible, preventing upgradeability and compromising transparency.
|
||||
*/
|
||||
contract TransparentUpgradeableProxy is ERC1967Proxy {
|
||||
// An immutable address for the admin to avoid unnecessary SLOADs before each call
|
||||
|
||||
Reference in New Issue
Block a user