ETH Price: $3,387.97 (-1.44%)
Gas: 2 Gwei

Contract

0x8903D8D4F4c06814D7ecb42b1258E2209d53A7d4
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x60806040163918642023-01-12 16:17:59533 days ago1673540279IN
 Create: SoulboundIdentity
0 ETH0.0508941421.96574545

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SoulboundIdentity

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion
File 1 of 21 : SoulboundIdentity.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "./libraries/Errors.sol";
import "./interfaces/ISoulboundIdentity.sol";
import "./interfaces/ISoulName.sol";
import "./tokens/MasaSBTAuthority.sol";

/// @title Soulbound Identity
/// @author Masa Finance
/// @notice Soulbound token that represents an identity.
/// @dev Soulbound identity, that inherits from the SBT contract.
contract SoulboundIdentity is
    MasaSBTAuthority,
    ISoulboundIdentity,
    ReentrancyGuard
{
    /* ========== STATE VARIABLES =========================================== */

    ISoulName public soulName;

    /* ========== INITIALIZE ================================================ */

    /// @notice Creates a new soulbound identity
    /// @dev Creates a new soulbound identity, inheriting from the SBT contract.
    /// @param admin Administrator of the smart contract
    /// @param baseTokenURI Base URI of the token
    constructor(address admin, string memory baseTokenURI)
        MasaSBTAuthority(admin, "Masa Identity", "MID", baseTokenURI)
    {}

    /* ========== RESTRICTED FUNCTIONS ====================================== */

    /// @notice Sets the SoulName contract address linked to this identity
    /// @dev The caller must have the admin role to call this function
    /// @param _soulName Address of the SoulName contract
    function setSoulName(ISoulName _soulName)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        if (address(_soulName) == address(0)) revert ZeroAddress();
        if (soulName == _soulName) revert SameValue();
        soulName = _soulName;
    }

    /* ========== MUTATIVE FUNCTIONS ======================================== */

    /// @notice Mints a new soulbound identity
    /// @dev The caller can only mint one identity per address
    /// @param to Address of the admin of the new identity
    function mint(address to) public override returns (uint256) {
        // Soulbound identity already created!
        if (balanceOf(to) > 0) revert IdentityAlreadyCreated(to);

        return _mintWithCounter(to);
    }

    /// @notice Mints a new soulbound identity with a SoulName associated to it
    /// @dev The caller can only mint one identity per address, and the name must be unique
    /// @param to Address of the admin of the new identity
    /// @param name Name of the new identity
    /// @param yearsPeriod Years of validity of the name
    /// @param _tokenURI URI of the NFT
    function mintIdentityWithName(
        address to,
        string memory name,
        uint256 yearsPeriod,
        string memory _tokenURI
    ) external override soulNameAlreadySet nonReentrant returns (uint256) {
        uint256 identityId = mint(to);
        soulName.mint(to, name, yearsPeriod, _tokenURI);

        return identityId;
    }

    /* ========== VIEWS ===================================================== */

    /// @notice Returns the address of the SoulName contract linked to this identity
    /// @dev This function returns the address of the SoulName contract linked to this identity
    /// @return Address of the SoulName contract
    function getSoulName() external view override returns (ISoulName) {
        return soulName;
    }

    /// @notice Returns the extension of the soul name
    /// @dev This function returns the extension of the soul name
    /// @return Extension of the soul name
    function getExtension() external view returns (string memory) {
        return soulName.getExtension();
    }

    /// @notice Returns the owner address of an identity
    /// @dev This function returns the owner address of the identity specified by the tokenId
    /// @param tokenId TokenId of the identity
    /// @return Address of the owner of the identity
    function ownerOf(uint256 tokenId)
        public
        view
        override(SBT, ISBT)
        returns (address)
    {
        return super.ownerOf(tokenId);
    }

    /// @notice Returns the owner address of a soul name
    /// @dev This function returns the owner address of the soul name identity specified by the name
    /// @param name Name of the soul name
    /// @return Address of the owner of the identity
    function ownerOf(string memory name)
        external
        view
        soulNameAlreadySet
        returns (address)
    {
        (, , uint256 identityId, , , ) = soulName.getTokenData(name);
        return super.ownerOf(identityId);
    }

    /// @notice Returns the URI of a soul name
    /// @dev This function returns the token URI of the soul name identity specified by the name
    /// @param name Name of the soul name
    /// @return URI of the identity associated to a soul name
    function tokenURI(string memory name)
        external
        view
        soulNameAlreadySet
        returns (string memory)
    {
        (, , uint256 identityId, , , ) = soulName.getTokenData(name);
        return super.tokenURI(identityId);
    }

    /// @notice Returns the URI of the owner of an identity
    /// @dev This function returns the token URI of the identity owned by an account
    /// @param owner Address of the owner of the identity
    /// @return URI of the identity owned by the account
    function tokenURI(address owner) external view returns (string memory) {
        uint256 tokenId = tokenOfOwner(owner);
        return super.tokenURI(tokenId);
    }

    /// @notice Returns the identity id of an account
    /// @dev This function returns the tokenId of the identity owned by an account
    /// @param owner Address of the owner of the identity
    /// @return TokenId of the identity owned by the account
    function tokenOfOwner(address owner)
        public
        view
        override
        returns (uint256)
    {
        return super.tokenOfOwnerByIndex(owner, 0);
    }

    /// @notice Checks if a soul name is available
    /// @dev This function queries if a soul name already exists and is in the available state
    /// @param name Name of the soul name
    /// @return available `true` if the soul name is available, `false` otherwise
    function isAvailable(string memory name)
        external
        view
        soulNameAlreadySet
        returns (bool available)
    {
        return soulName.isAvailable(name);
    }

    /// @notice Returns the information of a soul name
    /// @dev This function queries the information of a soul name
    /// @param name Name of the soul name
    /// @return sbtName Soul name, in upper/lower case and extension
    /// @return linked `true` if the soul name is linked, `false` otherwise
    /// @return identityId Identity id of the soul name
    /// @return tokenId SoulName id of the soul name
    /// @return expirationDate Expiration date of the soul name
    /// @return active `true` if the soul name is active, `false` otherwise
    function getTokenData(string memory name)
        external
        view
        soulNameAlreadySet
        returns (
            string memory sbtName,
            bool linked,
            uint256 identityId,
            uint256 tokenId,
            uint256 expirationDate,
            bool active
        )
    {
        return soulName.getTokenData(name);
    }

    /// @notice Returns all the active soul names of an account
    /// @dev This function queries all the identity names of the specified account
    /// @param owner Address of the owner of the identities
    /// @return sbtNames Array of soul names associated to the account
    function getSoulNames(address owner)
        external
        view
        soulNameAlreadySet
        returns (string[] memory sbtNames)
    {
        return soulName.getSoulNames(owner);
    }

    // SoulName -> SoulboundIdentity.tokenId
    // SoulName -> account -> SoulboundIdentity.tokenId

    /// @notice Returns all the active soul names of an account
    /// @dev This function queries all the identity names of the specified identity Id
    /// @param tokenId TokenId of the identity
    /// @return sbtNames Array of soul names associated to the identity Id
    function getSoulNames(uint256 tokenId)
        external
        view
        soulNameAlreadySet
        returns (string[] memory sbtNames)
    {
        return soulName.getSoulNames(tokenId);
    }

    /* ========== PRIVATE FUNCTIONS ========================================= */

    /* ========== MODIFIERS ================================================= */

    modifier soulNameAlreadySet() {
        if (address(soulName) == address(0)) revert SoulNameContractNotSet();
        _;
    }

    /* ========== EVENTS ==================================================== */
}

File 2 of 21 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 3 of 21 : Errors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

error AddressDoesNotHaveIdentity(address to);
error AlreadyAdded();
error AuthorityNotExists(address authority);
error CallerNotOwner(address caller);
error CallerNotReader(address caller);
error CreditScoreAlreadyCreated(address to);
error IdentityAlreadyCreated(address to);
error IdentityOwnerIsReader(uint256 readerIdentityId);
error InsufficientEthAmount(uint256 amount);
error IdentityOwnerNotTokenOwner(uint256 tokenId, uint256 ownerIdentityId);
error InvalidPaymentMethod(address paymentMethod);
error InvalidSignature();
error InvalidSignatureDate(uint256 signatureDate);
error InvalidToken(address token);
error InvalidTokenURI(string tokenURI);
error LinkAlreadyExists(
    address token,
    uint256 tokenId,
    uint256 readerIdentityId,
    uint256 signatureDate
);
error LinkAlreadyRevoked();
error LinkDoesNotExist();
error NameAlreadyExists(string name);
error NameNotFound(string name);
error NameRegisteredByOtherAccount(string name, uint256 tokenId);
error NotAuthorized(address signer);
error NonExistingErc20Token(address erc20token);
error RefundFailed();
error SameValue();
error SBTAlreadyLinked(address token);
error SoulNameContractNotSet();
error TokenNotFound(uint256 tokenId);
error TransferFailed();
error URIAlreadyExists(string tokenURI);
error ValidPeriodExpired(uint256 expirationDate);
error ZeroAddress();
error ZeroLengthName(string name);
error ZeroYearsPeriod(uint256 yearsPeriod);

File 4 of 21 : ISoulboundIdentity.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "../tokens/SBT/ISBT.sol";

import "./ISoulName.sol";

interface ISoulboundIdentity is ISBT {
    function mint(address to) external returns (uint256);

    function mintIdentityWithName(
        address to,
        string memory name,
        uint256 yearsPeriod,
        string memory _tokenURI
    ) external returns (uint256);

    function getSoulName() external view returns (ISoulName);

    function tokenOfOwner(address owner) external view returns (uint256);
}

File 5 of 21 : ISoulName.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

interface ISoulName {
    function mint(
        address to,
        string memory name,
        uint256 yearsPeriod,
        string memory _tokenURI
    ) external returns (uint256);

    function getExtension() external view returns (string memory);

    function isAvailable(string memory name)
        external
        view
        returns (bool available);

    function getTokenData(string memory name)
        external
        view
        returns (
            string memory sbtName,
            bool linked,
            uint256 identityId,
            uint256 tokenId,
            uint256 expirationDate,
            bool active
        );

    function getTokenId(string memory name) external view returns (uint256);

    function getSoulNames(address owner)
        external
        view
        returns (string[] memory sbtNames);

    function getSoulNames(uint256 identityId)
        external
        view
        returns (string[] memory sbtNames);
}

File 6 of 21 : MasaSBTAuthority.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@openzeppelin/contracts/utils/Counters.sol";

import "./MasaSBT.sol";

/// @title MasaSBT
/// @author Masa Finance
/// @notice Soulbound token. Non-fungible token that is not transferable.
/// @dev Implementation of https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4105763 Soulbound token.
abstract contract MasaSBTAuthority is MasaSBT {
    /* ========== STATE VARIABLES =========================================== */

    using Counters for Counters.Counter;

    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    Counters.Counter private _tokenIdCounter;

    /* ========== INITIALIZE ================================================ */

    /// @notice Creates a new soulbound token
    /// @dev Creates a new soulbound token
    /// @param admin Administrator of the smart contract
    /// @param name Name of the token
    /// @param symbol Symbol of the token
    /// @param baseTokenURI Base URI of the token
    constructor(
        address admin,
        string memory name,
        string memory symbol,
        string memory baseTokenURI
    ) MasaSBT(admin, name, symbol, baseTokenURI) {
        _grantRole(MINTER_ROLE, admin);
    }

    /* ========== RESTRICTED FUNCTIONS ====================================== */

    function _mintWithCounter(address to)
        internal
        virtual
        onlyRole(MINTER_ROLE)
        returns (uint256)
    {
        uint256 tokenId = _tokenIdCounter.current();
        _tokenIdCounter.increment();
        _mint(to, tokenId);

        return tokenId;
    }

    /* ========== MUTATIVE FUNCTIONS ======================================== */

    /* ========== VIEWS ===================================================== */

    /* ========== PRIVATE FUNCTIONS ========================================= */

    /* ========== MODIFIERS ================================================= */

    /* ========== EVENTS ==================================================== */
}

File 7 of 21 : ISBT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

interface ISBT is IERC165 {
    /// @dev This emits when an SBT is newly minted.
    ///  This event emits when SBTs are created
    event Mint(address indexed _owner, uint256 indexed _tokenId);

    /// @dev This emits when an SBT is burned
    ///  This event emits when SBTs are destroyed
    event Burn(address indexed _owner, uint256 indexed _tokenId);

    /// @notice Count all SBTs assigned to an owner
    /// @dev SBTs assigned to the zero address are considered invalid, and this
    ///  function throws for queries about the zero address.
    /// @param _owner An address for whom to query the balance
    /// @return The number of SBTs owned by `_owner`, possibly zero
    function balanceOf(address _owner) external view returns (uint256);

    /// @notice Find the owner of an SBT
    /// @dev SBTs assigned to zero address are considered invalid, and queries
    ///  about them do throw.
    /// @param _tokenId The identifier for an SBT
    /// @return The address of the owner of the SBT
    function ownerOf(uint256 _tokenId) external view returns (address);
}

File 8 of 21 : IERC165.sol
// 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);
}

File 9 of 21 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 10 of 21 : MasaSBT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

import "../libraries/Errors.sol";
import "../interfaces/ILinkableSBT.sol";
import "./SBT/SBT.sol";
import "./SBT/extensions/SBTEnumerable.sol";
import "./SBT/extensions/SBTBurnable.sol";

/// @title MasaSBT
/// @author Masa Finance
/// @notice Soulbound token. Non-fungible token that is not transferable.
/// @dev Implementation of https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4105763 Soulbound token.
abstract contract MasaSBT is
    SBT,
    SBTEnumerable,
    AccessControl,
    SBTBurnable,
    ILinkableSBT
{
    /* ========== STATE VARIABLES =========================================== */

    using Strings for uint256;

    string private _baseTokenURI;

    uint256 public override addLinkPrice; // price in stable coin
    uint256 public override addLinkPriceMASA; // price in MASA
    uint256 public override queryLinkPrice; // price in stable coin
    uint256 public override queryLinkPriceMASA; // price in MASA

    /* ========== INITIALIZE ================================================ */

    /// @notice Creates a new soulbound token
    /// @dev Creates a new soulbound token
    /// @param admin Administrator of the smart contract
    /// @param name Name of the token
    /// @param symbol Symbol of the token
    /// @param baseTokenURI Base URI of the token
    constructor(
        address admin,
        string memory name,
        string memory symbol,
        string memory baseTokenURI
    ) SBT(name, symbol) {
        _grantRole(DEFAULT_ADMIN_ROLE, admin);

        _baseTokenURI = baseTokenURI;
    }

    /* ========== RESTRICTED FUNCTIONS ====================================== */

    /// @notice Sets the price for adding the link in SoulLinker in stable coin
    /// @dev The caller must have the admin role to call this function
    /// @param _addLinkPrice New price for adding the link in SoulLinker in stable coin
    function setAddLinkPrice(uint256 _addLinkPrice)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        if (addLinkPrice == _addLinkPrice) revert SameValue();
        addLinkPrice = _addLinkPrice;
    }

    /// @notice Sets the price for adding the link in SoulLinker in MASA
    /// @dev The caller must have the admin role to call this function
    /// @param _addLinkPriceMASA New price for adding the link in SoulLinker in MASA
    function setAddLinkPriceMASA(uint256 _addLinkPriceMASA)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        if (addLinkPriceMASA == _addLinkPriceMASA) revert SameValue();
        addLinkPriceMASA = _addLinkPriceMASA;
    }

    /// @notice Sets the price for reading data in SoulLinker in stable coin
    /// @dev The caller must have the admin role to call this function
    /// @param _queryLinkPrice New price for reading data in SoulLinker in stable coin
    function setQueryLinkPrice(uint256 _queryLinkPrice)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        if (queryLinkPrice == _queryLinkPrice) revert SameValue();
        queryLinkPrice = _queryLinkPrice;
    }

    /// @notice Sets the price for reading data in SoulLinker in MASA
    /// @dev The caller must have the admin role to call this function
    /// @param _queryLinkPriceMASA New price for reading data in SoulLinker in MASA
    function setQueryLinkPriceMASA(uint256 _queryLinkPriceMASA)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        if (queryLinkPriceMASA == _queryLinkPriceMASA) revert SameValue();
        queryLinkPriceMASA = _queryLinkPriceMASA;
    }

    /* ========== MUTATIVE FUNCTIONS ======================================== */

    /* ========== VIEWS ===================================================== */

    /// @notice Returns true if the token exists
    /// @dev Returns true if the token has been minted
    /// @param tokenId Token to check
    /// @return True if the token exists
    function exists(uint256 tokenId) external view returns (bool) {
        return _exists(tokenId);
    }

    /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
    /// @dev Throws if `_tokenId` is not a valid SBT. URIs are defined in RFC
    ///  3986. The URI may point to a JSON file that conforms to the "ERC721
    ///  Metadata JSON Schema".
    /// @param tokenId SBT to get the URI of
    /// @return URI of the SBT
    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        _requireMinted(tokenId);

        string memory baseURI = _baseURI();
        return
            bytes(baseURI).length > 0
                ? string(abi.encodePacked(baseURI, tokenId.toString(), ".json"))
                : "";
    }

    /// @notice Query if a contract implements an interface
    /// @dev Interface identification is specified in ERC-165.
    /// @param interfaceId The interface identifier, as specified in ERC-165
    /// @return `true` if the contract implements `interfaceId` and
    ///  `interfaceId` is not 0xffffffff, `false` otherwise
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(SBT, SBTEnumerable, AccessControl, IERC165)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

    /* ========== PRIVATE FUNCTIONS ========================================= */

    function _baseURI() internal view virtual override returns (string memory) {
        return _baseTokenURI;
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override(SBT, SBTEnumerable) {
        super._beforeTokenTransfer(from, to, tokenId);
    }

    /* ========== MODIFIERS ================================================= */

    /* ========== EVENTS ==================================================== */
}

File 11 of 21 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 12 of 21 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 13 of 21 : ILinkableSBT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "../tokens/SBT/ISBT.sol";

interface ILinkableSBT is ISBT {
    function addLinkPrice() external view returns (uint256);

    function addLinkPriceMASA() external view returns (uint256);

    function queryLinkPrice() external view returns (uint256);

    function queryLinkPriceMASA() external view returns (uint256);
}

File 14 of 21 : SBT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

import "./ISBT.sol";
import "./extensions/ISBTMetadata.sol";

/// @title SBT
/// @author Masa Finance
/// @notice Soulbound token is an NFT token that is not transferable.
contract SBT is Context, ERC165, ISBT, ISBTMetadata {
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165, IERC165)
        returns (bool)
    {
        return
            interfaceId == type(ISBT).interfaceId ||
            interfaceId == type(ISBTMetadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {ISBT-balanceOf}.
     */
    function balanceOf(address owner)
        public
        view
        virtual
        override
        returns (uint256)
    {
        require(owner != address(0), "SBT: address zero is not a valid owner");
        return _balances[owner];
    }

    /**
     * @dev See {ISBT-ownerOf}.
     */
    function ownerOf(uint256 tokenId)
        public
        view
        virtual
        override
        returns (address)
    {
        address owner = _owners[tokenId];
        require(owner != address(0), "SBT: invalid token ID");
        return owner;
    }

    /**
     * @dev See {ISBTMetadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {ISBTMetadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {ISBTMetadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        _requireMinted(tokenId);

        string memory baseURI = _baseURI();
        return
            bytes(baseURI).length > 0
                ? string(abi.encodePacked(baseURI, tokenId.toString()))
                : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isOwner(address spender, uint256 tokenId)
        internal
        view
        virtual
        returns (bool)
    {
        address owner = SBT.ownerOf(tokenId);
        return (spender == owner);
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Mint} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "SBT: mint to the zero address");
        require(!_exists(tokenId), "SBT: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Mint(to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     *
     * Requirements:
     * - `tokenId` must exist.
     *
     * Emits a {Burn} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = SBT.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Burn(owner, tokenId);

        _afterTokenTransfer(owner, address(0), tokenId);
    }

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "SBT: invalid token ID");
    }

    /**
     * @dev Hook that is called before any token minting/burning
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address,
        address,
        uint256
    ) internal virtual {}

    /**
     * @dev Hook that is called after any minting/burning of tokens
     *
     * Calling conditions:
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address,
        address,
        uint256
    ) internal virtual {}
}

File 15 of 21 : SBTEnumerable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "../SBT.sol";
import "./ISBTEnumerable.sol";

/**
 * @dev This implements an optional extension of {SBT} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract SBTEnumerable is SBT, ISBTEnumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(IERC165, SBT)
        returns (bool)
    {
        return
            interfaceId == type(ISBTEnumerable).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {ISBTEnumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index)
        public
        view
        virtual
        override
        returns (uint256)
    {
        require(
            index < SBT.balanceOf(owner),
            "SBTEnumerable: owner index out of bounds"
        );
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {ISBTEnumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {ISBTEnumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index)
        public
        view
        virtual
        override
        returns (uint256)
    {
        require(
            index < SBTEnumerable.totalSupply(),
            "SBTEnumerable: global index out of bounds"
        );
        return _allTokens[index];
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = SBT.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId)
        private
    {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = SBT.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

File 16 of 21 : SBTBurnable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@openzeppelin/contracts/utils/Context.sol";

import "../SBT.sol";

/**
 * @title SBT Burnable Token
 * @dev SBT Token that can be burned (destroyed).
 */
abstract contract SBTBurnable is Context, SBT {
    /**
     * @dev Burns `tokenId`. See {SBT-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        //solhint-disable-next-line max-line-length
        require(
            _isOwner(_msgSender(), tokenId),
            "SBT: caller is not token owner"
        );
        _burn(tokenId);
    }
}

File 17 of 21 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 18 of 21 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

File 19 of 21 : ERC165.sol
// 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;
    }
}

File 20 of 21 : ISBTMetadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "../ISBT.sol";

/**
 * @title SBT Soulbound Token Standard, optional metadata extension
 */
interface ISBTMetadata is ISBT {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 21 of 21 : ISBTEnumerable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "../ISBT.sol";

/**
 * @title SBT Soulbound Token Standard, optional enumeration extension
 */
interface ISBTEnumerable is ISBT {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index)
        external
        view
        returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1,
    "details": {
      "yul": false
    }
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"string","name":"baseTokenURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"IdentityAlreadyCreated","type":"error"},{"inputs":[],"name":"SameValue","type":"error"},{"inputs":[],"name":"SoulNameContractNotSet","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addLinkPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addLinkPriceMASA","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getExtension","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSoulName","outputs":[{"internalType":"contract ISoulName","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getSoulNames","outputs":[{"internalType":"string[]","name":"sbtNames","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getSoulNames","outputs":[{"internalType":"string[]","name":"sbtNames","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"getTokenData","outputs":[{"internalType":"string","name":"sbtName","type":"string"},{"internalType":"bool","name":"linked","type":"bool"},{"internalType":"uint256","name":"identityId","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"expirationDate","type":"uint256"},{"internalType":"bool","name":"active","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"isAvailable","outputs":[{"internalType":"bool","name":"available","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"yearsPeriod","type":"uint256"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"mintIdentityWithName","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"queryLinkPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"queryLinkPriceMASA","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_addLinkPrice","type":"uint256"}],"name":"setAddLinkPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_addLinkPriceMASA","type":"uint256"}],"name":"setAddLinkPriceMASA","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_queryLinkPrice","type":"uint256"}],"name":"setQueryLinkPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_queryLinkPriceMASA","type":"uint256"}],"name":"setQueryLinkPriceMASA","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISoulName","name":"_soulName","type":"address"}],"name":"setSoulName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"soulName","outputs":[{"internalType":"contract ISoulName","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokenOfOwner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b50604051620029fb380380620029fb833981016040819052620000349162000300565b816040518060400160405280600d81526020016c4d617361204964656e7469747960981b8152506040518060400160405280600381526020016213525160ea1b81525083838383838282816000908051906020019062000096929190620001d4565b508051620000ac906001906020840190620001d4565b50620000be915060009050856200011c565b8051620000d3906009906020840190620001d4565b50505050506200010a7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6856200011c60201b60201c565b50506001600f5550620004a692505050565b620001288282620001a7565b620001a35760008281526008602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620001623390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b60008281526008602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b828054620001e290620003f3565b90600052602060002090601f01602090048101928262000206576000855562000251565b82601f106200022157805160ff191683800117855562000251565b8280016001018555821562000251579182015b828111156200025157825182559160200191906001019062000234565b506200025f92915062000263565b5090565b5b808211156200025f576000815560010162000264565b6000620002916200028b846200037e565b6200035f565b905082815260208101848484011115620002ae57620002ae600080fd5b620002bb848285620003c0565b509392505050565b8051620001ce816200048c565b600082601f830112620002e657620002e6600080fd5b8151620002f88482602086016200027a565b949350505050565b60008060408385031215620003185762000318600080fd5b6000620003268585620002c3565b92505060208301516001600160401b03811115620003475762000347600080fd5b6200035585828601620002d0565b9150509250929050565b60006200036b60405190565b905062000379828262000424565b919050565b60006001600160401b038211156200039a576200039a6200046c565b620003a58262000482565b60200192915050565b60006001600160a01b038216620001ce565b60005b83811015620003dd578181015183820152602001620003c3565b83811115620003ed576000848401525b50505050565b6002810460018216806200040857607f821691505b602082108114156200041e576200041e62000456565b50919050565b6200042f8262000482565b81018181106001600160401b03821117156200044f576200044f6200046c565b6040525050565b634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b601f01601f191690565b6200049781620003ae565b8114620004a357600080fd5b50565b61254580620004b66000396000f3fe608060405234801561001057600080fd5b50600436106101d85760003560e01c806301ffc9a7146101dd57806306fdde03146102065780630f2e68af1461021b57806313150b481461023b57806318160ddd146102515780631f37c12414610259578063248a9ca314610262578063289c686b14610275578063294cdf0d1461028a5780632f2ff15d1461029d5780632f745c59146102b057806336568abe146102c35780633c72ae70146102d657806342966c68146102e957806346b2b087146102fc5780634cf12d26146103215780634f558e79146103345780634f6ccce7146103475780635141453e1461035a5780636352211e1461036d5780636a6278421461038d57806370a08231146103a0578063776ce6a1146103b3578063776d1a54146103bb5780637db8cb68146103c45780637e669891146103d757806391d14854146103f7578063920ffa261461040a57806393702f331461041d57806395d89b4114610430578063965306aa14610438578063a217fddf1461044b578063b507d48114610453578063b79636b614610464578063b97d6b2314610477578063c87b56dd14610480578063d539139314610493578063d547741f146104a8578063ee7a9ec5146104bb578063fd48ac83146104ce575b600080fd5b6101f06101eb366004611b8c565b6104e1565b6040516101fd9190612128565b60405180910390f35b61020e6104f2565b6040516101fd9190612152565b60105461022e906001600160a01b031681565b6040516101fd9190612144565b610244600d5481565b6040516101fd9190612136565b600654610244565b610244600a5481565b610244610270366004611b38565b610584565b610288610283366004611b38565b610599565b005b6102446102983660046119e7565b6105cd565b6102886102ab366004611b59565b6105da565b6102446102be366004611aa0565b6105fb565b6102886102d1366004611b59565b610656565b6102886102e4366004611b38565b61068c565b6102886102f7366004611b38565b6106c0565b61030f61030a366004611bce565b6106f2565b6040516101fd96959493929190612163565b61020e61032f366004611bce565b6107c1565b6101f0610342366004611b38565b61088b565b610244610355366004611b38565b610896565b610244610368366004611a08565b6108e4565b61038061037b366004611b38565b6109db565b6040516101fd91906120be565b61024461039b3660046119e7565b6109e6565b6102446103ae3660046119e7565b610a1c565b61020e610a60565b610244600b5481565b6102886103d2366004611b38565b610ae6565b6103ea6103e5366004611b38565b610b1a565b6040516101fd9190612117565b6101f0610405366004611b59565b610bca565b610380610418366004611bce565b610bf5565b61020e61042b3660046119e7565b610cb6565b61020e610cce565b6101f0610446366004611bce565b610cdd565b610244600081565b6010546001600160a01b031661022e565b6103ea6104723660046119e7565b610d89565b610244600c5481565b61020e61048e366004611b38565b610de5565b6102446000805160206124f083398151915281565b6102886104b6366004611b59565b610e4b565b6102886104c9366004611bad565b610e67565b6102886104dc366004611b38565b610eeb565b60006104ec82610f1f565b92915050565b606060008054610501906123a3565b80601f016020809104026020016040519081016040528092919081815260200182805461052d906123a3565b801561057a5780601f1061054f5761010080835404028352916020019161057a565b820191906000526020600020905b81548152906001019060200180831161055d57829003601f168201915b5050505050905090565b60009081526008602052604090206001015490565b60006105a481610f44565b81600a5414156105c75760405163c23f6ccb60e01b815260040160405180910390fd5b50600a55565b60006104ec8260006105fb565b6105e382610584565b6105ec81610f44565b6105f68383610f4e565b505050565b600061060683610a1c565b821061062d5760405162461bcd60e51b8152600401610624906121e2565b60405180910390fd5b506001600160a01b03919091166000908152600460209081526040808320938352929052205490565b6001600160a01b038116331461067e5760405162461bcd60e51b815260040161062490612252565b6106888282610fd4565b5050565b600061069781610f44565b81600b5414156106ba5760405163c23f6ccb60e01b815260040160405180910390fd5b50600b55565b6106ca338261103b565b6106e65760405162461bcd60e51b815260040161062490612202565b6106ef8161105e565b50565b60105460609060009081908190819081906001600160a01b031661072957604051636d9e949f60e01b815260040160405180910390fd5b6010546040516346b2b08760e01b81526001600160a01b03909116906346b2b08790610759908a90600401612152565b60006040518083038186803b15801561077157600080fd5b505afa158015610785573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107ad9190810190611c42565b949c939b5091995097509550909350915050565b6010546060906001600160a01b03166107ed57604051636d9e949f60e01b815260040160405180910390fd5b6010546040516346b2b08760e01b81526000916001600160a01b0316906346b2b0879061081e908690600401612152565b60006040518083038186803b15801561083657600080fd5b505afa15801561084a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108729190810190611c42565b5050509250505061088281610de5565b9150505b919050565b60006104ec826110f8565b60006108a160065490565b82106108bf5760405162461bcd60e51b815260040161062490612232565b600682815481106108d2576108d261247e565b90600052602060002001549050919050565b6010546000906001600160a01b031661091057604051636d9e949f60e01b815260040160405180910390fd5b6002600f5414156109335760405162461bcd60e51b815260040161062490612242565b6002600f556000610943866109e6565b6010546040516303dd904360e41b81529192506001600160a01b031690633dd904309061097a9089908990899089906004016120cc565b602060405180830381600087803b15801561099457600080fd5b505af11580156109a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cc9190611ce5565b506001600f5595945050505050565b60006104ec82611115565b6000806109f283610a1c565b1115610a1357816040516312d5c31d60e01b815260040161062491906120be565b6104ec8261114a565b60006001600160a01b038216610a445760405162461bcd60e51b8152600401610624906121f2565b506001600160a01b031660009081526003602052604090205490565b6010546040805163776ce6a160e01b815290516060926001600160a01b03169163776ce6a1916004808301926000929190829003018186803b158015610aa557600080fd5b505afa158015610ab9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ae19190810190611c08565b905090565b6000610af181610f44565b81600d541415610b145760405163c23f6ccb60e01b815260040160405180910390fd5b50600d55565b6010546060906001600160a01b0316610b4657604051636d9e949f60e01b815260040160405180910390fd5b601054604051637e66989160e01b81526001600160a01b0390911690637e66989190610b76908590600401612136565b60006040518083038186803b158015610b8e57600080fd5b505afa158015610ba2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104ec9190810190611add565b60009182526008602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6010546000906001600160a01b0316610c2157604051636d9e949f60e01b815260040160405180910390fd5b6010546040516346b2b08760e01b81526000916001600160a01b0316906346b2b08790610c52908690600401612152565b60006040518083038186803b158015610c6a57600080fd5b505afa158015610c7e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ca69190810190611c42565b5050509250505061088281611115565b60606000610cc3836105cd565b905061088281610de5565b606060018054610501906123a3565b6010546000906001600160a01b0316610d0957604051636d9e949f60e01b815260040160405180910390fd5b601054604051634b29835560e11b81526001600160a01b039091169063965306aa90610d39908590600401612152565b60206040518083038186803b158015610d5157600080fd5b505afa158015610d65573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ec9190611b17565b6010546060906001600160a01b0316610db557604051636d9e949f60e01b815260040160405180910390fd5b601054604051635bcb1b5b60e11b81526001600160a01b039091169063b79636b690610b769085906004016120be565b6060610df08261118f565b6000610dfa6111b4565b90506000815111610e1a5760405180602001604052806000815250610882565b80610e24846111c3565b604051602001610e3592919061203e565b6040516020818303038152906040529392505050565b610e5482610584565b610e5d81610f44565b6105f68383610fd4565b6000610e7281610f44565b6001600160a01b038216610e995760405163d92e233d60e01b815260040160405180910390fd5b6010546001600160a01b0383811691161415610ec85760405163c23f6ccb60e01b815260040160405180910390fd5b50601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000610ef681610f44565b81600c541415610f195760405163c23f6ccb60e01b815260040160405180910390fd5b50600c55565b60006001600160e01b03198216637965db0b60e01b14806104ec57506104ec826112c8565b6106ef81336112ed565b610f588282610bca565b6106885760008281526008602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610f903390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610fde8282610bca565b156106885760008281526008602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008061104783611115565b6001600160a01b0385811691161491505092915050565b600061106982611115565b905061107781600084611351565b6001600160a01b03811660009081526003602052604081208054600192906110a0908490612312565b909155505060008281526002602052604080822080546001600160a01b03191690555183916001600160a01b038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59190a35050565b6000908152600260205260409020546001600160a01b0316151590565b6000818152600260205260408120546001600160a01b0316806104ec5760405162461bcd60e51b815260040161062490612222565b60006000805160206124f083398151915261116481610f44565b600061116f600e5490565b905061117f600e80546001019055565b610882848261135c565b50919050565b611198816110f8565b6106ef5760405162461bcd60e51b815260040161062490612222565b606060098054610501906123a3565b6060816111e75750506040805180820190915260018152600360fc1b602082015290565b8160005b811561121157806111fb816123f7565b915061120a9050600a836122df565b91506111eb565b6000816001600160401b0381111561122b5761122b612494565b6040519080825280601f01601f191660200182016040528015611255576020820181803683370190505b5090505b84156112c05761126a600183612312565b9150611277600a86612412565b6112829060306122c7565b60f81b8183815181106112975761129761247e565b60200101906001600160f81b031916908160001a9053506112b9600a866122df565b9450611259565b949350505050565b60006001600160e01b0319821663780e9d6360e01b14806104ec57506104ec82611438565b6112f78282610bca565b6106885761130f816001600160a01b03166014611488565b61131a836020611488565b60405160200161132b92919061206c565b60408051601f198184030181529082905262461bcd60e51b825261062491600401612152565b6105f68383836115fa565b6001600160a01b0382166113825760405162461bcd60e51b8152600401610624906121d2565b61138b816110f8565b156113a85760405162461bcd60e51b815260040161062490612212565b6113b460008383611351565b6001600160a01b03821660009081526003602052604081208054600192906113dd9084906122c7565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b038616908117909155905183927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688591a35050565b60006001600160e01b031982166313f2a32f60e01b148061146957506001600160e01b03198216635b5e139f60e01b145b806104ec57506301ffc9a760e01b6001600160e01b03198316146104ec565b606060006114978360026122f3565b6114a29060026122c7565b6001600160401b038111156114b9576114b9612494565b6040519080825280601f01601f1916602001820160405280156114e3576020820181803683370190505b509050600360fc1b816000815181106114fe576114fe61247e565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061152d5761152d61247e565b60200101906001600160f81b031916908160001a90535060006115518460026122f3565b61155c9060016122c7565b90505b60018111156115d4576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106115905761159061247e565b1a60f81b8282815181106115a6576115a661247e565b60200101906001600160f81b031916908160001a90535060049490941c936115cd8161238c565b905061155f565b5083156115f35760405162461bcd60e51b8152600401610624906121c2565b9392505050565b6001600160a01b0383166116555761165081600680546000838152600760205260408120829055600182018355919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0155565b611678565b816001600160a01b0316836001600160a01b0316146116785761167883826116b2565b6001600160a01b03821661168f576105f68161174f565b826001600160a01b0316826001600160a01b0316146105f6576105f682826117fe565b600060016116bf84610a1c565b6116c99190612312565b60008381526005602052604090205490915080821461171c576001600160a01b03841660009081526004602090815260408083208584528252808320548484528184208190558352600590915290208190555b5060009182526005602090815260408084208490556001600160a01b039094168352600481528383209183525290812055565b60065460009061176190600190612312565b600083815260076020526040812054600680549394509092849081106117895761178961247e565b9060005260206000200154905080600683815481106117aa576117aa61247e565b60009182526020808320909101929092558281526007909152604080822084905585825281205560068054806117e2576117e2612468565b6001900381819060005260206000200160009055905550505050565b600061180983610a1c565b6001600160a01b039093166000908152600460209081526040808320868452825280832085905593825260059052919091209190915550565b600061185561185084612279565b612262565b9050808382526020820190508285602086028201111561187757611877600080fd5b60005b858110156118bf5781516001600160401b0381111561189b5761189b600080fd5b8086016118a889826119b8565b85525050602092830192919091019060010161187a565b5050509392505050565b60006118d76118508461229c565b9050828152602081018484840111156118f2576118f2600080fd5b6118fd848285612350565b509392505050565b60006119136118508461229c565b90508281526020810184848401111561192e5761192e600080fd5b6118fd84828561235c565b80356104ec816124b4565b600082601f83011261195857611958600080fd5b81516112c0848260208601611842565b80516104ec816124c8565b80356104ec816124d0565b80356104ec816124d6565b80356104ec816124e6565b600082601f8301126119a8576119a8600080fd5b81356112c08482602086016118c9565b600082601f8301126119cc576119cc600080fd5b81516112c0848260208601611905565b80516104ec816124d0565b6000602082840312156119fc576119fc600080fd5b60006112c08484611939565b60008060008060808587031215611a2157611a21600080fd5b6000611a2d8787611939565b94505060208501356001600160401b03811115611a4c57611a4c600080fd5b611a5887828801611994565b9350506040611a6987828801611973565b92505060608501356001600160401b03811115611a8857611a88600080fd5b611a9487828801611994565b91505092959194509250565b60008060408385031215611ab657611ab6600080fd5b6000611ac28585611939565b9250506020611ad385828601611973565b9150509250929050565b600060208284031215611af257611af2600080fd5b81516001600160401b03811115611b0b57611b0b600080fd5b6112c084828501611944565b600060208284031215611b2c57611b2c600080fd5b60006112c08484611968565b600060208284031215611b4d57611b4d600080fd5b60006112c08484611973565b60008060408385031215611b6f57611b6f600080fd5b6000611b7b8585611973565b9250506020611ad385828601611939565b600060208284031215611ba157611ba1600080fd5b60006112c0848461197e565b600060208284031215611bc257611bc2600080fd5b60006112c08484611989565b600060208284031215611be357611be3600080fd5b81356001600160401b03811115611bfc57611bfc600080fd5b6112c084828501611994565b600060208284031215611c1d57611c1d600080fd5b81516001600160401b03811115611c3657611c36600080fd5b6112c0848285016119b8565b60008060008060008060c08789031215611c5e57611c5e600080fd5b86516001600160401b03811115611c7757611c77600080fd5b611c8389828a016119b8565b9650506020611c9489828a01611968565b9550506040611ca589828a016119dc565b9450506060611cb689828a016119dc565b9350506080611cc789828a016119dc565b92505060a0611cd889828a01611968565b9150509295509295509295565b600060208284031215611cfa57611cfa600080fd5b60006112c084846119dc565b60006115f38383611d9e565b611d1b81612329565b82525050565b6000611d2b825190565b80845260208401935083602082028501611d458560200190565b8060005b85811015611d7a5784840389528151611d628582611d06565b94506020830160209a909a0199925050600101611d49565b5091979650505050505050565b801515611d1b565b80611d1b565b611d1b81612345565b6000611da8825190565b808452602084019350611dbf81856020860161235c565b611dc8816124aa565b9093019392505050565b6000611ddc825190565b611dea81856020860161235c565b9290920192915050565b60208082527f537472696e67733a20686578206c656e67746820696e73756666696369656e74910190815260005b5060200190565b601d81526000602082017f5342543a206d696e7420746f20746865207a65726f206164647265737300000081529150611e22565b602881526000602082017f534254456e756d657261626c653a206f776e657220696e646578206f7574206f8152676620626f756e647360c01b602082015291505b5060400190565b602681526000602082017f5342543a2061646472657373207a65726f206973206e6f7420612076616c69648152651037bbb732b960d11b60208201529150611e9e565b601e81526000602082017f5342543a2063616c6c6572206973206e6f7420746f6b656e206f776e6572000081529150611e22565b601981526000602082017814d0950e881d1bdad95b88185b1c9958591e481b5a5b9d1959603a1b81529150611e22565b601581526000602082017414d0950e881a5b9d985b1a59081d1bdad95b881251605a1b81529150611e22565b602981526000602082017f534254456e756d657261626c653a20676c6f62616c20696e646578206f7574208152686f6620626f756e647360b81b60208201529150611e9e565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081529150611e22565b602f81526000602082017f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636581526e103937b632b9903337b91039b2b63360891b60208201529150611e9e565b600061204a8285611dd2565b91506120568284611dd2565b64173539b7b760d91b81529150600582016112c0565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260170160006120988285611dd2565b7001034b99036b4b9b9b4b733903937b6329607d1b815260110191506112c08284611dd2565b602081016104ec8284611d12565b608081016120da8287611d12565b81810360208301526120ec8186611d9e565b90506120fb6040830185611d8f565b818103606083015261210d8184611d9e565b9695505050505050565b602080825281016115f38184611d21565b602081016104ec8284611d87565b602081016104ec8284611d8f565b602081016104ec8284611d95565b602080825281016115f38184611d9e565b60c080825281016121748189611d9e565b90506121836020830188611d87565b6121906040830187611d8f565b61219d6060830186611d8f565b6121aa6080830185611d8f565b6121b760a0830184611d87565b979650505050505050565b602080825281016104ec81611df4565b602080825281016104ec81611e29565b602080825281016104ec81611e5d565b602080825281016104ec81611ea5565b602080825281016104ec81611ee8565b602080825281016104ec81611f1c565b602080825281016104ec81611f4c565b602080825281016104ec81611f78565b602080825281016104ec81611fbe565b602080825281016104ec81611ff2565b600061226d60405190565b905061088682826123ca565b60006001600160401b0382111561229257612292612494565b5060209081020190565b60006001600160401b038211156122b5576122b5612494565b6122be826124aa565b60200192915050565b600082198211156122da576122da612426565b500190565b6000826122ee576122ee61243c565b500490565b600081600019048311821515161561230d5761230d612426565b500290565b60008282101561232457612324612426565b500390565b60006001600160a01b0382166104ec565b60006104ec82612329565b60006104ec8261233a565b82818337506000910152565b60005b8381101561237757818101518382015260200161235f565b83811115612386576000848401525b50505050565b60008161239b5761239b612426565b506000190190565b6002810460018216806123b757607f821691505b6020821081141561118957611189612452565b6123d3826124aa565b81018181106001600160401b03821117156123f0576123f0612494565b6040525050565b600060001982141561240b5761240b612426565b5060010190565b6000826124215761242161243c565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b601f01601f191690565b6124bd81612329565b81146106ef57600080fd5b8015156124bd565b806124bd565b6001600160e01b031981166124bd565b6124bd8161233a56fe9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6a26469706673582212203274bfbca832043ac4bdf2282093c219dfc13caf8a7b4a9708003ec2988081bb64736f6c63430008070033000000000000000000000000bb4125c48e8c69b0f06e0c635dfcd0aa250fcbf90000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002c68747470733a2f2f6d657461646174612e6d6173612e66696e616e63652f76312e302f6964656e746974792f0000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101d85760003560e01c806301ffc9a7146101dd57806306fdde03146102065780630f2e68af1461021b57806313150b481461023b57806318160ddd146102515780631f37c12414610259578063248a9ca314610262578063289c686b14610275578063294cdf0d1461028a5780632f2ff15d1461029d5780632f745c59146102b057806336568abe146102c35780633c72ae70146102d657806342966c68146102e957806346b2b087146102fc5780634cf12d26146103215780634f558e79146103345780634f6ccce7146103475780635141453e1461035a5780636352211e1461036d5780636a6278421461038d57806370a08231146103a0578063776ce6a1146103b3578063776d1a54146103bb5780637db8cb68146103c45780637e669891146103d757806391d14854146103f7578063920ffa261461040a57806393702f331461041d57806395d89b4114610430578063965306aa14610438578063a217fddf1461044b578063b507d48114610453578063b79636b614610464578063b97d6b2314610477578063c87b56dd14610480578063d539139314610493578063d547741f146104a8578063ee7a9ec5146104bb578063fd48ac83146104ce575b600080fd5b6101f06101eb366004611b8c565b6104e1565b6040516101fd9190612128565b60405180910390f35b61020e6104f2565b6040516101fd9190612152565b60105461022e906001600160a01b031681565b6040516101fd9190612144565b610244600d5481565b6040516101fd9190612136565b600654610244565b610244600a5481565b610244610270366004611b38565b610584565b610288610283366004611b38565b610599565b005b6102446102983660046119e7565b6105cd565b6102886102ab366004611b59565b6105da565b6102446102be366004611aa0565b6105fb565b6102886102d1366004611b59565b610656565b6102886102e4366004611b38565b61068c565b6102886102f7366004611b38565b6106c0565b61030f61030a366004611bce565b6106f2565b6040516101fd96959493929190612163565b61020e61032f366004611bce565b6107c1565b6101f0610342366004611b38565b61088b565b610244610355366004611b38565b610896565b610244610368366004611a08565b6108e4565b61038061037b366004611b38565b6109db565b6040516101fd91906120be565b61024461039b3660046119e7565b6109e6565b6102446103ae3660046119e7565b610a1c565b61020e610a60565b610244600b5481565b6102886103d2366004611b38565b610ae6565b6103ea6103e5366004611b38565b610b1a565b6040516101fd9190612117565b6101f0610405366004611b59565b610bca565b610380610418366004611bce565b610bf5565b61020e61042b3660046119e7565b610cb6565b61020e610cce565b6101f0610446366004611bce565b610cdd565b610244600081565b6010546001600160a01b031661022e565b6103ea6104723660046119e7565b610d89565b610244600c5481565b61020e61048e366004611b38565b610de5565b6102446000805160206124f083398151915281565b6102886104b6366004611b59565b610e4b565b6102886104c9366004611bad565b610e67565b6102886104dc366004611b38565b610eeb565b60006104ec82610f1f565b92915050565b606060008054610501906123a3565b80601f016020809104026020016040519081016040528092919081815260200182805461052d906123a3565b801561057a5780601f1061054f5761010080835404028352916020019161057a565b820191906000526020600020905b81548152906001019060200180831161055d57829003601f168201915b5050505050905090565b60009081526008602052604090206001015490565b60006105a481610f44565b81600a5414156105c75760405163c23f6ccb60e01b815260040160405180910390fd5b50600a55565b60006104ec8260006105fb565b6105e382610584565b6105ec81610f44565b6105f68383610f4e565b505050565b600061060683610a1c565b821061062d5760405162461bcd60e51b8152600401610624906121e2565b60405180910390fd5b506001600160a01b03919091166000908152600460209081526040808320938352929052205490565b6001600160a01b038116331461067e5760405162461bcd60e51b815260040161062490612252565b6106888282610fd4565b5050565b600061069781610f44565b81600b5414156106ba5760405163c23f6ccb60e01b815260040160405180910390fd5b50600b55565b6106ca338261103b565b6106e65760405162461bcd60e51b815260040161062490612202565b6106ef8161105e565b50565b60105460609060009081908190819081906001600160a01b031661072957604051636d9e949f60e01b815260040160405180910390fd5b6010546040516346b2b08760e01b81526001600160a01b03909116906346b2b08790610759908a90600401612152565b60006040518083038186803b15801561077157600080fd5b505afa158015610785573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107ad9190810190611c42565b949c939b5091995097509550909350915050565b6010546060906001600160a01b03166107ed57604051636d9e949f60e01b815260040160405180910390fd5b6010546040516346b2b08760e01b81526000916001600160a01b0316906346b2b0879061081e908690600401612152565b60006040518083038186803b15801561083657600080fd5b505afa15801561084a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108729190810190611c42565b5050509250505061088281610de5565b9150505b919050565b60006104ec826110f8565b60006108a160065490565b82106108bf5760405162461bcd60e51b815260040161062490612232565b600682815481106108d2576108d261247e565b90600052602060002001549050919050565b6010546000906001600160a01b031661091057604051636d9e949f60e01b815260040160405180910390fd5b6002600f5414156109335760405162461bcd60e51b815260040161062490612242565b6002600f556000610943866109e6565b6010546040516303dd904360e41b81529192506001600160a01b031690633dd904309061097a9089908990899089906004016120cc565b602060405180830381600087803b15801561099457600080fd5b505af11580156109a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cc9190611ce5565b506001600f5595945050505050565b60006104ec82611115565b6000806109f283610a1c565b1115610a1357816040516312d5c31d60e01b815260040161062491906120be565b6104ec8261114a565b60006001600160a01b038216610a445760405162461bcd60e51b8152600401610624906121f2565b506001600160a01b031660009081526003602052604090205490565b6010546040805163776ce6a160e01b815290516060926001600160a01b03169163776ce6a1916004808301926000929190829003018186803b158015610aa557600080fd5b505afa158015610ab9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ae19190810190611c08565b905090565b6000610af181610f44565b81600d541415610b145760405163c23f6ccb60e01b815260040160405180910390fd5b50600d55565b6010546060906001600160a01b0316610b4657604051636d9e949f60e01b815260040160405180910390fd5b601054604051637e66989160e01b81526001600160a01b0390911690637e66989190610b76908590600401612136565b60006040518083038186803b158015610b8e57600080fd5b505afa158015610ba2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104ec9190810190611add565b60009182526008602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6010546000906001600160a01b0316610c2157604051636d9e949f60e01b815260040160405180910390fd5b6010546040516346b2b08760e01b81526000916001600160a01b0316906346b2b08790610c52908690600401612152565b60006040518083038186803b158015610c6a57600080fd5b505afa158015610c7e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ca69190810190611c42565b5050509250505061088281611115565b60606000610cc3836105cd565b905061088281610de5565b606060018054610501906123a3565b6010546000906001600160a01b0316610d0957604051636d9e949f60e01b815260040160405180910390fd5b601054604051634b29835560e11b81526001600160a01b039091169063965306aa90610d39908590600401612152565b60206040518083038186803b158015610d5157600080fd5b505afa158015610d65573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ec9190611b17565b6010546060906001600160a01b0316610db557604051636d9e949f60e01b815260040160405180910390fd5b601054604051635bcb1b5b60e11b81526001600160a01b039091169063b79636b690610b769085906004016120be565b6060610df08261118f565b6000610dfa6111b4565b90506000815111610e1a5760405180602001604052806000815250610882565b80610e24846111c3565b604051602001610e3592919061203e565b6040516020818303038152906040529392505050565b610e5482610584565b610e5d81610f44565b6105f68383610fd4565b6000610e7281610f44565b6001600160a01b038216610e995760405163d92e233d60e01b815260040160405180910390fd5b6010546001600160a01b0383811691161415610ec85760405163c23f6ccb60e01b815260040160405180910390fd5b50601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000610ef681610f44565b81600c541415610f195760405163c23f6ccb60e01b815260040160405180910390fd5b50600c55565b60006001600160e01b03198216637965db0b60e01b14806104ec57506104ec826112c8565b6106ef81336112ed565b610f588282610bca565b6106885760008281526008602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610f903390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610fde8282610bca565b156106885760008281526008602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008061104783611115565b6001600160a01b0385811691161491505092915050565b600061106982611115565b905061107781600084611351565b6001600160a01b03811660009081526003602052604081208054600192906110a0908490612312565b909155505060008281526002602052604080822080546001600160a01b03191690555183916001600160a01b038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59190a35050565b6000908152600260205260409020546001600160a01b0316151590565b6000818152600260205260408120546001600160a01b0316806104ec5760405162461bcd60e51b815260040161062490612222565b60006000805160206124f083398151915261116481610f44565b600061116f600e5490565b905061117f600e80546001019055565b610882848261135c565b50919050565b611198816110f8565b6106ef5760405162461bcd60e51b815260040161062490612222565b606060098054610501906123a3565b6060816111e75750506040805180820190915260018152600360fc1b602082015290565b8160005b811561121157806111fb816123f7565b915061120a9050600a836122df565b91506111eb565b6000816001600160401b0381111561122b5761122b612494565b6040519080825280601f01601f191660200182016040528015611255576020820181803683370190505b5090505b84156112c05761126a600183612312565b9150611277600a86612412565b6112829060306122c7565b60f81b8183815181106112975761129761247e565b60200101906001600160f81b031916908160001a9053506112b9600a866122df565b9450611259565b949350505050565b60006001600160e01b0319821663780e9d6360e01b14806104ec57506104ec82611438565b6112f78282610bca565b6106885761130f816001600160a01b03166014611488565b61131a836020611488565b60405160200161132b92919061206c565b60408051601f198184030181529082905262461bcd60e51b825261062491600401612152565b6105f68383836115fa565b6001600160a01b0382166113825760405162461bcd60e51b8152600401610624906121d2565b61138b816110f8565b156113a85760405162461bcd60e51b815260040161062490612212565b6113b460008383611351565b6001600160a01b03821660009081526003602052604081208054600192906113dd9084906122c7565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b038616908117909155905183927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688591a35050565b60006001600160e01b031982166313f2a32f60e01b148061146957506001600160e01b03198216635b5e139f60e01b145b806104ec57506301ffc9a760e01b6001600160e01b03198316146104ec565b606060006114978360026122f3565b6114a29060026122c7565b6001600160401b038111156114b9576114b9612494565b6040519080825280601f01601f1916602001820160405280156114e3576020820181803683370190505b509050600360fc1b816000815181106114fe576114fe61247e565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061152d5761152d61247e565b60200101906001600160f81b031916908160001a90535060006115518460026122f3565b61155c9060016122c7565b90505b60018111156115d4576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106115905761159061247e565b1a60f81b8282815181106115a6576115a661247e565b60200101906001600160f81b031916908160001a90535060049490941c936115cd8161238c565b905061155f565b5083156115f35760405162461bcd60e51b8152600401610624906121c2565b9392505050565b6001600160a01b0383166116555761165081600680546000838152600760205260408120829055600182018355919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0155565b611678565b816001600160a01b0316836001600160a01b0316146116785761167883826116b2565b6001600160a01b03821661168f576105f68161174f565b826001600160a01b0316826001600160a01b0316146105f6576105f682826117fe565b600060016116bf84610a1c565b6116c99190612312565b60008381526005602052604090205490915080821461171c576001600160a01b03841660009081526004602090815260408083208584528252808320548484528184208190558352600590915290208190555b5060009182526005602090815260408084208490556001600160a01b039094168352600481528383209183525290812055565b60065460009061176190600190612312565b600083815260076020526040812054600680549394509092849081106117895761178961247e565b9060005260206000200154905080600683815481106117aa576117aa61247e565b60009182526020808320909101929092558281526007909152604080822084905585825281205560068054806117e2576117e2612468565b6001900381819060005260206000200160009055905550505050565b600061180983610a1c565b6001600160a01b039093166000908152600460209081526040808320868452825280832085905593825260059052919091209190915550565b600061185561185084612279565b612262565b9050808382526020820190508285602086028201111561187757611877600080fd5b60005b858110156118bf5781516001600160401b0381111561189b5761189b600080fd5b8086016118a889826119b8565b85525050602092830192919091019060010161187a565b5050509392505050565b60006118d76118508461229c565b9050828152602081018484840111156118f2576118f2600080fd5b6118fd848285612350565b509392505050565b60006119136118508461229c565b90508281526020810184848401111561192e5761192e600080fd5b6118fd84828561235c565b80356104ec816124b4565b600082601f83011261195857611958600080fd5b81516112c0848260208601611842565b80516104ec816124c8565b80356104ec816124d0565b80356104ec816124d6565b80356104ec816124e6565b600082601f8301126119a8576119a8600080fd5b81356112c08482602086016118c9565b600082601f8301126119cc576119cc600080fd5b81516112c0848260208601611905565b80516104ec816124d0565b6000602082840312156119fc576119fc600080fd5b60006112c08484611939565b60008060008060808587031215611a2157611a21600080fd5b6000611a2d8787611939565b94505060208501356001600160401b03811115611a4c57611a4c600080fd5b611a5887828801611994565b9350506040611a6987828801611973565b92505060608501356001600160401b03811115611a8857611a88600080fd5b611a9487828801611994565b91505092959194509250565b60008060408385031215611ab657611ab6600080fd5b6000611ac28585611939565b9250506020611ad385828601611973565b9150509250929050565b600060208284031215611af257611af2600080fd5b81516001600160401b03811115611b0b57611b0b600080fd5b6112c084828501611944565b600060208284031215611b2c57611b2c600080fd5b60006112c08484611968565b600060208284031215611b4d57611b4d600080fd5b60006112c08484611973565b60008060408385031215611b6f57611b6f600080fd5b6000611b7b8585611973565b9250506020611ad385828601611939565b600060208284031215611ba157611ba1600080fd5b60006112c0848461197e565b600060208284031215611bc257611bc2600080fd5b60006112c08484611989565b600060208284031215611be357611be3600080fd5b81356001600160401b03811115611bfc57611bfc600080fd5b6112c084828501611994565b600060208284031215611c1d57611c1d600080fd5b81516001600160401b03811115611c3657611c36600080fd5b6112c0848285016119b8565b60008060008060008060c08789031215611c5e57611c5e600080fd5b86516001600160401b03811115611c7757611c77600080fd5b611c8389828a016119b8565b9650506020611c9489828a01611968565b9550506040611ca589828a016119dc565b9450506060611cb689828a016119dc565b9350506080611cc789828a016119dc565b92505060a0611cd889828a01611968565b9150509295509295509295565b600060208284031215611cfa57611cfa600080fd5b60006112c084846119dc565b60006115f38383611d9e565b611d1b81612329565b82525050565b6000611d2b825190565b80845260208401935083602082028501611d458560200190565b8060005b85811015611d7a5784840389528151611d628582611d06565b94506020830160209a909a0199925050600101611d49565b5091979650505050505050565b801515611d1b565b80611d1b565b611d1b81612345565b6000611da8825190565b808452602084019350611dbf81856020860161235c565b611dc8816124aa565b9093019392505050565b6000611ddc825190565b611dea81856020860161235c565b9290920192915050565b60208082527f537472696e67733a20686578206c656e67746820696e73756666696369656e74910190815260005b5060200190565b601d81526000602082017f5342543a206d696e7420746f20746865207a65726f206164647265737300000081529150611e22565b602881526000602082017f534254456e756d657261626c653a206f776e657220696e646578206f7574206f8152676620626f756e647360c01b602082015291505b5060400190565b602681526000602082017f5342543a2061646472657373207a65726f206973206e6f7420612076616c69648152651037bbb732b960d11b60208201529150611e9e565b601e81526000602082017f5342543a2063616c6c6572206973206e6f7420746f6b656e206f776e6572000081529150611e22565b601981526000602082017814d0950e881d1bdad95b88185b1c9958591e481b5a5b9d1959603a1b81529150611e22565b601581526000602082017414d0950e881a5b9d985b1a59081d1bdad95b881251605a1b81529150611e22565b602981526000602082017f534254456e756d657261626c653a20676c6f62616c20696e646578206f7574208152686f6620626f756e647360b81b60208201529150611e9e565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081529150611e22565b602f81526000602082017f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636581526e103937b632b9903337b91039b2b63360891b60208201529150611e9e565b600061204a8285611dd2565b91506120568284611dd2565b64173539b7b760d91b81529150600582016112c0565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260170160006120988285611dd2565b7001034b99036b4b9b9b4b733903937b6329607d1b815260110191506112c08284611dd2565b602081016104ec8284611d12565b608081016120da8287611d12565b81810360208301526120ec8186611d9e565b90506120fb6040830185611d8f565b818103606083015261210d8184611d9e565b9695505050505050565b602080825281016115f38184611d21565b602081016104ec8284611d87565b602081016104ec8284611d8f565b602081016104ec8284611d95565b602080825281016115f38184611d9e565b60c080825281016121748189611d9e565b90506121836020830188611d87565b6121906040830187611d8f565b61219d6060830186611d8f565b6121aa6080830185611d8f565b6121b760a0830184611d87565b979650505050505050565b602080825281016104ec81611df4565b602080825281016104ec81611e29565b602080825281016104ec81611e5d565b602080825281016104ec81611ea5565b602080825281016104ec81611ee8565b602080825281016104ec81611f1c565b602080825281016104ec81611f4c565b602080825281016104ec81611f78565b602080825281016104ec81611fbe565b602080825281016104ec81611ff2565b600061226d60405190565b905061088682826123ca565b60006001600160401b0382111561229257612292612494565b5060209081020190565b60006001600160401b038211156122b5576122b5612494565b6122be826124aa565b60200192915050565b600082198211156122da576122da612426565b500190565b6000826122ee576122ee61243c565b500490565b600081600019048311821515161561230d5761230d612426565b500290565b60008282101561232457612324612426565b500390565b60006001600160a01b0382166104ec565b60006104ec82612329565b60006104ec8261233a565b82818337506000910152565b60005b8381101561237757818101518382015260200161235f565b83811115612386576000848401525b50505050565b60008161239b5761239b612426565b506000190190565b6002810460018216806123b757607f821691505b6020821081141561118957611189612452565b6123d3826124aa565b81018181106001600160401b03821117156123f0576123f0612494565b6040525050565b600060001982141561240b5761240b612426565b5060010190565b6000826124215761242161243c565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b601f01601f191690565b6124bd81612329565b81146106ef57600080fd5b8015156124bd565b806124bd565b6001600160e01b031981166124bd565b6124bd8161233a56fe9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6a26469706673582212203274bfbca832043ac4bdf2282093c219dfc13caf8a7b4a9708003ec2988081bb64736f6c63430008070033

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

000000000000000000000000bb4125c48e8c69b0f06e0c635dfcd0aa250fcbf90000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002c68747470733a2f2f6d657461646174612e6d6173612e66696e616e63652f76312e302f6964656e746974792f0000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : admin (address): 0xBb4125C48e8c69b0F06E0c635dfCd0Aa250fcbF9
Arg [1] : baseTokenURI (string): https://metadata.masa.finance/v1.0/identity/

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000bb4125c48e8c69b0f06e0c635dfcd0aa250fcbf9
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [2] : 000000000000000000000000000000000000000000000000000000000000002c
Arg [3] : 68747470733a2f2f6d657461646174612e6d6173612e66696e616e63652f7631
Arg [4] : 2e302f6964656e746974792f0000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

Soulbound token that represents an identity.

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.