ETH Price: $2,958.35 (+0.31%)

Contract

0xBdec68492d69A7ff1fb4C2ABF5C28aDE535dc88A

Overview

ETH Balance

Linea Mainnet LogoLinea Mainnet LogoLinea Mainnet Logo0.003035665869 ETH

ETH Value

$8.98 (@ $2,958.35/ETH)

More Info

Private Name Tags

Transaction Hash
Block
From
To
Attest0x Score S...278665232026-01-15 5:14:049 days ago1768454044IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000011560.03237357
Attest0x Score S...274572412026-01-05 15:03:5619 days ago1767625436IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000021350.05979162
Attest0x Score S...264220392025-12-07 8:02:3348 days ago1765094553IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000010920.03242492
Attest0x Score S...264219252025-12-07 7:57:5948 days ago1765094279IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000011560.03237357
Attest0x Score S...240205902025-10-01 11:55:40115 days ago1759319740IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000014120.039548
Withdraw232257382025-09-12 9:38:49134 days ago1757669929IN
0xScore: ZeroXScorePortal
0 ETH0.000001620.05217329
Attest0x Score S...225703542025-08-27 9:28:34150 days ago1756286914IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000013370.03966872
Attest0x Score S...224729852025-08-25 1:29:12152 days ago1756085352IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000013370.03966872
Attest0x Score S...222003042025-08-18 13:43:21159 days ago1755524601IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000013370.03966872
Attest0x Score S...221122592025-08-16 11:49:48161 days ago1755344988IN
0xScore: ZeroXScorePortal
0.0005 ETH0.0000140.0415577
Attest0x Score S...219890012025-08-13 13:39:38164 days ago1755092378IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000013360.03966879
Attest0x Score S...219889882025-08-13 13:39:12164 days ago1755092352IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000013360.03966879
Attest0x Score S...219417882025-08-12 11:10:48165 days ago1754997048IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000012730.03777973
Attest0x Score S...219415502025-08-12 11:02:50165 days ago1754996570IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000013460.03768143
Attest0x Score S...219337342025-08-12 6:41:42165 days ago1754980902IN
0xScore: ZeroXScorePortal
0.0005 ETH0.0000140.0415577
Attest0x Score S...219335562025-08-12 6:35:46165 days ago1754980546IN
0xScore: ZeroXScorePortal
0.0005 ETH0.0000140.0415577
Attest0x Score S...219335482025-08-12 6:35:30165 days ago1754980530IN
0xScore: ZeroXScorePortal
0.0005 ETH0.00001480.04144957
Attest0x Score S...219237782025-08-12 1:07:19165 days ago1754960839IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000013370.03966872
Attest0x Score S...219237622025-08-12 1:06:47165 days ago1754960807IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000013370.03966872
Attest0x Score S...219235912025-08-12 1:01:01165 days ago1754960461IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000013370.03966872
Attest0x Score S...219235812025-08-12 1:00:39165 days ago1754960439IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000014130.03956551
Attest0x Score S...219084092025-08-11 16:17:13165 days ago1754929033IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000014130.03956551
Attest0x Score S...219053482025-08-11 14:32:10166 days ago1754922730IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000015280.0453356
Attest0x Score S...219053362025-08-11 14:31:46166 days ago1754922706IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000015280.0453356
Attest0x Score S...219047032025-08-11 14:10:32166 days ago1754921432IN
0xScore: ZeroXScorePortal
0.0005 ETH0.000014130.03956557
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
278665232026-01-15 5:14:049 days ago1768454044
0xScore: ZeroXScorePortal
0 ETH
278665232026-01-15 5:14:049 days ago1768454044
0xScore: ZeroXScorePortal
0 ETH
274572412026-01-05 15:03:5619 days ago1767625436
0xScore: ZeroXScorePortal
0 ETH
274572412026-01-05 15:03:5619 days ago1767625436
0xScore: ZeroXScorePortal
0 ETH
264220392025-12-07 8:02:3348 days ago1765094553
0xScore: ZeroXScorePortal
0 ETH
264220392025-12-07 8:02:3348 days ago1765094553
0xScore: ZeroXScorePortal
0 ETH
264219252025-12-07 7:57:5948 days ago1765094279
0xScore: ZeroXScorePortal
0 ETH
264219252025-12-07 7:57:5948 days ago1765094279
0xScore: ZeroXScorePortal
0 ETH
240205902025-10-01 11:55:40115 days ago1759319740
0xScore: ZeroXScorePortal
0 ETH
240205902025-10-01 11:55:40115 days ago1759319740
0xScore: ZeroXScorePortal
0 ETH
232257382025-09-12 9:38:49134 days ago1757669929
0xScore: ZeroXScorePortal
0.039 ETH
225703542025-08-27 9:28:34150 days ago1756286914
0xScore: ZeroXScorePortal
0 ETH
225703542025-08-27 9:28:34150 days ago1756286914
0xScore: ZeroXScorePortal
0 ETH
224729852025-08-25 1:29:12152 days ago1756085352
0xScore: ZeroXScorePortal
0 ETH
224729852025-08-25 1:29:12152 days ago1756085352
0xScore: ZeroXScorePortal
0 ETH
222003042025-08-18 13:43:21159 days ago1755524601
0xScore: ZeroXScorePortal
0 ETH
222003042025-08-18 13:43:21159 days ago1755524601
0xScore: ZeroXScorePortal
0 ETH
221122592025-08-16 11:49:48161 days ago1755344988
0xScore: ZeroXScorePortal
0 ETH
221122592025-08-16 11:49:48161 days ago1755344988
0xScore: ZeroXScorePortal
0 ETH
219890012025-08-13 13:39:38164 days ago1755092378
0xScore: ZeroXScorePortal
0 ETH
219890012025-08-13 13:39:38164 days ago1755092378
0xScore: ZeroXScorePortal
0 ETH
219889882025-08-13 13:39:12164 days ago1755092352
0xScore: ZeroXScorePortal
0 ETH
219889882025-08-13 13:39:12164 days ago1755092352
0xScore: ZeroXScorePortal
0 ETH
219417882025-08-12 11:10:48165 days ago1754997048
0xScore: ZeroXScorePortal
0 ETH
219417882025-08-12 11:10:48165 days ago1754997048
0xScore: ZeroXScorePortal
0 ETH
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ZeroXScorePortal

Compiler Version
v0.8.21+commit.d9974bed

Optimization Enabled:
Yes with 200 runs

Other Settings:
london EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

import { AbstractPortal } from "verax/abstracts/AbstractPortal.sol";
import { AttestationPayload } from "verax/types/Structs.sol";
import { Ownable } from "openzeppelin/access/Ownable.sol";
import { Pausable } from "openzeppelin/utils/Pausable.sol";


contract ZeroXScorePortal is
    Ownable,
    Pausable,
    AbstractPortal
{
    struct AttestationRequestData {
        uint64 expirationTime;
        uint32 score;
        address walletAddress;
    }

    bytes32 public schema;
    uint256 public issuePrice;
    uint256 public reIssuePrice;
    mapping(address => bool) private _alreadyIssued;

    error WithdrawFail();

    error AttestationExpired();

    error AttestationWrong();

    constructor(
        address[] memory modules,
        address router,
        bytes32 _schema,
        uint256 _issuePrice,
        uint256 _reIssuePrice
    ) AbstractPortal(modules, router) Ownable(msg.sender) {
      schema = _schema;
      issuePrice = _issuePrice;
      reIssuePrice = _reIssuePrice;
    }


    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }

    function withdraw(
        address payable to,
        uint256 amount
    ) external override onlyOwner {
        (bool s, ) = to.call{ value: amount }("");
        if (!s) revert WithdrawFail();
    }

    function attest0xScoreSimple(
        uint64 expirationTime,
        address walletAddress,
        uint32 score,
        bytes memory signature
    ) public payable whenNotPaused {
        checkPrice();

        AttestationRequestData memory attestationRequestData = AttestationRequestData(
            expirationTime,
            score,
            walletAddress
        );
        bytes[] memory validationPayload = new bytes[](1);
        validationPayload[0] = signature;
        attest0xScore(attestationRequestData, validationPayload);
    }


    function attest0xScore(
        AttestationRequestData memory attestationRequestData,
        bytes[] memory validationPayload
    ) internal {
        if (attestationRequestData.expirationTime < block.timestamp) {
            revert AttestationExpired();
        }

        bytes memory attestationData = abi.encode(
            attestationRequestData.score
        );
        AttestationPayload memory attestationPayload = AttestationPayload(
            schema,
            attestationRequestData.expirationTime,
            abi.encode(attestationRequestData.walletAddress),
            attestationData
        );
        super.attest(attestationPayload, validationPayload);
    }

    function bulkAttest0xScore(
        AttestationRequestData[] memory attestationsRequests,
        bytes[] memory validationPayload
    ) public onlyOwner {
        for (uint256 i = 0; i < attestationsRequests.length; i++) {
            attest0xScore(attestationsRequests[i], validationPayload);
        }
    }

    function setIssuePrice(uint256 price) public onlyOwner {
      issuePrice = price;
    }

    function setReIssuePrice(uint256 price) public onlyOwner {
      reIssuePrice = price;
    }

    function checkPrice() internal {
        uint256 price;
        if (_alreadyIssued[msg.sender]) {
            price = reIssuePrice;
        } else {
            price = issuePrice;
            _alreadyIssued[msg.sender] = true;
        }
        require(msg.value >= price, "value < price");
    }
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

import { AttestationRegistry } from "../AttestationRegistry.sol";
import { ModuleRegistry } from "../ModuleRegistry.sol";
import { PortalRegistry } from "../PortalRegistry.sol";
import { AttestationPayload } from "../types/Structs.sol";
import { IERC165 } from "openzeppelin-contracts/contracts/utils/introspection/ERC165.sol";
import { IRouter } from "../interfaces/IRouter.sol";
import { IPortal } from "../interfaces/IPortal.sol";

/**
 * @title Abstract Portal
 * @author Consensys
 * @notice This contract is an abstract contract with basic Portal logic
 *         to be inherited. We strongly encourage all Portals to implement
 *         this contract.
 */
abstract contract AbstractPortal is IPortal {
  IRouter public router;
  address[] public modules;
  ModuleRegistry public moduleRegistry;
  AttestationRegistry public attestationRegistry;
  PortalRegistry public portalRegistry;

  /// @notice Error thrown when someone else than the portal's owner is trying to revoke
  error OnlyPortalOwner();

  /**
   * @notice Contract constructor
   * @param _modules list of modules to use for the portal (can be empty)
   * @param _router Router's address
   * @dev This sets the addresses for the AttestationRegistry, ModuleRegistry and PortalRegistry
   */
  constructor(address[] memory _modules, address _router) {
    modules = _modules;
    router = IRouter(_router);
    attestationRegistry = AttestationRegistry(router.getAttestationRegistry());
    moduleRegistry = ModuleRegistry(router.getModuleRegistry());
    portalRegistry = PortalRegistry(router.getPortalRegistry());
  }

  /**
   * @notice Optional method to withdraw funds from the Portal
   * @param to the address to send the funds to
   * @param amount the amount to withdraw
   */
  function withdraw(address payable to, uint256 amount) external virtual;

  /**
   * @notice Attest the schema with given attestationPayload and validationPayload
   * @param attestationPayload the payload to attest
   * @param validationPayloads the payloads to validate via the modules to issue the attestations
   * @dev Runs all modules for the portal and registers the attestation using AttestationRegistry
   */
  function attest(AttestationPayload memory attestationPayload, bytes[] memory validationPayloads) public payable {
    moduleRegistry.runModules(modules, attestationPayload, validationPayloads, msg.value);

    _onAttest(attestationPayload, getAttester(), msg.value);

    attestationRegistry.attest(attestationPayload, getAttester());
  }

  /**
   * @notice Bulk attest the schema with payloads to attest and validation payloads
   * @param attestationsPayloads the payloads to attest
   * @param validationPayloads the payloads to validate via the modules to issue the attestations
   */
  function bulkAttest(AttestationPayload[] memory attestationsPayloads, bytes[][] memory validationPayloads) public {
    moduleRegistry.bulkRunModules(modules, attestationsPayloads, validationPayloads);

    _onBulkAttest(attestationsPayloads, validationPayloads);

    attestationRegistry.bulkAttest(attestationsPayloads, getAttester());
  }

  /**
   * @notice Replaces the attestation for the given identifier and replaces it with a new attestation
   * @param attestationId the ID of the attestation to replace
   * @param attestationPayload the attestation payload to create the new attestation and register it
   * @param validationPayloads the payloads to validate via the modules to issue the attestation
   * @dev Runs all modules for the portal and registers the attestation using AttestationRegistry
   */
  function replace(
    bytes32 attestationId,
    AttestationPayload memory attestationPayload,
    bytes[] memory validationPayloads
  ) public payable {
    moduleRegistry.runModules(modules, attestationPayload, validationPayloads, msg.value);

    _onReplace(attestationId, attestationPayload, getAttester(), msg.value);

    attestationRegistry.replace(attestationId, attestationPayload, getAttester());
  }

  /**
   * @notice Bulk replaces the attestation for the given identifiers and replaces them with new attestations
   * @param attestationIds the list of IDs of the attestations to replace
   * @param attestationsPayloads the list of attestation payloads to create the new attestations and register them
   * @param validationPayloads the payloads to validate via the modules to issue the attestations
   */
  function bulkReplace(
    bytes32[] memory attestationIds,
    AttestationPayload[] memory attestationsPayloads,
    bytes[][] memory validationPayloads
  ) public {
    moduleRegistry.bulkRunModules(modules, attestationsPayloads, validationPayloads);

    _onBulkReplace(attestationIds, attestationsPayloads, validationPayloads);

    attestationRegistry.bulkReplace(attestationIds, attestationsPayloads, getAttester());
  }

  /**
   * @notice Revokes an attestation for the given identifier
   * @param attestationId the ID of the attestation to revoke
   * @dev By default, revocation is only possible by the portal owner
   * We strongly encourage implementing such a rule in your Portal if you intend on overriding this method
   */
  function revoke(bytes32 attestationId) public {
    _onRevoke(attestationId);

    attestationRegistry.revoke(attestationId);
  }

  /**
   * @notice Bulk revokes a list of attestations for the given identifiers
   * @param attestationIds the IDs of the attestations to revoke
   */
  function bulkRevoke(bytes32[] memory attestationIds) public {
    _onBulkRevoke(attestationIds);

    attestationRegistry.bulkRevoke(attestationIds);
  }

  /**
   * @notice Get all the modules addresses used by the Portal
   * @return The list of modules addresses linked to the Portal
   */
  function getModules() external view returns (address[] memory) {
    return modules;
  }

  /**
   * @notice Verifies that a specific interface is implemented by the Portal, following ERC-165 specification
   * @param interfaceID the interface identifier checked in this call
   * @return The list of modules addresses linked to the Portal
   */
  function supportsInterface(bytes4 interfaceID) public pure virtual override returns (bool) {
    return
      interfaceID == type(AbstractPortal).interfaceId ||
      interfaceID == type(IPortal).interfaceId ||
      interfaceID == type(IERC165).interfaceId;
  }

  /**
   * @notice Defines the address of the entity issuing attestations to the subject
   * @dev We strongly encourage a reflection when overriding this rule: who should be set as the attester?
   */
  function getAttester() public view virtual returns (address) {
    return msg.sender;
  }

  /**
   * @notice Optional method run before a payload is attested
   * @param attestationPayload the attestation payload supposed to be attested
   * @param attester the address of the attester
   * @param value the value sent with the attestation
   */
  function _onAttest(AttestationPayload memory attestationPayload, address attester, uint256 value) internal virtual {}

  /**
   * @notice Optional method run when an attestation is replaced
   * @param attestationId the ID of the attestation being replaced
   * @param attestationPayload the attestation payload to create attestation and register it
   * @param attester the address of the attester
   * @param value the value sent with the attestation
   */
  function _onReplace(
    bytes32 attestationId,
    AttestationPayload memory attestationPayload,
    address attester,
    uint256 value
  ) internal virtual {}

  /**
   * @notice Optional method run when attesting a batch of payloads
   * @param attestationsPayloads the payloads to attest
   * @param validationPayloads the payloads to validate in order to issue the attestations
   */
  function _onBulkAttest(
    AttestationPayload[] memory attestationsPayloads,
    bytes[][] memory validationPayloads
  ) internal virtual {}

  function _onBulkReplace(
    bytes32[] memory attestationIds,
    AttestationPayload[] memory attestationsPayloads,
    bytes[][] memory validationPayloads
  ) internal virtual {}

  /**
   * @notice Optional method run when an attestation is revoked or replaced
   * @dev    IMPORTANT NOTE: By default, revocation is only possible by the portal owner
   */
  function _onRevoke(bytes32 /*attestationId*/) internal virtual {
    if (msg.sender != portalRegistry.getPortalByAddress(address(this)).ownerAddress) revert OnlyPortalOwner();
  }

  /**
   * @notice Optional method run when a batch of attestations are revoked or replaced
   * @dev    IMPORTANT NOTE: By default, revocation is only possible by the portal owner
   */
  function _onBulkRevoke(bytes32[] memory /*attestationIds*/) internal virtual {
    if (msg.sender != portalRegistry.getPortalByAddress(address(this)).ownerAddress) revert OnlyPortalOwner();
  }
}

File 3 of 21 : Structs.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

struct AttestationPayload {
  bytes32 schemaId; // The identifier of the schema this attestation adheres to.
  uint64 expirationDate; // The expiration date of the attestation.
  bytes subject; // The ID of the attestee, EVM address, DID, URL etc.
  bytes attestationData; // The attestation data.
}

struct Attestation {
  bytes32 attestationId; // The unique identifier of the attestation.
  bytes32 schemaId; // The identifier of the schema this attestation adheres to.
  bytes32 replacedBy; // Whether the attestation was replaced by a new one.
  address attester; // The address issuing the attestation to the subject.
  address portal; // The id of the portal that created the attestation.
  uint64 attestedDate; // The date the attestation is issued.
  uint64 expirationDate; // The expiration date of the attestation.
  uint64 revocationDate; // The date when the attestation was revoked.
  uint16 version; // Version of the registry when the attestation was created.
  bool revoked; // Whether the attestation is revoked or not.
  bytes subject; // The ID of the attestee, EVM address, DID, URL etc.
  bytes attestationData; // The attestation data.
}

struct Schema {
  string name; // The name of the schema.
  string description; // A description of the schema.
  string context; // The context of the schema.
  string schema; // The schema definition.
}

struct Portal {
  address id; // The unique identifier of the portal.
  address ownerAddress; // The address of the owner of this portal.
  address[] modules; // Addresses of modules implemented by the portal.
  bool isRevocable; // Whether attestations issued can be revoked.
  string name; // The name of the portal.
  string description; // A description of the portal.
  string ownerName; // The name of the owner of this portal.
}

struct Module {
  address moduleAddress; // The address of the module.
  string name; // The name of the module.
  string description; // A description of the module.
}

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

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @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.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * 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.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(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 virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

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

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    bool private _paused;

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

import { OwnableUpgradeable } from "openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol";
import { Attestation, AttestationPayload } from "./types/Structs.sol";
import { PortalRegistry } from "./PortalRegistry.sol";
import { SchemaRegistry } from "./SchemaRegistry.sol";
import { IRouter } from "./interfaces/IRouter.sol";
import { uncheckedInc256 } from "./Common.sol";

/**
 * @title Attestation Registry
 * @author Consensys
 * @notice This contract stores a registry of all attestations
 */
contract AttestationRegistry is OwnableUpgradeable {
  IRouter public router;

  uint16 private version;
  uint32 private attestationIdCounter;

  mapping(bytes32 attestationId => Attestation attestation) private attestations;

  uint256 private chainPrefix;

  /// @notice Error thrown when a non-portal tries to call a method that can only be called by a portal
  error OnlyPortal();
  /// @notice Error thrown when an invalid Router address is given
  error RouterInvalid();
  /// @notice Error thrown when an attestation is not registered in the AttestationRegistry
  error AttestationNotAttested();
  /// @notice Error thrown when an attempt is made to revoke an attestation by an entity other than the attesting portal
  error OnlyAttestingPortal();
  /// @notice Error thrown when a schema id is not registered
  error SchemaNotRegistered();
  /// @notice Error thrown when an attestation subject is empty
  error AttestationSubjectFieldEmpty();
  /// @notice Error thrown when an attestation data field is empty
  error AttestationDataFieldEmpty();
  /// @notice Error thrown when an attempt is made to bulk replace with mismatched parameter array lengths
  error ArrayLengthMismatch();
  /// @notice Error thrown when an attempt is made to revoke an attestation that was already revoked
  error AlreadyRevoked();
  /// @notice Error thrown when an attempt is made to revoke an attestation based on a non-revocable schema
  error AttestationNotRevocable();

  /// @notice Event emitted when an attestation is registered
  event AttestationRegistered(bytes32 indexed attestationId);
  /// @notice Event emitted when an attestation is replaced
  event AttestationReplaced(bytes32 attestationId, bytes32 replacedBy);
  /// @notice Event emitted when an attestation is revoked
  event AttestationRevoked(bytes32 attestationId);
  /// @notice Event emitted when the version number is incremented
  event VersionUpdated(uint16 version);

  /**
   * @notice Checks if the caller is a registered portal
   * @param portal the portal address
   */
  modifier onlyPortals(address portal) {
    bool isPortalRegistered = PortalRegistry(router.getPortalRegistry()).isRegistered(portal);
    if (!isPortalRegistered) revert OnlyPortal();
    _;
  }

  /// @custom:oz-upgrades-unsafe-allow constructor
  constructor() {
    _disableInitializers();
  }

  /**
   * @notice Contract initialization
   */
  function initialize() public initializer {
    __Ownable_init(msg.sender);
  }

  /**
   * @notice Changes the address for the Router
   * @dev Only the registry owner can call this method
   */
  function updateRouter(address _router) public onlyOwner {
    if (_router == address(0)) revert RouterInvalid();
    router = IRouter(_router);
  }

  /**
   * @notice Changes the chain prefix for the attestation IDs
   * @dev Only the registry owner can call this method
   */
  function updateChainPrefix(uint256 _chainPrefix) public onlyOwner {
    chainPrefix = _chainPrefix;
  }

  /**
   * @notice Registers an attestation to the AttestationRegistry
   * @param attestationPayload the attestation payload to create attestation and register it
   * @param attester the account address issuing the attestation
   * @dev This method is only callable by a registered Portal
   */
  function attest(AttestationPayload calldata attestationPayload, address attester) public onlyPortals(msg.sender) {
    // Verify the schema id exists
    SchemaRegistry schemaRegistry = SchemaRegistry(router.getSchemaRegistry());
    if (!schemaRegistry.isRegistered(attestationPayload.schemaId)) revert SchemaNotRegistered();
    // Verify the subject field is not blank
    if (attestationPayload.subject.length == 0) revert AttestationSubjectFieldEmpty();
    // Verify the attestationData field is not blank
    if (attestationPayload.attestationData.length == 0) revert AttestationDataFieldEmpty();
    // Auto increment attestation counter
    attestationIdCounter++;
    // Generate the full attestation ID, padded with the chain prefix
    bytes32 id = generateAttestationId(attestationIdCounter);
    // Create attestation
    attestations[id] = Attestation(
      id,
      attestationPayload.schemaId,
      bytes32(0),
      attester,
      msg.sender,
      uint64(block.timestamp),
      attestationPayload.expirationDate,
      0,
      version,
      false,
      attestationPayload.subject,
      attestationPayload.attestationData
    );
    emit AttestationRegistered(id);
  }

  /**
   * @notice Registers attestations to the AttestationRegistry
   * @param attestationsPayloads the attestations payloads to create attestations and register them
   */
  function bulkAttest(AttestationPayload[] calldata attestationsPayloads, address attester) public {
    for (uint256 i = 0; i < attestationsPayloads.length; i = uncheckedInc256(i)) {
      attest(attestationsPayloads[i], attester);
    }
  }

  function massImport(AttestationPayload[] calldata attestationsPayloads, address portal) public onlyOwner {
    for (uint256 i = 0; i < attestationsPayloads.length; i = uncheckedInc256(i)) {
      // Auto increment attestation counter
      attestationIdCounter++;
      // Generate the full attestation ID, padded with the chain prefix
      bytes32 id = generateAttestationId(attestationIdCounter);
      // Create attestation
      attestations[id] = Attestation(
        id,
        attestationsPayloads[i].schemaId,
        bytes32(0),
        msg.sender,
        portal,
        uint64(block.timestamp),
        attestationsPayloads[i].expirationDate,
        0,
        version,
        false,
        attestationsPayloads[i].subject,
        attestationsPayloads[i].attestationData
      );
      emit AttestationRegistered(id);
    }
  }

  /**
   * @notice Replaces an attestation for the given identifier and replaces it with a new attestation
   * @param attestationId the ID of the attestation to replace
   * @param attestationPayload the attestation payload to create the new attestation and register it
   * @param attester the account address issuing the attestation
   */
  function replace(bytes32 attestationId, AttestationPayload calldata attestationPayload, address attester) public {
    attest(attestationPayload, attester);
    revoke(attestationId);
    bytes32 replacedBy = generateAttestationId(attestationIdCounter);
    attestations[attestationId].replacedBy = replacedBy;

    emit AttestationReplaced(attestationId, replacedBy);
  }

  /**
   * @notice Replaces attestations for given identifiers and replaces them with new attestations
   * @param attestationIds the list of IDs of the attestations to replace
   * @param attestationPayloads the list of attestation payloads to create the new attestations and register them
   * @param attester the account address issuing the attestation
   */
  function bulkReplace(
    bytes32[] calldata attestationIds,
    AttestationPayload[] calldata attestationPayloads,
    address attester
  ) public {
    if (attestationIds.length != attestationPayloads.length) revert ArrayLengthMismatch();
    for (uint256 i = 0; i < attestationIds.length; i = uncheckedInc256(i)) {
      replace(attestationIds[i], attestationPayloads[i], attester);
    }
  }

  /**
   * @notice Revokes an attestation for a given identifier
   * @param attestationId the ID of the attestation to revoke
   */
  function revoke(bytes32 attestationId) public {
    if (!isRegistered(attestationId)) revert AttestationNotAttested();
    if (attestations[attestationId].revoked) revert AlreadyRevoked();
    if (msg.sender != attestations[attestationId].portal) revert OnlyAttestingPortal();
    if (!isRevocable(attestations[attestationId].portal)) revert AttestationNotRevocable();

    attestations[attestationId].revoked = true;
    attestations[attestationId].revocationDate = uint64(block.timestamp);

    emit AttestationRevoked(attestationId);
  }

  /**
   * @notice Bulk revokes a list of attestations for the given identifiers
   * @param attestationIds the IDs of the attestations to revoke
   */
  function bulkRevoke(bytes32[] memory attestationIds) external {
    for (uint256 i = 0; i < attestationIds.length; i = uncheckedInc256(i)) {
      revoke(attestationIds[i]);
    }
  }

  /**
   * @notice Checks if an attestation is registered
   * @param attestationId the attestation identifier
   * @return true if the attestation is registered, false otherwise
   */
  function isRegistered(bytes32 attestationId) public view returns (bool) {
    return attestations[attestationId].attestationId != bytes32(0);
  }

  /**
   * @notice Checks whether a portal issues revocable attestations
   * @param portalId the portal address (ID)
   * @return true if the attestations issued by this portal are revocable, false otherwise
   */
  function isRevocable(address portalId) public view returns (bool) {
    PortalRegistry portalRegistry = PortalRegistry(router.getPortalRegistry());
    return portalRegistry.getPortalByAddress(portalId).isRevocable;
  }

  /**
   * @notice Gets an attestation by its identifier
   * @param attestationId the attestation identifier
   * @return the attestation
   */
  function getAttestation(bytes32 attestationId) public view returns (Attestation memory) {
    if (!isRegistered(attestationId)) revert AttestationNotAttested();
    return attestations[attestationId];
  }

  /**
   * @notice Increments the registry version
   * @return The new version number
   */
  function incrementVersionNumber() public onlyOwner returns (uint16) {
    ++version;
    emit VersionUpdated(version);
    return version;
  }

  /**
   * @notice Gets the registry version
   * @return The current version number
   */
  function getVersionNumber() public view returns (uint16) {
    return version;
  }

  /**
   * @notice Gets the attestation counter
   * @return The attestation counter
   */
  function getAttestationIdCounter() public view returns (uint32) {
    return attestationIdCounter;
  }

  /**
   * @notice Gets the chain prefix used to generate the attestation IDs
   * @return The chain prefix
   */
  function getChainPrefix() public view returns (uint256) {
    return chainPrefix;
  }

  /**
   * @notice Checks if an address owns a given attestation following ERC-1155
   * @param account The address of the token holder
   * @param id ID of the attestation
   * @return The _owner's balance of the attestations on a given attestation ID
   */
  function balanceOf(address account, uint256 id) public view returns (uint256) {
    bytes32 attestationId = generateAttestationId(id);
    Attestation memory attestation = attestations[attestationId];
    if (attestation.subject.length > 20 && keccak256(attestation.subject) == keccak256(abi.encode(account))) {
      return 1;
    }
    if (attestation.subject.length == 20 && keccak256(attestation.subject) == keccak256(abi.encodePacked(account))) {
      return 1;
    }
    return 0;
  }

  /**
   * @notice Get the balance of multiple account/attestation pairs following ERC-1155
   * @param accounts The addresses of the attestation holders
   * @param ids ID of the attestations
   * @return The _owner's balance of the attestation for a given address (i.e. balance for each (owner, id) pair)
   */
  function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view returns (uint256[] memory) {
    if (accounts.length != ids.length) revert ArrayLengthMismatch();
    uint256[] memory result = new uint256[](accounts.length);
    for (uint256 i = 0; i < accounts.length; i = uncheckedInc256(i)) {
      result[i] = balanceOf(accounts[i], ids[i]);
    }
    return result;
  }

  /**
   * @notice Generate an attestation ID, prefixed by the Verax chain identifier
   * @param id The attestation ID (coming after the chain prefix)
   * @return The attestation ID
   */
  function generateAttestationId(uint256 id) internal view returns (bytes32) {
    // Combine the chain prefix and the ID
    return bytes32(abi.encode(chainPrefix + id));
  }
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

import { AttestationPayload, Module } from "./types/Structs.sol";
import { AbstractModule } from "./abstracts/AbstractModule.sol";
import { OwnableUpgradeable } from "openzeppelin-upgradeable/access/OwnableUpgradeable.sol";
// solhint-disable-next-line max-line-length
import { ERC165Checker } from "openzeppelin/utils/introspection/ERC165Checker.sol";
import { PortalRegistry } from "./PortalRegistry.sol";
import { IRouter } from "./interfaces/IRouter.sol";
import { uncheckedInc32 } from "./Common.sol";

/**
 * @title Module Registry
 * @author Consensys
 * @notice This contract aims to manage the Modules used by the Portals, including their discoverability
 */
contract ModuleRegistry is OwnableUpgradeable {
  IRouter public router;
  /// @dev The list of Modules, accessed by their address
  mapping(address id => Module module) public modules;
  /// @dev The list of Module addresses
  address[] public moduleAddresses;

  /// @notice Error thrown when an invalid Router address is given
  error RouterInvalid();
  /// @notice Error thrown when a non-issuer tries to call a method that can only be called by an issuer
  error OnlyIssuer();
  /// @notice Error thrown when an identical Module was already registered
  error ModuleAlreadyExists();
  /// @notice Error thrown when attempting to add a Module without a name
  error ModuleNameMissing();
  /// @notice Error thrown when attempting to add a Module without an address of deployed smart contract
  error ModuleAddressInvalid();
  /// @notice Error thrown when attempting to add a Module which has not implemented the IModule interface
  error ModuleInvalid();
  /// @notice Error thrown when attempting to run modules with no attestation payload provided
  error AttestationPayloadMissing();
  /// @notice Error thrown when module is not registered
  error ModuleNotRegistered();
  /// @notice Error thrown when module addresses and validation payload length mismatch
  error ModuleValidationPayloadMismatch();

  /// @notice Event emitted when a Module is registered
  event ModuleRegistered(string name, string description, address moduleAddress);

  /// @custom:oz-upgrades-unsafe-allow constructor
  constructor() {
    _disableInitializers();
  }

  /**
   * @notice Contract initialization
   */
  function initialize() public initializer {
    __Ownable_init(msg.sender);
  }

  /**
   * @notice Checks if the caller is a registered issuer.
   * @param issuer the issuer address
   */
  modifier onlyIssuers(address issuer) {
    bool isIssuerRegistered = PortalRegistry(router.getPortalRegistry()).isIssuer(issuer);
    if (!isIssuerRegistered) revert OnlyIssuer();
    _;
  }

  /**
   * @notice Changes the address for the Router
   * @dev Only the registry owner can call this method
   */
  function updateRouter(address _router) public onlyOwner {
    if (_router == address(0)) revert RouterInvalid();
    router = IRouter(_router);
  }

  /**
   * Check if address is smart contract and not EOA
   * @param contractAddress address to be verified
   * @return the result as true if it is a smart contract else false
   */
  function isContractAddress(address contractAddress) public view returns (bool) {
    return contractAddress.code.length > 0;
  }

  /**
   * @notice Registers a Module, with its metadata and run some checks:
   * - mandatory name
   * - mandatory module's deployed smart contract address
   * - the module must be unique
   * @param name the module name
   * @param description the module description
   * @param moduleAddress the address of the deployed smart contract
   * @dev the module is stored in a mapping, the number of modules is incremented and an event is emitted
   */
  function register(
    string memory name,
    string memory description,
    address moduleAddress
  ) public onlyIssuers(msg.sender) {
    if (bytes(name).length == 0) revert ModuleNameMissing();
    // Check if moduleAddress is a smart contract address
    if (!isContractAddress(moduleAddress)) revert ModuleAddressInvalid();
    // Check if module has implemented AbstractModule
    if (!ERC165Checker.supportsInterface(moduleAddress, type(AbstractModule).interfaceId)) {
      revert ModuleInvalid();
    }
    // Module address is used to identify uniqueness of the module
    if (bytes(modules[moduleAddress].name).length > 0) revert ModuleAlreadyExists();

    modules[moduleAddress] = Module(moduleAddress, name, description);
    moduleAddresses.push(moduleAddress);
    emit ModuleRegistered(name, description, moduleAddress);
  }

  /**
   * @notice Executes the run method for all given Modules that are registered
   * @param modulesAddresses the addresses of the registered modules
   * @param attestationPayload the payload to attest
   * @param validationPayloads the payloads to check for each module (one payload per module)
   * @dev check if modules are registered and execute run method for each module
   */
  function runModules(
    address[] memory modulesAddresses,
    AttestationPayload memory attestationPayload,
    bytes[] memory validationPayloads,
    uint256 value
  ) public {
    // If no modules provided, bypass module validation
    if (modulesAddresses.length == 0) return;
    // Each module involved must have a corresponding item from the validation payload
    if (modulesAddresses.length != validationPayloads.length) revert ModuleValidationPayloadMismatch();

    // For each module check if it is registered and call run method
    for (uint32 i = 0; i < modulesAddresses.length; i = uncheckedInc32(i)) {
      if (!isRegistered(modulesAddresses[i])) revert ModuleNotRegistered();
      AbstractModule(modulesAddresses[i]).run(attestationPayload, validationPayloads[i], tx.origin, value);
    }
  }

  /**
   * @notice Executes the modules validation for all attestations payloads for all given Modules that are registered
   * @param modulesAddresses the addresses of the registered modules
   * @param attestationsPayloads the payloads to attest
   * @param validationPayloads the payloads to check for each module
   * @dev NOTE: Currently the bulk run modules does not handle payable modules
   *            a default value of 0 is used.
   */
  function bulkRunModules(
    address[] memory modulesAddresses,
    AttestationPayload[] memory attestationsPayloads,
    bytes[][] memory validationPayloads
  ) public {
    for (uint32 i = 0; i < attestationsPayloads.length; i = uncheckedInc32(i)) {
      runModules(modulesAddresses, attestationsPayloads[i], validationPayloads[i], 0);
    }
  }

  /**
   * @notice Get the number of Modules managed by the contract
   * @return The number of Modules already registered
   * @dev Returns the length of the `moduleAddresses` array
   */
  function getModulesNumber() public view returns (uint256) {
    return moduleAddresses.length;
  }

  /**
   * @notice Checks that a module is registered in the module registry
   * @param moduleAddress The address of the Module to check
   * @return True if the Module is registered, False otherwise
   */
  function isRegistered(address moduleAddress) public view returns (bool) {
    return bytes(modules[moduleAddress].name).length > 0;
  }
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

import { OwnableUpgradeable } from "openzeppelin-upgradeable/access/OwnableUpgradeable.sol";
// solhint-disable-next-line max-line-length
import { ERC165Checker } from "openzeppelin/utils/introspection/ERC165Checker.sol";
import { AbstractPortal } from "./abstracts/AbstractPortal.sol";
import { DefaultPortal } from "./DefaultPortal.sol";
import { SchemaRegistry } from "./SchemaRegistry.sol";
import { Portal } from "./types/Structs.sol";
import { IRouter } from "./interfaces/IRouter.sol";
import { IPortal } from "./interfaces/IPortal.sol";

/**
 * @title Portal Registry
 * @author Consensys
 * @notice This contract aims to manage the Portals used by attestation issuers
 */
contract PortalRegistry is OwnableUpgradeable {
  IRouter public router;

  mapping(address id => Portal portal) private portals;

  mapping(address issuerAddress => bool isIssuer) private issuers;

  address[] private portalAddresses;

  /// @notice Error thrown when an invalid Router address is given
  error RouterInvalid();
  /// @notice Error thrown when a non-issuer tries to call a method that can only be called by an issuer
  error OnlyIssuer();
  /// @notice Error thrown when attempting to register a Portal twice
  error PortalAlreadyExists();
  /// @notice Error thrown when attempting to register a Portal that is not a smart contract
  error PortalAddressInvalid();
  /// @notice Error thrown when attempting to register a Portal with an empty name
  error PortalNameMissing();
  /// @notice Error thrown when attempting to register a Portal with an empty description
  error PortalDescriptionMissing();
  /// @notice Error thrown when attempting to register a Portal with an empty owner name
  error PortalOwnerNameMissing();
  /// @notice Error thrown when attempting to register a Portal that does not implement IPortal interface
  error PortalInvalid();
  /// @notice Error thrown when attempting to get a Portal that is not registered
  error PortalNotRegistered();

  /// @notice Event emitted when a Portal registered
  event PortalRegistered(string name, string description, address portalAddress);
  /// @notice Event emitted when a new issuer is added
  event IssuerAdded(address issuerAddress);
  /// @notice Event emitted when the issuer is removed
  event IssuerRemoved(address issuerAddress);

  /// @custom:oz-upgrades-unsafe-allow constructor
  constructor() {
    _disableInitializers();
  }

  /**
   * @notice Contract initialization
   */
  function initialize() public initializer {
    __Ownable_init(msg.sender);
  }

  /**
   * @notice Changes the address for the Router
   * @dev Only the registry owner can call this method
   */
  function updateRouter(address _router) public onlyOwner {
    if (_router == address(0)) revert RouterInvalid();
    router = IRouter(_router);
  }

  /**
   * @notice Registers an address as been an issuer
   * @param issuer the address to register as an issuer
   */
  function setIssuer(address issuer) public onlyOwner {
    issuers[issuer] = true;
    // Emit event
    emit IssuerAdded(issuer);
  }

  /**
   * @notice Revokes issuer status from an address
   * @param issuer the address to be revoked as an issuer
   */
  function removeIssuer(address issuer) public onlyOwner {
    issuers[issuer] = false;
    SchemaRegistry(router.getSchemaRegistry()).updateMatchingSchemaIssuers(issuer, msg.sender);
    // Emit event
    emit IssuerRemoved(issuer);
  }

  /**
   * @notice Checks if a given address is an issuer
   * @return A flag indicating whether the given address is an issuer
   */
  function isIssuer(address issuer) public view returns (bool) {
    return issuers[issuer];
  }

  /**
   * @notice Checks if the caller is a registered issuer.
   * @param issuer the issuer address
   */
  modifier onlyIssuers(address issuer) {
    if (!isIssuer(issuer)) revert OnlyIssuer();
    _;
  }

  /**
   * @notice Registers a Portal to the PortalRegistry
   * @param id the portal address
   * @param name the portal name
   * @param description the portal description
   * @param isRevocable whether the portal issues revocable attestations
   * @param ownerName name of this portal's owner
   */
  function register(
    address id,
    string memory name,
    string memory description,
    bool isRevocable,
    string memory ownerName
  ) public onlyIssuers(msg.sender) {
    // Check if portal already exists
    if (portals[id].id != address(0)) revert PortalAlreadyExists();

    // Check if portal is a smart contract
    if (!isContractAddress(id)) revert PortalAddressInvalid();

    // Check if name is not empty
    if (bytes(name).length == 0) revert PortalNameMissing();

    // Check if description is not empty
    if (bytes(description).length == 0) revert PortalDescriptionMissing();

    // Check if the owner's name is not empty
    if (bytes(ownerName).length == 0) revert PortalOwnerNameMissing();

    // Check if portal has implemented AbstractPortal
    if (!ERC165Checker.supportsInterface(id, type(IPortal).interfaceId)) revert PortalInvalid();

    // Get the array of modules implemented by the portal
    address[] memory modules = AbstractPortal(id).getModules();

    // Add portal to mapping
    Portal memory newPortal = Portal(id, msg.sender, modules, isRevocable, name, description, ownerName);
    portals[id] = newPortal;
    portalAddresses.push(id);

    // Emit event
    emit PortalRegistered(name, description, id);
  }

  /**
   * @notice Deploys and registers a clone of default portal
   * @param modules the modules addresses
   * @param name the portal name
   * @param description the portal description
   * @param ownerName name of this portal's owner
   */
  function deployDefaultPortal(
    address[] calldata modules,
    string memory name,
    string memory description,
    bool isRevocable,
    string memory ownerName
  ) external onlyIssuers(msg.sender) {
    DefaultPortal defaultPortal = new DefaultPortal(modules, address(router));
    register(address(defaultPortal), name, description, isRevocable, ownerName);
  }

  /**
   * @notice Get a Portal by its address
   * @param id The address of the Portal
   * @return The Portal
   */
  function getPortalByAddress(address id) public view returns (Portal memory) {
    if (!isRegistered(id)) revert PortalNotRegistered();
    return portals[id];
  }

  /**
   * @notice Check if a Portal is registered
   * @param id The address of the Portal
   * @return True if the Portal is registered, false otherwise
   */
  function isRegistered(address id) public view returns (bool) {
    return portals[id].id != address(0);
  }

  /**
   * @notice Get the number of Portals managed by the contract
   * @return The number of Portals already registered
   * @dev Returns the length of the `portalAddresses` array
   */
  function getPortalsCount() public view returns (uint256) {
    return portalAddresses.length;
  }

  /**
   * Check if address is smart contract and not EOA
   * @param contractAddress address to be verified
   * @return the result as true if it is a smart contract else false
   */
  function isContractAddress(address contractAddress) internal view returns (bool) {
    return contractAddress.code.length > 0;
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

/**
 * @title Router
 * @author Consensys
 * @notice This contract aims to provides a single entrypoint for the Verax registries
 */
interface IRouter {
  /**
   * @notice Gives the address for the AttestationRegistry contract
   * @return The current address of the AttestationRegistry contract
   */
  function getAttestationRegistry() external view returns (address);

  /**
   * @notice Gives the address for the ModuleRegistry contract
   * @return The current address of the ModuleRegistry contract
   */
  function getModuleRegistry() external view returns (address);

  /**
   * @notice Gives the address for the PortalRegistry contract
   * @return The current address of the PortalRegistry contract
   */
  function getPortalRegistry() external view returns (address);

  /**
   * @notice Gives the address for the SchemaRegistry contract
   * @return The current address of the SchemaRegistry contract
   */
  function getSchemaRegistry() external view returns (address);
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

import { IERC165 } from "openzeppelin-contracts/contracts/utils/introspection/ERC165.sol";

/**
 * @title IPortal
 * @author Consensys
 * @notice This contract is the interface to be implemented by any Portal.
 *         NOTE: A portal must implement this interface to registered on
 *         the PortalRegistry contract.
 */
interface IPortal is IERC165 {
  /**
   * @notice Get all the modules addresses used by the Portal
   * @return The list of modules addresses linked to the Portal
   */
  function getModules() external view returns (address[] memory);

  /**
   * @notice Defines the address of the entity issuing attestations to the subject
   * @dev We strongly encourage a reflection when implementing this method
   */
  function getAttester() external view returns (address);
}

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

pragma solidity ^0.8.20;

/**
 * @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 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.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

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

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @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.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * 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.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable
    struct OwnableStorage {
        address _owner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;

    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
        assembly {
            $.slot := OwnableStorageLocation
        }
    }

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    function __Ownable_init(address initialOwner) internal onlyInitializing {
        __Ownable_init_unchained(initialOwner);
    }

    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        OwnableStorage storage $ = _getOwnableStorage();
        return $._owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(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 virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        OwnableStorage storage $ = _getOwnableStorage();
        address oldOwner = $._owner;
        $._owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

import { OwnableUpgradeable } from "openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol";
import { Schema } from "./types/Structs.sol";
import { PortalRegistry } from "./PortalRegistry.sol";
import { IRouter } from "./interfaces/IRouter.sol";
import { uncheckedInc256 } from "./Common.sol";

/**
 * @title Schema Registry
 * @author Consensys
 * @notice This contract aims to manage the Schemas used by the Portals, including their discoverability
 */
contract SchemaRegistry is OwnableUpgradeable {
  IRouter public router;
  /// @dev The list of Schemas, accessed by their ID
  mapping(bytes32 id => Schema schema) private schemas;
  /// @dev The list of Schema IDs
  bytes32[] public schemaIds;
  /// @dev Associates a Schema ID with the address of the Issuer who created it
  mapping(bytes32 id => address issuer) private schemasIssuers;

  /// @notice Error thrown when an invalid Router address is given
  error RouterInvalid();
  /// @notice Error thrown when a non-issuer tries to call a method that can only be called by an issuer
  error OnlyIssuer();
  /// @notice Error thrown when any address which is not a portal registry tries to call a method
  error OnlyPortalRegistry();
  /// @notice Error thrown when a non-assigned issuer tries to call a method that can only be called by an assigned issuer
  error OnlyAssignedIssuer();
  /// @notice Error thrown when an invalid Issuer address is given
  error IssuerInvalid();
  /// @notice Error thrown when an identical Schema was already registered
  error SchemaAlreadyExists();
  /// @notice Error thrown when attempting to add a Schema without a name
  error SchemaNameMissing();
  /// @notice Error thrown when attempting to add a Schema without a string to define it
  error SchemaStringMissing();
  /// @notice Error thrown when attempting to get a Schema that is not registered
  error SchemaNotRegistered();

  /// @notice Event emitted when a Schema is created and registered
  event SchemaCreated(bytes32 indexed id, string name, string description, string context, string schemaString);
  /// @notice Event emitted when a Schema context is updated
  event SchemaContextUpdated(bytes32 indexed id);

  /// @custom:oz-upgrades-unsafe-allow constructor
  constructor() {
    _disableInitializers();
  }

  /**
   * @notice Contract initialization
   */
  function initialize() public initializer {
    __Ownable_init(msg.sender);
  }

  /**
   * @notice Checks if the caller is a registered issuer.
   * @param issuer the issuer address
   */
  modifier onlyIssuers(address issuer) {
    bool isIssuerRegistered = PortalRegistry(router.getPortalRegistry()).isIssuer(issuer);
    if (!isIssuerRegistered) revert OnlyIssuer();
    _;
  }

  /**
   * @notice Checks if the caller is the portal registry.
   * @param caller the caller address
   */
  modifier onlyPortalRegistry(address caller) {
    bool isCallerPortalRegistry = router.getPortalRegistry() == caller;
    if (!isCallerPortalRegistry) revert OnlyPortalRegistry();
    _;
  }

  /**
   * @notice Changes the address for the Router
   * @dev Only the registry owner can call this method
   */
  function updateRouter(address _router) public onlyOwner {
    if (_router == address(0)) revert RouterInvalid();
    router = IRouter(_router);
  }

  /**
   * @notice Updates a given Schema's Issuer
   * @param schemaId the Schema's ID
   * @param issuer the address of the issuer who created the given Schema
   * @dev Updates issuer for the given schemaId in the `schemaIssuers` mapping
   *      The issuer must already be registered as an Issuer via the `PortalRegistry`
   */
  function updateSchemaIssuer(bytes32 schemaId, address issuer) public onlyOwner {
    if (!isRegistered(schemaId)) revert SchemaNotRegistered();
    if (issuer == address(0)) revert IssuerInvalid();
    schemasIssuers[schemaId] = issuer;
  }

  /**
   * @notice Updates issuer address for all schemas associated with old issuer address
   * @param oldIssuer the address of old issuer
   * @param newIssuer the address of new issuer
   * @dev Finds all the schemaIds associated with old issuer and updates the mapping `schemasIssuers`
   *      for schemaIds found with new issuer
   */
  function updateMatchingSchemaIssuers(address oldIssuer, address newIssuer) public onlyPortalRegistry(msg.sender) {
    for (uint256 i = 0; i < schemaIds.length; i = uncheckedInc256(i)) {
      if (schemasIssuers[schemaIds[i]] == oldIssuer) {
        schemasIssuers[schemaIds[i]] = newIssuer;
      }
    }
  }

  /**
   * Generate an ID for a given schema
   * @param schema the string defining a schema
   * @return the schema ID
   * @dev encodes a schema string to unique bytes
   */
  function getIdFromSchemaString(string memory schema) public pure returns (bytes32) {
    return keccak256(abi.encodePacked(schema));
  }

  /**
   * @notice Creates a Schema, with its metadata and runs some checks:
   * - mandatory name
   * - mandatory string defining the schema
   * - the Schema must be unique
   * @param name the Schema name
   * @param description the Schema description
   * @param context the Schema context
   * @param schemaString the string defining a Schema
   * @dev The Schema is stored in the `schemas` mapping, its ID is added to an array of IDs and an event is emitted
   *      The caller is assigned as the creator of the Schema, via the `schemasIssuers` mapping
   */
  function createSchema(
    string memory name,
    string memory description,
    string memory context,
    string memory schemaString
  ) public onlyIssuers(msg.sender) {
    if (bytes(name).length == 0) revert SchemaNameMissing();
    if (bytes(schemaString).length == 0) revert SchemaStringMissing();

    bytes32 schemaId = getIdFromSchemaString(schemaString);

    if (isRegistered(schemaId)) {
      revert SchemaAlreadyExists();
    }

    schemas[schemaId] = Schema(name, description, context, schemaString);
    schemaIds.push(schemaId);
    schemasIssuers[schemaId] = msg.sender;
    emit SchemaCreated(schemaId, name, description, context, schemaString);
  }

  /**
   * @notice Updates the context of a given schema
   * @param schemaId the schema ID
   * @param context the Schema context
   * @dev Retrieve the Schema with given ID and update its context with new value and an event is emitted
   *      The caller must be the creator of the given Schema (through the `schemaIssuers` mapping)
   */
  function updateContext(bytes32 schemaId, string memory context) public {
    if (!isRegistered(schemaId)) revert SchemaNotRegistered();
    if (schemasIssuers[schemaId] != msg.sender) revert OnlyAssignedIssuer();
    schemas[schemaId].context = context;
    emit SchemaContextUpdated(schemaId);
  }

  /**
   * @notice Gets a schema by its identifier
   * @param schemaId the schema ID
   * @return the schema
   */
  function getSchema(bytes32 schemaId) public view returns (Schema memory) {
    if (!isRegistered(schemaId)) revert SchemaNotRegistered();
    return schemas[schemaId];
  }

  /**
   * @notice Get the number of Schemas managed by the contract
   * @return The number of Schemas already registered
   * @dev Returns the length of the `schemaIds` array
   */
  function getSchemasNumber() public view returns (uint256) {
    return schemaIds.length;
  }

  /**
   * @notice Check if a Schema is registered
   * @param schemaId The ID of the Schema
   * @return True if the Schema is registered, false otherwise
   */
  function isRegistered(bytes32 schemaId) public view returns (bool) {
    return bytes(schemas[schemaId].name).length > 0;
  }
}

File 15 of 21 : Common.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

/**
 * @notice This function is inspired by PADO Labs' codebase
 * solhint-disable-next-line max-line-length
 * https://github.com/pado-labs/offchain-data-hooks/blob/c6f37ad2a42d0eb40cf2295aed68ea3b94ee0925/src/hooks/Common.sol#L45
 * @dev A helper function to work with unchecked uint256 iterators in loops
 */
function uncheckedInc256(uint256 i) pure returns (uint256 j) {
  unchecked {
    j = i + 1;
  }
}

/**
 * @notice This function is inspired by PADO Labs' codebase
 * solhint-disable-next-line max-line-length
 * https://github.com/pado-labs/offchain-data-hooks/blob/c6f37ad2a42d0eb40cf2295aed68ea3b94ee0925/src/hooks/Common.sol#L45
 * @dev A helper function to work with unchecked uint32 iterators in loops
 */
function uncheckedInc32(uint32 i) pure returns (uint32 j) {
  unchecked {
    j = i + 1;
  }
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

import { AttestationPayload } from "../types/Structs.sol";
import { IERC165 } from "openzeppelin-contracts/contracts/utils/introspection/IERC165.sol";

/**
 * @title Abstract Module
 * @author Consensys
 * @notice Defines the minimal Module interface
 */
abstract contract AbstractModule is IERC165 {
  /// @notice Error thrown when someone else than the portal's owner is trying to revoke
  error OnlyPortalOwner();

  /**
   * @notice Executes the module's custom logic.
   * @param attestationPayload The incoming attestation data.
   * @param validationPayload Additional data required for verification.
   * @param txSender The transaction sender's address.
   * @param value The transaction value.
   */
  function run(
    AttestationPayload memory attestationPayload,
    bytes memory validationPayload,
    address txSender,
    uint256 value
  ) public virtual;

  /**
   * @notice Checks if the contract implements the Module interface.
   * @param interfaceID The ID of the interface to check.
   * @return A boolean indicating interface support.
   */
  function supportsInterface(bytes4 interfaceID) public pure virtual override returns (bool) {
    return interfaceID == type(AbstractModule).interfaceId || interfaceID == type(IERC165).interfaceId;
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165Checker.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./IERC165.sol";

/**
 * @dev Library used to query support of an interface declared via {IERC165}.
 *
 * Note that these functions return the actual result of the query: they do not
 * `revert` if an interface is not supported. It is up to the caller to decide
 * what to do in these cases.
 */
library ERC165Checker {
    // As per the EIP-165 spec, no interface should ever match 0xffffffff
    bytes4 private constant INTERFACE_ID_INVALID = 0xffffffff;

    /**
     * @dev Returns true if `account` supports the {IERC165} interface.
     */
    function supportsERC165(address account) internal view returns (bool) {
        // Any contract that implements ERC165 must explicitly indicate support of
        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
        return
            supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&
            !supportsERC165InterfaceUnchecked(account, INTERFACE_ID_INVALID);
    }

    /**
     * @dev Returns true if `account` supports the interface defined by
     * `interfaceId`. Support for {IERC165} itself is queried automatically.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
        // query support of both ERC165 as per the spec and support of _interfaceId
        return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);
    }

    /**
     * @dev Returns a boolean array where each value corresponds to the
     * interfaces passed in and whether they're supported or not. This allows
     * you to batch check interfaces for a contract where your expectation
     * is that some interfaces may not be supported.
     *
     * See {IERC165-supportsInterface}.
     */
    function getSupportedInterfaces(
        address account,
        bytes4[] memory interfaceIds
    ) internal view returns (bool[] memory) {
        // an array of booleans corresponding to interfaceIds and whether they're supported or not
        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);

        // query support of ERC165 itself
        if (supportsERC165(account)) {
            // query support of each interface in interfaceIds
            for (uint256 i = 0; i < interfaceIds.length; i++) {
                interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);
            }
        }

        return interfaceIdsSupported;
    }

    /**
     * @dev Returns true if `account` supports all the interfaces defined in
     * `interfaceIds`. Support for {IERC165} itself is queried automatically.
     *
     * Batch-querying can lead to gas savings by skipping repeated checks for
     * {IERC165} support.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
        // query support of ERC165 itself
        if (!supportsERC165(account)) {
            return false;
        }

        // query support of each interface in interfaceIds
        for (uint256 i = 0; i < interfaceIds.length; i++) {
            if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {
                return false;
            }
        }

        // all interfaces supported
        return true;
    }

    /**
     * @notice Query if a contract implements an interface, does not check ERC165 support
     * @param account The address of the contract to query for support of an interface
     * @param interfaceId The interface identifier, as specified in ERC-165
     * @return true if the contract at account indicates support of the interface with
     * identifier interfaceId, false otherwise
     * @dev Assumes that account contains a contract that supports ERC165, otherwise
     * the behavior of this method is undefined. This precondition can be checked
     * with {supportsERC165}.
     *
     * Some precompiled contracts will falsely indicate support for a given interface, so caution
     * should be exercised when using this function.
     *
     * Interface identification is specified in ERC-165.
     */
    function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {
        // prepare call
        bytes memory encodedParams = abi.encodeCall(IERC165.supportsInterface, (interfaceId));

        // perform static call
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly {
            success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0x00)
        }

        return success && returnSize >= 0x20 && returnValue > 0;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

import { AbstractPortal } from "./abstracts/AbstractPortal.sol";

/**
 * @title Default Portal
 * @author Consensys
 * @notice This contract aims to provide a default portal
 * @dev This Portal does not add any logic to the AbstractPortal
 */
contract DefaultPortal is AbstractPortal {
  /**
   * @notice Contract constructor
   * @param modules list of modules to use for the portal (can be empty)
   * @param router the Router's address
   * @dev This sets the addresses for the AttestationRegistry, ModuleRegistry and PortalRegistry
   */
  constructor(address[] memory modules, address router) AbstractPortal(modules, router) {}

  /// @inheritdoc AbstractPortal
  function withdraw(address payable to, uint256 amount) external override {}
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @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);
}

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

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @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 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.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

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

pragma solidity ^0.8.20;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint64) {
        return _getInitializableStorage()._initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _getInitializableStorage()._initializing;
    }

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "verax/=lib/linea-attestation-registry/contracts/src/",
    "verax-test/=lib/linea-attestation-registry/contracts/test/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "linea-attestation-registry/=lib/linea-attestation-registry/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "solmate/=lib/solmate/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address[]","name":"modules","type":"address[]"},{"internalType":"address","name":"router","type":"address"},{"internalType":"bytes32","name":"_schema","type":"bytes32"},{"internalType":"uint256","name":"_issuePrice","type":"uint256"},{"internalType":"uint256","name":"_reIssuePrice","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AttestationExpired","type":"error"},{"inputs":[],"name":"AttestationWrong","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"OnlyPortalOwner","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"WithdrawFail","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"components":[{"internalType":"bytes32","name":"schemaId","type":"bytes32"},{"internalType":"uint64","name":"expirationDate","type":"uint64"},{"internalType":"bytes","name":"subject","type":"bytes"},{"internalType":"bytes","name":"attestationData","type":"bytes"}],"internalType":"struct AttestationPayload","name":"attestationPayload","type":"tuple"},{"internalType":"bytes[]","name":"validationPayloads","type":"bytes[]"}],"name":"attest","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint64","name":"expirationTime","type":"uint64"},{"internalType":"address","name":"walletAddress","type":"address"},{"internalType":"uint32","name":"score","type":"uint32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"attest0xScoreSimple","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"attestationRegistry","outputs":[{"internalType":"contract AttestationRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"schemaId","type":"bytes32"},{"internalType":"uint64","name":"expirationDate","type":"uint64"},{"internalType":"bytes","name":"subject","type":"bytes"},{"internalType":"bytes","name":"attestationData","type":"bytes"}],"internalType":"struct AttestationPayload[]","name":"attestationsPayloads","type":"tuple[]"},{"internalType":"bytes[][]","name":"validationPayloads","type":"bytes[][]"}],"name":"bulkAttest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"expirationTime","type":"uint64"},{"internalType":"uint32","name":"score","type":"uint32"},{"internalType":"address","name":"walletAddress","type":"address"}],"internalType":"struct ZeroXScorePortal.AttestationRequestData[]","name":"attestationsRequests","type":"tuple[]"},{"internalType":"bytes[]","name":"validationPayload","type":"bytes[]"}],"name":"bulkAttest0xScore","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"attestationIds","type":"bytes32[]"},{"components":[{"internalType":"bytes32","name":"schemaId","type":"bytes32"},{"internalType":"uint64","name":"expirationDate","type":"uint64"},{"internalType":"bytes","name":"subject","type":"bytes"},{"internalType":"bytes","name":"attestationData","type":"bytes"}],"internalType":"struct AttestationPayload[]","name":"attestationsPayloads","type":"tuple[]"},{"internalType":"bytes[][]","name":"validationPayloads","type":"bytes[][]"}],"name":"bulkReplace","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"attestationIds","type":"bytes32[]"}],"name":"bulkRevoke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAttester","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getModules","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"issuePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"moduleRegistry","outputs":[{"internalType":"contract ModuleRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"modules","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"portalRegistry","outputs":[{"internalType":"contract PortalRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reIssuePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"attestationId","type":"bytes32"},{"components":[{"internalType":"bytes32","name":"schemaId","type":"bytes32"},{"internalType":"uint64","name":"expirationDate","type":"uint64"},{"internalType":"bytes","name":"subject","type":"bytes"},{"internalType":"bytes","name":"attestationData","type":"bytes"}],"internalType":"struct AttestationPayload","name":"attestationPayload","type":"tuple"},{"internalType":"bytes[]","name":"validationPayloads","type":"bytes[]"}],"name":"replace","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"attestationId","type":"bytes32"}],"name":"revoke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract IRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"schema","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setIssuePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setReIssuePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620020f7380380620020f7833981016040819052620000349162000350565b848433806200005d57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b62000068816200024c565b506000805460ff60a01b1916905581516200008b9060029060208501906200029c565b50600180546001600160a01b0319166001600160a01b0383169081179091556040805163bfa6658560e01b8152905163bfa66585916004808201926020929091908290030181865afa158015620000e6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200010c919062000451565b600480546001600160a01b0319166001600160a01b03928316178155600154604080516376f63ca960e11b81529051919093169263edec795292818101926020929091908290030181865afa1580156200016a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000190919062000451565b600380546001600160a01b0319166001600160a01b0392831617905560015460408051635bed64bb60e11b81529051919092169163b7dac9769160048083019260209291908290030181865afa158015620001ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000215919062000451565b600580546001600160a01b0319166001600160a01b0392909216919091179055505060069290925560075560085550620004769050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b828054828255906000526020600020908101928215620002f4579160200282015b82811115620002f457825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190620002bd565b506200030292915062000306565b5090565b5b8082111562000302576000815560010162000307565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b03811681146200034b57600080fd5b919050565b600080600080600060a086880312156200036957600080fd5b85516001600160401b03808211156200038157600080fd5b818801915088601f8301126200039657600080fd5b8151602082821115620003ad57620003ad6200031d565b8160051b604051601f19603f83011681018181108682111715620003d557620003d56200031d565b60405292835281830193508481018201928c841115620003f457600080fd5b948201945b838610156200041d576200040d8662000333565b85529482019493820193620003f9565b99506200042e90508a820162000333565b60408b015160608c01516080909c01519a9d919c509a9998509650505050505050565b6000602082840312156200046457600080fd5b6200046f8262000333565b9392505050565b611c7180620004866000396000f3fe6080604052600436106101b75760003560e01c80638388e226116100ec578063bc2a4c291161008a578063f2fde38b11610064578063f2fde38b1461048f578063f3fef3a3146104af578063f887ea40146104cf578063f8895cc8146104ef57600080fd5b8063bc2a4c2914610449578063ecdbb4fd1461045c578063ed6d73f91461046f57600080fd5b8063b2494df3116100c6578063b2494df3146103c7578063b6664934146103e9578063b75c7dc614610409578063b95459e41461042957600080fd5b80638388e226146103815780638456cb59146103945780638da5cb5b146103a957600080fd5b8063523ba7ca116101595780635c975abb116101335780635c975abb146102f55780636119580114610314578063715018a61461033457806381b2248a1461034957600080fd5b8063523ba7ca1461029f5780635a27e3a4146102bf5780635c2c2005146102df57600080fd5b80633cc30e2a116101955780633cc30e2a1461022a5780633cd5d2b21461024a5780633f4ba83a1461026a5780634ada80761461027f57600080fd5b806301ffc9a7146101bc57806307432196146101f157806311f5066f14610206575b600080fd5b3480156101c857600080fd5b506101dc6101d7366004610ec5565b610505565b60405190151581526020015b60405180910390f35b6102046101ff366004611170565b610557565b005b34801561021257600080fd5b5061021c60085481565b6040519081526020016101e8565b34801561023657600080fd5b5061020461024536600461132c565b610635565b34801561025657600080fd5b506102046102653660046113b3565b610705565b34801561027657600080fd5b50610204610712565b34801561028b57600080fd5b5061020461029a3660046113cc565b610724565b3480156102ab57600080fd5b506102046102ba366004611408565b610791565b3480156102cb57600080fd5b506102046102da36600461148a565b610828565b3480156102eb57600080fd5b5061021c60075481565b34801561030157600080fd5b50600054600160a01b900460ff166101dc565b34801561032057600080fd5b5061020461032f3660046113b3565b610876565b34801561034057600080fd5b50610204610883565b34801561035557600080fd5b506103696103643660046113b3565b610895565b6040516001600160a01b0390911681526020016101e8565b34801561038d57600080fd5b5033610369565b3480156103a057600080fd5b506102046108bf565b3480156103b557600080fd5b506000546001600160a01b0316610369565b3480156103d357600080fd5b506103dc6108cf565b6040516101e8919061157c565b3480156103f557600080fd5b50600554610369906001600160a01b031681565b34801561041557600080fd5b506102046104243660046113b3565b610931565b34801561043557600080fd5b50600354610369906001600160a01b031681565b6102046104573660046115c9565b610969565b61020461046a366004611639565b610a01565b34801561047b57600080fd5b50600454610369906001600160a01b031681565b34801561049b57600080fd5b506102046104aa36600461169b565b610aa8565b3480156104bb57600080fd5b506102046104ca3660046116b8565b610aeb565b3480156104db57600080fd5b50600154610369906001600160a01b031681565b3480156104fb57600080fd5b5061021c60065481565b60006001600160e01b0319821663204cf90960e01b148061053657506001600160e01b031982166331c1afd560e01b145b8061055157506001600160e01b031982166301ffc9a760e01b145b92915050565b60035460405163747129e560e11b81526001600160a01b039091169063e8e253ca9061058e90600290869086903490600401611826565b600060405180830381600087803b1580156105a857600080fd5b505af11580156105bc573d6000803e3d6000fd5b505050506105cf826105cb3390565b5050565b6004546001600160a01b03166362fa3d4583336040518363ffffffff1660e01b81526004016105ff929190611871565b600060405180830381600087803b15801561061957600080fd5b505af115801561062d573d6000803e3d6000fd5b505050505050565b60035460405163715d762560e11b81526001600160a01b039091169063e2baec4a9061066a90600290869086906004016118e3565b600060405180830381600087803b15801561068457600080fd5b505af1158015610698573d6000803e3d6000fd5b505050506004546001600160a01b0316636ec4d4cb8484336040518463ffffffff1660e01b81526004016106ce9392919061199a565b600060405180830381600087803b1580156106e857600080fd5b505af11580156106fc573d6000803e3d6000fd5b50505050505050565b61070d610b66565b600755565b61071a610b66565b610722610b93565b565b61072d81610be8565b6004805460405163256d403b60e11b81526001600160a01b0390911691634ada80769161075c918591016119d8565b600060405180830381600087803b15801561077657600080fd5b505af115801561078a573d6000803e3d6000fd5b5050505050565b60035460405163715d762560e11b81526001600160a01b039091169063e2baec4a906107c690600290869086906004016118e3565b600060405180830381600087803b1580156107e057600080fd5b505af11580156107f4573d6000803e3d6000fd5b505050506004546001600160a01b031663a8e2812d83336040518363ffffffff1660e01b81526004016105ff9291906119eb565b610830610b66565b60005b82518110156108715761085f838281518110610851576108516119fe565b602002602001015183610c8d565b8061086981611a14565b915050610833565b505050565b61087e610b66565b600855565b61088b610b66565b6107226000610d5d565b600281815481106108a557600080fd5b6000918252602090912001546001600160a01b0316905081565b6108c7610b66565b610722610dad565b6060600280548060200260200160405190810160405280929190818152602001828054801561092757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610909575b5050505050905090565b61093a81610be8565b60048054604051635bae3ee360e11b81529182018390526001600160a01b03169063b75c7dc69060240161075c565b610971610df0565b610979610e1b565b604080516060810182526001600160401b038616815263ffffffff841660208201526001600160a01b0385168183015281516001808252818401909352909160009190816020015b60608152602001906001900390816109c157905050905082816000815181106109ec576109ec6119fe565b602002602001018190525061062d8282610c8d565b60035460405163747129e560e11b81526001600160a01b039091169063e8e253ca90610a3890600290869086903490600401611826565b600060405180830381600087803b158015610a5257600080fd5b505af1158015610a66573d6000803e3d6000fd5b50505050610a7683836108713390565b6004546001600160a01b0316638ffa736b8484336040518463ffffffff1660e01b81526004016106ce93929190611a3b565b610ab0610b66565b6001600160a01b038116610adf57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610ae881610d5d565b50565b610af3610b66565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610b40576040519150601f19603f3d011682016040523d82523d6000602084013e610b45565b606091505b50509050806108715760405162c0f29960e01b815260040160405180910390fd5b6000546001600160a01b031633146107225760405163118cdaa760e01b8152336004820152602401610ad6565b610b9b610e9b565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60055460405163181f78e960e31b81523060048201526001600160a01b039091169063c0fbc74890602401600060405180830381865afa158015610c30573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c589190810190611b30565b602001516001600160a01b0316336001600160a01b031614610ae8576040516371f63e3160e01b815260040160405180910390fd5b4282600001516001600160401b03161015610cbb5760405163716dcc3960e01b815260040160405180910390fd5b60008260200151604051602001610cde919063ffffffff91909116815260200190565b60408051601f19818403018152608083018252600654835285516001600160401b031660208481019190915286830151835192955060009493840192610d3392016001600160a01b0391909116815260200190565b6040516020818303038152906040528152602001838152509050610d578184610557565b50505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610db5610df0565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610bcb3390565b600054600160a01b900460ff16156107225760405163d93c066560e01b815260040160405180910390fd5b3360009081526009602052604081205460ff1615610e3c5750600854610e5b565b50600754336000908152600960205260409020805460ff191660011790555b80341015610ae85760405162461bcd60e51b815260206004820152600d60248201526c76616c7565203c20707269636560981b6044820152606401610ad6565b600054600160a01b900460ff1661072257604051638dfc202b60e01b815260040160405180910390fd5b600060208284031215610ed757600080fd5b81356001600160e01b031981168114610eef57600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715610f2e57610f2e610ef6565b60405290565b60405160e081016001600160401b0381118282101715610f2e57610f2e610ef6565b604051601f8201601f191681016001600160401b0381118282101715610f7e57610f7e610ef6565b604052919050565b80356001600160401b0381168114610f9d57600080fd5b919050565b60006001600160401b03821115610fbb57610fbb610ef6565b50601f01601f191660200190565b600082601f830112610fda57600080fd5b8135610fed610fe882610fa2565b610f56565b81815284602083860101111561100257600080fd5b816020850160208301376000918101602001919091529392505050565b60006080828403121561103157600080fd5b604051608081016001600160401b03828210818311171561105457611054610ef6565b816040528293508435835261106b60208601610f86565b6020840152604085013591508082111561108457600080fd5b61109086838701610fc9565b604084015260608501359150808211156110a957600080fd5b506110b685828601610fc9565b6060830152505092915050565b60006001600160401b038211156110dc576110dc610ef6565b5060051b60200190565b600082601f8301126110f757600080fd5b81356020611107610fe8836110c3565b82815260059290921b8401810191818101908684111561112657600080fd5b8286015b848110156111655780356001600160401b038111156111495760008081fd5b6111578986838b0101610fc9565b84525091830191830161112a565b509695505050505050565b6000806040838503121561118357600080fd5b82356001600160401b038082111561119a57600080fd5b6111a68683870161101f565b935060208501359150808211156111bc57600080fd5b506111c9858286016110e6565b9150509250929050565b600082601f8301126111e457600080fd5b813560206111f4610fe8836110c3565b82815260059290921b8401810191818101908684111561121357600080fd5b8286015b848110156111655780358352918301918301611217565b600082601f83011261123f57600080fd5b8135602061124f610fe8836110c3565b82815260059290921b8401810191818101908684111561126e57600080fd5b8286015b848110156111655780356001600160401b038111156112915760008081fd5b61129f8986838b010161101f565b845250918301918301611272565b600082601f8301126112be57600080fd5b813560206112ce610fe8836110c3565b82815260059290921b840181019181810190868411156112ed57600080fd5b8286015b848110156111655780356001600160401b038111156113105760008081fd5b61131e8986838b01016110e6565b8452509183019183016112f1565b60008060006060848603121561134157600080fd5b83356001600160401b038082111561135857600080fd5b611364878388016111d3565b9450602086013591508082111561137a57600080fd5b6113868783880161122e565b9350604086013591508082111561139c57600080fd5b506113a9868287016112ad565b9150509250925092565b6000602082840312156113c557600080fd5b5035919050565b6000602082840312156113de57600080fd5b81356001600160401b038111156113f457600080fd5b611400848285016111d3565b949350505050565b6000806040838503121561141b57600080fd5b82356001600160401b038082111561143257600080fd5b61143e8683870161122e565b9350602085013591508082111561145457600080fd5b506111c9858286016112ad565b803563ffffffff81168114610f9d57600080fd5b6001600160a01b0381168114610ae857600080fd5b600080604080848603121561149e57600080fd5b83356001600160401b03808211156114b557600080fd5b818601915086601f8301126114c957600080fd5b813560206114d9610fe8836110c3565b8281526060928302850182019282820191908b8511156114f857600080fd5b958301955b848710156115575780878d0312156115155760008081fd5b61151d610f0c565b61152688610f86565b8152611533858901611461565b858201528888013561154481611475565b818a0152835295860195918301916114fd565b509750508701359350508083111561156e57600080fd5b50506111c9858286016110e6565b6020808252825182820181905260009190848201906040850190845b818110156115bd5783516001600160a01b031683529284019291840191600101611598565b50909695505050505050565b600080600080608085870312156115df57600080fd5b6115e885610f86565b935060208501356115f881611475565b925061160660408601611461565b915060608501356001600160401b0381111561162157600080fd5b61162d87828801610fc9565b91505092959194509250565b60008060006060848603121561164e57600080fd5b8335925060208401356001600160401b038082111561166c57600080fd5b6116788783880161101f565b9350604086013591508082111561168e57600080fd5b506113a9868287016110e6565b6000602082840312156116ad57600080fd5b8135610eef81611475565b600080604083850312156116cb57600080fd5b82356116d681611475565b946020939093013593505050565b6000815480845260208085019450836000528060002060005b838110156117225781546001600160a01b0316875295820195600191820191016116fd565b509495945050505050565b60005b83811015611748578181015183820152602001611730565b50506000910152565b6000815180845261176981602086016020860161172d565b601f01601f19169290920160200192915050565b805182526001600160401b03602082015116602083015260006040820151608060408501526117af6080850182611751565b9050606083015184820360608601526117c88282611751565b95945050505050565b600081518084526020808501808196508360051b8101915082860160005b85811015611819578284038952611807848351611751565b988501989350908401906001016117ef565b5091979650505050505050565b60808152600061183960808301876116e4565b828103602084015261184b818761177d565b9050828103604084015261185f81866117d1565b91505082606083015295945050505050565b604081526000611884604083018561177d565b905060018060a01b03831660208301529392505050565b600081518084526020808501808196508360051b8101915082860160005b858110156118195782840389526118d184835161177d565b988501989350908401906001016118b9565b6060815260006118f660608301866116e4565b602083820381850152611909828761189b565b915083820360408501528185518084528284019150828160051b85010183880160005b8381101561195a57601f198784030185526119488383516117d1565b9486019492509085019060010161192c565b50909a9950505050505050505050565b600081518084526020808501945080840160005b838110156117225781518752958201959082019060010161197e565b6060815260006119ad606083018661196a565b82810360208401526119bf818661189b565b91505060018060a01b0383166040830152949350505050565b602081526000610eef602083018461196a565b604081526000611884604083018561189b565b634e487b7160e01b600052603260045260246000fd5b600060018201611a3457634e487b7160e01b600052601160045260246000fd5b5060010190565b838152606060208201526000611a54606083018561177d565b905060018060a01b0383166040830152949350505050565b8051610f9d81611475565b600082601f830112611a8857600080fd5b81516020611a98610fe8836110c3565b82815260059290921b84018101918181019086841115611ab757600080fd5b8286015b84811015611165578051611ace81611475565b8352918301918301611abb565b80518015158114610f9d57600080fd5b600082601f830112611afc57600080fd5b8151611b0a610fe882610fa2565b818152846020838601011115611b1f57600080fd5b61140082602083016020870161172d565b600060208284031215611b4257600080fd5b81516001600160401b0380821115611b5957600080fd5b9083019060e08286031215611b6d57600080fd5b611b75610f34565b611b7e83611a6c565b8152611b8c60208401611a6c565b6020820152604083015182811115611ba357600080fd5b611baf87828601611a77565b604083015250611bc160608401611adb565b6060820152608083015182811115611bd857600080fd5b611be487828601611aeb565b60808301525060a083015182811115611bfc57600080fd5b611c0887828601611aeb565b60a08301525060c083015182811115611c2057600080fd5b611c2c87828601611aeb565b60c0830152509594505050505056fea26469706673582212206c8790822a897bc3534001197f70f99b930ef4f31d1b83f36a1470d4188fd46864736f6c6343000815003300000000000000000000000000000000000000000000000000000000000000a00000000000000000000000004d3a380a03f3a18a5dc44b01119839d8674a552e6350a66dfb1aebcab88bb92c6fc179eb618472b7e0a95dee7ca5982a3461003000000000000000000000000000000000000000000000000000027ca57357c00000000000000000000000000000000000000000000000000000013e52b9abe0000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d4e9a7d35022d50b672416447ebc5fbc272643ee

Deployed Bytecode

0x6080604052600436106101b75760003560e01c80638388e226116100ec578063bc2a4c291161008a578063f2fde38b11610064578063f2fde38b1461048f578063f3fef3a3146104af578063f887ea40146104cf578063f8895cc8146104ef57600080fd5b8063bc2a4c2914610449578063ecdbb4fd1461045c578063ed6d73f91461046f57600080fd5b8063b2494df3116100c6578063b2494df3146103c7578063b6664934146103e9578063b75c7dc614610409578063b95459e41461042957600080fd5b80638388e226146103815780638456cb59146103945780638da5cb5b146103a957600080fd5b8063523ba7ca116101595780635c975abb116101335780635c975abb146102f55780636119580114610314578063715018a61461033457806381b2248a1461034957600080fd5b8063523ba7ca1461029f5780635a27e3a4146102bf5780635c2c2005146102df57600080fd5b80633cc30e2a116101955780633cc30e2a1461022a5780633cd5d2b21461024a5780633f4ba83a1461026a5780634ada80761461027f57600080fd5b806301ffc9a7146101bc57806307432196146101f157806311f5066f14610206575b600080fd5b3480156101c857600080fd5b506101dc6101d7366004610ec5565b610505565b60405190151581526020015b60405180910390f35b6102046101ff366004611170565b610557565b005b34801561021257600080fd5b5061021c60085481565b6040519081526020016101e8565b34801561023657600080fd5b5061020461024536600461132c565b610635565b34801561025657600080fd5b506102046102653660046113b3565b610705565b34801561027657600080fd5b50610204610712565b34801561028b57600080fd5b5061020461029a3660046113cc565b610724565b3480156102ab57600080fd5b506102046102ba366004611408565b610791565b3480156102cb57600080fd5b506102046102da36600461148a565b610828565b3480156102eb57600080fd5b5061021c60075481565b34801561030157600080fd5b50600054600160a01b900460ff166101dc565b34801561032057600080fd5b5061020461032f3660046113b3565b610876565b34801561034057600080fd5b50610204610883565b34801561035557600080fd5b506103696103643660046113b3565b610895565b6040516001600160a01b0390911681526020016101e8565b34801561038d57600080fd5b5033610369565b3480156103a057600080fd5b506102046108bf565b3480156103b557600080fd5b506000546001600160a01b0316610369565b3480156103d357600080fd5b506103dc6108cf565b6040516101e8919061157c565b3480156103f557600080fd5b50600554610369906001600160a01b031681565b34801561041557600080fd5b506102046104243660046113b3565b610931565b34801561043557600080fd5b50600354610369906001600160a01b031681565b6102046104573660046115c9565b610969565b61020461046a366004611639565b610a01565b34801561047b57600080fd5b50600454610369906001600160a01b031681565b34801561049b57600080fd5b506102046104aa36600461169b565b610aa8565b3480156104bb57600080fd5b506102046104ca3660046116b8565b610aeb565b3480156104db57600080fd5b50600154610369906001600160a01b031681565b3480156104fb57600080fd5b5061021c60065481565b60006001600160e01b0319821663204cf90960e01b148061053657506001600160e01b031982166331c1afd560e01b145b8061055157506001600160e01b031982166301ffc9a760e01b145b92915050565b60035460405163747129e560e11b81526001600160a01b039091169063e8e253ca9061058e90600290869086903490600401611826565b600060405180830381600087803b1580156105a857600080fd5b505af11580156105bc573d6000803e3d6000fd5b505050506105cf826105cb3390565b5050565b6004546001600160a01b03166362fa3d4583336040518363ffffffff1660e01b81526004016105ff929190611871565b600060405180830381600087803b15801561061957600080fd5b505af115801561062d573d6000803e3d6000fd5b505050505050565b60035460405163715d762560e11b81526001600160a01b039091169063e2baec4a9061066a90600290869086906004016118e3565b600060405180830381600087803b15801561068457600080fd5b505af1158015610698573d6000803e3d6000fd5b505050506004546001600160a01b0316636ec4d4cb8484336040518463ffffffff1660e01b81526004016106ce9392919061199a565b600060405180830381600087803b1580156106e857600080fd5b505af11580156106fc573d6000803e3d6000fd5b50505050505050565b61070d610b66565b600755565b61071a610b66565b610722610b93565b565b61072d81610be8565b6004805460405163256d403b60e11b81526001600160a01b0390911691634ada80769161075c918591016119d8565b600060405180830381600087803b15801561077657600080fd5b505af115801561078a573d6000803e3d6000fd5b5050505050565b60035460405163715d762560e11b81526001600160a01b039091169063e2baec4a906107c690600290869086906004016118e3565b600060405180830381600087803b1580156107e057600080fd5b505af11580156107f4573d6000803e3d6000fd5b505050506004546001600160a01b031663a8e2812d83336040518363ffffffff1660e01b81526004016105ff9291906119eb565b610830610b66565b60005b82518110156108715761085f838281518110610851576108516119fe565b602002602001015183610c8d565b8061086981611a14565b915050610833565b505050565b61087e610b66565b600855565b61088b610b66565b6107226000610d5d565b600281815481106108a557600080fd5b6000918252602090912001546001600160a01b0316905081565b6108c7610b66565b610722610dad565b6060600280548060200260200160405190810160405280929190818152602001828054801561092757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610909575b5050505050905090565b61093a81610be8565b60048054604051635bae3ee360e11b81529182018390526001600160a01b03169063b75c7dc69060240161075c565b610971610df0565b610979610e1b565b604080516060810182526001600160401b038616815263ffffffff841660208201526001600160a01b0385168183015281516001808252818401909352909160009190816020015b60608152602001906001900390816109c157905050905082816000815181106109ec576109ec6119fe565b602002602001018190525061062d8282610c8d565b60035460405163747129e560e11b81526001600160a01b039091169063e8e253ca90610a3890600290869086903490600401611826565b600060405180830381600087803b158015610a5257600080fd5b505af1158015610a66573d6000803e3d6000fd5b50505050610a7683836108713390565b6004546001600160a01b0316638ffa736b8484336040518463ffffffff1660e01b81526004016106ce93929190611a3b565b610ab0610b66565b6001600160a01b038116610adf57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610ae881610d5d565b50565b610af3610b66565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610b40576040519150601f19603f3d011682016040523d82523d6000602084013e610b45565b606091505b50509050806108715760405162c0f29960e01b815260040160405180910390fd5b6000546001600160a01b031633146107225760405163118cdaa760e01b8152336004820152602401610ad6565b610b9b610e9b565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60055460405163181f78e960e31b81523060048201526001600160a01b039091169063c0fbc74890602401600060405180830381865afa158015610c30573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c589190810190611b30565b602001516001600160a01b0316336001600160a01b031614610ae8576040516371f63e3160e01b815260040160405180910390fd5b4282600001516001600160401b03161015610cbb5760405163716dcc3960e01b815260040160405180910390fd5b60008260200151604051602001610cde919063ffffffff91909116815260200190565b60408051601f19818403018152608083018252600654835285516001600160401b031660208481019190915286830151835192955060009493840192610d3392016001600160a01b0391909116815260200190565b6040516020818303038152906040528152602001838152509050610d578184610557565b50505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610db5610df0565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610bcb3390565b600054600160a01b900460ff16156107225760405163d93c066560e01b815260040160405180910390fd5b3360009081526009602052604081205460ff1615610e3c5750600854610e5b565b50600754336000908152600960205260409020805460ff191660011790555b80341015610ae85760405162461bcd60e51b815260206004820152600d60248201526c76616c7565203c20707269636560981b6044820152606401610ad6565b600054600160a01b900460ff1661072257604051638dfc202b60e01b815260040160405180910390fd5b600060208284031215610ed757600080fd5b81356001600160e01b031981168114610eef57600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715610f2e57610f2e610ef6565b60405290565b60405160e081016001600160401b0381118282101715610f2e57610f2e610ef6565b604051601f8201601f191681016001600160401b0381118282101715610f7e57610f7e610ef6565b604052919050565b80356001600160401b0381168114610f9d57600080fd5b919050565b60006001600160401b03821115610fbb57610fbb610ef6565b50601f01601f191660200190565b600082601f830112610fda57600080fd5b8135610fed610fe882610fa2565b610f56565b81815284602083860101111561100257600080fd5b816020850160208301376000918101602001919091529392505050565b60006080828403121561103157600080fd5b604051608081016001600160401b03828210818311171561105457611054610ef6565b816040528293508435835261106b60208601610f86565b6020840152604085013591508082111561108457600080fd5b61109086838701610fc9565b604084015260608501359150808211156110a957600080fd5b506110b685828601610fc9565b6060830152505092915050565b60006001600160401b038211156110dc576110dc610ef6565b5060051b60200190565b600082601f8301126110f757600080fd5b81356020611107610fe8836110c3565b82815260059290921b8401810191818101908684111561112657600080fd5b8286015b848110156111655780356001600160401b038111156111495760008081fd5b6111578986838b0101610fc9565b84525091830191830161112a565b509695505050505050565b6000806040838503121561118357600080fd5b82356001600160401b038082111561119a57600080fd5b6111a68683870161101f565b935060208501359150808211156111bc57600080fd5b506111c9858286016110e6565b9150509250929050565b600082601f8301126111e457600080fd5b813560206111f4610fe8836110c3565b82815260059290921b8401810191818101908684111561121357600080fd5b8286015b848110156111655780358352918301918301611217565b600082601f83011261123f57600080fd5b8135602061124f610fe8836110c3565b82815260059290921b8401810191818101908684111561126e57600080fd5b8286015b848110156111655780356001600160401b038111156112915760008081fd5b61129f8986838b010161101f565b845250918301918301611272565b600082601f8301126112be57600080fd5b813560206112ce610fe8836110c3565b82815260059290921b840181019181810190868411156112ed57600080fd5b8286015b848110156111655780356001600160401b038111156113105760008081fd5b61131e8986838b01016110e6565b8452509183019183016112f1565b60008060006060848603121561134157600080fd5b83356001600160401b038082111561135857600080fd5b611364878388016111d3565b9450602086013591508082111561137a57600080fd5b6113868783880161122e565b9350604086013591508082111561139c57600080fd5b506113a9868287016112ad565b9150509250925092565b6000602082840312156113c557600080fd5b5035919050565b6000602082840312156113de57600080fd5b81356001600160401b038111156113f457600080fd5b611400848285016111d3565b949350505050565b6000806040838503121561141b57600080fd5b82356001600160401b038082111561143257600080fd5b61143e8683870161122e565b9350602085013591508082111561145457600080fd5b506111c9858286016112ad565b803563ffffffff81168114610f9d57600080fd5b6001600160a01b0381168114610ae857600080fd5b600080604080848603121561149e57600080fd5b83356001600160401b03808211156114b557600080fd5b818601915086601f8301126114c957600080fd5b813560206114d9610fe8836110c3565b8281526060928302850182019282820191908b8511156114f857600080fd5b958301955b848710156115575780878d0312156115155760008081fd5b61151d610f0c565b61152688610f86565b8152611533858901611461565b858201528888013561154481611475565b818a0152835295860195918301916114fd565b509750508701359350508083111561156e57600080fd5b50506111c9858286016110e6565b6020808252825182820181905260009190848201906040850190845b818110156115bd5783516001600160a01b031683529284019291840191600101611598565b50909695505050505050565b600080600080608085870312156115df57600080fd5b6115e885610f86565b935060208501356115f881611475565b925061160660408601611461565b915060608501356001600160401b0381111561162157600080fd5b61162d87828801610fc9565b91505092959194509250565b60008060006060848603121561164e57600080fd5b8335925060208401356001600160401b038082111561166c57600080fd5b6116788783880161101f565b9350604086013591508082111561168e57600080fd5b506113a9868287016110e6565b6000602082840312156116ad57600080fd5b8135610eef81611475565b600080604083850312156116cb57600080fd5b82356116d681611475565b946020939093013593505050565b6000815480845260208085019450836000528060002060005b838110156117225781546001600160a01b0316875295820195600191820191016116fd565b509495945050505050565b60005b83811015611748578181015183820152602001611730565b50506000910152565b6000815180845261176981602086016020860161172d565b601f01601f19169290920160200192915050565b805182526001600160401b03602082015116602083015260006040820151608060408501526117af6080850182611751565b9050606083015184820360608601526117c88282611751565b95945050505050565b600081518084526020808501808196508360051b8101915082860160005b85811015611819578284038952611807848351611751565b988501989350908401906001016117ef565b5091979650505050505050565b60808152600061183960808301876116e4565b828103602084015261184b818761177d565b9050828103604084015261185f81866117d1565b91505082606083015295945050505050565b604081526000611884604083018561177d565b905060018060a01b03831660208301529392505050565b600081518084526020808501808196508360051b8101915082860160005b858110156118195782840389526118d184835161177d565b988501989350908401906001016118b9565b6060815260006118f660608301866116e4565b602083820381850152611909828761189b565b915083820360408501528185518084528284019150828160051b85010183880160005b8381101561195a57601f198784030185526119488383516117d1565b9486019492509085019060010161192c565b50909a9950505050505050505050565b600081518084526020808501945080840160005b838110156117225781518752958201959082019060010161197e565b6060815260006119ad606083018661196a565b82810360208401526119bf818661189b565b91505060018060a01b0383166040830152949350505050565b602081526000610eef602083018461196a565b604081526000611884604083018561189b565b634e487b7160e01b600052603260045260246000fd5b600060018201611a3457634e487b7160e01b600052601160045260246000fd5b5060010190565b838152606060208201526000611a54606083018561177d565b905060018060a01b0383166040830152949350505050565b8051610f9d81611475565b600082601f830112611a8857600080fd5b81516020611a98610fe8836110c3565b82815260059290921b84018101918181019086841115611ab757600080fd5b8286015b84811015611165578051611ace81611475565b8352918301918301611abb565b80518015158114610f9d57600080fd5b600082601f830112611afc57600080fd5b8151611b0a610fe882610fa2565b818152846020838601011115611b1f57600080fd5b61140082602083016020870161172d565b600060208284031215611b4257600080fd5b81516001600160401b0380821115611b5957600080fd5b9083019060e08286031215611b6d57600080fd5b611b75610f34565b611b7e83611a6c565b8152611b8c60208401611a6c565b6020820152604083015182811115611ba357600080fd5b611baf87828601611a77565b604083015250611bc160608401611adb565b6060820152608083015182811115611bd857600080fd5b611be487828601611aeb565b60808301525060a083015182811115611bfc57600080fd5b611c0887828601611aeb565b60a08301525060c083015182811115611c2057600080fd5b611c2c87828601611aeb565b60c0830152509594505050505056fea26469706673582212206c8790822a897bc3534001197f70f99b930ef4f31d1b83f36a1470d4188fd46864736f6c63430008150033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000004d3a380a03f3a18a5dc44b01119839d8674a552e6350a66dfb1aebcab88bb92c6fc179eb618472b7e0a95dee7ca5982a3461003000000000000000000000000000000000000000000000000000027ca57357c00000000000000000000000000000000000000000000000000000013e52b9abe0000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d4e9a7d35022d50b672416447ebc5fbc272643ee

-----Decoded View---------------
Arg [0] : modules (address[]): 0xD4e9a7D35022D50B672416447EBC5FbC272643Ee
Arg [1] : router (address): 0x4d3a380A03f3a18A5dC44b01119839D8674a552E
Arg [2] : _schema (bytes32): 0x6350a66dfb1aebcab88bb92c6fc179eb618472b7e0a95dee7ca5982a34610030
Arg [3] : _issuePrice (uint256): 700000000000000
Arg [4] : _reIssuePrice (uint256): 350000000000000

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [1] : 0000000000000000000000004d3a380a03f3a18a5dc44b01119839d8674a552e
Arg [2] : 6350a66dfb1aebcab88bb92c6fc179eb618472b7e0a95dee7ca5982a34610030
Arg [3] : 00000000000000000000000000000000000000000000000000027ca57357c000
Arg [4] : 00000000000000000000000000000000000000000000000000013e52b9abe000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [6] : 000000000000000000000000d4e9a7d35022d50b672416447ebc5fbc272643ee


Block Transaction Gas Used Reward
view all blocks sequenced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
0xBdec68492d69A7ff1fb4C2ABF5C28aDE535dc88A
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.