ETH Price: $2,489.97 (-1.56%)

Transaction Decoder

Block:
19691386 at Apr-19-2024 06:52:23 PM +UTC
Transaction Fee:
0.001403609225589504 ETH $3.49
Gas Used:
154,512 Gas / 9.084143792 Gwei

Emitted Events:

264 RaribleUserToken.TransferSingle( _operator=[Receiver] WalletProxy, _from=[Receiver] WalletProxy, _to=0xd8220ED5...54E2F5DD0, _id=1, _value=1 )
265 WalletProxy.0x9c8b829578b661bfe74f6d7fa943ea59c34dc54ed4892cd2ceb1e24a2e3ce23e( 0x9c8b829578b661bfe74f6d7fa943ea59c34dc54ed4892cd2ceb1e24a2e3ce23e, 000000000000000000000000a6df7b5714d56296aa107de3a84d8f3006451709, 0000000000000000000000000000000000000000000000000000000000000000, 0000000000000000000000000000000000000000000000000000000000000060, 00000000000000000000000000000000000000000000000000000000000000c4, f242432a000000000000000000000000c257b68699eed075a31008660d2a7e54, aea42c3a000000000000000000000000d8220ed57d8bbb98a3512ae48fa23125, 4e2f5dd000000000000000000000000000000000000000000000000000000000, 0000000100000000000000000000000000000000000000000000000000000000, 0000000100000000000000000000000000000000000000000000000000000000, 000000a000000000000000000000000000000000000000000000000000000000, 0000000000000000000000000000000000000000000000000000000000000000 )
266 Proxy.0x3d0ce9bfc3ed7d6862dbb28b2dea94561fe714a1b4d019aa8af39730d1ad7c3d( 0x3d0ce9bfc3ed7d6862dbb28b2dea94561fe714a1b4d019aa8af39730d1ad7c3d, 0x000000000000000000000000c257b68699eed075a31008660d2a7e54aea42c3a, 00000000000000000000000000000000000000000000000000052221827006eb )
267 WalletProxy.0x62c84a9696a03a1f76d684995670d2063d321d1a8f155d3b075037418ac2cccd( 0x62c84a9696a03a1f76d684995670d2063d321d1a8f155d3b075037418ac2cccd, 0000000000000000000000000000000000000000000000000000018ef7b3b202, 0000000000000000000000000000000000000000000000000000000000000000, 75ff0ba9395e2f26f06c5b630db5ef504f9392f7597ac3dd2517b91d1c0ea103, 0000000000000000000000000000000000000000000000000000000000000001, 000000000000000000000000000000000000000000000000000000000002c960 )

Account State Difference:

  Address   Before After State Difference Code
0x3243Ed9f...4cF0F68f2
3.720389531662718487 Eth
Nonce: 27015
3.718985922437128983 Eth
Nonce: 27016
0.001403609225589504
(Titan Builder)
5.474088929574207085 Eth5.474089079450847085 Eth0.00000014987664
0xA6Df7B57...006451709
0xC257B686...4AeA42c3a 0.010449067890187756 Eth0.009004165688989441 Eth0.001444902201198315
0xDd2A08a1...2877D9c97
(Loopring: Proxy Admin)
619.942354069504581297 Eth619.943798971705779612 Eth0.001444902201198315

Execution Trace

WalletProxy.09779927( )
  • 0xa8280e16647767782fa313ddac9837ba217fe15b.09779927( )
    • 0x2af5c750836590fadc4d14b3de04a33e27395148.531020c2( )
      • WalletProxy.2e9feb79( )
        • 0xa8280e16647767782fa313ddac9837ba217fe15b.2e9feb79( )
          • 0x2f2a674dd95880a810855e75c1304ab20c0b261e.fc55b679( )
            • OwnedUpgradeabilityProxy.f1821783( )
            • RaribleUserToken.safeTransferFrom( _from=0xC257B68699Eed075a31008660D2a7e54AeA42c3a, _to=0xd8220ED57d8bBB98A3512AE48FA231254E2F5DD0, _id=1, _value=1, _data=0x )
            • Null: 0x000...001.75ff0ba9( )
            • 0x2f2a674dd95880a810855e75c1304ab20c0b261e.beabacc8( )
              • ETH 0.001444902201198315 Proxy.CALL( )
                • ETH 0.001444902201198315 GnosisSafe.DELEGATECALL( )
                  File 1 of 5: WalletProxy
                  // SPDX-License-Identifier: LGPL-3.0-or-later
                  // Taken from: https://github.com/gnosis/safe-contracts/blob/development/contracts/proxies/GnosisSafeProxy.sol
                  pragma solidity ^0.7.0;
                  
                  /// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain
                  /// @author Richard Meissner - <[email protected]>
                  interface IProxy {
                      function masterCopy() external view returns (address);
                  }
                  
                  /// @title WalletProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.
                  /// @author Stefan George - <[email protected]>
                  /// @author Richard Meissner - <[email protected]>
                  contract WalletProxy {
                  
                      // masterCopy always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated.
                      // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`
                      address internal masterCopy;
                  
                      /// @dev Constructor function sets address of master copy contract.
                      /// @param _masterCopy Master copy address.
                      constructor(address _masterCopy)
                      {
                          require(_masterCopy != address(0), "Invalid master copy address provided");
                          masterCopy = _masterCopy;
                      }
                  
                      /// @dev Fallback function forwards all transactions and returns all received return data.
                      fallback()
                      payable
                      external
                      {
                          // solium-disable-next-line security/no-inline-assembly
                          assembly {
                              let _masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)
                          // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s
                              if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {
                                  mstore(0, _masterCopy)
                                  return(0, 0x20)
                              }
                              calldatacopy(0, 0, calldatasize())
                              let success := delegatecall(gas(), _masterCopy, 0, calldatasize(), 0, 0)
                              returndatacopy(0, 0, returndatasize())
                              if eq(success, 0) { revert(0, returndatasize()) }
                              return(0, returndatasize())
                          }
                      }
                  }

                  File 2 of 5: RaribleUserToken
                  pragma solidity ^0.5.0;
                  pragma experimental ABIEncoderV2;
                  
                  
                  /**
                   * @title SafeMath
                   * @dev Math operations with safety checks that throw on error
                   */
                  library SafeMath {
                  
                      /**
                      * @dev Multiplies two numbers, throws on overflow.
                      */
                      function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
                          // Gas optimization: this is cheaper than asserting 'a' not being zero, but the
                          // benefit is lost if 'b' is also tested.
                          // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
                          if (a == 0) {
                              return 0;
                          }
                  
                          c = a * b;
                          assert(c / a == b);
                          return c;
                      }
                  
                      /**
                      * @dev Integer division of two numbers, truncating the quotient.
                      */
                      function div(uint256 a, uint256 b) internal pure returns (uint256) {
                          // assert(b > 0); // Solidity automatically throws when dividing by 0
                          // uint256 c = a / b;
                          // assert(a == b * c + a % b); // There is no case in which this doesn't hold
                          return a / b;
                      }
                  
                      /**
                      * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
                      */
                      function sub(uint256 a, uint256 b) internal pure returns (uint256) {
                          assert(b <= a);
                          return a - b;
                      }
                  
                      /**
                      * @dev Adds two numbers, throws on overflow.
                      */
                      function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
                          c = a + b;
                          assert(c >= a);
                          return c;
                      }
                  }
                  
                  /**
                      Note: Simple contract to use as base for const vals
                  */
                  contract CommonConstants {
                  
                      bytes4 constant internal ERC1155_ACCEPTED = 0xf23a6e61; // bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))
                      bytes4 constant internal ERC1155_BATCH_ACCEPTED = 0xbc197c81; // bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))
                  }
                  
                  /**
                      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 the balance has been updated.
                          This function MUST return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61) if it accepts the 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) external returns(bytes4);
                  
                      /**
                          @notice Handle the receipt of multiple ERC1155 token types.
                          @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeBatchTransferFrom` after the balances have been updated.
                          This function MUST return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81) if it accepts the transfer(s).
                          This function MUST revert if it rejects the transfer(s).
                          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 batch transfer (i.e. msg.sender)
                          @param _from      The address which previously owned the token
                          @param _ids       An array containing ids of each token being transferred (order and length must match _values array)
                          @param _values    An array containing amounts of each token being transferred (order and length must match _ids array)
                          @param _data      Additional data with no specified format
                          @return           `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
                      */
                      function onERC1155BatchReceived(address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external returns(bytes4);
                  }
                  
                  /**
                   * @dev Interface of the ERC165 standard, as defined in the
                   * https://eips.ethereum.org/EIPS/eip-165[EIP].
                   *
                   * Implementers can declare support of contract interfaces, which can then be
                   * queried by others ({ERC165Checker}).
                   *
                   * For an implementation, see {ERC165}.
                   */
                  interface IERC165 {
                      /**
                       * @dev Returns true if this contract implements the interface defined by
                       * `interfaceId`. See the corresponding
                       * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
                       * 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);
                  }
                  
                  /**
                      @title ERC-1155 Multi Token Standard
                      @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md
                      Note: The ERC-165 identifier for this interface is 0xd9b67a26.
                   */
                  contract IERC1155 is IERC165 {
                      /**
                          @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
                          The `_operator` argument MUST be msg.sender.
                          The `_from` argument MUST be the address of the holder whose balance is decreased.
                          The `_to` argument MUST be the address of the recipient whose balance is increased.
                          The `_id` argument MUST be the token type being transferred.
                          The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
                          When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
                          When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
                      */
                      event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value);
                  
                      /**
                          @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
                          The `_operator` argument MUST be msg.sender.
                          The `_from` argument MUST be the address of the holder whose balance is decreased.
                          The `_to` argument MUST be the address of the recipient whose balance is increased.
                          The `_ids` argument MUST be the list of tokens being transferred.
                          The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by.
                          When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
                          When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
                      */
                      event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values);
                  
                      /**
                          @dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absense of an event assumes disabled).
                      */
                      event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
                  
                      /**
                          @dev MUST emit when the URI is updated for a token ID.
                          URIs are defined in RFC 3986.
                          The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
                      */
                      event URI(string _value, uint256 indexed _id);
                  
                      /**
                          @notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
                          @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
                          MUST revert if `_to` is the zero address.
                          MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
                          MUST revert on any other error.
                          MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
                          After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
                          @param _from    Source address
                          @param _to      Target address
                          @param _id      ID of the token type
                          @param _value   Transfer amount
                          @param _data    Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
                      */
                      function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;
                  
                      /**
                          @notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
                          @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
                          MUST revert if `_to` is the zero address.
                          MUST revert if length of `_ids` is not the same as length of `_values`.
                          MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.
                          MUST revert on any other error.
                          MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
                          Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
                          After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
                          @param _from    Source address
                          @param _to      Target address
                          @param _ids     IDs of each token type (order and length must match _values array)
                          @param _values  Transfer amounts per token type (order and length must match _ids array)
                          @param _data    Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
                      */
                      function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external;
                  
                      /**
                          @notice Get the balance of an account's Tokens.
                          @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) external view returns (uint256);
                  
                      /**
                          @notice Get the balance of multiple account/token pairs
                          @param _owners The addresses of the token holders
                          @param _ids    ID of the Tokens
                          @return        The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair)
                       */
                      function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory);
                  
                      /**
                          @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens.
                          @dev MUST emit the ApprovalForAll event on success.
                          @param _operator  Address to add to the set of authorized operators
                          @param _approved  True if the operator is approved, false to revoke approval
                      */
                      function setApprovalForAll(address _operator, bool _approved) external;
                  
                      /**
                          @notice Queries the approval status of an operator for a given owner.
                          @param _owner     The owner of the Tokens
                          @param _operator  Address of authorized operator
                          @return           True if the operator is approved, false if not
                      */
                      function isApprovedForAll(address _owner, address _operator) external view returns (bool);
                  }
                  
                  /**
                   * @dev Implementation of the {IERC165} interface.
                   *
                   * Contracts may inherit from this and call {_registerInterface} to declare
                   * their support of an interface.
                   */
                  contract ERC165 is IERC165 {
                      /*
                       * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
                       */
                      bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
                  
                      /**
                       * @dev Mapping of interface ids to whether or not it's supported.
                       */
                      mapping(bytes4 => bool) private _supportedInterfaces;
                  
                      constructor () internal {
                          // Derived contracts need only register support for their own interfaces,
                          // we register support for ERC165 itself here
                          _registerInterface(_INTERFACE_ID_ERC165);
                      }
                  
                      /**
                       * @dev See {IERC165-supportsInterface}.
                       *
                       * Time complexity O(1), guaranteed to always use less than 30 000 gas.
                       */
                      function supportsInterface(bytes4 interfaceId) external view returns (bool) {
                          return _supportedInterfaces[interfaceId];
                      }
                  
                      /**
                       * @dev Registers the contract as an implementer of the interface defined by
                       * `interfaceId`. Support of the actual ERC165 interface is automatic and
                       * registering its interface id is not required.
                       *
                       * See {IERC165-supportsInterface}.
                       *
                       * Requirements:
                       *
                       * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
                       */
                      function _registerInterface(bytes4 interfaceId) internal {
                          require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
                          _supportedInterfaces[interfaceId] = true;
                      }
                  }
                  
                  /**
                   * @dev Collection of functions related to the address type
                   */
                  library Address {
                      /**
                       * @dev Returns true if `account` is a contract.
                       *
                       * [IMPORTANT]
                       * ====
                       * It is unsafe to assume that an address for which this function returns
                       * false is an externally-owned account (EOA) and not a contract.
                       *
                       * Among others, `isContract` will return false for the following 
                       * types of addresses:
                       *
                       *  - an externally-owned account
                       *  - a contract in construction
                       *  - an address where a contract will be created
                       *  - an address where a contract lived, but was destroyed
                       * ====
                       */
                      function isContract(address account) internal view returns (bool) {
                          // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
                          // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
                          // for accounts without code, i.e. `keccak256('')`
                          bytes32 codehash;
                          bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
                          // solhint-disable-next-line no-inline-assembly
                          assembly { codehash := extcodehash(account) }
                          return (codehash != accountHash && codehash != 0x0);
                      }
                  
                      /**
                       * @dev Converts an `address` into `address payable`. Note that this is
                       * simply a type cast: the actual underlying value is not changed.
                       *
                       * _Available since v2.4.0._
                       */
                      function toPayable(address account) internal pure returns (address payable) {
                          return address(uint160(account));
                      }
                  
                      /**
                       * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
                       * `recipient`, forwarding all available gas and reverting on errors.
                       *
                       * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
                       * of certain opcodes, possibly making contracts go over the 2300 gas limit
                       * imposed by `transfer`, making them unable to receive funds via
                       * `transfer`. {sendValue} removes this limitation.
                       *
                       * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
                       *
                       * IMPORTANT: because control is transferred to `recipient`, care must be
                       * taken to not create reentrancy vulnerabilities. Consider using
                       * {ReentrancyGuard} or the
                       * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
                       *
                       * _Available since v2.4.0._
                       */
                      function sendValue(address payable recipient, uint256 amount) internal {
                          require(address(this).balance >= amount, "Address: insufficient balance");
                  
                          // solhint-disable-next-line avoid-call-value
                          (bool success, ) = recipient.call.value(amount)("");
                          require(success, "Address: unable to send value, recipient may have reverted");
                      }
                  }
                  
                  // A sample implementation of core ERC1155 function.
                  contract ERC1155 is IERC1155, ERC165, CommonConstants
                  {
                      using SafeMath for uint256;
                      using Address for address;
                  
                      // id => (owner => balance)
                      mapping (uint256 => mapping(address => uint256)) internal balances;
                  
                      // owner => (operator => approved)
                      mapping (address => mapping(address => bool)) internal operatorApproval;
                  
                  /////////////////////////////////////////// ERC165 //////////////////////////////////////////////
                  
                      /*
                          bytes4(keccak256("safeTransferFrom(address,address,uint256,uint256,bytes)")) ^
                          bytes4(keccak256("safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)")) ^
                          bytes4(keccak256("balanceOf(address,uint256)")) ^
                          bytes4(keccak256("balanceOfBatch(address[],uint256[])")) ^
                          bytes4(keccak256("setApprovalForAll(address,bool)")) ^
                          bytes4(keccak256("isApprovedForAll(address,address)"));
                      */
                      bytes4 constant private INTERFACE_SIGNATURE_ERC1155 = 0xd9b67a26;
                  
                  /////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////
                  
                      constructor() public {
                          _registerInterface(INTERFACE_SIGNATURE_ERC1155);
                      }
                  
                  /////////////////////////////////////////// ERC1155 //////////////////////////////////////////////
                  
                      /**
                          @notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
                          @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
                          MUST revert if `_to` is the zero address.
                          MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
                          MUST revert on any other error.
                          MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
                          After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
                          @param _from    Source address
                          @param _to      Target address
                          @param _id      ID of the token type
                          @param _value   Transfer amount
                          @param _data    Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
                      */
                      function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external {
                  
                          require(_to != address(0x0), "_to must be non-zero.");
                          require(_from == msg.sender || operatorApproval[_from][msg.sender] == true, "Need operator approval for 3rd party transfers.");
                  
                          // SafeMath will throw with insuficient funds _from
                          // or if _id is not valid (balance will be 0)
                          balances[_id][_from] = balances[_id][_from].sub(_value);
                          balances[_id][_to]   = _value.add(balances[_id][_to]);
                  
                          // MUST emit event
                          emit TransferSingle(msg.sender, _from, _to, _id, _value);
                  
                          // Now that the balance is updated and the event was emitted,
                          // call onERC1155Received if the destination is a contract.
                          if (_to.isContract()) {
                              _doSafeTransferAcceptanceCheck(msg.sender, _from, _to, _id, _value, _data);
                          }
                      }
                  
                      /**
                          @notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
                          @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
                          MUST revert if `_to` is the zero address.
                          MUST revert if length of `_ids` is not the same as length of `_values`.
                          MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.
                          MUST revert on any other error.
                          MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
                          Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
                          After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
                          @param _from    Source address
                          @param _to      Target address
                          @param _ids     IDs of each token type (order and length must match _values array)
                          @param _values  Transfer amounts per token type (order and length must match _ids array)
                          @param _data    Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
                      */
                      function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external {
                  
                          // MUST Throw on errors
                          require(_to != address(0x0), "destination address must be non-zero.");
                          require(_ids.length == _values.length, "_ids and _values array lenght must match.");
                          require(_from == msg.sender || operatorApproval[_from][msg.sender] == true, "Need operator approval for 3rd party transfers.");
                  
                          for (uint256 i = 0; i < _ids.length; ++i) {
                              uint256 id = _ids[i];
                              uint256 value = _values[i];
                  
                              // SafeMath will throw with insuficient funds _from
                              // or if _id is not valid (balance will be 0)
                              balances[id][_from] = balances[id][_from].sub(value);
                              balances[id][_to]   = value.add(balances[id][_to]);
                          }
                  
                          // Note: instead of the below batch versions of event and acceptance check you MAY have emitted a TransferSingle
                          // event and a subsequent call to _doSafeTransferAcceptanceCheck in above loop for each balance change instead.
                          // Or emitted a TransferSingle event for each in the loop and then the single _doSafeBatchTransferAcceptanceCheck below.
                          // However it is implemented the balance changes and events MUST match when a check (i.e. calling an external contract) is done.
                  
                          // MUST emit event
                          emit TransferBatch(msg.sender, _from, _to, _ids, _values);
                  
                          // Now that the balances are updated and the events are emitted,
                          // call onERC1155BatchReceived if the destination is a contract.
                          if (_to.isContract()) {
                              _doSafeBatchTransferAcceptanceCheck(msg.sender, _from, _to, _ids, _values, _data);
                          }
                      }
                  
                      /**
                          @notice Get the balance of an account's Tokens.
                          @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) external view returns (uint256) {
                          // The balance of any account can be calculated from the Transfer events history.
                          // However, since we need to keep the balances to validate transfer request,
                          // there is no extra cost to also privide a querry function.
                          return balances[_id][_owner];
                      }
                  
                  
                      /**
                          @notice Get the balance of multiple account/token pairs
                          @param _owners The addresses of the token holders
                          @param _ids    ID of the Tokens
                          @return        The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair)
                       */
                      function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory) {
                  
                          require(_owners.length == _ids.length);
                  
                          uint256[] memory balances_ = new uint256[](_owners.length);
                  
                          for (uint256 i = 0; i < _owners.length; ++i) {
                              balances_[i] = balances[_ids[i]][_owners[i]];
                          }
                  
                          return balances_;
                      }
                  
                      /**
                          @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens.
                          @dev MUST emit the ApprovalForAll event on success.
                          @param _operator  Address to add to the set of authorized operators
                          @param _approved  True if the operator is approved, false to revoke approval
                      */
                      function setApprovalForAll(address _operator, bool _approved) external {
                          operatorApproval[msg.sender][_operator] = _approved;
                          emit ApprovalForAll(msg.sender, _operator, _approved);
                      }
                  
                      /**
                          @notice Queries the approval status of an operator for a given owner.
                          @param _owner     The owner of the Tokens
                          @param _operator  Address of authorized operator
                          @return           True if the operator is approved, false if not
                      */
                      function isApprovedForAll(address _owner, address _operator) external view returns (bool) {
                          return operatorApproval[_owner][_operator];
                      }
                  
                  /////////////////////////////////////////// Internal //////////////////////////////////////////////
                  
                      function _doSafeTransferAcceptanceCheck(address _operator, address _from, address _to, uint256 _id, uint256 _value, bytes memory _data) internal {
                  
                          // If this was a hybrid standards solution you would have to check ERC165(_to).supportsInterface(0x4e2312e0) here but as this is a pure implementation of an ERC-1155 token set as recommended by
                          // the standard, it is not necessary. The below should revert in all failure cases i.e. _to isn't a receiver, or it is and either returns an unknown value or it reverts in the call to indicate non-acceptance.
                  
                  
                          // Note: if the below reverts in the onERC1155Received function of the _to address you will have an undefined revert reason returned rather than the one in the require test.
                          // If you want predictable revert reasons consider using low level _to.call() style instead so the revert does not bubble up and you can revert yourself on the ERC1155_ACCEPTED test.
                          require(ERC1155TokenReceiver(_to).onERC1155Received(_operator, _from, _id, _value, _data) == ERC1155_ACCEPTED, "contract returned an unknown value from onERC1155Received");
                      }
                  
                      function _doSafeBatchTransferAcceptanceCheck(address _operator, address _from, address _to, uint256[] memory _ids, uint256[] memory _values, bytes memory _data) internal {
                  
                          // If this was a hybrid standards solution you would have to check ERC165(_to).supportsInterface(0x4e2312e0) here but as this is a pure implementation of an ERC-1155 token set as recommended by
                          // the standard, it is not necessary. The below should revert in all failure cases i.e. _to isn't a receiver, or it is and either returns an unknown value or it reverts in the call to indicate non-acceptance.
                  
                          // Note: if the below reverts in the onERC1155BatchReceived function of the _to address you will have an undefined revert reason returned rather than the one in the require test.
                          // If you want predictable revert reasons consider using low level _to.call() style instead so the revert does not bubble up and you can revert yourself on the ERC1155_BATCH_ACCEPTED test.
                          require(ERC1155TokenReceiver(_to).onERC1155BatchReceived(_operator, _from, _ids, _values, _data) == ERC1155_BATCH_ACCEPTED, "contract returned an unknown value from onERC1155BatchReceived");
                      }
                  }
                  
                  library UintLibrary {
                      function toString(uint256 _i) internal pure returns (string memory) {
                          if (_i == 0) {
                              return "0";
                          }
                          uint j = _i;
                          uint len;
                          while (j != 0) {
                              len++;
                              j /= 10;
                          }
                          bytes memory bstr = new bytes(len);
                          uint k = len - 1;
                          while (_i != 0) {
                              bstr[k--] = byte(uint8(48 + _i % 10));
                              _i /= 10;
                          }
                          return string(bstr);
                      }
                  }
                  
                  library StringLibrary {
                      using UintLibrary for uint256;
                  
                      function append(string memory _a, string memory _b) internal pure returns (string memory) {
                          bytes memory _ba = bytes(_a);
                          bytes memory _bb = bytes(_b);
                          bytes memory bab = new bytes(_ba.length + _bb.length);
                          uint k = 0;
                          for (uint i = 0; i < _ba.length; i++) bab[k++] = _ba[i];
                          for (uint i = 0; i < _bb.length; i++) bab[k++] = _bb[i];
                          return string(bab);
                      }
                  
                      function append(string memory _a, string memory _b, string memory _c) internal pure returns (string memory) {
                          bytes memory _ba = bytes(_a);
                          bytes memory _bb = bytes(_b);
                          bytes memory _bc = bytes(_c);
                          bytes memory bbb = new bytes(_ba.length + _bb.length + _bc.length);
                          uint k = 0;
                          for (uint i = 0; i < _ba.length; i++) bbb[k++] = _ba[i];
                          for (uint i = 0; i < _bb.length; i++) bbb[k++] = _bb[i];
                          for (uint i = 0; i < _bc.length; i++) bbb[k++] = _bc[i];
                          return string(bbb);
                      }
                  
                      function recover(string memory message, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
                          bytes memory msgBytes = bytes(message);
                          bytes memory fullMessage = concat(
                              bytes("\x19Ethereum Signed Message:\n"),
                              bytes(msgBytes.length.toString()),
                              msgBytes,
                              new bytes(0), new bytes(0), new bytes(0), new bytes(0)
                          );
                          return ecrecover(keccak256(fullMessage), v, r, s);
                      }
                  
                      function concat(bytes memory _ba, bytes memory _bb, bytes memory _bc, bytes memory _bd, bytes memory _be, bytes memory _bf, bytes memory _bg) internal pure returns (bytes memory) {
                          bytes memory resultBytes = new bytes(_ba.length + _bb.length + _bc.length + _bd.length + _be.length + _bf.length + _bg.length);
                          uint k = 0;
                          for (uint i = 0; i < _ba.length; i++) resultBytes[k++] = _ba[i];
                          for (uint i = 0; i < _bb.length; i++) resultBytes[k++] = _bb[i];
                          for (uint i = 0; i < _bc.length; i++) resultBytes[k++] = _bc[i];
                          for (uint i = 0; i < _bd.length; i++) resultBytes[k++] = _bd[i];
                          for (uint i = 0; i < _be.length; i++) resultBytes[k++] = _be[i];
                          for (uint i = 0; i < _bf.length; i++) resultBytes[k++] = _bf[i];
                          for (uint i = 0; i < _bg.length; i++) resultBytes[k++] = _bg[i];
                          return resultBytes;
                      }
                  }
                  
                  contract HasContractURI is ERC165 {
                  
                      string public contractURI;
                  
                      /*
                       * bytes4(keccak256('contractURI()')) == 0xe8a3d485
                       */
                      bytes4 private constant _INTERFACE_ID_CONTRACT_URI = 0xe8a3d485;
                  
                      constructor(string memory _contractURI) public {
                          contractURI = _contractURI;
                          _registerInterface(_INTERFACE_ID_CONTRACT_URI);
                      }
                  
                      /**
                       * @dev Internal function to set the contract URI
                       * @param _contractURI string URI prefix to assign
                       */
                      function _setContractURI(string memory _contractURI) internal {
                          contractURI = _contractURI;
                      }
                  }
                  
                  contract HasTokenURI {
                      using StringLibrary for string;
                  
                      //Token URI prefix
                      string public tokenURIPrefix;
                  
                      // Optional mapping for token URIs
                      mapping(uint256 => string) private _tokenURIs;
                  
                      constructor(string memory _tokenURIPrefix) public {
                          tokenURIPrefix = _tokenURIPrefix;
                      }
                  
                      /**
                       * @dev Returns an URI for a given token ID.
                       * Throws if the token ID does not exist. May return an empty string.
                       * @param tokenId uint256 ID of the token to query
                       */
                      function _tokenURI(uint256 tokenId) internal view returns (string memory) {
                          return tokenURIPrefix.append(_tokenURIs[tokenId]);
                      }
                  
                      /**
                       * @dev Internal function to set the token URI for a given token.
                       * Reverts if the token ID does not exist.
                       * @param tokenId uint256 ID of the token to set its URI
                       * @param uri string URI to assign
                       */
                      function _setTokenURI(uint256 tokenId, string memory uri) internal {
                          _tokenURIs[tokenId] = uri;
                      }
                  
                      /**
                       * @dev Internal function to set the token URI prefix.
                       * @param _tokenURIPrefix string URI prefix to assign
                       */
                      function _setTokenURIPrefix(string memory _tokenURIPrefix) internal {
                          tokenURIPrefix = _tokenURIPrefix;
                      }
                  
                      function _clearTokenURI(uint256 tokenId) internal {
                          if (bytes(_tokenURIs[tokenId]).length != 0) {
                              delete _tokenURIs[tokenId];
                          }
                      }
                  }
                  
                  /*
                   * @dev Provides information about the current execution context, including the
                   * sender of the transaction and its data. While these are generally available
                   * via msg.sender and msg.data, they should not be accessed in such a direct
                   * manner, since when dealing with GSN meta-transactions the account sending and
                   * paying for execution may not be the actual sender (as far as an application
                   * is concerned).
                   *
                   * This contract is only required for intermediate, library-like contracts.
                   */
                  contract Context {
                      // Empty internal constructor, to prevent people from mistakenly deploying
                      // an instance of this contract, which should be used via inheritance.
                      constructor () internal { }
                      // solhint-disable-previous-line no-empty-blocks
                  
                      function _msgSender() internal view returns (address payable) {
                          return msg.sender;
                      }
                  
                      function _msgData() internal view returns (bytes memory) {
                          this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
                          return msg.data;
                      }
                  }
                  
                  /**
                   * @dev Contract module which provides a basic access control mechanism, where
                   * there is an account (an owner) that can be granted exclusive access to
                   * specific functions.
                   *
                   * This module is used through inheritance. It will make available the modifier
                   * `onlyOwner`, which can be applied to your functions to restrict their use to
                   * the owner.
                   */
                  contract Ownable is Context {
                      address private _owner;
                  
                      event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
                  
                      /**
                       * @dev Initializes the contract setting the deployer as the initial owner.
                       */
                      constructor () internal {
                          address msgSender = _msgSender();
                          _owner = msgSender;
                          emit OwnershipTransferred(address(0), msgSender);
                      }
                  
                      /**
                       * @dev Returns the address of the current owner.
                       */
                      function owner() public view returns (address) {
                          return _owner;
                      }
                  
                      /**
                       * @dev Throws if called by any account other than the owner.
                       */
                      modifier onlyOwner() {
                          require(isOwner(), "Ownable: caller is not the owner");
                          _;
                      }
                  
                      /**
                       * @dev Returns true if the caller is the current owner.
                       */
                      function isOwner() public view returns (bool) {
                          return _msgSender() == _owner;
                      }
                  
                      /**
                       * @dev Leaves the contract without owner. It will not be possible to call
                       * `onlyOwner` functions anymore. Can only be called by the current owner.
                       *
                       * NOTE: Renouncing ownership will leave the contract without an owner,
                       * thereby removing any functionality that is only available to the owner.
                       */
                      function renounceOwnership() public onlyOwner {
                          emit OwnershipTransferred(_owner, address(0));
                          _owner = address(0);
                      }
                  
                      /**
                       * @dev Transfers ownership of the contract to a new account (`newOwner`).
                       * Can only be called by the current owner.
                       */
                      function transferOwnership(address newOwner) public onlyOwner {
                          _transferOwnership(newOwner);
                      }
                  
                      /**
                       * @dev Transfers ownership of the contract to a new account (`newOwner`).
                       */
                      function _transferOwnership(address newOwner) internal {
                          require(newOwner != address(0), "Ownable: new owner is the zero address");
                          emit OwnershipTransferred(_owner, newOwner);
                          _owner = newOwner;
                      }
                  }
                  
                  /**
                      Note: The ERC-165 identifier for this interface is 0x0e89341c.
                  */
                  interface IERC1155Metadata_URI {
                      /**
                          @notice A distinct Uniform Resource Identifier (URI) for a given token.
                          @dev URIs are defined in RFC 3986.
                          The URI may point to a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
                          @return URI string
                      */
                      function uri(uint256 _id) external view returns (string memory);
                  }
                  
                  /**
                      Note: The ERC-165 identifier for this interface is 0x0e89341c.
                  */
                  contract ERC1155Metadata_URI is IERC1155Metadata_URI, HasTokenURI {
                  
                      constructor(string memory _tokenURIPrefix) HasTokenURI(_tokenURIPrefix) public {
                  
                      }
                  
                      function uri(uint256 _id) external view returns (string memory) {
                          return _tokenURI(_id);
                      }
                  }
                  
                  contract HasSecondarySaleFees is ERC165 {
                  
                      event SecondarySaleFees(uint256 tokenId, address[] recipients, uint[] bps);
                  
                      /*
                       * bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f
                       * bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb
                       *
                       * => 0x0ebd4c7f ^ 0xb9c4d9fb == 0xb7799584
                       */
                      bytes4 private constant _INTERFACE_ID_FEES = 0xb7799584;
                  
                      constructor() public {
                          _registerInterface(_INTERFACE_ID_FEES);
                      }
                  
                      function getFeeRecipients(uint256 id) public view returns (address payable[] memory);
                      function getFeeBps(uint256 id) public view returns (uint[] memory);
                  }
                  
                  contract ERC1155Base is HasSecondarySaleFees, Ownable, ERC1155Metadata_URI, HasContractURI, ERC1155 {
                  
                      struct Fee {
                          address payable recipient;
                          uint256 value;
                      }
                  
                      // id => creator
                      mapping (uint256 => address) public creators;
                      // id => fees
                      mapping (uint256 => Fee[]) public fees;
                  
                      constructor(string memory contractURI, string memory tokenURIPrefix) HasContractURI(contractURI) ERC1155Metadata_URI(tokenURIPrefix) public {
                  
                      }
                  
                      function getFeeRecipients(uint256 id) public view returns (address payable[] memory) {
                          Fee[] memory _fees = fees[id];
                          address payable[] memory result = new address payable[](_fees.length);
                          for (uint i = 0; i < _fees.length; i++) {
                              result[i] = _fees[i].recipient;
                          }
                          return result;
                      }
                  
                      function getFeeBps(uint256 id) public view returns (uint[] memory) {
                          Fee[] memory _fees = fees[id];
                          uint[] memory result = new uint[](_fees.length);
                          for (uint i = 0; i < _fees.length; i++) {
                              result[i] = _fees[i].value;
                          }
                          return result;
                      }
                  
                      // Creates a new token type and assings _initialSupply to minter
                      function _mint(uint256 _id, Fee[] memory _fees, uint256 _supply, string memory _uri) internal {
                          require(creators[_id] == address(0x0), "Token is already minted");
                          require(_supply != 0, "Supply should be positive");
                          require(bytes(_uri).length > 0, "uri should be set");
                  
                          creators[_id] = msg.sender;
                          address[] memory recipients = new address[](_fees.length);
                          uint[] memory bps = new uint[](_fees.length);
                          for (uint i = 0; i < _fees.length; i++) {
                              require(_fees[i].recipient != address(0x0), "Recipient should be present");
                              require(_fees[i].value != 0, "Fee value should be positive");
                              fees[_id].push(_fees[i]);
                              recipients[i] = _fees[i].recipient;
                              bps[i] = _fees[i].value;
                          }
                          if (_fees.length > 0) {
                              emit SecondarySaleFees(_id, recipients, bps);
                          }
                          balances[_id][msg.sender] = _supply;
                          _setTokenURI(_id, _uri);
                  
                          // Transfer event with mint semantic
                          emit TransferSingle(msg.sender, address(0x0), msg.sender, _id, _supply);
                          emit URI(_uri, _id);
                      }
                  
                      function burn(address _owner, uint256 _id, uint256 _value) external {
                  
                          require(_owner == msg.sender || operatorApproval[_owner][msg.sender] == true, "Need operator approval for 3rd party burns.");
                  
                          // SafeMath will throw with insuficient funds _owner
                          // or if _id is not valid (balance will be 0)
                          balances[_id][_owner] = balances[_id][_owner].sub(_value);
                  
                          // MUST emit event
                          emit TransferSingle(msg.sender, _owner, address(0x0), _id, _value);
                      }
                  
                      /**
                       * @dev Internal function to set the token URI for a given token.
                       * Reverts if the token ID does not exist.
                       * @param tokenId uint256 ID of the token to set its URI
                       * @param uri string URI to assign
                       */
                      function _setTokenURI(uint256 tokenId, string memory uri) internal {
                          require(creators[tokenId] != address(0x0), "_setTokenURI: Token should exist");
                          super._setTokenURI(tokenId, uri);
                      }
                  
                      function setTokenURIPrefix(string memory tokenURIPrefix) public onlyOwner {
                          _setTokenURIPrefix(tokenURIPrefix);
                      }
                  
                      function setContractURI(string memory contractURI) public onlyOwner {
                          _setContractURI(contractURI);
                      }
                  }
                  
                  /**
                   * @title Roles
                   * @dev Library for managing addresses assigned to a Role.
                   */
                  library Roles {
                      struct Role {
                          mapping (address => bool) bearer;
                      }
                  
                      /**
                       * @dev Give an account access to this role.
                       */
                      function add(Role storage role, address account) internal {
                          require(!has(role, account), "Roles: account already has role");
                          role.bearer[account] = true;
                      }
                  
                      /**
                       * @dev Remove an account's access to this role.
                       */
                      function remove(Role storage role, address account) internal {
                          require(has(role, account), "Roles: account does not have role");
                          role.bearer[account] = false;
                      }
                  
                      /**
                       * @dev Check if an account has this role.
                       * @return bool
                       */
                      function has(Role storage role, address account) internal view returns (bool) {
                          require(account != address(0), "Roles: account is the zero address");
                          return role.bearer[account];
                      }
                  }
                  
                  contract SignerRole is Context {
                      using Roles for Roles.Role;
                  
                      event SignerAdded(address indexed account);
                      event SignerRemoved(address indexed account);
                  
                      Roles.Role private _signers;
                  
                      constructor () internal {
                          _addSigner(_msgSender());
                      }
                  
                      modifier onlySigner() {
                          require(isSigner(_msgSender()), "SignerRole: caller does not have the Signer role");
                          _;
                      }
                  
                      function isSigner(address account) public view returns (bool) {
                          return _signers.has(account);
                      }
                  
                      function addSigner(address account) public onlySigner {
                          _addSigner(account);
                      }
                  
                      function renounceSigner() public {
                          _removeSigner(_msgSender());
                      }
                  
                      function _addSigner(address account) internal {
                          _signers.add(account);
                          emit SignerAdded(account);
                      }
                  
                      function _removeSigner(address account) internal {
                          _signers.remove(account);
                          emit SignerRemoved(account);
                      }
                  }
                  
                  
                  
                  
                  
                  
                  contract RaribleToken is Ownable, SignerRole, ERC1155Base {
                      string public name;
                      string public symbol;
                  
                      constructor(string memory _name, string memory _symbol, address signer, string memory contractURI, string memory tokenURIPrefix) ERC1155Base(contractURI, tokenURIPrefix) public {
                          name = _name;
                          symbol = _symbol;
                  
                          _addSigner(signer);
                          _registerInterface(bytes4(keccak256('MINT_WITH_ADDRESS')));
                      }
                  
                      function addSigner(address account) public onlyOwner {
                          _addSigner(account);
                      }
                  
                      function removeSigner(address account) public onlyOwner {
                          _removeSigner(account);
                      }
                  
                      function mint(uint256 id, uint8 v, bytes32 r, bytes32 s, Fee[] memory fees, uint256 supply, string memory uri) public {
                          require(isSigner(ecrecover(keccak256(abi.encodePacked(this, id)), v, r, s)), "signer should sign tokenId");
                          _mint(id, fees, supply, uri);
                      }
                  }
                  
                  
                  
                  contract RaribleUserToken is RaribleToken {
                      event CreateERC1155_v1(address indexed creator, string name, string symbol);
                  
                      constructor(string memory name, string memory symbol, string memory contractURI, string memory tokenURIPrefix, address signer) RaribleToken(name, symbol, signer, contractURI, tokenURIPrefix) public {
                          emit CreateERC1155_v1(msg.sender, name, symbol);
                      }
                  
                      function mint(uint256 id, uint8 v, bytes32 r, bytes32 s, Fee[] memory fees, uint256 supply, string memory uri) onlyOwner public {
                          super.mint(id, v, r, s, fees, supply, uri);
                      }
                  }

                  File 3 of 5: Proxy
                  pragma solidity ^0.5.3;
                  
                  /// @title Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.
                  /// @author Stefan George - <[email protected]>
                  /// @author Richard Meissner - <[email protected]>
                  contract Proxy {
                  
                      // masterCopy always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated.
                      // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`
                      address internal masterCopy;
                  
                      /// @dev Constructor function sets address of master copy contract.
                      /// @param _masterCopy Master copy address.
                      constructor(address _masterCopy)
                          public
                      {
                          require(_masterCopy != address(0), "Invalid master copy address provided");
                          masterCopy = _masterCopy;
                      }
                  
                      /// @dev Fallback function forwards all transactions and returns all received return data.
                      function ()
                          external
                          payable
                      {
                          // solium-disable-next-line security/no-inline-assembly
                          assembly {
                              let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)
                              // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s
                              if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {
                                  mstore(0, masterCopy)
                                  return(0, 0x20)
                              }
                              calldatacopy(0, 0, calldatasize())
                              let success := delegatecall(gas, masterCopy, 0, calldatasize(), 0, 0)
                              returndatacopy(0, 0, returndatasize())
                              if eq(success, 0) { revert(0, returndatasize()) }
                              return(0, returndatasize())
                          }
                      }
                  }

                  File 4 of 5: OwnedUpgradeabilityProxy
                  // SPDX-License-Identifier: UNLICENSED
                  // This code is taken from https://github.com/OpenZeppelin/openzeppelin-labs
                  // with minor modifications.
                  pragma solidity ^0.7.0;
                  import './UpgradeabilityProxy.sol';
                  /**
                   * @title OwnedUpgradeabilityProxy
                   * @dev This contract combines an upgradeability proxy with basic authorization control functionalities
                   */
                  contract OwnedUpgradeabilityProxy is UpgradeabilityProxy {
                    /**
                    * @dev Event to show ownership has been transferred
                    * @param previousOwner representing the address of the previous owner
                    * @param newOwner representing the address of the new owner
                    */
                    event ProxyOwnershipTransferred(address previousOwner, address newOwner);
                    // Storage position of the owner of the contract
                    bytes32 private constant proxyOwnerPosition = keccak256("org.zeppelinos.proxy.owner");
                    /**
                    * @dev the constructor sets the original owner of the contract to the sender account.
                    */
                    constructor() {
                      setUpgradeabilityOwner(msg.sender);
                    }
                    /**
                    * @dev Throws if called by any account other than the owner.
                    */
                    modifier onlyProxyOwner() {
                      require(msg.sender == proxyOwner());
                      _;
                    }
                    /**
                     * @dev Tells the address of the owner
                     * @return owner the address of the owner
                     */
                    function proxyOwner() public view returns (address owner) {
                      bytes32 position = proxyOwnerPosition;
                      assembly {
                        owner := sload(position)
                      }
                    }
                    /**
                     * @dev Sets the address of the owner
                     */
                    function setUpgradeabilityOwner(address newProxyOwner) internal {
                      bytes32 position = proxyOwnerPosition;
                      assembly {
                        sstore(position, newProxyOwner)
                      }
                    }
                    /**
                     * @dev Allows the current owner to transfer control of the contract to a newOwner.
                     * @param newOwner The address to transfer ownership to.
                     */
                    function transferProxyOwnership(address newOwner) public onlyProxyOwner {
                      require(newOwner != address(0));
                      emit ProxyOwnershipTransferred(proxyOwner(), newOwner);
                      setUpgradeabilityOwner(newOwner);
                    }
                    /**
                     * @dev Allows the proxy owner to upgrade the current version of the proxy.
                     * @param implementation representing the address of the new implementation to be set.
                     */
                    function upgradeTo(address implementation) public onlyProxyOwner {
                      _upgradeTo(implementation);
                    }
                    /**
                     * @dev Allows the proxy owner to upgrade the current version of the proxy and call the new implementation
                     * to initialize whatever is needed through a low level call.
                     * @param implementation representing the address of the new implementation to be set.
                     * @param data represents the msg.data to bet sent in the low level call. This parameter may include the function
                     * signature of the implementation to be called with the needed payload
                     */
                    function upgradeToAndCall(address implementation, bytes memory data) payable public onlyProxyOwner {
                      upgradeTo(implementation);
                      (bool success, ) = address(this).call{value: msg.value}(data);
                      require(success);
                    }
                  }// SPDX-License-Identifier: UNLICENSED
                  // This code is taken from https://github.com/OpenZeppelin/openzeppelin-labs
                  // with minor modifications.
                  pragma solidity ^0.7.0;
                  import "./Proxy.sol";
                  /**
                   * @title UpgradeabilityProxy
                   * @dev This contract represents a proxy where the implementation address to which it will delegate can be upgraded
                   */
                  contract UpgradeabilityProxy is Proxy {
                      /**
                       * @dev This event will be emitted every time the implementation gets upgraded
                       * @param implementation representing the address of the upgraded implementation
                       */
                      event Upgraded(address indexed implementation);
                      // Storage position of the address of the current implementation
                      bytes32 private constant implementationPosition = keccak256("org.zeppelinos.proxy.implementation");
                      /**
                       * @dev Constructor function
                       */
                      constructor() {}
                      /**
                       * @dev Tells the address of the current implementation
                       * @return impl address of the current implementation
                       */
                      function implementation() public view override returns (address impl) {
                          bytes32 position = implementationPosition;
                          assembly {
                              impl := sload(position)
                          }
                      }
                      /**
                       * @dev Sets the address of the current implementation
                       * @param newImplementation address representing the new implementation to be set
                       */
                      function setImplementation(address newImplementation) internal {
                          bytes32 position = implementationPosition;
                          assembly {
                              sstore(position, newImplementation)
                          }
                      }
                      /**
                       * @dev Upgrades the implementation address
                       * @param newImplementation representing the address of the new implementation to be set
                       */
                      function _upgradeTo(address newImplementation) internal {
                          address currentImplementation = implementation();
                          require(currentImplementation != newImplementation);
                          setImplementation(newImplementation);
                          emit Upgraded(newImplementation);
                      }
                  }// SPDX-License-Identifier: UNLICENSED
                  // This code is taken from https://github.com/OpenZeppelin/openzeppelin-labs
                  pragma solidity ^0.7.0;
                  /**
                   * @title Proxy
                   * @dev Gives the possibility to delegate any call to a foreign implementation.
                   */
                  abstract contract Proxy {
                    /**
                    * @dev Tells the address of the implementation where every call will be delegated.
                    * @return address of the implementation to which it will be delegated
                    */
                    function implementation() public view virtual returns (address);
                    /**
                    * @dev Fallback function allowing to perform a delegatecall to the given implementation.
                    * This function will return whatever the implementation call returns
                    */
                    fallback() payable external {
                      address _impl = implementation();
                      require(_impl != address(0));
                      assembly {
                        let ptr := mload(0x40)
                        calldatacopy(ptr, 0, calldatasize())
                        let result := delegatecall(gas(), _impl, ptr, calldatasize(), 0, 0)
                        let size := returndatasize()
                        returndatacopy(ptr, 0, size)
                        switch result
                        case 0 { revert(ptr, size) }
                        default { return(ptr, size) }
                      }
                    }
                    receive() payable external {}
                  }
                  

                  File 5 of 5: GnosisSafe
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma 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/EtherPaymentFallback.sol";
                  import "./common/Singleton.sol";
                  import "./common/SignatureDecoder.sol";
                  import "./common/SecuredTokenTransfer.sol";
                  import "./common/StorageAccessible.sol";
                  import "./interfaces/ISignatureValidator.sol";
                  import "./external/GnosisSafeMath.sol";
                  /// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.
                  /// @author Stefan George - <[email protected]>
                  /// @author Richard Meissner - <[email protected]>
                  contract GnosisSafe is
                      EtherPaymentFallback,
                      Singleton,
                      ModuleManager,
                      OwnerManager,
                      SignatureDecoder,
                      SecuredTokenTransfer,
                      ISignatureValidatorConstants,
                      FallbackManager,
                      StorageAccessible,
                      GuardManager
                  {
                      using GnosisSafeMath for uint256;
                      string public constant VERSION = "1.3.0";
                      // keccak256(
                      //     "EIP712Domain(uint256 chainId,address verifyingContract)"
                      // );
                      bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218;
                      // keccak256(
                      //     "SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)"
                      // );
                      bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8;
                      event SafeSetup(address indexed initiator, address[] owners, uint256 threshold, address initializer, address fallbackHandler);
                      event ApproveHash(bytes32 indexed approvedHash, address indexed owner);
                      event SignMsg(bytes32 indexed msgHash);
                      event ExecutionFailure(bytes32 txHash, uint256 payment);
                      event ExecutionSuccess(bytes32 txHash, uint256 payment);
                      uint256 public nonce;
                      bytes32 private _deprecatedDomainSeparator;
                      // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners
                      mapping(bytes32 => uint256) public signedMessages;
                      // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners
                      mapping(address => mapping(bytes32 => uint256)) public approvedHashes;
                      // This constructor ensures that this contract can only be used as a master copy for Proxy contracts
                      constructor() {
                          // By setting the threshold it is not possible to call setup anymore,
                          // so we create a Safe with 0 owners and threshold 1.
                          // This is an unusable Safe, perfect for the singleton
                          threshold = 1;
                      }
                      /// @dev Setup function sets initial storage of contract.
                      /// @param _owners List of Safe owners.
                      /// @param _threshold Number of required confirmations for a Safe transaction.
                      /// @param to Contract address for optional delegate call.
                      /// @param data Data payload for optional delegate call.
                      /// @param fallbackHandler Handler for fallback calls to this contract
                      /// @param paymentToken Token that should be used for the payment (0 is ETH)
                      /// @param payment Value that should be paid
                      /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin)
                      function setup(
                          address[] calldata _owners,
                          uint256 _threshold,
                          address to,
                          bytes calldata data,
                          address fallbackHandler,
                          address paymentToken,
                          uint256 payment,
                          address payable paymentReceiver
                      ) external {
                          // setupOwners checks if the Threshold is already set, therefore preventing that this method is called twice
                          setupOwners(_owners, _threshold);
                          if (fallbackHandler != address(0)) internalSetFallbackHandler(fallbackHandler);
                          // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules
                          setupModules(to, data);
                          if (payment > 0) {
                              // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself)
                              // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment
                              handlePayment(payment, 0, 1, paymentToken, paymentReceiver);
                          }
                          emit SafeSetup(msg.sender, _owners, _threshold, to, fallbackHandler);
                      }
                      /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.
                      ///      Note: The fees are always transferred, even if the user transaction fails.
                      /// @param to Destination address of Safe transaction.
                      /// @param value Ether value of Safe transaction.
                      /// @param data Data payload of Safe transaction.
                      /// @param operation Operation type of Safe transaction.
                      /// @param safeTxGas Gas that should be used for the Safe transaction.
                      /// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)
                      /// @param gasPrice Gas price that should be used for the payment calculation.
                      /// @param gasToken Token address (or 0 if ETH) that is used for the payment.
                      /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).
                      /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})
                      function execTransaction(
                          address to,
                          uint256 value,
                          bytes calldata data,
                          Enum.Operation operation,
                          uint256 safeTxGas,
                          uint256 baseGas,
                          uint256 gasPrice,
                          address gasToken,
                          address payable refundReceiver,
                          bytes memory signatures
                      ) public payable virtual returns (bool success) {
                          bytes32 txHash;
                          // Use scope here to limit variable lifetime and prevent `stack too deep` errors
                          {
                              bytes memory txHashData =
                                  encodeTransactionData(
                                      // Transaction info
                                      to,
                                      value,
                                      data,
                                      operation,
                                      safeTxGas,
                                      // Payment info
                                      baseGas,
                                      gasPrice,
                                      gasToken,
                                      refundReceiver,
                                      // Signature info
                                      nonce
                                  );
                              // Increase nonce and execute transaction.
                              nonce++;
                              txHash = keccak256(txHashData);
                              checkSignatures(txHash, txHashData, signatures);
                          }
                          address guard = getGuard();
                          {
                              if (guard != address(0)) {
                                  Guard(guard).checkTransaction(
                                      // Transaction info
                                      to,
                                      value,
                                      data,
                                      operation,
                                      safeTxGas,
                                      // Payment info
                                      baseGas,
                                      gasPrice,
                                      gasToken,
                                      refundReceiver,
                                      // Signature info
                                      signatures,
                                      msg.sender
                                  );
                              }
                          }
                          // We require some gas to emit the events (at least 2500) after the execution and some to perform code until the execution (500)
                          // We also include the 1/64 in the check that is not send along with a call to counteract potential shortings because of EIP-150
                          require(gasleft() >= ((safeTxGas * 64) / 63).max(safeTxGas + 2500) + 500, "GS010");
                          // Use scope here to limit variable lifetime and prevent `stack too deep` errors
                          {
                              uint256 gasUsed = gasleft();
                              // If the gasPrice is 0 we assume that nearly all available gas can be used (it is always more than safeTxGas)
                              // We only substract 2500 (compared to the 3000 before) to ensure that the amount passed is still higher than safeTxGas
                              success = execute(to, value, data, operation, gasPrice == 0 ? (gasleft() - 2500) : safeTxGas);
                              gasUsed = gasUsed.sub(gasleft());
                              // If no safeTxGas and no gasPrice was set (e.g. both are 0), then the internal tx is required to be successful
                              // This makes it possible to use `estimateGas` without issues, as it searches for the minimum gas where the tx doesn't revert
                              require(success || safeTxGas != 0 || gasPrice != 0, "GS013");
                              // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls
                              uint256 payment = 0;
                              if (gasPrice > 0) {
                                  payment = handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver);
                              }
                              if (success) emit ExecutionSuccess(txHash, payment);
                              else emit ExecutionFailure(txHash, payment);
                          }
                          {
                              if (guard != address(0)) {
                                  Guard(guard).checkAfterExecution(txHash, success);
                              }
                          }
                      }
                      function handlePayment(
                          uint256 gasUsed,
                          uint256 baseGas,
                          uint256 gasPrice,
                          address gasToken,
                          address payable refundReceiver
                      ) private returns (uint256 payment) {
                          // solhint-disable-next-line avoid-tx-origin
                          address payable receiver = refundReceiver == address(0) ? payable(tx.origin) : refundReceiver;
                          if (gasToken == address(0)) {
                              // For ETH we will only adjust the gas price to not be higher than the actual used gas price
                              payment = gasUsed.add(baseGas).mul(gasPrice < tx.gasprice ? gasPrice : tx.gasprice);
                              require(receiver.send(payment), "GS011");
                          } else {
                              payment = gasUsed.add(baseGas).mul(gasPrice);
                              require(transferToken(gasToken, receiver, payment), "GS012");
                          }
                      }
                      /**
                       * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.
                       * @param dataHash Hash of the data (could be either a message hash or transaction hash)
                       * @param data That should be signed (this is passed to an external validator contract)
                       * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.
                       */
                      function checkSignatures(
                          bytes32 dataHash,
                          bytes memory data,
                          bytes memory signatures
                      ) public view {
                          // Load threshold to avoid multiple storage loads
                          uint256 _threshold = threshold;
                          // Check that a threshold is set
                          require(_threshold > 0, "GS001");
                          checkNSignatures(dataHash, data, signatures, _threshold);
                      }
                      /**
                       * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.
                       * @param dataHash Hash of the data (could be either a message hash or transaction hash)
                       * @param data That should be signed (this is passed to an external validator contract)
                       * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.
                       * @param requiredSignatures Amount of required valid signatures.
                       */
                      function checkNSignatures(
                          bytes32 dataHash,
                          bytes memory data,
                          bytes memory signatures,
                          uint256 requiredSignatures
                      ) public view {
                          // Check that the provided signature data is not too short
                          require(signatures.length >= requiredSignatures.mul(65), "GS020");
                          // There cannot be an owner with address 0.
                          address lastOwner = address(0);
                          address currentOwner;
                          uint8 v;
                          bytes32 r;
                          bytes32 s;
                          uint256 i;
                          for (i = 0; i < requiredSignatures; i++) {
                              (v, r, s) = signatureSplit(signatures, i);
                              if (v == 0) {
                                  // If v is 0 then it is a contract signature
                                  // When handling contract signatures the address of the contract is encoded into r
                                  currentOwner = address(uint160(uint256(r)));
                                  // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes
                                  // This check is not completely accurate, since it is possible that more signatures than the threshold are send.
                                  // Here we only check that the pointer is not pointing inside the part that is being processed
                                  require(uint256(s) >= requiredSignatures.mul(65), "GS021");
                                  // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes)
                                  require(uint256(s).add(32) <= signatures.length, "GS022");
                                  // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length
                                  uint256 contractSignatureLen;
                                  // solhint-disable-next-line no-inline-assembly
                                  assembly {
                                      contractSignatureLen := mload(add(add(signatures, s), 0x20))
                                  }
                                  require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, "GS023");
                                  // Check signature
                                  bytes memory contractSignature;
                                  // solhint-disable-next-line no-inline-assembly
                                  assembly {
                                      // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s
                                      contractSignature := add(add(signatures, s), 0x20)
                                  }
                                  require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, "GS024");
                              } else if (v == 1) {
                                  // If v is 1 then it is an approved hash
                                  // When handling approved hashes the address of the approver is encoded into r
                                  currentOwner = address(uint160(uint256(r)));
                                  // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction
                                  require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, "GS025");
                              } else if (v > 30) {
                                  // If v > 30 then default va (27,28) has been adjusted for eth_sign flow
                                  // To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover
                                  currentOwner = ecrecover(keccak256(abi.encodePacked("\\x19Ethereum Signed Message:\
                  32", dataHash)), v - 4, r, s);
                              } else {
                                  // Default is the ecrecover flow with the provided data hash
                                  // Use ecrecover with the messageHash for EOA signatures
                                  currentOwner = ecrecover(dataHash, v, r, s);
                              }
                              require(currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, "GS026");
                              lastOwner = currentOwner;
                          }
                      }
                      /// @dev Allows to estimate a Safe transaction.
                      ///      This method is only meant for estimation purpose, therefore the call will always revert and encode the result in the revert data.
                      ///      Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction`
                      /// @param to Destination address of Safe transaction.
                      /// @param value Ether value of Safe transaction.
                      /// @param data Data payload of Safe transaction.
                      /// @param operation Operation type of Safe transaction.
                      /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs).
                      /// @notice Deprecated in favor of common/StorageAccessible.sol and will be removed in next version.
                      function requiredTxGas(
                          address to,
                          uint256 value,
                          bytes calldata data,
                          Enum.Operation operation
                      ) external returns (uint256) {
                          uint256 startGas = gasleft();
                          // We don't provide an error message here, as we use it to return the estimate
                          require(execute(to, value, data, operation, gasleft()));
                          uint256 requiredGas = startGas - gasleft();
                          // Convert response to string and return via error message
                          revert(string(abi.encodePacked(requiredGas)));
                      }
                      /**
                       * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature.
                       * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract.
                       */
                      function approveHash(bytes32 hashToApprove) external {
                          require(owners[msg.sender] != address(0), "GS030");
                          approvedHashes[msg.sender][hashToApprove] = 1;
                          emit ApproveHash(hashToApprove, msg.sender);
                      }
                      /// @dev Returns the chain id used by this contract.
                      function getChainId() public view returns (uint256) {
                          uint256 id;
                          // solhint-disable-next-line no-inline-assembly
                          assembly {
                              id := chainid()
                          }
                          return id;
                      }
                      function domainSeparator() public view returns (bytes32) {
                          return keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, getChainId(), this));
                      }
                      /// @dev Returns the bytes that are hashed to be signed by owners.
                      /// @param to Destination address.
                      /// @param value Ether value.
                      /// @param data Data payload.
                      /// @param operation Operation type.
                      /// @param safeTxGas Gas that should be used for the safe transaction.
                      /// @param baseGas Gas costs for that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)
                      /// @param gasPrice Maximum gas price that should be used for this transaction.
                      /// @param gasToken Token address (or 0 if ETH) that is used for the payment.
                      /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).
                      /// @param _nonce Transaction nonce.
                      /// @return Transaction hash bytes.
                      function encodeTransactionData(
                          address to,
                          uint256 value,
                          bytes calldata data,
                          Enum.Operation operation,
                          uint256 safeTxGas,
                          uint256 baseGas,
                          uint256 gasPrice,
                          address gasToken,
                          address refundReceiver,
                          uint256 _nonce
                      ) public view returns (bytes memory) {
                          bytes32 safeTxHash =
                              keccak256(
                                  abi.encode(
                                      SAFE_TX_TYPEHASH,
                                      to,
                                      value,
                                      keccak256(data),
                                      operation,
                                      safeTxGas,
                                      baseGas,
                                      gasPrice,
                                      gasToken,
                                      refundReceiver,
                                      _nonce
                                  )
                              );
                          return abi.encodePacked(bytes1(0x19), bytes1(0x01), domainSeparator(), safeTxHash);
                      }
                      /// @dev Returns hash to be signed by owners.
                      /// @param to Destination address.
                      /// @param value Ether value.
                      /// @param data Data payload.
                      /// @param operation Operation type.
                      /// @param safeTxGas Fas that should be used for the safe transaction.
                      /// @param baseGas Gas costs for data used to trigger the safe transaction.
                      /// @param gasPrice Maximum gas price that should be used for this transaction.
                      /// @param gasToken Token address (or 0 if ETH) that is used for the payment.
                      /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).
                      /// @param _nonce Transaction nonce.
                      /// @return Transaction hash.
                      function getTransactionHash(
                          address to,
                          uint256 value,
                          bytes calldata data,
                          Enum.Operation operation,
                          uint256 safeTxGas,
                          uint256 baseGas,
                          uint256 gasPrice,
                          address gasToken,
                          address refundReceiver,
                          uint256 _nonce
                      ) public view returns (bytes32) {
                          return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce));
                      }
                  }
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma solidity >=0.7.0 <0.9.0;
                  import "../common/Enum.sol";
                  /// @title Executor - A contract that can execute transactions
                  /// @author Richard Meissner - <[email protected]>
                  contract Executor {
                      function execute(
                          address to,
                          uint256 value,
                          bytes memory data,
                          Enum.Operation operation,
                          uint256 txGas
                      ) internal returns (bool success) {
                          if (operation == Enum.Operation.DelegateCall) {
                              // solhint-disable-next-line no-inline-assembly
                              assembly {
                                  success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)
                              }
                          } else {
                              // solhint-disable-next-line no-inline-assembly
                              assembly {
                                  success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)
                              }
                          }
                      }
                  }
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma solidity >=0.7.0 <0.9.0;
                  import "../common/SelfAuthorized.sol";
                  /// @title Fallback Manager - A contract that manages fallback calls made to this contract
                  /// @author Richard Meissner - <[email protected]>
                  contract FallbackManager is SelfAuthorized {
                      event ChangedFallbackHandler(address handler);
                      // keccak256("fallback_manager.handler.address")
                      bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5;
                      function internalSetFallbackHandler(address handler) internal {
                          bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;
                          // solhint-disable-next-line no-inline-assembly
                          assembly {
                              sstore(slot, handler)
                          }
                      }
                      /// @dev Allows to add a contract to handle fallback calls.
                      ///      Only fallback calls without value and with data will be forwarded.
                      ///      This can only be done via a Safe transaction.
                      /// @param handler contract to handle fallbacks calls.
                      function setFallbackHandler(address handler) public authorized {
                          internalSetFallbackHandler(handler);
                          emit ChangedFallbackHandler(handler);
                      }
                      // solhint-disable-next-line payable-fallback,no-complex-fallback
                      fallback() external {
                          bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;
                          // solhint-disable-next-line no-inline-assembly
                          assembly {
                              let handler := sload(slot)
                              if iszero(handler) {
                                  return(0, 0)
                              }
                              calldatacopy(0, 0, calldatasize())
                              // The msg.sender address is shifted to the left by 12 bytes to remove the padding
                              // Then the address without padding is stored right after the calldata
                              mstore(calldatasize(), shl(96, caller()))
                              // Add 20 bytes for the address appended add the end
                              let success := call(gas(), handler, 0, 0, add(calldatasize(), 20), 0, 0)
                              returndatacopy(0, 0, returndatasize())
                              if iszero(success) {
                                  revert(0, returndatasize())
                              }
                              return(0, returndatasize())
                          }
                      }
                  }
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma solidity >=0.7.0 <0.9.0;
                  import "../common/Enum.sol";
                  import "../common/SelfAuthorized.sol";
                  interface Guard {
                      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;
                  }
                  /// @title Fallback Manager - A contract that manages fallback calls made to this contract
                  /// @author Richard Meissner - <[email protected]>
                  contract GuardManager is SelfAuthorized {
                      event ChangedGuard(address guard);
                      // keccak256("guard_manager.guard.address")
                      bytes32 internal constant GUARD_STORAGE_SLOT = 0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8;
                      /// @dev Set a guard that checks transactions before execution
                      /// @param guard The address of the guard to be used or the 0 address to disable the guard
                      function setGuard(address guard) external authorized {
                          bytes32 slot = GUARD_STORAGE_SLOT;
                          // solhint-disable-next-line no-inline-assembly
                          assembly {
                              sstore(slot, guard)
                          }
                          emit ChangedGuard(guard);
                      }
                      function getGuard() internal view returns (address guard) {
                          bytes32 slot = GUARD_STORAGE_SLOT;
                          // solhint-disable-next-line no-inline-assembly
                          assembly {
                              guard := sload(slot)
                          }
                      }
                  }
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma solidity >=0.7.0 <0.9.0;
                  import "../common/Enum.sol";
                  import "../common/SelfAuthorized.sol";
                  import "./Executor.sol";
                  /// @title Module Manager - A contract that manages modules that can execute transactions via this contract
                  /// @author Stefan George - <[email protected]>
                  /// @author Richard Meissner - <[email protected]>
                  contract ModuleManager is SelfAuthorized, Executor {
                      event EnabledModule(address module);
                      event DisabledModule(address module);
                      event ExecutionFromModuleSuccess(address indexed module);
                      event ExecutionFromModuleFailure(address indexed module);
                      address internal constant SENTINEL_MODULES = address(0x1);
                      mapping(address => address) internal modules;
                      function setupModules(address to, bytes memory data) internal {
                          require(modules[SENTINEL_MODULES] == address(0), "GS100");
                          modules[SENTINEL_MODULES] = SENTINEL_MODULES;
                          if (to != address(0))
                              // Setup has to complete successfully or transaction fails.
                              require(execute(to, 0, data, Enum.Operation.DelegateCall, gasleft()), "GS000");
                      }
                      /// @dev Allows to add a module to the whitelist.
                      ///      This can only be done via a Safe transaction.
                      /// @notice Enables the module `module` for the Safe.
                      /// @param module Module to be whitelisted.
                      function enableModule(address module) public authorized {
                          // Module address cannot be null or sentinel.
                          require(module != address(0) && module != SENTINEL_MODULES, "GS101");
                          // Module cannot be added twice.
                          require(modules[module] == address(0), "GS102");
                          modules[module] = modules[SENTINEL_MODULES];
                          modules[SENTINEL_MODULES] = module;
                          emit EnabledModule(module);
                      }
                      /// @dev Allows to remove a module from the whitelist.
                      ///      This can only be done via a Safe transaction.
                      /// @notice Disables the module `module` for the Safe.
                      /// @param prevModule Module that pointed to the module to be removed in the linked list
                      /// @param module Module to be removed.
                      function disableModule(address prevModule, address module) public authorized {
                          // Validate module address and check that it corresponds to module index.
                          require(module != address(0) && module != SENTINEL_MODULES, "GS101");
                          require(modules[prevModule] == module, "GS103");
                          modules[prevModule] = modules[module];
                          modules[module] = address(0);
                          emit DisabledModule(module);
                      }
                      /// @dev Allows a Module to execute a Safe transaction without any further confirmations.
                      /// @param to Destination address of module transaction.
                      /// @param value Ether value of module transaction.
                      /// @param data Data payload of module transaction.
                      /// @param operation Operation type of module transaction.
                      function execTransactionFromModule(
                          address to,
                          uint256 value,
                          bytes memory data,
                          Enum.Operation operation
                      ) public virtual returns (bool success) {
                          // Only whitelisted modules are allowed.
                          require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), "GS104");
                          // Execute transaction without further confirmations.
                          success = execute(to, value, data, operation, gasleft());
                          if (success) emit ExecutionFromModuleSuccess(msg.sender);
                          else emit ExecutionFromModuleFailure(msg.sender);
                      }
                      /// @dev Allows a Module to execute a Safe transaction without any further confirmations and return data
                      /// @param to Destination address of module transaction.
                      /// @param value Ether value of module transaction.
                      /// @param data Data payload of module transaction.
                      /// @param operation Operation type of module transaction.
                      function execTransactionFromModuleReturnData(
                          address to,
                          uint256 value,
                          bytes memory data,
                          Enum.Operation operation
                      ) public returns (bool success, bytes memory returnData) {
                          success = execTransactionFromModule(to, value, data, operation);
                          // solhint-disable-next-line no-inline-assembly
                          assembly {
                              // Load free memory location
                              let ptr := mload(0x40)
                              // We allocate memory for the return data by setting the free memory location to
                              // current free memory location + data size + 32 bytes for data size value
                              mstore(0x40, add(ptr, add(returndatasize(), 0x20)))
                              // Store the size
                              mstore(ptr, returndatasize())
                              // Store the data
                              returndatacopy(add(ptr, 0x20), 0, returndatasize())
                              // Point the return data to the correct memory location
                              returnData := ptr
                          }
                      }
                      /// @dev Returns if an module is enabled
                      /// @return True if the module is enabled
                      function isModuleEnabled(address module) public view returns (bool) {
                          return SENTINEL_MODULES != module && modules[module] != address(0);
                      }
                      /// @dev Returns array of modules.
                      /// @param start Start of the page.
                      /// @param pageSize Maximum number of modules that should be returned.
                      /// @return array Array of modules.
                      /// @return next Start of the next page.
                      function getModulesPaginated(address start, uint256 pageSize) external view returns (address[] memory array, address next) {
                          // Init array with max page size
                          array = new address[](pageSize);
                          // Populate return array
                          uint256 moduleCount = 0;
                          address currentModule = modules[start];
                          while (currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) {
                              array[moduleCount] = currentModule;
                              currentModule = modules[currentModule];
                              moduleCount++;
                          }
                          next = currentModule;
                          // Set correct size of returned array
                          // solhint-disable-next-line no-inline-assembly
                          assembly {
                              mstore(array, moduleCount)
                          }
                      }
                  }
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma solidity >=0.7.0 <0.9.0;
                  import "../common/SelfAuthorized.sol";
                  /// @title OwnerManager - Manages a set of owners and a threshold to perform actions.
                  /// @author Stefan George - <[email protected]>
                  /// @author Richard Meissner - <[email protected]>
                  contract OwnerManager is SelfAuthorized {
                      event AddedOwner(address owner);
                      event RemovedOwner(address owner);
                      event ChangedThreshold(uint256 threshold);
                      address internal constant SENTINEL_OWNERS = address(0x1);
                      mapping(address => address) internal owners;
                      uint256 internal ownerCount;
                      uint256 internal threshold;
                      /// @dev Setup function sets initial storage of contract.
                      /// @param _owners List of Safe owners.
                      /// @param _threshold Number of required confirmations for a Safe transaction.
                      function setupOwners(address[] memory _owners, uint256 _threshold) internal {
                          // Threshold can only be 0 at initialization.
                          // Check ensures that setup function can only be called once.
                          require(threshold == 0, "GS200");
                          // Validate that threshold is smaller than number of added owners.
                          require(_threshold <= _owners.length, "GS201");
                          // There has to be at least one Safe owner.
                          require(_threshold >= 1, "GS202");
                          // Initializing Safe owners.
                          address currentOwner = SENTINEL_OWNERS;
                          for (uint256 i = 0; i < _owners.length; i++) {
                              // Owner address cannot be null.
                              address owner = _owners[i];
                              require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this) && currentOwner != owner, "GS203");
                              // No duplicate owners allowed.
                              require(owners[owner] == address(0), "GS204");
                              owners[currentOwner] = owner;
                              currentOwner = owner;
                          }
                          owners[currentOwner] = SENTINEL_OWNERS;
                          ownerCount = _owners.length;
                          threshold = _threshold;
                      }
                      /// @dev Allows to add a new owner to the Safe and update the threshold at the same time.
                      ///      This can only be done via a Safe transaction.
                      /// @notice Adds the owner `owner` to the Safe and updates the threshold to `_threshold`.
                      /// @param owner New owner address.
                      /// @param _threshold New threshold.
                      function addOwnerWithThreshold(address owner, uint256 _threshold) public authorized {
                          // Owner address cannot be null, the sentinel or the Safe itself.
                          require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this), "GS203");
                          // No duplicate owners allowed.
                          require(owners[owner] == address(0), "GS204");
                          owners[owner] = owners[SENTINEL_OWNERS];
                          owners[SENTINEL_OWNERS] = owner;
                          ownerCount++;
                          emit AddedOwner(owner);
                          // Change threshold if threshold was changed.
                          if (threshold != _threshold) changeThreshold(_threshold);
                      }
                      /// @dev Allows to remove an owner from the Safe and update the threshold at the same time.
                      ///      This can only be done via a Safe transaction.
                      /// @notice Removes the owner `owner` from the Safe and updates the threshold to `_threshold`.
                      /// @param prevOwner Owner that pointed to the owner to be removed in the linked list
                      /// @param owner Owner address to be removed.
                      /// @param _threshold New threshold.
                      function removeOwner(
                          address prevOwner,
                          address owner,
                          uint256 _threshold
                      ) public authorized {
                          // Only allow to remove an owner, if threshold can still be reached.
                          require(ownerCount - 1 >= _threshold, "GS201");
                          // Validate owner address and check that it corresponds to owner index.
                          require(owner != address(0) && owner != SENTINEL_OWNERS, "GS203");
                          require(owners[prevOwner] == owner, "GS205");
                          owners[prevOwner] = owners[owner];
                          owners[owner] = address(0);
                          ownerCount--;
                          emit RemovedOwner(owner);
                          // Change threshold if threshold was changed.
                          if (threshold != _threshold) changeThreshold(_threshold);
                      }
                      /// @dev Allows to swap/replace an owner from the Safe with another address.
                      ///      This can only be done via a Safe transaction.
                      /// @notice Replaces the owner `oldOwner` in the Safe with `newOwner`.
                      /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list
                      /// @param oldOwner Owner address to be replaced.
                      /// @param newOwner New owner address.
                      function swapOwner(
                          address prevOwner,
                          address oldOwner,
                          address newOwner
                      ) public authorized {
                          // Owner address cannot be null, the sentinel or the Safe itself.
                          require(newOwner != address(0) && newOwner != SENTINEL_OWNERS && newOwner != address(this), "GS203");
                          // No duplicate owners allowed.
                          require(owners[newOwner] == address(0), "GS204");
                          // Validate oldOwner address and check that it corresponds to owner index.
                          require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, "GS203");
                          require(owners[prevOwner] == oldOwner, "GS205");
                          owners[newOwner] = owners[oldOwner];
                          owners[prevOwner] = newOwner;
                          owners[oldOwner] = address(0);
                          emit RemovedOwner(oldOwner);
                          emit AddedOwner(newOwner);
                      }
                      /// @dev Allows to update the number of required confirmations by Safe owners.
                      ///      This can only be done via a Safe transaction.
                      /// @notice Changes the threshold of the Safe to `_threshold`.
                      /// @param _threshold New threshold.
                      function changeThreshold(uint256 _threshold) public authorized {
                          // Validate that threshold is smaller than number of owners.
                          require(_threshold <= ownerCount, "GS201");
                          // There has to be at least one Safe owner.
                          require(_threshold >= 1, "GS202");
                          threshold = _threshold;
                          emit ChangedThreshold(threshold);
                      }
                      function getThreshold() public view returns (uint256) {
                          return threshold;
                      }
                      function isOwner(address owner) public view returns (bool) {
                          return owner != SENTINEL_OWNERS && owners[owner] != address(0);
                      }
                      /// @dev Returns array of owners.
                      /// @return Array of Safe owners.
                      function getOwners() public view returns (address[] memory) {
                          address[] memory array = new address[](ownerCount);
                          // populate return array
                          uint256 index = 0;
                          address currentOwner = owners[SENTINEL_OWNERS];
                          while (currentOwner != SENTINEL_OWNERS) {
                              array[index] = currentOwner;
                              currentOwner = owners[currentOwner];
                              index++;
                          }
                          return array;
                      }
                  }
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma solidity >=0.7.0 <0.9.0;
                  /// @title Enum - Collection of enums
                  /// @author Richard Meissner - <[email protected]>
                  contract Enum {
                      enum Operation {Call, DelegateCall}
                  }
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma solidity >=0.7.0 <0.9.0;
                  /// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments
                  /// @author Richard Meissner - <[email protected]>
                  contract EtherPaymentFallback {
                      event SafeReceived(address indexed sender, uint256 value);
                      /// @dev Fallback function accepts Ether transactions.
                      receive() external payable {
                          emit SafeReceived(msg.sender, msg.value);
                      }
                  }
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma solidity >=0.7.0 <0.9.0;
                  /// @title SecuredTokenTransfer - Secure token transfer
                  /// @author Richard Meissner - <[email protected]>
                  contract SecuredTokenTransfer {
                      /// @dev Transfers a token and returns if it was a success
                      /// @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
                      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-assembly
                          assembly {
                              // We write the return value to scratch space.
                              // See https://docs.soliditylang.org/en/v0.7.6/internals/layout_in_memory.html#layout-in-memory
                              let success := call(sub(gas(), 10000), token, 0, add(data, 0x20), mload(data), 0, 0x20)
                              switch returndatasize()
                                  case 0 {
                                      transferred := success
                                  }
                                  case 0x20 {
                                      transferred := iszero(or(iszero(success), iszero(mload(0))))
                                  }
                                  default {
                                      transferred := 0
                                  }
                          }
                      }
                  }
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma solidity >=0.7.0 <0.9.0;
                  /// @title SelfAuthorized - authorizes current contract to perform actions
                  /// @author Richard Meissner - <[email protected]>
                  contract SelfAuthorized {
                      function requireSelfCall() private view {
                          require(msg.sender == address(this), "GS031");
                      }
                      modifier authorized() {
                          // This is a function call as it minimized the bytecode size
                          requireSelfCall();
                          _;
                      }
                  }
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma solidity >=0.7.0 <0.9.0;
                  /// @title SignatureDecoder - Decodes signatures that a encoded as bytes
                  /// @author Richard Meissner - <[email protected]>
                  contract SignatureDecoder {
                      /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`.
                      /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures
                      /// @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 rsv signatures
                      function signatureSplit(bytes memory signatures, uint256 pos)
                          internal
                          pure
                          returns (
                              uint8 v,
                              bytes32 r,
                              bytes32 s
                          )
                      {
                          // The signature format is a compact form of:
                          //   {bytes32 r}{bytes32 s}{uint8 v}
                          // Compact means, uint8 is not padded to 32 bytes.
                          // solhint-disable-next-line no-inline-assembly
                          assembly {
                              let signaturePos := mul(0x41, pos)
                              r := mload(add(signatures, add(signaturePos, 0x20)))
                              s := mload(add(signatures, add(signaturePos, 0x40)))
                              // Here we are loading the last 32 bytes, including 31 bytes
                              // of 's'. There is no 'mload8' to do this.
                              //
                              // 'byte' is not working due to the Solidity parser, so lets
                              // use the second best option, 'and'
                              v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff)
                          }
                      }
                  }
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma solidity >=0.7.0 <0.9.0;
                  /// @title Singleton - Base for singleton contracts (should always be first super contract)
                  ///         This contract is tightly coupled to our proxy contract (see `proxies/GnosisSafeProxy.sol`)
                  /// @author Richard Meissner - <[email protected]>
                  contract Singleton {
                      // singleton always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract.
                      // It should also always be ensured that the address is stored alone (uses a full word)
                      address private singleton;
                  }
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma solidity >=0.7.0 <0.9.0;
                  /// @title StorageAccessible - generic base contract that allows callers to access all internal storage.
                  /// @notice See https://github.com/gnosis/util-contracts/blob/bb5fe5fb5df6d8400998094fb1b32a178a47c3a1/contracts/StorageAccessible.sol
                  contract StorageAccessible {
                      /**
                       * @dev 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-assembly
                              assembly {
                                  let word := sload(add(offset, index))
                                  mstore(add(add(result, 0x20), mul(index, 0x20)), word)
                              }
                          }
                          return result;
                      }
                      /**
                       * @dev Performs a delegetecall on a targetContract in the context of self.
                       * Internally reverts execution to avoid side effects (making it static).
                       *
                       * This method reverts with data equal to `abi.encode(bool(success), bytes(response))`.
                       * Specifically, the `returndata` after a call to this method will be:
                       * `success:bool || response.length:uint256 || response:bytes`.
                       *
                       * @param targetContract Address of the contract containing the code to execute.
                       * @param calldataPayload Calldata that should be sent to the target contract (encoded method name and arguments).
                       */
                      function simulateAndRevert(address targetContract, bytes memory calldataPayload) external {
                          // solhint-disable-next-line no-inline-assembly
                          assembly {
                              let success := delegatecall(gas(), targetContract, add(calldataPayload, 0x20), mload(calldataPayload), 0, 0)
                              mstore(0x00, success)
                              mstore(0x20, returndatasize())
                              returndatacopy(0x40, 0, returndatasize())
                              revert(0, add(returndatasize(), 0x40))
                          }
                      }
                  }
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma solidity >=0.7.0 <0.9.0;
                  /**
                   * @title GnosisSafeMath
                   * @dev Math operations with safety checks that revert on error
                   * Renamed from SafeMath to GnosisSafeMath to avoid conflicts
                   * TODO: remove once open zeppelin update to solc 0.5.0
                   */
                  library GnosisSafeMath {
                      /**
                       * @dev Multiplies two numbers, reverts on overflow.
                       */
                      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/522
                          if (a == 0) {
                              return 0;
                          }
                          uint256 c = a * b;
                          require(c / a == b);
                          return c;
                      }
                      /**
                       * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
                       */
                      function sub(uint256 a, uint256 b) internal pure returns (uint256) {
                          require(b <= a);
                          uint256 c = a - b;
                          return c;
                      }
                      /**
                       * @dev Adds two numbers, reverts on overflow.
                       */
                      function add(uint256 a, uint256 b) internal pure returns (uint256) {
                          uint256 c = a + b;
                          require(c >= a);
                          return c;
                      }
                      /**
                       * @dev Returns the largest of two numbers.
                       */
                      function max(uint256 a, uint256 b) internal pure returns (uint256) {
                          return a >= b ? a : b;
                      }
                  }
                  // SPDX-License-Identifier: LGPL-3.0-only
                  pragma 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 {
                      /**
                       * @dev Should return whether the signature provided is valid for the provided data
                       * @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);
                  }