Source Code
Overview
SOPH Balance
More Info
ContractCreator
Multichain Info
N/A
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Loading...
Loading
Contract Name:
TokenCallbackHandler
Compiler Version
v0.7.6+commit.7338295f
ZkSolc Version
v1.5.4
Contract Source Code (Solidity Standard Json-Input format)
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "../interfaces/ERC1155TokenReceiver.sol";import "../interfaces/ERC721TokenReceiver.sol";import "../interfaces/ERC777TokensRecipient.sol";import "../interfaces/IERC165.sol";/*** @title Default Callback Handler - Handles supported tokens' callbacks, allowing Safes receiving these tokens.* @author Richard Meissner - @rmeissner*/contract TokenCallbackHandler is ERC1155TokenReceiver, ERC777TokensRecipient, ERC721TokenReceiver, IERC165 {/*** @notice Handles ERC1155 Token callback.* return Standardized onERC1155Received return value.*/function onERC1155Received(address, address, uint256, uint256, bytes calldata) external pure override returns (bytes4) {return 0xf23a6e61;}/*** @notice Handles ERC1155 Token batch callback.* return Standardized onERC1155BatchReceived return value.*/function onERC1155BatchReceived(
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "../base/Executor.sol";/*** @title Simulate Transaction Accessor.* @notice Can be used with StorageAccessible to simulate Safe transactions.* @author Richard Meissner - @rmeissner*/contract SimulateTxAccessor is Executor {address private immutable accessorSingleton;constructor() {accessorSingleton = address(this);}/*** @notice Modifier to make a function callable via delegatecall only.* If the function is called via a regular call, it will revert.*/modifier onlyDelegateCall() {require(address(this) != accessorSingleton, "SimulateTxAccessor should only be called via delegatecall");_;}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "../common/Enum.sol";/*** @title Executor - A contract that can execute transactions* @author Richard Meissner - @rmeissner*/abstract contract Executor {/*** @notice Executes either a delegatecall or a call with provided parameters.* @dev This method doesn't perform any sanity check of the transaction, such as:* - if the contract at `to` address has code or not* It is the responsibility of the caller to perform such checks.* @param to Destination address.* @param value Ether value.* @param data Data payload.* @param operation Operation type.* @return success boolean flag indicating if the call succeeded.*/function execute(address to,uint256 value,bytes memory data,Enum.Operation operation,uint256 txGas
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "../common/SelfAuthorized.sol";/*** @title Fallback Manager - A contract managing fallback calls made to this contract* @author Richard Meissner - @rmeissner*/abstract contract FallbackManager is SelfAuthorized {event ChangedFallbackHandler(address indexed handler);// keccak256("fallback_manager.handler.address")bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5;/*** @notice Internal function to set the fallback handler.* @param handler contract to handle fallback calls.*/function internalSetFallbackHandler(address handler) internal {/*If a fallback handler is set to self, then the following attack vector is opened:Imagine we have a function like this:function withdraw() internal authorized {withdrawalAddress.call.value(address(this).balance)("");}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "../common/Enum.sol";import "../common/SelfAuthorized.sol";import "../interfaces/IERC165.sol";interface Guard is IERC165 {function checkTransaction(address to,uint256 value,bytes memory data,Enum.Operation operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address payable refundReceiver,bytes memory signatures,address msgSender) external;function checkAfterExecution(bytes32 txHash, bool success) external;}abstract contract BaseGuard is Guard {
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "../common/Enum.sol";import "../common/SelfAuthorized.sol";import "./Executor.sol";/*** @title Module Manager - A contract managing Safe modules* @notice Modules are extensions with unlimited access to a Safe that can be added to a Safe by its owners.⚠️ WARNING: Modules are a security risk since they can execute arbitrary transactions,so only trusted and audited modules should be added to a Safe. A malicious module cancompletely takeover a Safe.* @author Stefan George - @Georgi87* @author Richard Meissner - @rmeissner*/abstract contract ModuleManager is SelfAuthorized, Executor {event EnabledModule(address indexed module);event DisabledModule(address indexed module);event ExecutionFromModuleSuccess(address indexed module);event ExecutionFromModuleFailure(address indexed module);address internal constant SENTINEL_MODULES = address(0x1);mapping(address => address) internal modules;/**
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "../common/SelfAuthorized.sol";/*** @title OwnerManager - Manages Safe owners and a threshold to authorize transactions.* @dev Uses a linked list to store the owners because the code generate by the solidity compiler* is more efficient than using a dynamic array.* @author Stefan George - @Georgi87* @author Richard Meissner - @rmeissner*/abstract contract OwnerManager is SelfAuthorized {event AddedOwner(address indexed owner);event RemovedOwner(address indexed owner);event ChangedThreshold(uint256 threshold);address internal constant SENTINEL_OWNERS = address(0x1);mapping(address => address) internal owners;uint256 internal ownerCount;uint256 internal threshold;/*** @notice Sets the initial storage of the contract.* @param _owners List of Safe owners.* @param _threshold Number of required confirmations for a Safe transaction.
12345678910111213// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;/*** @title Enum - Collection of enums used in Safe contracts.* @author Richard Meissner - @rmeissner*/abstract contract Enum {enum Operation {Call,DelegateCall}}
123456789101112131415161718// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;/*** @title NativeCurrencyPaymentFallback - A contract that has a fallback to accept native currency payments.* @author Richard Meissner - @rmeissner*/abstract contract NativeCurrencyPaymentFallback {event SafeReceived(address indexed sender, uint256 value);/*** @notice Receive function accepts native currency transactions.* @dev Emits an event with sender and received value.*/receive() external payable {emit SafeReceived(msg.sender, msg.value);}}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;/*** @title SecuredTokenTransfer - Secure token transfer.* @author Richard Meissner - @rmeissner*/abstract contract SecuredTokenTransfer {/*** @notice Transfers a token and returns a boolean if it was a success* @dev It checks the return data of the transfer call and returns true if the transfer was successful.* It doesn't check if the `token` address is a contract or not.* @param token Token that should be transferred* @param receiver Receiver to whom the token should be transferred* @param amount The amount of tokens that should be transferred* @return transferred Returns true if the transfer was successful*/function transferToken(address token, address receiver, uint256 amount) internal returns (bool transferred) {// 0xa9059cbb - keccack("transfer(address,uint256)")bytes memory data = abi.encodeWithSelector(0xa9059cbb, receiver, amount);// solhint-disable-next-line no-inline-assemblyassembly {// We write the return value to scratch space.// See https://docs.soliditylang.org/en/v0.7.6/internals/layout_in_memory.html#layout-in-memorylet success := call(sub(gas(), 10000), token, 0, add(data, 0x20), mload(data), 0, 0x20)switch returndatasize()
123456789101112131415161718// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;/*** @title SelfAuthorized - Authorizes current contract to perform actions to itself.* @author Richard Meissner - @rmeissner*/abstract contract SelfAuthorized {function requireSelfCall() private view {require(msg.sender == address(this), "GS031");}modifier authorized() {// Modifiers are copied around during compilation. This is a function call as it minimized the bytecode sizerequireSelfCall();_;}}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;/*** @title SignatureDecoder - Decodes signatures encoded as bytes* @author Richard Meissner - @rmeissner*/abstract contract SignatureDecoder {/*** @notice Splits signature bytes into `uint8 v, bytes32 r, bytes32 s`.* @dev Make sure to perform a bounds check for @param pos, to avoid out of bounds access on @param signatures* The signature format is a compact form of {bytes32 r}{bytes32 s}{uint8 v}* Compact means uint8 is not padded to 32 bytes.* @param pos Which signature to read.* A prior bounds check of this parameter should be performed, to avoid out of bounds access.* @param signatures Concatenated {r, s, v} signatures.* @return v Recovery ID or Safe signature type.* @return r Output value r of the signature.* @return s Output value s of the signature.*/function signatureSplit(bytes memory signatures, uint256 pos) internal pure returns (uint8 v, bytes32 r, bytes32 s) {// solhint-disable-next-line no-inline-assemblyassembly {let signaturePos := mul(0x41, pos)r := mload(add(signatures, add(signaturePos, 0x20)))s := mload(add(signatures, add(signaturePos, 0x40)))
12345678910111213// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;/*** @title Singleton - Base for singleton contracts (should always be the first super contract)* This contract is tightly coupled to our proxy contract (see `proxies/SafeProxy.sol`)* @author Richard Meissner - @rmeissner*/abstract contract Singleton {// singleton always has to be the first declared variable to ensure the same location as in the Proxy contract.// It should also always be ensured the address is stored alone (uses a full word)address private singleton;}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;/*** @title StorageAccessible - A generic base contract that allows callers to access all internal storage.* @notice See https://github.com/gnosis/util-contracts/blob/bb5fe5fb5df6d8400998094fb1b32a178a47c3a1/contracts/StorageAccessible.sol* It removes a method from the original contract not needed for the Safe contracts.* @author Gnosis Developers*/abstract contract StorageAccessible {/*** @notice Reads `length` bytes of storage in the currents contract* @param offset - the offset in the current contract's storage in words to start reading from* @param length - the number of words (32 bytes) of data to read* @return the bytes that were read.*/function getStorageAt(uint256 offset, uint256 length) public view returns (bytes memory) {bytes memory result = new bytes(length * 32);for (uint256 index = 0; index < length; index++) {// solhint-disable-next-line no-inline-assemblyassembly {let word := sload(add(offset, index))mstore(add(add(result, 0x20), mul(index, 0x20)), word)}}return result;
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "../../common/Enum.sol";import "../../base/GuardManager.sol";import "../../Safe.sol";/*** @title Debug Transaction Guard - Emits transaction events with extended information.* @dev This guard is only meant as a development tool and example* @author Richard Meissner - @rmeissner*/contract DebugTransactionGuard is BaseGuard {// solhint-disable-next-line payable-fallbackfallback() external {// We don't revert on fallback to avoid issues in case of a Safe upgrade// E.g. The expected check method might change and then the Safe would be locked.}event TransactionDetails(address indexed safe,bytes32 indexed txHash,address to,uint256 value,bytes data,Enum.Operation operation,
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "../../common/Enum.sol";import "../../base/GuardManager.sol";import "../../Safe.sol";/*** @title DelegateCallTransactionGuard - Limits delegate calls to a specific target.* @author Richard Meissner - @rmeissner*/contract DelegateCallTransactionGuard is BaseGuard {address public immutable ALLOWED_TARGET;constructor(address target) {ALLOWED_TARGET = target;}// solhint-disable-next-line payable-fallbackfallback() external {// We don't revert on fallback to avoid issues in case of a Safe upgrade// E.g. The expected check method might change and then the Safe would be locked.}/*** @notice Called by the Safe contract before a transaction is executed.
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "../../common/Enum.sol";import "../../base/GuardManager.sol";import "../../Safe.sol";interface ISafe {function getOwners() external view returns (address[] memory);}/*** @title OnlyOwnersGuard - Only allows owners to execute transactions.* @author Richard Meissner - @rmeissner*/contract OnlyOwnersGuard is BaseGuard {ISafe public safe;constructor() {}// solhint-disable-next-line payable-fallbackfallback() external {// We don't revert on fallback to avoid issues in case of a Safe upgrade// E.g. The expected check method might change and then the Safe would be locked.}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "../../common/Enum.sol";import "../../base/GuardManager.sol";import "../../Safe.sol";/*** @title ReentrancyTransactionGuard - Prevents reentrancy into the transaction execution function.* @author Richard Meissner - @rmeissner*/contract ReentrancyTransactionGuard is BaseGuard {bytes32 internal constant GUARD_STORAGE_SLOT = keccak256("reentrancy_guard.guard.struct");struct GuardValue {bool active;}// solhint-disable-next-line payable-fallbackfallback() external {// We don't revert on fallback to avoid issues in case of a Safe upgrade// E.g. The expected check method might change and then the Safe would be locked.}/*** @notice Returns the guard value for the current context.
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "../../libraries/SafeStorage.sol";/*** @title Migration - Migrates a Safe contract from 1.3.0 to 1.2.0* @author Richard Meissner - @rmeissner*/contract Migration is SafeStorage {bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x035aff83d86937d35b32e04f0ddc6ff469290eef2f1b692d8a815c89404d4749;address public immutable migrationSingleton;address public immutable safe120Singleton;constructor(address targetSingleton) {// Singleton address cannot be zero address.require(targetSingleton != address(0), "Invalid singleton address provided");safe120Singleton = targetSingleton;migrationSingleton = address(this);}event ChangedMasterCopy(address singleton);/*** @notice Migrates the Safe to the Singleton contract at `migrationSingleton`.* @dev This can only be called via a delegatecall.
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;/*** @title SafeMath* @notice Math operations with safety checks that revert on error (overflow/underflow)*/library SafeMath {/*** @notice Multiplies two numbers, reverts on overflow.* @param a First number* @param b Second number* @return Product of a and b*/function mul(uint256 a, uint256 b) internal pure returns (uint256) {// Gas optimization: this is cheaper than requiring 'a' not being zero, but the// benefit is lost if 'b' is also tested.// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522if (a == 0) {return 0;}uint256 c = a * b;require(c / a == b);return c;
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "./TokenCallbackHandler.sol";import "../interfaces/ISignatureValidator.sol";import "../Safe.sol";/*** @title Compatibility Fallback Handler - Provides compatibility between pre 1.3.0 and 1.3.0+ Safe contracts.* @author Richard Meissner - @rmeissner*/contract CompatibilityFallbackHandler is TokenCallbackHandler, ISignatureValidator {// keccak256("SafeMessage(bytes message)");bytes32 private constant SAFE_MSG_TYPEHASH = 0x60b3cbf8b4a223d68d641b3b6ddf9a298e7f33710cf3d3a9d1146b5a6150fbca;bytes4 internal constant SIMULATE_SELECTOR = bytes4(keccak256("simulate(address,bytes)"));address internal constant SENTINEL_MODULES = address(0x1);bytes4 internal constant UPDATED_MAGIC_VALUE = 0x1626ba7e;/*** @notice Legacy EIP-1271 signature validation method.* @dev Implementation of ISignatureValidator (see `interfaces/ISignatureValidator.sol`)* @param _data Arbitrary length data signed on the behalf of address(msg.sender).* @param _signature Signature byte array associated with _data.* @return The EIP-1271 magic value.
123456789101112131415161718192021222324// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;// Note: The ERC-165 identifier for this interface is 0x4e2312e0.interface ERC1155TokenReceiver {/*** @notice Handle the receipt of a single ERC1155 token type.* @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeTransferFrom` after thebalance has been updated.* This function MUST return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61) if it acceptsthe transfer.* This function MUST revert if it rejects the transfer.* Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.* @param _operator The address which initiated the transfer (i.e. msg.sender).* @param _from The address which previously owned the token.* @param _id The ID of the token being transferred.* @param _value The amount of tokens being transferred.* @param _data Additional data with no specified format.* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`.*/function onERC1155Received(address _operator,address _from,uint256 _id,uint256 _value,bytes calldata _data
123456789101112131415161718192021// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;/// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02.interface ERC721TokenReceiver {/*** @notice Handle the receipt of an NFT* @dev The ERC721 smart contract calls this function on the recipient* after a `transfer`. This function MAY throw to revert and reject the* transfer. Return of other than the magic value MUST result in the* transaction being reverted.* Note: the contract address is always the message sender.* @param _operator The address which called `safeTransferFrom` function.* @param _from The address which previously owned the token.* @param _tokenId The NFT identifier which is being transferred.* @param _data Additional data with no specified format.* @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.* unless throwing*/function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external returns (bytes4);}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;/*** @title ERC777TokensRecipient* @dev Interface for contracts that will be called with the ERC777 token's `tokensReceived` method.* The contract receiving the tokens must implement this interface in order to receive the tokens.*/interface ERC777TokensRecipient {/*** @dev Called by the ERC777 token contract after a successful transfer or a minting operation.* @param operator The address of the operator performing the transfer or minting operation.* @param from The address of the sender.* @param to The address of the recipient.* @param amount The amount of tokens that were transferred or minted.* @param data Additional data that was passed during the transfer or minting operation.* @param operatorData Additional data that was passed by the operator during the transfer or minting operation.*/function tokensReceived(address operator,address from,address to,uint256 amount,bytes calldata data,bytes calldata operatorData) external;
123456789101112131415// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;/// @notice More details at https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/introspection/IERC165.solinterface IERC165 {/*** @dev Returns true if this contract implements the interface defined by `interfaceId`.* See the corresponding EIP section* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified* to learn more about how these ids are created.** This function call must use less than 30 000 gas.*/function supportsInterface(bytes4 interfaceId) external view returns (bool);}
1234567891011121314151617181920// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;contract ISignatureValidatorConstants {// bytes4(keccak256("isValidSignature(bytes,bytes)")bytes4 internal constant EIP1271_MAGIC_VALUE = 0x20c13b0b;}abstract contract ISignatureValidator is ISignatureValidatorConstants {/*** @notice Legacy EIP1271 method to validate a signature.* @param _data Arbitrary length data signed on the behalf of address(this).* @param _signature Signature byte array associated with _data.** MUST return the bytes4 magic value 0x20c13b0b when function passes.* MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5)* MUST allow external calls*/function isValidSignature(bytes memory _data, bytes memory _signature) public view virtual returns (bytes4);}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import {SafeStorage} from "../libraries/SafeStorage.sol";interface ISafe {function setFallbackHandler(address handler) external;}/*** @title Migration Contract for Safe Upgrade* @notice This is a generic contract that facilitates Safe and SafeL2 proxy contracts to migrate their singleton address.* The supported target Safe version is immutable and set in the constructor during the deployment of the contract.* This contract also supports migration with fallback handler update.* @author @safe-global/safe-protocol* @dev IMPORTANT: The library is intended to be used with the Safe standard proxy that stores the singleton address* at the storage slot 0. Use at your own risk with custom proxy implementations. The contract will allow invocations* to the migration functions only via delegatecall.*/contract SafeMigration is SafeStorage {/*** @notice Address of this contract*/address public immutable MIGRATION_SINGLETON;/*** @notice Address of the Safe Singleton implementation
123456789101112131415161718192021222324// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;/*** @title SafeStorage - Storage layout of the Safe contracts to be used in libraries.* @dev Should be always the first base contract of a library that is used with a Safe.* @author Richard Meissner - @rmeissner*/contract SafeStorage {// From /common/Singleton.soladdress internal singleton;// From /common/ModuleManager.solmapping(address => address) internal modules;// From /common/OwnerManager.solmapping(address => address) internal owners;uint256 internal ownerCount;uint256 internal threshold;// From /Safe.soluint256 internal nonce;bytes32 internal _deprecatedDomainSeparator;mapping(bytes32 => uint256) internal signedMessages;mapping(address => mapping(bytes32 => uint256)) internal approvedHashes;}
12345678910111213141516171819202122232425// SPDX-License-Identifier: LGPL-3.0-only/* solhint-disable one-contract-per-file */pragma solidity >=0.7.0 <0.9.0;import {SafeStorage} from "../libraries/SafeStorage.sol";import {Enum} from "../common/Enum.sol";interface ISafe {// solhint-disable-next-linefunction VERSION() external view returns (string memory);function setFallbackHandler(address handler) external;}/*** @title Migration Contract for updating a Safe from 1.1.1/1.3.0/1.4.1 versions to a L2 version. Useful when replaying a Safe from a non L2 networkin a L2 network.* @notice This contract facilitates the migration of a Safe contract from version 1.1.1 to 1.3.0/1.4.1 L2, 1.3.0 to 1.3.0L2 or from 1.4.1 to 1.4.1L2* Other versions are not supported* @dev IMPORTANT: The migration will only work with proxies that store the implementation address in the storage slot 0.*/contract SafeToL2Migration is SafeStorage {// Address of this contractaddress public immutable MIGRATION_SINGLETON;/**
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import {SafeStorage} from "../libraries/SafeStorage.sol";/*** @title Safe to L2 Setup Contract* @dev This contract expects the singleton to be the {Safe} by default. Even if there are more* {SafeL2} proxies deployed, the average gas cost on L2s is significantly lower, making the* current design more economically efficient overall.* @notice This contract facilitates the deployment of a Safe to the same address on all networks by* automatically changing the singleton to the L2 version when not on chain ID 1.*/contract SafeToL2Setup is SafeStorage {/*** @dev Address of the contract.* This is used to ensure that the contract is only ever `DELEGATECALL`-ed.*/address private immutable SELF;/*** @notice Event indicating a change of master copy address.* @param singleton New master copy address*/event ChangedMasterCopy(address singleton);
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "./SafeStorage.sol";import "../Safe.sol";/*** @title SignMessageLib - Allows to sign messages on-chain by writing the signed message hashes on-chain.* @author Richard Meissner - @rmeissner*/contract SignMessageLib is SafeStorage {// keccak256("SafeMessage(bytes message)");bytes32 private constant SAFE_MSG_TYPEHASH = 0x60b3cbf8b4a223d68d641b3b6ddf9a298e7f33710cf3d3a9d1146b5a6150fbca;event SignMsg(bytes32 indexed msgHash);/*** @notice Marks a message (`_data`) as signed.* @dev Can be verified using EIP-1271 validation method by passing the pre-image of the message hash and empty bytes as the signature.* @param _data Arbitrary length data that should be marked as signed on the behalf of address(this).*/function signMessage(bytes calldata _data) external {bytes32 msgHash = getMessageHash(_data);signedMessages[msgHash] = 1;emit SignMsg(msgHash);}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "./base/ModuleManager.sol";import "./base/OwnerManager.sol";import "./base/FallbackManager.sol";import "./base/GuardManager.sol";import "./common/NativeCurrencyPaymentFallback.sol";import "./common/Singleton.sol";import "./common/SignatureDecoder.sol";import "./common/SecuredTokenTransfer.sol";import "./common/StorageAccessible.sol";import "./interfaces/ISignatureValidator.sol";import "./external/SafeMath.sol";/*** @title Safe - A multisignature wallet with support for confirmations using signed messages based on EIP-712.* @dev Most important concepts:* - Threshold: Number of required confirmations for a Safe transaction.* - Owners: List of addresses that control the Safe. They are the only ones that can add/remove owners, change the threshold and* approve transactions. Managed in `OwnerManager`.* - Transaction Hash: Hash of a transaction is calculated using the EIP-712 typed structured data hashing scheme.* - Nonce: Each transaction should have a different nonce to prevent replay attacks.* - Signature: A valid signature of an owner of the Safe for a transaction hash.* - Guard: Guard is a contract that can execute pre- and post- transaction checks. Managed in `GuardManager`.* - Modules: Modules are contracts that can be used to extend the write functionality of a Safe. Managed in `ModuleManager`.
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "./Safe.sol";/*** @title SafeL2 - An implementation of the Safe contract that emits additional events on transaction executions.* @notice For a more complete description of the Safe contract, please refer to the main Safe contract `Safe.sol`.* @author Stefan George - @Georgi87* @author Richard Meissner - @rmeissner*/contract SafeL2 is Safe {event SafeMultiSigTransaction(address to,uint256 value,bytes data,Enum.Operation operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address payable refundReceiver,bytes signatures,// We combine nonce, sender and threshold into one to avoid stack too deep// Dev note: additionalInfo should not contain `bytes`, as this complicates decodingbytes additionalInfo
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;pragma abicoder v2;import "../../libraries/SafeStorage.sol";struct UserOperation {address sender;uint256 nonce;bytes initCode;bytes callData;uint256 callGasLimit;uint256 verificationGasLimit;uint256 preVerificationGas;uint256 maxFeePerGas;uint256 maxPriorityFeePerGas;bytes paymasterAndData;bytes signature;}interface ISafe {function execTransactionFromModule(address to, uint256 value, bytes memory data, uint8 operation) external returns (bool success);}/// @dev A Dummy 4337 Module/Handler for testing purposes/// ⚠️ ⚠️ ⚠️ DO NOT USE IN PRODUCTION ⚠️ ⚠️ ⚠️
1234567891011121314151617181920212223242526// SPDX-License-Identifier: LGPL-3.0-onlypragma solidity >=0.7.0 <0.9.0;import "../interfaces/ERC1155TokenReceiver.sol";import "../external/SafeMath.sol";/*** @title ERC1155Token - A test ERC1155 token contract*/contract ERC1155Token {using SafeMath for uint256;// Mapping from token ID to owner balancesmapping(uint256 => mapping(address => uint256)) private _balances;// Mapping from owner to operator approvalsmapping(address => mapping(address => bool)) private _operatorApprovals;/*** @dev Get the specified address' balance for token with specified ID.* @param owner The address of the token holder* @param id ID of the token* @return The owner's balance of the token type requested*/function balanceOf(address owner, uint256 id) public view returns (uint256) {require(owner != address(0), "ERC1155: balance query for the zero address");
1234567891011121314151617{"optimizer": {"enabled": true,"mode": "3"},"outputSelection": {"*": {"*": ["abi"]}},"forceEVMLA": false,"detectMissingLibraries": false,"enableEraVMExtensions": false,"libraries": {}}
Contract ABI
API[{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"tokensReceived","outputs":[],"stateMutability":"pure","type":"function"}]
Contract Creation Code
00000000000000000000000000000000000000000000000000000000000000009c4d535b0000000000000000000000000000000000000000000000000000000000000000010000456b7d627fabaf9ca4d4a8463301a79c507485902995bd2756877e531e00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x0000008003000039000000400030043f000000000300041600000001002001900000002c0000c13d000000000003004b000000b60000c13d000000000201001900000060022002700000002f02200197000000040020008c000000b60000413d000000000301043b000000e003300270000000310030009c000000330000a13d000000320030009c000000470000613d000000330030009c0000005d0000613d000000340030009c000000b60000c13d000000a40320008a0000003f0030009c000000b60000813d0000008403100370000000000403043b000000370040009c000000b60000213d0000002403400039000000000023004b000000b60000213d0000000404400039000000000141034f000000000101043b000000370010009c000000b60000213d0000000001310019000000000021004b000000b60000213d0000003801000041000000800010043f0000003901000041000000b90001042e000000000003004b000000b60000c13d0000002001000039000001000010044300000120000004430000003001000041000000b90001042e000000350030009c000000930000613d000000360030009c000000b60000c13d000000240220008a000000400020009c000000b60000813d0000000401100370000000000101043b0000003c011001970000003b0010009c000000000200003900000001020060390000003d0010009c00000001022061bf0000003e0010009c00000001022061bf000000800020043f0000003901000041000000b90001042e000000840320008a000000410030009c000000b60000813d0000006403100370000000000403043b000000370040009c000000b60000213d0000002403400039000000000023004b000000b60000213d0000000404400039000000000141034f000000000101043b000000370010009c000000b60000213d0000000001310019000000000021004b000000b60000213d0000003b01000041000000800010043f0000003901000041000000b90001042e000000a40320008a0000003f0030009c000000b60000813d0000004403100370000000000403043b000000370040009c000000b60000213d0000002403400039000000000023004b000000b60000213d0000000404400039000000000441034f000000000404043b000000370040009c000000b60000213d00000005044002100000000003340019000000000023004b000000b60000213d0000006403100370000000000403043b000000370040009c000000b60000213d0000002403400039000000000023004b000000b60000213d0000000404400039000000000441034f000000000404043b000000370040009c000000b60000213d00000005044002100000000003340019000000000023004b000000b60000213d0000008403100370000000000403043b000000370040009c000000b60000213d0000002403400039000000000023004b000000b60000213d0000000404400039000000000141034f000000000101043b000000370010009c000000b60000213d0000000001310019000000000021004b000000b60000213d0000003a01000041000000800010043f0000003901000041000000b90001042e000000c40320008a000000420030009c000000b60000813d0000008403100370000000000403043b000000370040009c000000b60000213d0000002403400039000000000023004b000000b60000213d0000000404400039000000000441034f000000000404043b000000370040009c000000b60000213d0000000003340019000000000023004b000000b60000213d000000a403100370000000000403043b000000370040009c000000b60000213d0000002403400039000000000023004b000000b60000213d0000000404400039000000000141034f000000000101043b000000370010009c000000b60000213d0000000001310019000000000021004b000000b60000213d0000000001000019000000b90001042e0000000001000019000000ba00010430000000b800000432000000b90001042e000000ba00010430000000000000000000000000000000000000000000000000000000000000000000000000ffffffff000000020000000000000000000000000000004000000100000000000000000000000000000000000000000000000000000000000000000000000000150b7a0100000000000000000000000000000000000000000000000000000000150b7a0200000000000000000000000000000000000000000000000000000000bc197c8100000000000000000000000000000000000000000000000000000000f23a6e61000000000000000000000000000000000000000000000000000000000023de290000000000000000000000000000000000000000000000000000000001ffc9a70000000000000000000000000000000000000000000000000000000100000000f23a6e61000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000800000000000000000bc197c8100000000000000000000000000000000000000000000000000000000150b7a0200000000000000000000000000000000000000000000000000000000ffffffff000000000000000000000000000000000000000000000000000000004e2312e00000000000000000000000000000000000000000000000000000000001ffc9a700000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff400000000000000000000000000000000000000000000000000000000000000000425a139c7023026b7d8786ee861d8a3d1d313cfe05ddc882a3e9a2e751977b24
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.