Verified contractExactGPL-3.0
Proxy
Address0x14b1a5f2d0a302bcc4536e5f801d71d07f562b9e
- Balance
0.20022 ETH
- Transactions
391
- Compiler
solc 0.8.20
- Same code
1,047 more contracts
Details
- Compiler
- solc 0.8.20+commit.a1b79de6
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- paris
- Via IR
- yes
- License
- GPL-3.0
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 17,552,292
- Creation transaction
- 0xc829eecc6e…8133a48d69
3 files
contracts/utils/Proxy.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.20;
import "./LibRawResult.sol";
import "./Implementation.sol";
/// @notice Base class for all proxy contracts.
contract Proxy {
using LibRawResult for bytes;
/// @notice The address of the implementation contract used by this proxy.
Implementation public immutable IMPL;
// Made `payable` to allow initialized crowdfunds to receive ETH as an
// initial contribution.
constructor(Implementation impl, bytes memory initCallData) payable {
IMPL = impl;
(bool s, bytes memory r) = address(impl).delegatecall(initCallData);
if (!s) {
r.rawRevert();
}
}
// Forward all calls to the implementation.
fallback() external payable {
Implementation impl = IMPL;
assembly {
calldatacopy(0x00, 0x00, calldatasize())
let s := delegatecall(gas(), impl, 0x00, calldatasize(), 0x00, 0)
returndatacopy(0x00, 0x00, returndatasize())
if iszero(s) {
revert(0x00, returndatasize())
}
return(0x00, returndatasize())
}
}
}
contracts/utils/Implementation.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.20;
// Base contract for all contracts intended to be delegatecalled into.
abstract contract Implementation {
error OnlyDelegateCallError();
error OnlyConstructorError();
address public immutable IMPL;
constructor() {
IMPL = address(this);
}
// Reverts if the current function context is not inside of a delegatecall.
modifier onlyDelegateCall() virtual {
if (address(this) == IMPL) {
revert OnlyDelegateCallError();
}
_;
}
// Reverts if the current function context is not inside of a constructor.
modifier onlyConstructor() {
if (address(this).code.length != 0) {
revert OnlyConstructorError();
}
_;
}
}
contracts/utils/LibRawResult.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.20;
library LibRawResult {
// Revert with the data in `b`.
function rawRevert(bytes memory b) internal pure {
assembly {
revert(add(b, 32), mload(b))
}
}
// Return with the data in `b`.
function rawReturn(bytes memory b) internal pure {
assembly {
return(add(b, 32), mload(b))
}
}
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "paris",
"remappings": [
":ds-test/=lib/forge-std/lib/ds-test/src/",
":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
":forge-std/=lib/forge-std/src/",
":openzeppelin-contracts/=lib/openzeppelin-contracts/",
":openzeppelin/=lib/openzeppelin-contracts/",
":solmate/=lib/solmate/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.