Source Code
Overview
ETH Balance
ETH Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 15469586 | 353 days ago | 0 ETH | ||||
| 15469586 | 353 days ago | 0 ETH | ||||
| 15469289 | 353 days ago | 0 ETH | ||||
| 15469238 | 353 days ago | 0 ETH | ||||
| 15469238 | 353 days ago | 0 ETH | ||||
| 15469222 | 353 days ago | 0 ETH | ||||
| 15469213 | 353 days ago | 0 ETH | ||||
| 15469213 | 353 days ago | 0 ETH | ||||
| 15469194 | 353 days ago | 0 ETH | ||||
| 15469170 | 353 days ago | 0 ETH | ||||
| 15469138 | 353 days ago | 0 ETH | ||||
| 15469096 | 353 days ago | 0 ETH | ||||
| 15468996 | 353 days ago | 0 ETH | ||||
| 15468973 | 353 days ago | 0 ETH | ||||
| 15468966 | 353 days ago | 0 ETH | ||||
| 15468961 | 353 days ago | 0 ETH | ||||
| 15468891 | 353 days ago | 0 ETH | ||||
| 15468891 | 353 days ago | 0 ETH | ||||
| 15468876 | 353 days ago | 0 ETH | ||||
| 15468791 | 353 days ago | 0 ETH | ||||
| 15468637 | 353 days ago | 0 ETH | ||||
| 15468518 | 353 days ago | 0 ETH | ||||
| 15468407 | 353 days ago | 0 ETH | ||||
| 15468407 | 353 days ago | 0 ETH | ||||
| 15468290 | 353 days ago | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
PortalRegistry
Compiler Version
v0.8.21+commit.d9974bed
Optimization Enabled:
Yes with 150 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
// solhint-disable-next-line max-line-length
import { ERC165CheckerUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol";
import { AbstractPortal } from "./abstracts/AbstractPortal.sol";
import { DefaultPortal } from "./DefaultPortal.sol";
import { Portal } from "./types/Structs.sol";
import { IRouter } from "./interfaces/IRouter.sol";
import { IPortal } from "./interfaces/IPortal.sol";
import { uncheckedInc256 } from "./Common.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;
bool private isTestnet;
/// @notice Error thrown when an invalid Router address is given
error RouterInvalid();
/// @notice Error thrown when a non-allowlisted user tries to call a forbidden method
error OnlyAllowlisted();
/// @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 Error thrown when an invalid address is given
error AddressInvalid();
/// @notice Event emitted when a Portal is 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);
/// @notice Event emitted when a Portal is revoked
event PortalRevoked(address portalAddress);
/// @notice Event emitted when the router is updated
event RouterUpdated(address routerAddress);
/// @notice Event emitted when the `isTestnet` flag is updated
event IsTestnetUpdated(bool isTestnet);
/// @custom:oz-upgrades-unsafe-allow constructor
constructor(bool _isTestnet) {
_disableInitializers();
isTestnet = _isTestnet;
}
/**
* @notice Contract initialization
*/
function initialize() public initializer {
__Ownable_init();
}
/**
* @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);
emit RouterUpdated(_router);
}
/**
* @notice Registers an address as an issuer
* @param issuer the address to register as an issuer
*/
function setIssuer(address issuer) public onlyOwner {
if (issuer == address(0)) revert AddressInvalid();
issuers[issuer] = true;
emit IssuerAdded(issuer);
}
/**
* @notice Update the testnet status
* @param _isTestnet the flag defining the testnet status
*/
function setIsTestnet(bool _isTestnet) public onlyOwner {
isTestnet = _isTestnet;
emit IsTestnetUpdated(_isTestnet);
}
/**
* @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;
// 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 allowlisted.
* @param user the user address
*/
modifier onlyAllowlisted(address user) {
if (!isAllowlisted(user)) revert OnlyAllowlisted();
_;
}
/**
* @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 onlyAllowlisted(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 (!ERC165CheckerUpgradeable.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 Revokes a Portal from the PortalRegistry
* @param id the portal address
* @dev Only the registry owner can call this method
*/
function revoke(address id) public onlyOwner {
if (!isRegistered(id)) revert PortalNotRegistered();
portals[id] = Portal(address(0), address(0), new address[](0), false, "", "", "");
bool found = false;
uint256 portalAddressIndex;
for (uint256 i = 0; i < portalAddresses.length; i = uncheckedInc256(i)) {
if (portalAddresses[i] == id) {
portalAddressIndex = i;
found = true;
break;
}
}
if (!found) {
revert PortalNotRegistered();
}
portalAddresses[portalAddressIndex] = portalAddresses[portalAddresses.length - 1];
portalAddresses.pop();
emit PortalRevoked(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 onlyAllowlisted(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;
}
/**
* @notice Checks if the caller is allowlisted.
* @return A flag indicating whether the Verax instance is running on testnet
*/
function getIsTestnet() public view returns (bool) {
return isTestnet;
}
/**
* @notice Checks if a user is allowlisted.
* @param user the user address
* @return A flag indicating whether the given address is allowlisted
*/
function isAllowlisted(address user) public view returns (bool) {
return isTestnet || isIssuer(user);
}
/**
* 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 v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../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.
*
* By default, the owner account will be the one that deploys the contract. 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 {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @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 {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_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);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @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 Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 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 functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_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 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_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() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @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 {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/ERC165Checker.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.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 ERC165CheckerUpgradeable {
// 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(IERC165Upgradeable).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}.
*
* _Available since v3.4._
*/
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.encodeWithSelector(IERC165Upgradeable.supportsInterface.selector, 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
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @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 IERC165Upgradeable {
/**
* @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 v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./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);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @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
pragma solidity 0.8.21;
import { AttestationPayload } from "../types/Structs.sol";
import { IERC165 } from "@openzeppelin/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
pragma solidity 0.8.21;
import { OperationType } from "../types/Enums.sol";
import { AttestationPayload } from "../types/Structs.sol";
import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
/**
* @title Abstract Module V2
* @author Consensys
* @notice Defines the minimal Module V2 interface
*/
abstract contract AbstractModuleV2 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 initialCaller The address of the initial caller (transaction sender)
* @param value The value (ETH) optionally passed in the attesting transaction
* @param attester The address defined by the Portal as the attester for this payload
* @param portal The issuing Portal's address
*/
function run(
AttestationPayload memory attestationPayload,
bytes memory validationPayload,
address initialCaller,
uint256 value,
address attester,
address portal,
OperationType operationType
) 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(AbstractModuleV2).interfaceId || interfaceID == type(IERC165).interfaceId;
}
}// 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 { OperationType } from "../types/Enums.sol";
import { AttestationPayload } from "../types/Structs.sol";
import { IERC165 } from "@openzeppelin/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 abstracts 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
* @dev DISCLAIMER: by default, this method is not implemented and should be overridden if funds are to be withdrawn
*/
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 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 attestV2(AttestationPayload memory attestationPayload, bytes[] memory validationPayloads) public payable {
moduleRegistry.runModulesV2(
modules,
attestationPayload,
validationPayloads,
msg.value,
msg.sender,
getAttester(),
OperationType.Attest
);
_onAttestV2(attestationPayload, validationPayloads, 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
* @dev DISCLAIMER: This method may have unexpected behavior if one of the Module checks is done on the attestation ID
* as this ID won't be incremented before the end of the transaction.
* If you need to check the attestation ID, please use the `attest` method.
*/
function bulkAttest(AttestationPayload[] memory attestationsPayloads, bytes[][] memory validationPayloads) public {
moduleRegistry.bulkRunModules(modules, attestationsPayloads, validationPayloads);
_onBulkAttest(attestationsPayloads, validationPayloads);
attestationRegistry.bulkAttest(attestationsPayloads, getAttester());
}
/**
* @notice Bulk attest the schema with payloads to attest and validation payloads
* @param attestationPayloads the payloads to attest
* @param validationPayloads the payloads to validate via the modules to issue the attestations
* @dev DISCLAIMER: This method may have unexpected behavior if one of the Module checks is done on the attestation ID
* as this ID won't be incremented before the end of the transaction.
* If you need to check the attestation ID, please use the `attestV2` method.
*/
function bulkAttestV2(AttestationPayload[] memory attestationPayloads, bytes[][] memory validationPayloads) public {
moduleRegistry.bulkRunModulesV2(
modules,
attestationPayloads,
validationPayloads,
msg.sender,
getAttester(),
OperationType.BulkAttest
);
_onBulkAttest(attestationPayloads, validationPayloads);
attestationRegistry.bulkAttest(attestationPayloads, 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 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 replaceV2(
bytes32 attestationId,
AttestationPayload memory attestationPayload,
bytes[] memory validationPayloads
) public payable {
moduleRegistry.runModulesV2(
modules,
attestationPayload,
validationPayloads,
msg.value,
msg.sender,
getAttester(),
OperationType.Replace
);
_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
* @dev DISCLAIMER: This method may have unexpected behavior if one of the Module checks is done on the attestation ID
* as this ID won't be incremented before the end of the transaction.
* If you need to check the attestation ID, please use the `replace` method.
*/
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 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
* @dev DISCLAIMER: This method may have unexpected behavior if one of the Module checks is done on the attestation ID
* as this ID won't be incremented before the end of the transaction.
* If you need to check the attestation ID, please use the `replaceV2` method.
*/
function bulkReplaceV2(
bytes32[] memory attestationIds,
AttestationPayload[] memory attestationsPayloads,
bytes[][] memory validationPayloads
) public {
moduleRegistry.bulkRunModulesV2(
modules,
attestationsPayloads,
validationPayloads,
msg.sender,
getAttester(),
OperationType.BulkReplace
);
_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 before a payload is attested
* @param attestationPayload the attestation payload to attest
* @param validationPayloads the payloads to validate via the modules
* @param value the value sent with the attestation
*/
function _onAttestV2(
AttestationPayload memory attestationPayload,
bytes[] memory validationPayloads,
uint256 value
) internal virtual {}
/**
* @notice Optional method run when an attestation is replaced
* @dev IMPORTANT NOTE: By default, replacement is only possible by the portal owner
* @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 {
if (msg.sender != portalRegistry.getPortalByAddress(address(this)).ownerAddress) revert OnlyPortalOwner();
}
/**
* @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 {}
/**
* @notice Optional method run when replacing a batch of payloads
* @dev IMPORTANT NOTE: By default, bulk replacement is only possible by the portal owner
* @param attestationIds the IDs of the attestations being replaced
* @param attestationsPayloads the payloads to replace
* @param validationPayloads the payloads to validate in order to replace the attestations
*/
function _onBulkReplace(
bytes32[] memory attestationIds,
AttestationPayload[] memory attestationsPayloads,
bytes[][] memory validationPayloads
) internal virtual {
if (msg.sender != portalRegistry.getPortalByAddress(address(this)).ownerAddress) revert OnlyPortalOwner();
}
/**
* @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();
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/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 Event emitted when the router is updated
event RouterUpdated(address routerAddress);
/// @notice Event emitted when the chain prefix is updated
event ChainPrefixUpdated(uint256 chainPrefix);
/**
* @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();
}
/**
* @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);
emit RouterUpdated(_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;
emit ChainPrefixUpdated(_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;
/**
* @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 { 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
pragma solidity 0.8.21;
import { IERC165 } from "@openzeppelin/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
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 { OperationType } from "./types/Enums.sol";
import { AttestationPayload, Module } from "./types/Structs.sol";
import { AbstractModule } from "./abstracts/AbstractModule.sol";
import { AbstractModuleV2 } from "./abstracts/AbstractModuleV2.sol";
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
// solhint-disable-next-line max-line-length
import { ERC165CheckerUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.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-allowlisted user tries to call a forbidden method
error OnlyAllowlisted();
/// @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);
/// @notice Event emitted when the router is updated
event RouterUpdated(address routerAddress);
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
/**
* @notice Contract initialization
*/
function initialize() public initializer {
__Ownable_init();
}
/**
* @notice Checks if the caller is allowlisted.
* @param user the user address
*/
modifier onlyAllowlisted(address user) {
if (!PortalRegistry(router.getPortalRegistry()).isAllowlisted(user)) revert OnlyAllowlisted();
_;
}
/**
* @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);
emit RouterUpdated(_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 onlyAllowlisted(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 or AbstractModuleV2
if (
!ERC165CheckerUpgradeable.supportsInterface(moduleAddress, type(AbstractModule).interfaceId) &&
!ERC165CheckerUpgradeable.supportsInterface(moduleAddress, type(AbstractModuleV2).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 module 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 its run method
for (uint32 i = 0; i < modulesAddresses.length; i = uncheckedInc32(i)) {
if (!isRegistered(modulesAddresses[i])) revert ModuleNotRegistered();
// solhint-disable avoid-tx-origin
AbstractModule(modulesAddresses[i]).run(attestationPayload, validationPayloads[i], tx.origin, value);
}
}
/**
* @notice Executes the V2 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)
* @param value the value (ETH) optionally passed in the attesting transaction
* @param initialCaller the address of the initial caller (transaction sender)
* @param attester the address defined by the Portal as the attester for this payload
* @dev check if modules are registered and execute the V2 run method for each module
*/
function runModulesV2(
address[] memory modulesAddresses,
AttestationPayload memory attestationPayload,
bytes[] memory validationPayloads,
uint256 value,
address initialCaller,
address attester,
OperationType operationType
) public {
// If no module 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 its run method
for (uint32 i = 0; i < modulesAddresses.length; i = uncheckedInc32(i)) {
if (!isRegistered(modulesAddresses[i])) revert ModuleNotRegistered();
AbstractModuleV2(modulesAddresses[i]).run(
attestationPayload,
validationPayloads[i],
initialCaller,
value,
attester,
msg.sender,
operationType
);
}
}
/**
* @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.
* @dev DISCLAIMER: This method may have unexpected behavior if one of the checks is done on the attestation ID
* as this ID won't be incremented before the end of the transaction.
* If you need to check the attestation ID, please use the `attest` method.
*/
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 Executes the V2 modules validation for all attestations payloads for all given V2 Modules that are registered
* @param modulesAddresses the addresses of the registered modules
* @param attestationPayloads 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.
* @dev DISCLAIMER: This method may have unexpected behavior if one of the checks is done on the attestation ID
* as this ID won't be incremented before the end of the transaction.
* If you need to check the attestation ID, please use the `attestV2` method.
*/
function bulkRunModulesV2(
address[] memory modulesAddresses,
AttestationPayload[] memory attestationPayloads,
bytes[][] memory validationPayloads,
address initialCaller,
address attester,
OperationType operationType
) public {
for (uint32 i = 0; i < attestationPayloads.length; i = uncheckedInc32(i)) {
runModulesV2(
modulesAddresses,
attestationPayloads[i],
validationPayloads[i],
0,
initialCaller,
attester,
operationType
);
}
}
/**
* @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/contracts-upgradeable/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-allowlisted user tries to call a forbidden method
error OnlyAllowlisted();
/// @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);
/// @notice Event emitted when the router is updated
event RouterUpdated(address routerAddress);
/// @notice Event emitted when the schema issuer is updated
event SchemaIssuerUpdated(bytes32 schemaId, address schemaIssuerAddress);
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
/**
* @notice Contract initialization
*/
function initialize() public initializer {
__Ownable_init();
}
/**
* @notice Checks if the caller is allowlisted.
* @param user the user address
*/
modifier onlyAllowlisted(address user) {
if (!PortalRegistry(router.getPortalRegistry()).isAllowlisted(user)) revert OnlyAllowlisted();
_;
}
/**
* @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);
emit RouterUpdated(_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;
emit SchemaIssuerUpdated(schemaId, issuer);
}
/**
* @notice Updates issuers of all given schemaIds with the new issuer
* @param schemaIdsToUpdate the IDs of schemas to update
* @param issuer the address of new issuer
* @dev Updates issuer for the given schemaIds in the `schemaIssuers` mapping
* The issuer must already be registered as an Issuer via the `PortalRegistry`
*/
function bulkUpdateSchemasIssuers(bytes32[] calldata schemaIdsToUpdate, address issuer) public onlyOwner {
for (uint256 i = 0; i < schemaIdsToUpdate.length; i = uncheckedInc256(i)) {
updateSchemaIssuer(schemaIdsToUpdate[i], issuer);
}
}
/**
* 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 onlyAllowlisted(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;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;
enum OperationType {
Attest,
BulkAttest,
Replace,
BulkReplace
}// 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.
}{
"evmVersion": "paris",
"optimizer": {
"enabled": true,
"runs": 150
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"bool","name":"_isTestnet","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressInvalid","type":"error"},{"inputs":[],"name":"OnlyAllowlisted","type":"error"},{"inputs":[],"name":"PortalAddressInvalid","type":"error"},{"inputs":[],"name":"PortalAlreadyExists","type":"error"},{"inputs":[],"name":"PortalDescriptionMissing","type":"error"},{"inputs":[],"name":"PortalInvalid","type":"error"},{"inputs":[],"name":"PortalNameMissing","type":"error"},{"inputs":[],"name":"PortalNotRegistered","type":"error"},{"inputs":[],"name":"PortalOwnerNameMissing","type":"error"},{"inputs":[],"name":"RouterInvalid","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isTestnet","type":"bool"}],"name":"IsTestnetUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"issuerAddress","type":"address"}],"name":"IssuerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"issuerAddress","type":"address"}],"name":"IssuerRemoved","type":"event"},{"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":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"description","type":"string"},{"indexed":false,"internalType":"address","name":"portalAddress","type":"address"}],"name":"PortalRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"portalAddress","type":"address"}],"name":"PortalRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"routerAddress","type":"address"}],"name":"RouterUpdated","type":"event"},{"inputs":[{"internalType":"address[]","name":"modules","type":"address[]"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"bool","name":"isRevocable","type":"bool"},{"internalType":"string","name":"ownerName","type":"string"}],"name":"deployDefaultPortal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getIsTestnet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"id","type":"address"}],"name":"getPortalByAddress","outputs":[{"components":[{"internalType":"address","name":"id","type":"address"},{"internalType":"address","name":"ownerAddress","type":"address"},{"internalType":"address[]","name":"modules","type":"address[]"},{"internalType":"bool","name":"isRevocable","type":"bool"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"ownerName","type":"string"}],"internalType":"struct Portal","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPortalsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"isAllowlisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"issuer","type":"address"}],"name":"isIssuer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"id","type":"address"}],"name":"isRegistered","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"id","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"bool","name":"isRevocable","type":"bool"},{"internalType":"string","name":"ownerName","type":"string"}],"name":"register","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"issuer","type":"address"}],"name":"removeIssuer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"id","type":"address"}],"name":"revoke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract IRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_isTestnet","type":"bool"}],"name":"setIsTestnet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"issuer","type":"address"}],"name":"setIssuer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"}],"name":"updateRouter","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b506040516200374038038062003740833981016040819052620000349162000116565b6200003e62000055565b6069805460ff191691151591909117905562000141565b600054610100900460ff1615620000c25760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161462000114576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6000602082840312156200012957600080fd5b815180151581146200013a57600080fd5b9392505050565b6135ef80620001516000396000f3fe60806040523480156200001157600080fd5b50600436106200012d5760003560e01c8063877b9a6711620000af578063c851cc32116200007a578063c851cc32146200028b578063e569aabd14620002a2578063f0d124ec14620002ae578063f2fde38b14620002c5578063f887ea4014620002dc57600080fd5b8063877b9a6714620001f95780638da5cb5b1462000228578063c0fbc748146200024e578063c3c5a547146200027457600080fd5b806347bc709311620000fc57806347bc709314620001a057806355cc4e5714620001b7578063715018a614620001ce57806374a8f10314620001d85780638129fc1c14620001ef57600080fd5b806305a3b80914620001325780632246f111146200015e57806328c0ddf5146200017757806345592640146200018e575b600080fd5b6200014962000143366004620012a6565b620002f0565b60405190151581526020015b60405180910390f35b620001756200016f366004620012dc565b62000323565b005b6200017562000188366004620013bb565b62000375565b60685460405190815260200162000155565b62000175620001b1366004620012a6565b62000696565b62000175620001c8366004620012a6565b620006f2565b6200017562000779565b62000175620001e9366004620012a6565b62000791565b6200017562000a57565b620001496200020a366004620012a6565b6001600160a01b031660009081526067602052604090205460ff1690565b6033546001600160a01b03165b6040516001600160a01b03909116815260200162000155565b620002656200025f366004620012a6565b62000b72565b60405162000155919062001503565b6200014962000285366004620012a6565b62000e4f565b620001756200029c366004620012a6565b62000e6f565b60695460ff1662000149565b62000175620002bf366004620015cd565b62000ef0565b62000175620002d6366004620012a6565b62000f83565b60655462000235906001600160a01b031681565b60695460009060ff16806200031d57506001600160a01b03821660009081526067602052604090205460ff165b92915050565b6200032d62000fff565b6069805460ff19168215159081179091556040519081527f21e0e9c4df7d2dd6974ac374a82e79c3faf589fdb01055addc8b2c34b7810649906020015b60405180910390a150565b336200038181620002f0565b6200039f5760405163acf8a02d60e01b815260040160405180910390fd5b6001600160a01b038681166000908152606660205260409020541615620003d95760405163b11640c960e01b815260040160405180910390fd5b6001600160a01b0386163b620004025760405163a3f8514f60e01b815260040160405180910390fd5b845160000362000425576040516320789fc760e11b815260040160405180910390fd5b83516000036200044857604051631bcf1a0360e11b815260040160405180910390fd5b81516000036200046b5760405163c57edda160e01b815260040160405180910390fd5b6200047e866331c1afd560e01b6200105b565b6200049c57604051632c1d4deb60e01b815260040160405180910390fd5b6000866001600160a01b031663b2494df36040518163ffffffff1660e01b8152600401600060405180830381865afa158015620004dd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620005079190810190620016cd565b6040805160e0810182526001600160a01b03808b168083523360208085019182528486018781528b15156060870152608086018e905260a086018d905260c086018b905260009384526066825295909220845181549085166001600160a01b031991821617825591516001820180549190951692169190911790925592518051949550919384939192620005a392600285019291019062001201565b50606082015160038201805460ff191691151591909117905560808201516004820190620005d290826200181b565b5060a08201516005820190620005e990826200181b565b5060c082015160068201906200060090826200181b565b5050606880546001810182556000919091527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977530180546001600160a01b0319166001600160a01b038b16179055506040517f2b7df910f1bbb7a5c5b32de79907b6445d28b219a71bcb754b46d8d225d27e86906200068490899089908c90620018e8565b60405180910390a15050505050505050565b620006a062000fff565b6001600160a01b038116600081815260676020908152604091829020805460ff1916905590519182527faf66545c919a3be306ee446d8f42a9558b5b022620df880517bc9593ec0f2d5291016200036a565b620006fc62000fff565b6001600160a01b038116620007245760405163028be62f60e61b815260040160405180910390fd5b6001600160a01b038116600081815260676020908152604091829020805460ff1916600117905590519182527f05e7c881d716bee8cb7ed92293133ba156704252439e5c502c277448f04e20c291016200036a565b6200078362000fff565b6200078f600062001083565b565b6200079b62000fff565b620007a68162000e4f565b620007c45760405163082cec1d60e01b815260040160405180910390fd5b6040805160e0810182526000808252602080830182815284518381528083018652848601908152606085018490528551808401875284815260808601528551808401875284815260a08601528551808401875284815260c08601526001600160a01b0387811685526066845295909320845181549087166001600160a01b03199182161782559151600182018054919097169216919091179094559051805192939262000878926002850192019062001201565b50606082015160038201805460ff191691151591909117905560808201516004820190620008a790826200181b565b5060a08201516005820190620008be90826200181b565b5060c08201516006820190620008d590826200181b565b5060009150819050805b6068548110156200093b57836001600160a01b0316606882815481106200090a576200090a6200192a565b6000918252602090912001546001600160a01b0316036200093257809150600192506200093b565b600101620008df565b50816200095b5760405163082cec1d60e01b815260040160405180910390fd5b606880546200096d9060019062001940565b815481106200098057620009806200192a565b600091825260209091200154606880546001600160a01b039092169183908110620009af57620009af6200192a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506068805480620009f157620009f162001962565b6000828152602090819020600019908301810180546001600160a01b03191690559091019091556040516001600160a01b03851681527f3d6e85d7560af02579467bce30e02d3f08d3527a14d519ff42bee5774c70f95a910160405180910390a1505050565b600054610100900460ff161580801562000a785750600054600160ff909116105b8062000a945750303b15801562000a94575060005460ff166001145b62000afd5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff19166001179055801562000b21576000805461ff0019166101001790555b62000b2b620010d5565b801562000b6f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020016200036a565b50565b6040805160e0810182526000808252602082018190526060928201839052828201526080810182905260a0810182905260c081019190915262000bb58262000e4f565b62000bd35760405163082cec1d60e01b815260040160405180910390fd5b6001600160a01b03808316600090815260666020908152604091829020825160e0810184528154851681526001820154909416848301526002810180548451818502810185018652818152929486019383018282801562000c5e57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831162000c3f575b5050509183525050600382015460ff161515602082015260048201805460409092019162000c8c906200178c565b80601f016020809104026020016040519081016040528092919081815260200182805462000cba906200178c565b801562000d0b5780601f1062000cdf5761010080835404028352916020019162000d0b565b820191906000526020600020905b81548152906001019060200180831162000ced57829003601f168201915b5050505050815260200160058201805462000d26906200178c565b80601f016020809104026020016040519081016040528092919081815260200182805462000d54906200178c565b801562000da55780601f1062000d795761010080835404028352916020019162000da5565b820191906000526020600020905b81548152906001019060200180831162000d8757829003601f168201915b5050505050815260200160068201805462000dc0906200178c565b80601f016020809104026020016040519081016040528092919081815260200182805462000dee906200178c565b801562000e3f5780601f1062000e135761010080835404028352916020019162000e3f565b820191906000526020600020905b81548152906001019060200180831162000e2157829003601f168201915b5050505050815250509050919050565b6001600160a01b0390811660009081526066602052604090205416151590565b62000e7962000fff565b6001600160a01b03811662000ea1576040516324a2034760e11b815260040160405180910390fd5b606580546001600160a01b0319166001600160a01b0383169081179091556040519081527f7aed1d3e8155a07ccf395e44ea3109a0e2d6c9b29bbbe9f142d9790596f4dc80906020016200036a565b3362000efc81620002f0565b62000f1a5760405163acf8a02d60e01b815260040160405180910390fd5b606554604051600091899189916001600160a01b03169062000f3c906200126b565b62000f4a9392919062001978565b604051809103906000f08015801562000f67573d6000803e3d6000fd5b50905062000f79818787878762000375565b5050505050505050565b62000f8d62000fff565b6001600160a01b03811662000ff45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000af4565b62000b6f8162001083565b6033546001600160a01b031633146200078f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000af4565b6000620010688362001109565b80156200107c57506200107c838362001141565b9392505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16620010ff5760405162461bcd60e51b815260040162000af490620019df565b6200078f620011cc565b60006200111e826301ffc9a760e01b62001141565b80156200031d57506200113a826001600160e01b031962001141565b1592915050565b604080516001600160e01b03198316602480830191909152825180830390910181526044909101909152602080820180516001600160e01b03166301ffc9a760e01b178152825160009392849283928392918391908a617530fa92503d91506000519050828015620011b4575060208210155b8015620011c15750600081115b979650505050505050565b600054610100900460ff16620011f65760405162461bcd60e51b815260040162000af490620019df565b6200078f3362001083565b82805482825590600052602060002090810192821562001259579160200282015b828111156200125957825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062001222565b506200126792915062001279565b5090565b611b8f8062001a2b83390190565b5b808211156200126757600081556001016200127a565b6001600160a01b038116811462000b6f57600080fd5b600060208284031215620012b957600080fd5b81356200107c8162001290565b80358015158114620012d757600080fd5b919050565b600060208284031215620012ef57600080fd5b6200107c82620012c6565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156200133c576200133c620012fa565b604052919050565b600082601f8301126200135657600080fd5b813567ffffffffffffffff811115620013735762001373620012fa565b62001388601f8201601f191660200162001310565b8181528460208386010111156200139e57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a08688031215620013d457600080fd5b8535620013e18162001290565b9450602086013567ffffffffffffffff80821115620013ff57600080fd5b6200140d89838a0162001344565b955060408801359150808211156200142457600080fd5b6200143289838a0162001344565b94506200144260608901620012c6565b935060808801359150808211156200145957600080fd5b50620014688882890162001344565b9150509295509295909350565b600081518084526020808501945080840160005b83811015620014b05781516001600160a01b03168752958201959082019060010162001489565b509495945050505050565b6000815180845260005b81811015620014e357602081850181015186830182015201620014c5565b506000602082860101526020601f19601f83011685010191505092915050565b602080825282516001600160a01b0316828201528201516000906200153360408401826001600160a01b03169052565b50604083015160e060608401526200155061010084018262001475565b9050606084015162001566608085018215159052565b506080840151601f19808584030160a0860152620015858383620014bb565b925060a08601519150808584030160c0860152620015a48383620014bb565b925060c08601519150808584030160e086015250620015c48282620014bb565b95945050505050565b60008060008060008060a08789031215620015e757600080fd5b863567ffffffffffffffff808211156200160057600080fd5b818901915089601f8301126200161557600080fd5b8135818111156200162557600080fd5b8a60208260051b85010111156200163b57600080fd5b6020928301985096509088013590808211156200165757600080fd5b620016658a838b0162001344565b955060408901359150808211156200167c57600080fd5b6200168a8a838b0162001344565b94506200169a60608a01620012c6565b93506080890135915080821115620016b157600080fd5b50620016c089828a0162001344565b9150509295509295509295565b60006020808385031215620016e157600080fd5b825167ffffffffffffffff80821115620016fa57600080fd5b818501915085601f8301126200170f57600080fd5b815181811115620017245762001724620012fa565b8060051b91506200173784830162001310565b81815291830184019184810190888411156200175257600080fd5b938501935b838510156200178057845192506200176f8362001290565b828252938501939085019062001757565b98975050505050505050565b600181811c90821680620017a157607f821691505b602082108103620017c257634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200181657600081815260208120601f850160051c81016020861015620017f15750805b601f850160051c820191505b818110156200181257828155600101620017fd565b5050505b505050565b815167ffffffffffffffff811115620018385762001838620012fa565b62001850816200184984546200178c565b84620017c8565b602080601f8311600181146200188857600084156200186f5750858301515b600019600386901b1c1916600185901b17855562001812565b600085815260208120601f198616915b82811015620018b95788860151825594840194600190910190840162001898565b5085821015620018d85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b606081526000620018fd6060830186620014bb565b8281036020840152620019118186620014bb565b91505060018060a01b0383166040830152949350505050565b634e487b7160e01b600052603260045260246000fd5b818103818111156200031d57634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6040808252810183905260008460608301825b86811015620019bf578235620019a18162001290565b6001600160a01b03168252602092830192909101906001016200198b565b506001600160a01b03949094166020939093019290925250909392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fe60806040523480156200001157600080fd5b5060405162001b8f38038062001b8f8339810160408190526200003491620002b7565b8151829082906200004d90600190602085019062000203565b50600080546001600160a01b0319166001600160a01b0383169081179091556040805163bfa6658560e01b8152905163bfa66585916004808201926020929091908290030181865afa158015620000a8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000ce91906200039d565b600380546001600160a01b0319166001600160a01b03928316179055600054604080516376f63ca960e11b81529051919092169163edec79529160048083019260209291908290030181865afa1580156200012d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200015391906200039d565b600280546001600160a01b0319166001600160a01b0392831617905560005460408051635bed64bb60e11b81529051919092169163b7dac9769160048083019260209291908290030181865afa158015620001b2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001d891906200039d565b600480546001600160a01b0319166001600160a01b039290921691909117905550620003c292505050565b8280548282559060005260206000209081019282156200025b579160200282015b828111156200025b57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062000224565b50620002699291506200026d565b5090565b5b808211156200026957600081556001016200026e565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b0381168114620002b257600080fd5b919050565b60008060408385031215620002cb57600080fd5b82516001600160401b0380821115620002e357600080fd5b818501915085601f830112620002f857600080fd5b81516020828211156200030f576200030f62000284565b8160051b604051601f19603f8301168101818110868211171562000337576200033762000284565b6040529283528183019350848101820192898411156200035657600080fd5b948201945b838610156200037f576200036f866200029a565b855294820194938201936200035b565b96506200039090508782016200029a565b9450505050509250929050565b600060208284031215620003b057600080fd5b620003bb826200029a565b9392505050565b6117bd80620003d26000396000f3fe6080604052600436106101145760003560e01c8063b2494df3116100a0578063ecdbb4fd11610064578063ecdbb4fd146102d6578063ed6d73f9146102e9578063ee9db95114610309578063f3fef3a314610329578063f887ea401461034857600080fd5b8063b2494df314610241578063b666493414610263578063b75c7dc614610283578063b95459e4146102a3578063c08b0ace146102c357600080fd5b80634ada8076116100e75780634ada807614610196578063523ba7ca146101b65780637deb12dc146101d657806381b2248a146101f65780638388e2261461022e57600080fd5b806301ffc9a714610119578063074321961461014e5780633cc30e2a146101635780634426d9d314610183575b600080fd5b34801561012557600080fd5b50610139610134366004610b0a565b610368565b60405190151581526020015b60405180910390f35b61016161015c366004610d81565b6103ba565b005b34801561016f57600080fd5b5061016161017e366004610f3d565b610494565b610161610191366004610fc4565b61056f565b3480156101a257600080fd5b506101616101b1366004611026565b610621565b3480156101c257600080fd5b506101616101d1366004611062565b61068f565b3480156101e257600080fd5b506101616101f1366004611062565b610726565b34801561020257600080fd5b506102166102113660046110bb565b610760565b6040516001600160a01b039091168152602001610145565b34801561023a57600080fd5b5033610216565b34801561024d57600080fd5b5061025661078a565b60405161014591906110d4565b34801561026f57600080fd5b50600454610216906001600160a01b031681565b34801561028f57600080fd5b5061016161029e3660046110bb565b6107ec565b3480156102af57600080fd5b50600254610216906001600160a01b031681565b6101616102d1366004610d81565b610826565b6101616102e4366004610fc4565b610899565b3480156102f557600080fd5b50600354610216906001600160a01b031681565b34801561031557600080fd5b50610161610324366004610f3d565b6108d0565b34801561033557600080fd5b50610161610344366004611136565b5050565b34801561035457600080fd5b50600054610216906001600160a01b031681565b60006001600160e01b03198216633797819960e01b148061039957506001600160e01b031982166331c1afd560e01b145b806103b457506001600160e01b031982166301ffc9a760e01b145b92915050565b60025460405163747129e560e11b81526001600160a01b039091169063e8e253ca906103f1906001908690869034906004016112a4565b600060405180830381600087803b15801561040b57600080fd5b505af115801561041f573d6000803e3d6000fd5b5050505061042e826103443390565b6003546001600160a01b03166362fa3d4583336040518363ffffffff1660e01b815260040161045e9291906112ef565b600060405180830381600087803b15801561047857600080fd5b505af115801561048c573d6000803e3d6000fd5b505050505050565b60025460405163715d762560e11b81526001600160a01b039091169063e2baec4a906104c990600190869086906004016113a9565b600060405180830381600087803b1580156104e357600080fd5b505af11580156104f7573d6000803e3d6000fd5b5050505061050683838361090f565b6003546001600160a01b0316636ec4d4cb8484336040518463ffffffff1660e01b81526004016105389392919061141c565b600060405180830381600087803b15801561055257600080fd5b505af1158015610566573d6000803e3d6000fd5b50505050505050565b6002546001600160a01b031663a8015e436001848434338060026040518863ffffffff1660e01b81526004016105ab979695949392919061147c565b600060405180830381600087803b1580156105c557600080fd5b505af11580156105d9573d6000803e3d6000fd5b505050506105ef83836105e93390565b346109b5565b6003546001600160a01b0316638ffa736b8484336040518463ffffffff1660e01b8152600401610538939291906114f0565b61062a81610a61565b60035460405163256d403b60e11b81526001600160a01b0390911690634ada80769061065a908490600401611521565b600060405180830381600087803b15801561067457600080fd5b505af1158015610688573d6000803e3d6000fd5b5050505050565b60025460405163715d762560e11b81526001600160a01b039091169063e2baec4a906106c490600190869086906004016113a9565b600060405180830381600087803b1580156106de57600080fd5b505af11580156106f2573d6000803e3d6000fd5b505050506003546001600160a01b031663a8e2812d83336040518363ffffffff1660e01b815260040161045e929190611534565b6002546001600160a01b03166379638ef160018484338060016040518763ffffffff1660e01b81526004016106c496959493929190611547565b6001818154811061077057600080fd5b6000918252602090912001546001600160a01b0316905081565b606060018054806020026020016040519081016040528092919081815260200182805480156107e257602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116107c4575b5050505050905090565b6107f581610a61565b600354604051635bae3ee360e11b8152600481018390526001600160a01b039091169063b75c7dc69060240161065a565b6002546001600160a01b031663a8015e436001848434338060006040518863ffffffff1660e01b8152600401610862979695949392919061147c565b600060405180830381600087803b15801561087c57600080fd5b505af1158015610890573d6000803e3d6000fd5b5050505061042e565b60025460405163747129e560e11b81526001600160a01b039091169063e8e253ca906105ab906001908690869034906004016112a4565b6002546001600160a01b03166379638ef160018484338060036040518763ffffffff1660e01b81526004016104c996959493929190611547565b505050565b6004805460405163181f78e960e31b815230928101929092526001600160a01b03169063c0fbc74890602401600060405180830381865afa158015610958573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610980919081019061167c565b602001516001600160a01b0316336001600160a01b03161461090a576040516371f63e3160e01b815260040160405180910390fd5b6004805460405163181f78e960e31b815230928101929092526001600160a01b03169063c0fbc74890602401600060405180830381865afa1580156109fe573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610a26919081019061167c565b602001516001600160a01b0316336001600160a01b031614610a5b576040516371f63e3160e01b815260040160405180910390fd5b50505050565b6004805460405163181f78e960e31b815230928101929092526001600160a01b03169063c0fbc74890602401600060405180830381865afa158015610aaa573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ad2919081019061167c565b602001516001600160a01b0316336001600160a01b031614610b07576040516371f63e3160e01b815260040160405180910390fd5b50565b600060208284031215610b1c57600080fd5b81356001600160e01b031981168114610b3457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715610b7357610b73610b3b565b60405290565b604051601f8201601f191681016001600160401b0381118282101715610ba157610ba1610b3b565b604052919050565b60006001600160401b03821115610bc257610bc2610b3b565b50601f01601f191660200190565b600082601f830112610be157600080fd5b8135610bf4610bef82610ba9565b610b79565b818152846020838601011115610c0957600080fd5b816020850160208301376000918101602001919091529392505050565b600060808284031215610c3857600080fd5b604051608081016001600160401b038282108183111715610c5b57610c5b610b3b565b8160405282935084358352602085013591508082168214610c7b57600080fd5b8160208401526040850135915080821115610c9557600080fd5b610ca186838701610bd0565b60408401526060850135915080821115610cba57600080fd5b50610cc785828601610bd0565b6060830152505092915050565b60006001600160401b03821115610ced57610ced610b3b565b5060051b60200190565b600082601f830112610d0857600080fd5b81356020610d18610bef83610cd4565b82815260059290921b84018101918181019086841115610d3757600080fd5b8286015b84811015610d765780356001600160401b03811115610d5a5760008081fd5b610d688986838b0101610bd0565b845250918301918301610d3b565b509695505050505050565b60008060408385031215610d9457600080fd5b82356001600160401b0380821115610dab57600080fd5b610db786838701610c26565b93506020850135915080821115610dcd57600080fd5b50610dda85828601610cf7565b9150509250929050565b600082601f830112610df557600080fd5b81356020610e05610bef83610cd4565b82815260059290921b84018101918181019086841115610e2457600080fd5b8286015b84811015610d765780358352918301918301610e28565b600082601f830112610e5057600080fd5b81356020610e60610bef83610cd4565b82815260059290921b84018101918181019086841115610e7f57600080fd5b8286015b84811015610d765780356001600160401b03811115610ea25760008081fd5b610eb08986838b0101610c26565b845250918301918301610e83565b600082601f830112610ecf57600080fd5b81356020610edf610bef83610cd4565b82815260059290921b84018101918181019086841115610efe57600080fd5b8286015b84811015610d765780356001600160401b03811115610f215760008081fd5b610f2f8986838b0101610cf7565b845250918301918301610f02565b600080600060608486031215610f5257600080fd5b83356001600160401b0380821115610f6957600080fd5b610f7587838801610de4565b94506020860135915080821115610f8b57600080fd5b610f9787838801610e3f565b93506040860135915080821115610fad57600080fd5b50610fba86828701610ebe565b9150509250925092565b600080600060608486031215610fd957600080fd5b8335925060208401356001600160401b0380821115610ff757600080fd5b61100387838801610c26565b9350604086013591508082111561101957600080fd5b50610fba86828701610cf7565b60006020828403121561103857600080fd5b81356001600160401b0381111561104e57600080fd5b61105a84828501610de4565b949350505050565b6000806040838503121561107557600080fd5b82356001600160401b038082111561108c57600080fd5b61109886838701610e3f565b935060208501359150808211156110ae57600080fd5b50610dda85828601610ebe565b6000602082840312156110cd57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b818110156111155783516001600160a01b0316835292840192918401916001016110f0565b50909695505050505050565b6001600160a01b0381168114610b0757600080fd5b6000806040838503121561114957600080fd5b823561115481611121565b946020939093013593505050565b6000815480845260208085019450836000528060002060005b838110156111a05781546001600160a01b03168752958201956001918201910161117b565b509495945050505050565b60005b838110156111c65781810151838201526020016111ae565b50506000910152565b600081518084526111e78160208601602086016111ab565b601f01601f19169290920160200192915050565b805182526001600160401b036020820151166020830152600060408201516080604085015261122d60808501826111cf565b90506060830151848203606086015261124682826111cf565b95945050505050565b600081518084526020808501808196508360051b8101915082860160005b858110156112975782840389526112858483516111cf565b9885019893509084019060010161126d565b5091979650505050505050565b6080815260006112b76080830187611162565b82810360208401526112c981876111fb565b905082810360408401526112dd818661124f565b91505082606083015295945050505050565b60408152600061130260408301856111fb565b905060018060a01b03831660208301529392505050565b600081518084526020808501808196508360051b8101915082860160005b8581101561129757828403895261134f8483516111fb565b98850198935090840190600101611337565b600081518084526020808501808196508360051b8101915082860160005b8581101561129757828403895261139784835161124f565b9885019893509084019060010161137f565b6060815260006113bc6060830186611162565b82810360208401526113ce8186611319565b905082810360408401526113e28185611361565b9695505050505050565b600081518084526020808501945080840160005b838110156111a057815187529582019590820190600101611400565b60608152600061142f60608301866113ec565b82810360208401526114418186611319565b91505060018060a01b0383166040830152949350505050565b6004811061147857634e487b7160e01b600052602160045260246000fd5b9052565b60e08152600061148f60e083018a611162565b82810360208401526114a1818a6111fb565b905082810360408401526114b5818961124f565b606084018890526001600160a01b038781166080860152861660a085015291506114e4905060c083018461145a565b98975050505050505050565b83815260606020820152600061150960608301856111fb565b905060018060a01b0383166040830152949350505050565b602081526000610b3460208301846113ec565b6040815260006113026040830185611319565b60c08152600061155a60c0830189611162565b828103602084015261156c8189611319565b905082810360408401526115808188611361565b6001600160a01b0387811660608601528616608085015291506115a8905060a083018461145a565b979650505050505050565b80516115be81611121565b919050565b600082601f8301126115d457600080fd5b815160206115e4610bef83610cd4565b82815260059290921b8401810191818101908684111561160357600080fd5b8286015b84811015610d7657805161161a81611121565b8352918301918301611607565b805180151581146115be57600080fd5b600082601f83011261164857600080fd5b8151611656610bef82610ba9565b81815284602083860101111561166b57600080fd5b61105a8260208301602087016111ab565b60006020828403121561168e57600080fd5b81516001600160401b03808211156116a557600080fd5b9083019060e082860312156116b957600080fd5b6116c1610b51565b6116ca836115b3565b81526116d8602084016115b3565b60208201526040830151828111156116ef57600080fd5b6116fb878286016115c3565b60408301525061170d60608401611627565b606082015260808301518281111561172457600080fd5b61173087828601611637565b60808301525060a08301518281111561174857600080fd5b61175487828601611637565b60a08301525060c08301518281111561176c57600080fd5b61177887828601611637565b60c0830152509594505050505056fea2646970667358221220c17c69fbae5ed80646e4e4b0951b72be3de57310909557f8c8e8d8242eb9abbb64736f6c63430008150033a26469706673582212204a8f1def506c681bc1cd61b6f4653c867a175633c1727ee26eb9b8cd5ca43d2964736f6c634300081500330000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x60806040523480156200001157600080fd5b50600436106200012d5760003560e01c8063877b9a6711620000af578063c851cc32116200007a578063c851cc32146200028b578063e569aabd14620002a2578063f0d124ec14620002ae578063f2fde38b14620002c5578063f887ea4014620002dc57600080fd5b8063877b9a6714620001f95780638da5cb5b1462000228578063c0fbc748146200024e578063c3c5a547146200027457600080fd5b806347bc709311620000fc57806347bc709314620001a057806355cc4e5714620001b7578063715018a614620001ce57806374a8f10314620001d85780638129fc1c14620001ef57600080fd5b806305a3b80914620001325780632246f111146200015e57806328c0ddf5146200017757806345592640146200018e575b600080fd5b6200014962000143366004620012a6565b620002f0565b60405190151581526020015b60405180910390f35b620001756200016f366004620012dc565b62000323565b005b6200017562000188366004620013bb565b62000375565b60685460405190815260200162000155565b62000175620001b1366004620012a6565b62000696565b62000175620001c8366004620012a6565b620006f2565b6200017562000779565b62000175620001e9366004620012a6565b62000791565b6200017562000a57565b620001496200020a366004620012a6565b6001600160a01b031660009081526067602052604090205460ff1690565b6033546001600160a01b03165b6040516001600160a01b03909116815260200162000155565b620002656200025f366004620012a6565b62000b72565b60405162000155919062001503565b6200014962000285366004620012a6565b62000e4f565b620001756200029c366004620012a6565b62000e6f565b60695460ff1662000149565b62000175620002bf366004620015cd565b62000ef0565b62000175620002d6366004620012a6565b62000f83565b60655462000235906001600160a01b031681565b60695460009060ff16806200031d57506001600160a01b03821660009081526067602052604090205460ff165b92915050565b6200032d62000fff565b6069805460ff19168215159081179091556040519081527f21e0e9c4df7d2dd6974ac374a82e79c3faf589fdb01055addc8b2c34b7810649906020015b60405180910390a150565b336200038181620002f0565b6200039f5760405163acf8a02d60e01b815260040160405180910390fd5b6001600160a01b038681166000908152606660205260409020541615620003d95760405163b11640c960e01b815260040160405180910390fd5b6001600160a01b0386163b620004025760405163a3f8514f60e01b815260040160405180910390fd5b845160000362000425576040516320789fc760e11b815260040160405180910390fd5b83516000036200044857604051631bcf1a0360e11b815260040160405180910390fd5b81516000036200046b5760405163c57edda160e01b815260040160405180910390fd5b6200047e866331c1afd560e01b6200105b565b6200049c57604051632c1d4deb60e01b815260040160405180910390fd5b6000866001600160a01b031663b2494df36040518163ffffffff1660e01b8152600401600060405180830381865afa158015620004dd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620005079190810190620016cd565b6040805160e0810182526001600160a01b03808b168083523360208085019182528486018781528b15156060870152608086018e905260a086018d905260c086018b905260009384526066825295909220845181549085166001600160a01b031991821617825591516001820180549190951692169190911790925592518051949550919384939192620005a392600285019291019062001201565b50606082015160038201805460ff191691151591909117905560808201516004820190620005d290826200181b565b5060a08201516005820190620005e990826200181b565b5060c082015160068201906200060090826200181b565b5050606880546001810182556000919091527fa2153420d844928b4421650203c77babc8b33d7f2e7b450e2966db0c220977530180546001600160a01b0319166001600160a01b038b16179055506040517f2b7df910f1bbb7a5c5b32de79907b6445d28b219a71bcb754b46d8d225d27e86906200068490899089908c90620018e8565b60405180910390a15050505050505050565b620006a062000fff565b6001600160a01b038116600081815260676020908152604091829020805460ff1916905590519182527faf66545c919a3be306ee446d8f42a9558b5b022620df880517bc9593ec0f2d5291016200036a565b620006fc62000fff565b6001600160a01b038116620007245760405163028be62f60e61b815260040160405180910390fd5b6001600160a01b038116600081815260676020908152604091829020805460ff1916600117905590519182527f05e7c881d716bee8cb7ed92293133ba156704252439e5c502c277448f04e20c291016200036a565b6200078362000fff565b6200078f600062001083565b565b6200079b62000fff565b620007a68162000e4f565b620007c45760405163082cec1d60e01b815260040160405180910390fd5b6040805160e0810182526000808252602080830182815284518381528083018652848601908152606085018490528551808401875284815260808601528551808401875284815260a08601528551808401875284815260c08601526001600160a01b0387811685526066845295909320845181549087166001600160a01b03199182161782559151600182018054919097169216919091179094559051805192939262000878926002850192019062001201565b50606082015160038201805460ff191691151591909117905560808201516004820190620008a790826200181b565b5060a08201516005820190620008be90826200181b565b5060c08201516006820190620008d590826200181b565b5060009150819050805b6068548110156200093b57836001600160a01b0316606882815481106200090a576200090a6200192a565b6000918252602090912001546001600160a01b0316036200093257809150600192506200093b565b600101620008df565b50816200095b5760405163082cec1d60e01b815260040160405180910390fd5b606880546200096d9060019062001940565b815481106200098057620009806200192a565b600091825260209091200154606880546001600160a01b039092169183908110620009af57620009af6200192a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506068805480620009f157620009f162001962565b6000828152602090819020600019908301810180546001600160a01b03191690559091019091556040516001600160a01b03851681527f3d6e85d7560af02579467bce30e02d3f08d3527a14d519ff42bee5774c70f95a910160405180910390a1505050565b600054610100900460ff161580801562000a785750600054600160ff909116105b8062000a945750303b15801562000a94575060005460ff166001145b62000afd5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff19166001179055801562000b21576000805461ff0019166101001790555b62000b2b620010d5565b801562000b6f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020016200036a565b50565b6040805160e0810182526000808252602082018190526060928201839052828201526080810182905260a0810182905260c081019190915262000bb58262000e4f565b62000bd35760405163082cec1d60e01b815260040160405180910390fd5b6001600160a01b03808316600090815260666020908152604091829020825160e0810184528154851681526001820154909416848301526002810180548451818502810185018652818152929486019383018282801562000c5e57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831162000c3f575b5050509183525050600382015460ff161515602082015260048201805460409092019162000c8c906200178c565b80601f016020809104026020016040519081016040528092919081815260200182805462000cba906200178c565b801562000d0b5780601f1062000cdf5761010080835404028352916020019162000d0b565b820191906000526020600020905b81548152906001019060200180831162000ced57829003601f168201915b5050505050815260200160058201805462000d26906200178c565b80601f016020809104026020016040519081016040528092919081815260200182805462000d54906200178c565b801562000da55780601f1062000d795761010080835404028352916020019162000da5565b820191906000526020600020905b81548152906001019060200180831162000d8757829003601f168201915b5050505050815260200160068201805462000dc0906200178c565b80601f016020809104026020016040519081016040528092919081815260200182805462000dee906200178c565b801562000e3f5780601f1062000e135761010080835404028352916020019162000e3f565b820191906000526020600020905b81548152906001019060200180831162000e2157829003601f168201915b5050505050815250509050919050565b6001600160a01b0390811660009081526066602052604090205416151590565b62000e7962000fff565b6001600160a01b03811662000ea1576040516324a2034760e11b815260040160405180910390fd5b606580546001600160a01b0319166001600160a01b0383169081179091556040519081527f7aed1d3e8155a07ccf395e44ea3109a0e2d6c9b29bbbe9f142d9790596f4dc80906020016200036a565b3362000efc81620002f0565b62000f1a5760405163acf8a02d60e01b815260040160405180910390fd5b606554604051600091899189916001600160a01b03169062000f3c906200126b565b62000f4a9392919062001978565b604051809103906000f08015801562000f67573d6000803e3d6000fd5b50905062000f79818787878762000375565b5050505050505050565b62000f8d62000fff565b6001600160a01b03811662000ff45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000af4565b62000b6f8162001083565b6033546001600160a01b031633146200078f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000af4565b6000620010688362001109565b80156200107c57506200107c838362001141565b9392505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16620010ff5760405162461bcd60e51b815260040162000af490620019df565b6200078f620011cc565b60006200111e826301ffc9a760e01b62001141565b80156200031d57506200113a826001600160e01b031962001141565b1592915050565b604080516001600160e01b03198316602480830191909152825180830390910181526044909101909152602080820180516001600160e01b03166301ffc9a760e01b178152825160009392849283928392918391908a617530fa92503d91506000519050828015620011b4575060208210155b8015620011c15750600081115b979650505050505050565b600054610100900460ff16620011f65760405162461bcd60e51b815260040162000af490620019df565b6200078f3362001083565b82805482825590600052602060002090810192821562001259579160200282015b828111156200125957825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062001222565b506200126792915062001279565b5090565b611b8f8062001a2b83390190565b5b808211156200126757600081556001016200127a565b6001600160a01b038116811462000b6f57600080fd5b600060208284031215620012b957600080fd5b81356200107c8162001290565b80358015158114620012d757600080fd5b919050565b600060208284031215620012ef57600080fd5b6200107c82620012c6565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156200133c576200133c620012fa565b604052919050565b600082601f8301126200135657600080fd5b813567ffffffffffffffff811115620013735762001373620012fa565b62001388601f8201601f191660200162001310565b8181528460208386010111156200139e57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a08688031215620013d457600080fd5b8535620013e18162001290565b9450602086013567ffffffffffffffff80821115620013ff57600080fd5b6200140d89838a0162001344565b955060408801359150808211156200142457600080fd5b6200143289838a0162001344565b94506200144260608901620012c6565b935060808801359150808211156200145957600080fd5b50620014688882890162001344565b9150509295509295909350565b600081518084526020808501945080840160005b83811015620014b05781516001600160a01b03168752958201959082019060010162001489565b509495945050505050565b6000815180845260005b81811015620014e357602081850181015186830182015201620014c5565b506000602082860101526020601f19601f83011685010191505092915050565b602080825282516001600160a01b0316828201528201516000906200153360408401826001600160a01b03169052565b50604083015160e060608401526200155061010084018262001475565b9050606084015162001566608085018215159052565b506080840151601f19808584030160a0860152620015858383620014bb565b925060a08601519150808584030160c0860152620015a48383620014bb565b925060c08601519150808584030160e086015250620015c48282620014bb565b95945050505050565b60008060008060008060a08789031215620015e757600080fd5b863567ffffffffffffffff808211156200160057600080fd5b818901915089601f8301126200161557600080fd5b8135818111156200162557600080fd5b8a60208260051b85010111156200163b57600080fd5b6020928301985096509088013590808211156200165757600080fd5b620016658a838b0162001344565b955060408901359150808211156200167c57600080fd5b6200168a8a838b0162001344565b94506200169a60608a01620012c6565b93506080890135915080821115620016b157600080fd5b50620016c089828a0162001344565b9150509295509295509295565b60006020808385031215620016e157600080fd5b825167ffffffffffffffff80821115620016fa57600080fd5b818501915085601f8301126200170f57600080fd5b815181811115620017245762001724620012fa565b8060051b91506200173784830162001310565b81815291830184019184810190888411156200175257600080fd5b938501935b838510156200178057845192506200176f8362001290565b828252938501939085019062001757565b98975050505050505050565b600181811c90821680620017a157607f821691505b602082108103620017c257634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200181657600081815260208120601f850160051c81016020861015620017f15750805b601f850160051c820191505b818110156200181257828155600101620017fd565b5050505b505050565b815167ffffffffffffffff811115620018385762001838620012fa565b62001850816200184984546200178c565b84620017c8565b602080601f8311600181146200188857600084156200186f5750858301515b600019600386901b1c1916600185901b17855562001812565b600085815260208120601f198616915b82811015620018b95788860151825594840194600190910190840162001898565b5085821015620018d85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b606081526000620018fd6060830186620014bb565b8281036020840152620019118186620014bb565b91505060018060a01b0383166040830152949350505050565b634e487b7160e01b600052603260045260246000fd5b818103818111156200031d57634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6040808252810183905260008460608301825b86811015620019bf578235620019a18162001290565b6001600160a01b03168252602092830192909101906001016200198b565b506001600160a01b03949094166020939093019290925250909392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fe60806040523480156200001157600080fd5b5060405162001b8f38038062001b8f8339810160408190526200003491620002b7565b8151829082906200004d90600190602085019062000203565b50600080546001600160a01b0319166001600160a01b0383169081179091556040805163bfa6658560e01b8152905163bfa66585916004808201926020929091908290030181865afa158015620000a8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000ce91906200039d565b600380546001600160a01b0319166001600160a01b03928316179055600054604080516376f63ca960e11b81529051919092169163edec79529160048083019260209291908290030181865afa1580156200012d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200015391906200039d565b600280546001600160a01b0319166001600160a01b0392831617905560005460408051635bed64bb60e11b81529051919092169163b7dac9769160048083019260209291908290030181865afa158015620001b2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001d891906200039d565b600480546001600160a01b0319166001600160a01b039290921691909117905550620003c292505050565b8280548282559060005260206000209081019282156200025b579160200282015b828111156200025b57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062000224565b50620002699291506200026d565b5090565b5b808211156200026957600081556001016200026e565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b0381168114620002b257600080fd5b919050565b60008060408385031215620002cb57600080fd5b82516001600160401b0380821115620002e357600080fd5b818501915085601f830112620002f857600080fd5b81516020828211156200030f576200030f62000284565b8160051b604051601f19603f8301168101818110868211171562000337576200033762000284565b6040529283528183019350848101820192898411156200035657600080fd5b948201945b838610156200037f576200036f866200029a565b855294820194938201936200035b565b96506200039090508782016200029a565b9450505050509250929050565b600060208284031215620003b057600080fd5b620003bb826200029a565b9392505050565b6117bd80620003d26000396000f3fe6080604052600436106101145760003560e01c8063b2494df3116100a0578063ecdbb4fd11610064578063ecdbb4fd146102d6578063ed6d73f9146102e9578063ee9db95114610309578063f3fef3a314610329578063f887ea401461034857600080fd5b8063b2494df314610241578063b666493414610263578063b75c7dc614610283578063b95459e4146102a3578063c08b0ace146102c357600080fd5b80634ada8076116100e75780634ada807614610196578063523ba7ca146101b65780637deb12dc146101d657806381b2248a146101f65780638388e2261461022e57600080fd5b806301ffc9a714610119578063074321961461014e5780633cc30e2a146101635780634426d9d314610183575b600080fd5b34801561012557600080fd5b50610139610134366004610b0a565b610368565b60405190151581526020015b60405180910390f35b61016161015c366004610d81565b6103ba565b005b34801561016f57600080fd5b5061016161017e366004610f3d565b610494565b610161610191366004610fc4565b61056f565b3480156101a257600080fd5b506101616101b1366004611026565b610621565b3480156101c257600080fd5b506101616101d1366004611062565b61068f565b3480156101e257600080fd5b506101616101f1366004611062565b610726565b34801561020257600080fd5b506102166102113660046110bb565b610760565b6040516001600160a01b039091168152602001610145565b34801561023a57600080fd5b5033610216565b34801561024d57600080fd5b5061025661078a565b60405161014591906110d4565b34801561026f57600080fd5b50600454610216906001600160a01b031681565b34801561028f57600080fd5b5061016161029e3660046110bb565b6107ec565b3480156102af57600080fd5b50600254610216906001600160a01b031681565b6101616102d1366004610d81565b610826565b6101616102e4366004610fc4565b610899565b3480156102f557600080fd5b50600354610216906001600160a01b031681565b34801561031557600080fd5b50610161610324366004610f3d565b6108d0565b34801561033557600080fd5b50610161610344366004611136565b5050565b34801561035457600080fd5b50600054610216906001600160a01b031681565b60006001600160e01b03198216633797819960e01b148061039957506001600160e01b031982166331c1afd560e01b145b806103b457506001600160e01b031982166301ffc9a760e01b145b92915050565b60025460405163747129e560e11b81526001600160a01b039091169063e8e253ca906103f1906001908690869034906004016112a4565b600060405180830381600087803b15801561040b57600080fd5b505af115801561041f573d6000803e3d6000fd5b5050505061042e826103443390565b6003546001600160a01b03166362fa3d4583336040518363ffffffff1660e01b815260040161045e9291906112ef565b600060405180830381600087803b15801561047857600080fd5b505af115801561048c573d6000803e3d6000fd5b505050505050565b60025460405163715d762560e11b81526001600160a01b039091169063e2baec4a906104c990600190869086906004016113a9565b600060405180830381600087803b1580156104e357600080fd5b505af11580156104f7573d6000803e3d6000fd5b5050505061050683838361090f565b6003546001600160a01b0316636ec4d4cb8484336040518463ffffffff1660e01b81526004016105389392919061141c565b600060405180830381600087803b15801561055257600080fd5b505af1158015610566573d6000803e3d6000fd5b50505050505050565b6002546001600160a01b031663a8015e436001848434338060026040518863ffffffff1660e01b81526004016105ab979695949392919061147c565b600060405180830381600087803b1580156105c557600080fd5b505af11580156105d9573d6000803e3d6000fd5b505050506105ef83836105e93390565b346109b5565b6003546001600160a01b0316638ffa736b8484336040518463ffffffff1660e01b8152600401610538939291906114f0565b61062a81610a61565b60035460405163256d403b60e11b81526001600160a01b0390911690634ada80769061065a908490600401611521565b600060405180830381600087803b15801561067457600080fd5b505af1158015610688573d6000803e3d6000fd5b5050505050565b60025460405163715d762560e11b81526001600160a01b039091169063e2baec4a906106c490600190869086906004016113a9565b600060405180830381600087803b1580156106de57600080fd5b505af11580156106f2573d6000803e3d6000fd5b505050506003546001600160a01b031663a8e2812d83336040518363ffffffff1660e01b815260040161045e929190611534565b6002546001600160a01b03166379638ef160018484338060016040518763ffffffff1660e01b81526004016106c496959493929190611547565b6001818154811061077057600080fd5b6000918252602090912001546001600160a01b0316905081565b606060018054806020026020016040519081016040528092919081815260200182805480156107e257602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116107c4575b5050505050905090565b6107f581610a61565b600354604051635bae3ee360e11b8152600481018390526001600160a01b039091169063b75c7dc69060240161065a565b6002546001600160a01b031663a8015e436001848434338060006040518863ffffffff1660e01b8152600401610862979695949392919061147c565b600060405180830381600087803b15801561087c57600080fd5b505af1158015610890573d6000803e3d6000fd5b5050505061042e565b60025460405163747129e560e11b81526001600160a01b039091169063e8e253ca906105ab906001908690869034906004016112a4565b6002546001600160a01b03166379638ef160018484338060036040518763ffffffff1660e01b81526004016104c996959493929190611547565b505050565b6004805460405163181f78e960e31b815230928101929092526001600160a01b03169063c0fbc74890602401600060405180830381865afa158015610958573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610980919081019061167c565b602001516001600160a01b0316336001600160a01b03161461090a576040516371f63e3160e01b815260040160405180910390fd5b6004805460405163181f78e960e31b815230928101929092526001600160a01b03169063c0fbc74890602401600060405180830381865afa1580156109fe573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610a26919081019061167c565b602001516001600160a01b0316336001600160a01b031614610a5b576040516371f63e3160e01b815260040160405180910390fd5b50505050565b6004805460405163181f78e960e31b815230928101929092526001600160a01b03169063c0fbc74890602401600060405180830381865afa158015610aaa573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ad2919081019061167c565b602001516001600160a01b0316336001600160a01b031614610b07576040516371f63e3160e01b815260040160405180910390fd5b50565b600060208284031215610b1c57600080fd5b81356001600160e01b031981168114610b3457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715610b7357610b73610b3b565b60405290565b604051601f8201601f191681016001600160401b0381118282101715610ba157610ba1610b3b565b604052919050565b60006001600160401b03821115610bc257610bc2610b3b565b50601f01601f191660200190565b600082601f830112610be157600080fd5b8135610bf4610bef82610ba9565b610b79565b818152846020838601011115610c0957600080fd5b816020850160208301376000918101602001919091529392505050565b600060808284031215610c3857600080fd5b604051608081016001600160401b038282108183111715610c5b57610c5b610b3b565b8160405282935084358352602085013591508082168214610c7b57600080fd5b8160208401526040850135915080821115610c9557600080fd5b610ca186838701610bd0565b60408401526060850135915080821115610cba57600080fd5b50610cc785828601610bd0565b6060830152505092915050565b60006001600160401b03821115610ced57610ced610b3b565b5060051b60200190565b600082601f830112610d0857600080fd5b81356020610d18610bef83610cd4565b82815260059290921b84018101918181019086841115610d3757600080fd5b8286015b84811015610d765780356001600160401b03811115610d5a5760008081fd5b610d688986838b0101610bd0565b845250918301918301610d3b565b509695505050505050565b60008060408385031215610d9457600080fd5b82356001600160401b0380821115610dab57600080fd5b610db786838701610c26565b93506020850135915080821115610dcd57600080fd5b50610dda85828601610cf7565b9150509250929050565b600082601f830112610df557600080fd5b81356020610e05610bef83610cd4565b82815260059290921b84018101918181019086841115610e2457600080fd5b8286015b84811015610d765780358352918301918301610e28565b600082601f830112610e5057600080fd5b81356020610e60610bef83610cd4565b82815260059290921b84018101918181019086841115610e7f57600080fd5b8286015b84811015610d765780356001600160401b03811115610ea25760008081fd5b610eb08986838b0101610c26565b845250918301918301610e83565b600082601f830112610ecf57600080fd5b81356020610edf610bef83610cd4565b82815260059290921b84018101918181019086841115610efe57600080fd5b8286015b84811015610d765780356001600160401b03811115610f215760008081fd5b610f2f8986838b0101610cf7565b845250918301918301610f02565b600080600060608486031215610f5257600080fd5b83356001600160401b0380821115610f6957600080fd5b610f7587838801610de4565b94506020860135915080821115610f8b57600080fd5b610f9787838801610e3f565b93506040860135915080821115610fad57600080fd5b50610fba86828701610ebe565b9150509250925092565b600080600060608486031215610fd957600080fd5b8335925060208401356001600160401b0380821115610ff757600080fd5b61100387838801610c26565b9350604086013591508082111561101957600080fd5b50610fba86828701610cf7565b60006020828403121561103857600080fd5b81356001600160401b0381111561104e57600080fd5b61105a84828501610de4565b949350505050565b6000806040838503121561107557600080fd5b82356001600160401b038082111561108c57600080fd5b61109886838701610e3f565b935060208501359150808211156110ae57600080fd5b50610dda85828601610ebe565b6000602082840312156110cd57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b818110156111155783516001600160a01b0316835292840192918401916001016110f0565b50909695505050505050565b6001600160a01b0381168114610b0757600080fd5b6000806040838503121561114957600080fd5b823561115481611121565b946020939093013593505050565b6000815480845260208085019450836000528060002060005b838110156111a05781546001600160a01b03168752958201956001918201910161117b565b509495945050505050565b60005b838110156111c65781810151838201526020016111ae565b50506000910152565b600081518084526111e78160208601602086016111ab565b601f01601f19169290920160200192915050565b805182526001600160401b036020820151166020830152600060408201516080604085015261122d60808501826111cf565b90506060830151848203606086015261124682826111cf565b95945050505050565b600081518084526020808501808196508360051b8101915082860160005b858110156112975782840389526112858483516111cf565b9885019893509084019060010161126d565b5091979650505050505050565b6080815260006112b76080830187611162565b82810360208401526112c981876111fb565b905082810360408401526112dd818661124f565b91505082606083015295945050505050565b60408152600061130260408301856111fb565b905060018060a01b03831660208301529392505050565b600081518084526020808501808196508360051b8101915082860160005b8581101561129757828403895261134f8483516111fb565b98850198935090840190600101611337565b600081518084526020808501808196508360051b8101915082860160005b8581101561129757828403895261139784835161124f565b9885019893509084019060010161137f565b6060815260006113bc6060830186611162565b82810360208401526113ce8186611319565b905082810360408401526113e28185611361565b9695505050505050565b600081518084526020808501945080840160005b838110156111a057815187529582019590820190600101611400565b60608152600061142f60608301866113ec565b82810360208401526114418186611319565b91505060018060a01b0383166040830152949350505050565b6004811061147857634e487b7160e01b600052602160045260246000fd5b9052565b60e08152600061148f60e083018a611162565b82810360208401526114a1818a6111fb565b905082810360408401526114b5818961124f565b606084018890526001600160a01b038781166080860152861660a085015291506114e4905060c083018461145a565b98975050505050505050565b83815260606020820152600061150960608301856111fb565b905060018060a01b0383166040830152949350505050565b602081526000610b3460208301846113ec565b6040815260006113026040830185611319565b60c08152600061155a60c0830189611162565b828103602084015261156c8189611319565b905082810360408401526115808188611361565b6001600160a01b0387811660608601528616608085015291506115a8905060a083018461145a565b979650505050505050565b80516115be81611121565b919050565b600082601f8301126115d457600080fd5b815160206115e4610bef83610cd4565b82815260059290921b8401810191818101908684111561160357600080fd5b8286015b84811015610d7657805161161a81611121565b8352918301918301611607565b805180151581146115be57600080fd5b600082601f83011261164857600080fd5b8151611656610bef82610ba9565b81815284602083860101111561166b57600080fd5b61105a8260208301602087016111ab565b60006020828403121561168e57600080fd5b81516001600160401b03808211156116a557600080fd5b9083019060e082860312156116b957600080fd5b6116c1610b51565b6116ca836115b3565b81526116d8602084016115b3565b60208201526040830151828111156116ef57600080fd5b6116fb878286016115c3565b60408301525061170d60608401611627565b606082015260808301518281111561172457600080fd5b61173087828601611637565b60808301525060a08301518281111561174857600080fd5b61175487828601611637565b60a08301525060c08301518281111561176c57600080fd5b61177887828601611637565b60c0830152509594505050505056fea2646970667358221220c17c69fbae5ed80646e4e4b0951b72be3de57310909557f8c8e8d8242eb9abbb64736f6c63430008150033a26469706673582212204a8f1def506c681bc1cd61b6f4653c867a175633c1727ee26eb9b8cd5ca43d2964736f6c63430008150033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _isTestnet (bool): False
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.