Contract Overview
Balance:
0 CELO
CELO Value:
$0.00
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x650f83dd9e6a4a2d83e0161626a6746e10ce4402a81f54072988b89d528790b0 | 0x60806040 | 18033434 | 99 days 12 hrs ago | 0x84a74cc52048dd8421df4a9eb139d91bb7744b4e | IN | Contract Creation | 0 CELO | 0.057930125 |
[ Download CSV Export ]
Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0x1C7652919598b32C576D362E74F44C6E34EF7Aba
Contract Name:
SoulboundIdentity
Compiler Version
v0.8.7+commit.e28d00a7
Optimization Enabled:
Yes with 1 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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(account), " 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()); } } }
// 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; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (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() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// 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; } }
// 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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _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) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @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] = _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); } }
// 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); }
// 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); }
// 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); }
// 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 NotLinkedToAnIdentitySBT(); 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);
// 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 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 ) MasaSBTAuthority(admin, name, symbol, 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 ==================================================== */ }
// 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 ==================================================== */ }
// 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 ==================================================== */ }
// 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); }
// 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); }
// 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); } }
// 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(); } }
// 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); }
// 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 {} }
{ "optimizer": { "enabled": true, "runs": 1, "details": { "yul": false } }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"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"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162002a4338038062002a438339810160408190526200003491620002c2565b8383838383838383828281600090805190602001906200005692919062000196565b5080516200006c90600190602084019062000196565b506200007e91506000905085620000de565b80516200009390600990602084019062000196565b5050505050620000ca7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a685620000de60201b60201c565b50506001600f5550620004cb945050505050565b620000ea828262000169565b620001655760008281526008602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620001243390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b60008281526008602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b828054620001a49062000418565b90600052602060002090601f016020900481019282620001c8576000855562000213565b82601f10620001e357805160ff191683800117855562000213565b8280016001018555821562000213579182015b8281111562000213578251825591602001919060010190620001f6565b506200022192915062000225565b5090565b5b8082111562000221576000815560010162000226565b6000620002536200024d84620003a3565b62000384565b905082815260208101848484011115620002705762000270600080fd5b6200027d848285620003e5565b509392505050565b80516200019081620004b1565b600082601f830112620002a857620002a8600080fd5b8151620002ba8482602086016200023c565b949350505050565b60008060008060808587031215620002dd57620002dd600080fd5b6000620002eb878762000285565b94505060208501516001600160401b038111156200030c576200030c600080fd5b6200031a8782880162000292565b93505060408501516001600160401b038111156200033b576200033b600080fd5b620003498782880162000292565b92505060608501516001600160401b038111156200036a576200036a600080fd5b620003788782880162000292565b91505092959194509250565b60006200039060405190565b90506200039e828262000449565b919050565b60006001600160401b03821115620003bf57620003bf62000491565b620003ca82620004a7565b60200192915050565b60006001600160a01b03821662000190565b60005b8381101562000402578181015183820152602001620003e8565b8381111562000412576000848401525b50505050565b6002810460018216806200042d57607f821691505b602082108114156200044357620004436200047b565b50919050565b6200045482620004a7565b81018181106001600160401b038211171562000474576200047462000491565b6040525050565b634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b601f01601f191690565b620004bc81620003d3565b8114620004c857600080fd5b50565b61256880620004db6000396000f3fe608060405234801561001057600080fd5b50600436106101d85760003560e01c806301ffc9a7146101dd57806306fdde03146102065780630f2e68af1461021b57806313150b481461023b57806318160ddd146102515780631f37c12414610259578063248a9ca314610262578063289c686b14610275578063294cdf0d1461028a5780632f2ff15d1461029d5780632f745c59146102b057806336568abe146102c35780633c72ae70146102d657806342966c68146102e957806346b2b087146102fc5780634cf12d26146103215780634f558e79146103345780634f6ccce7146103475780635141453e1461035a5780636352211e1461036d5780636a6278421461038d57806370a08231146103a0578063776ce6a1146103b3578063776d1a54146103bb5780637db8cb68146103c45780637e669891146103d757806391d14854146103f7578063920ffa261461040a57806393702f331461041d57806395d89b4114610430578063965306aa14610438578063a217fddf1461044b578063b507d48114610453578063b79636b614610464578063b97d6b2314610477578063c87b56dd14610480578063d539139314610493578063d547741f146104a8578063ee7a9ec5146104bb578063fd48ac83146104ce575b600080fd5b6101f06101eb366004611c08565b6104e1565b6040516101fd91906121a4565b60405180910390f35b61020e6104f2565b6040516101fd91906121ce565b60105461022e906001600160a01b031681565b6040516101fd91906121c0565b610244600d5481565b6040516101fd91906121b2565b600654610244565b610244600a5481565b610244610270366004611bb4565b610584565b610288610283366004611bb4565b610599565b005b610244610298366004611a63565b6105cd565b6102886102ab366004611bd5565b6105da565b6102446102be366004611b1c565b6105fb565b6102886102d1366004611bd5565b610656565b6102886102e4366004611bb4565b61068c565b6102886102f7366004611bb4565b6106c0565b61030f61030a366004611c4a565b6106f2565b6040516101fd969594939291906121df565b61020e61032f366004611c4a565b6107c1565b6101f0610342366004611bb4565b61088b565b610244610355366004611bb4565b610896565b610244610368366004611a84565b6108e4565b61038061037b366004611bb4565b6109c1565b6040516101fd919061213a565b61024461039b366004611a63565b6109cc565b6102446103ae366004611a63565b610a02565b61020e610a46565b610244600b5481565b6102886103d2366004611bb4565b610acc565b6103ea6103e5366004611bb4565b610b00565b6040516101fd9190612193565b6101f0610405366004611bd5565b610bb0565b610380610418366004611c4a565b610bdb565b61020e61042b366004611a63565b610c9c565b61020e610cb4565b6101f0610446366004611c4a565b610cc3565b610244600081565b6010546001600160a01b031661022e565b6103ea610472366004611a63565b610d6f565b610244600c5481565b61020e61048e366004611bb4565b610dcb565b61024460008051602061251383398151915281565b6102886104b6366004611bd5565b610e31565b6102886104c9366004611c29565b610e4d565b6102886104dc366004611bb4565b610ed1565b60006104ec82610f05565b92915050565b6060600080546105019061240b565b80601f016020809104026020016040519081016040528092919081815260200182805461052d9061240b565b801561057a5780601f1061054f5761010080835404028352916020019161057a565b820191906000526020600020905b81548152906001019060200180831161055d57829003601f168201915b5050505050905090565b60009081526008602052604090206001015490565b60006105a481610f2a565b81600a5414156105c75760405163c23f6ccb60e01b815260040160405180910390fd5b50600a55565b60006104ec8260006105fb565b6105e382610584565b6105ec81610f2a565b6105f68383610f34565b505050565b600061060683610a02565b821061062d5760405162461bcd60e51b81526004016106249061225e565b60405180910390fd5b506001600160a01b03919091166000908152600460209081526040808320938352929052205490565b6001600160a01b038116331461067e5760405162461bcd60e51b8152600401610624906122ce565b6106888282610fba565b5050565b600061069781610f2a565b81600b5414156106ba5760405163c23f6ccb60e01b815260040160405180910390fd5b50600b55565b6106ca3382611021565b6106e65760405162461bcd60e51b81526004016106249061227e565b6106ef81611044565b50565b60105460609060009081908190819081906001600160a01b031661072957604051636d9e949f60e01b815260040160405180910390fd5b6010546040516346b2b08760e01b81526001600160a01b03909116906346b2b08790610759908a906004016121ce565b60006040518083038186803b15801561077157600080fd5b505afa158015610785573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107ad9190810190611cbe565b949c939b5091995097509550909350915050565b6010546060906001600160a01b03166107ed57604051636d9e949f60e01b815260040160405180910390fd5b6010546040516346b2b08760e01b81526000916001600160a01b0316906346b2b0879061081e9086906004016121ce565b60006040518083038186803b15801561083657600080fd5b505afa15801561084a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108729190810190611cbe565b5050509250505061088281610dcb565b9150505b919050565b60006104ec826110de565b60006108a160065490565b82106108bf5760405162461bcd60e51b8152600401610624906122ae565b600682815481106108d2576108d26124a1565b90600052602060002001549050919050565b6010546000906001600160a01b031661091057604051636d9e949f60e01b815260040160405180910390fd5b6109186110fb565b6000610923866109cc565b6010546040516303dd904360e41b81529192506001600160a01b031690633dd904309061095a908990899089908990600401612148565b602060405180830381600087803b15801561097457600080fd5b505af1158015610988573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ac9190611d61565b5090506109b96001600f55565b949350505050565b60006104ec82611125565b6000806109d883610a02565b11156109f957816040516312d5c31d60e01b8152600401610624919061213a565b6104ec8261115a565b60006001600160a01b038216610a2a5760405162461bcd60e51b81526004016106249061226e565b506001600160a01b031660009081526003602052604090205490565b6010546040805163776ce6a160e01b815290516060926001600160a01b03169163776ce6a1916004808301926000929190829003018186803b158015610a8b57600080fd5b505afa158015610a9f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ac79190810190611c84565b905090565b6000610ad781610f2a565b81600d541415610afa5760405163c23f6ccb60e01b815260040160405180910390fd5b50600d55565b6010546060906001600160a01b0316610b2c57604051636d9e949f60e01b815260040160405180910390fd5b601054604051637e66989160e01b81526001600160a01b0390911690637e66989190610b5c9085906004016121b2565b60006040518083038186803b158015610b7457600080fd5b505afa158015610b88573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104ec9190810190611b59565b60009182526008602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6010546000906001600160a01b0316610c0757604051636d9e949f60e01b815260040160405180910390fd5b6010546040516346b2b08760e01b81526000916001600160a01b0316906346b2b08790610c389086906004016121ce565b60006040518083038186803b158015610c5057600080fd5b505afa158015610c64573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c8c9190810190611cbe565b5050509250505061088281611125565b60606000610ca9836105cd565b905061088281610dcb565b6060600180546105019061240b565b6010546000906001600160a01b0316610cef57604051636d9e949f60e01b815260040160405180910390fd5b601054604051634b29835560e11b81526001600160a01b039091169063965306aa90610d1f9085906004016121ce565b60206040518083038186803b158015610d3757600080fd5b505afa158015610d4b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ec9190611b93565b6010546060906001600160a01b0316610d9b57604051636d9e949f60e01b815260040160405180910390fd5b601054604051635bcb1b5b60e11b81526001600160a01b039091169063b79636b690610b5c90859060040161213a565b6060610dd68261119f565b6000610de06111c4565b90506000815111610e005760405180602001604052806000815250610882565b80610e0a846111d3565b604051602001610e1b9291906120ba565b6040516020818303038152906040529392505050565b610e3a82610584565b610e4381610f2a565b6105f68383610fba565b6000610e5881610f2a565b6001600160a01b038216610e7f5760405163d92e233d60e01b815260040160405180910390fd5b6010546001600160a01b0383811691161415610eae5760405163c23f6ccb60e01b815260040160405180910390fd5b50601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000610edc81610f2a565b81600c541415610eff5760405163c23f6ccb60e01b815260040160405180910390fd5b50600c55565b60006001600160e01b03198216637965db0b60e01b14806104ec57506104ec8261126f565b6106ef8133611294565b610f3e8282610bb0565b6106885760008281526008602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610f763390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610fc48282610bb0565b156106885760008281526008602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008061102d83611125565b6001600160a01b0385811691161491505092915050565b600061104f82611125565b905061105d816000846112ed565b6001600160a01b038116600090815260036020526040812080546001929061108690849061237a565b909155505060008281526002602052604080822080546001600160a01b03191690555183916001600160a01b038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59190a35050565b6000908152600260205260409020546001600160a01b0316151590565b6002600f54141561111e5760405162461bcd60e51b8152600401610624906122be565b6002600f55565b6000818152600260205260408120546001600160a01b0316806104ec5760405162461bcd60e51b81526004016106249061229e565b600060008051602061251383398151915261117481610f2a565b600061117f600e5490565b905061118f600e80546001019055565b61088284826112f8565b50919050565b6111a8816110de565b6106ef5760405162461bcd60e51b81526004016106249061229e565b6060600980546105019061240b565b606060006111e0836113d4565b60010190506000816001600160401b038111156111ff576111ff6124b7565b6040519080825280601f01601f191660200182016040528015611229576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461126257611267565b611233565b509392505050565b60006001600160e01b0319821663780e9d6360e01b14806104ec57506104ec826114aa565b61129e8282610bb0565b610688576112ab816114fa565b6112b683602061150c565b6040516020016112c79291906120e8565b60408051601f198184030181529082905262461bcd60e51b8252610624916004016121ce565b6105f683838361167e565b6001600160a01b03821661131e5760405162461bcd60e51b81526004016106249061224e565b611327816110de565b156113445760405162461bcd60e51b81526004016106249061228e565b611350600083836112ed565b6001600160a01b0382166000908152600360205260408120805460019290611379908490612343565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b038616908117909155905183927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688591a35050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106114135772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6904ee2d6d415b85acef8160201b831061143d576904ee2d6d415b85acef8160201b830492506020015b662386f26fc10000831061145b57662386f26fc10000830492506010015b6305f5e1008310611473576305f5e100830492506008015b612710831061148757612710830492506004015b60648310611499576064830492506002015b600a83106104ec5760010192915050565b60006001600160e01b031982166313f2a32f60e01b14806114db57506001600160e01b03198216635b5e139f60e01b145b806104ec57506301ffc9a760e01b6001600160e01b03198316146104ec565b60606104ec6001600160a01b03831660145b6060600061151b83600261235b565b611526906002612343565b6001600160401b0381111561153d5761153d6124b7565b6040519080825280601f01601f191660200182016040528015611567576020820181803683370190505b509050600360fc1b81600081518110611582576115826124a1565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106115b1576115b16124a1565b60200101906001600160f81b031916908160001a90535060006115d584600261235b565b6115e0906001612343565b90505b6001811115611658576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611614576116146124a1565b1a60f81b82828151811061162a5761162a6124a1565b60200101906001600160f81b031916908160001a90535060049490941c93611651816123f4565b90506115e3565b5083156116775760405162461bcd60e51b81526004016106249061223e565b9392505050565b6001600160a01b0383166116d9576116d481600680546000838152600760205260408120829055600182018355919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0155565b6116fc565b816001600160a01b0316836001600160a01b0316146116fc576116fc8382611736565b6001600160a01b038216611713576105f6816117d3565b826001600160a01b0316826001600160a01b0316146105f6576105f68282611882565b6000600161174384610a02565b61174d919061237a565b6000838152600560205260409020549091508082146117a0576001600160a01b03841660009081526004602090815260408083208584528252808320548484528184208190558352600590915290208190555b5060009182526005602090815260408084208490556001600160a01b039094168352600481528383209183525290812055565b6006546000906117e59060019061237a565b6000838152600760205260408120546006805493945090928490811061180d5761180d6124a1565b90600052602060002001549050806006838154811061182e5761182e6124a1565b60009182526020808320909101929092558281526007909152604080822084905585825281205560068054806118665761186661248b565b6001900381819060005260206000200160009055905550505050565b600061188d83610a02565b6001600160a01b039093166000908152600460209081526040808320868452825280832085905593825260059052919091209190915550565b60006118d96118d4846122f5565b6122de565b905080838252602082019050828560208602820111156118fb576118fb600080fd5b60005b858110156119435781516001600160401b0381111561191f5761191f600080fd5b80860161192c8982611a34565b8552505060209283019291909101906001016118fe565b5050509392505050565b600061195b6118d484612318565b90508281526020810184848401111561197657611976600080fd5b6112678482856123b8565b600061198f6118d484612318565b9050828152602081018484840111156119aa576119aa600080fd5b6112678482856123c4565b80356104ec816124d7565b600082601f8301126119d4576119d4600080fd5b81516109b98482602086016118c6565b80516104ec816124eb565b80356104ec816124f3565b80356104ec816124f9565b80356104ec81612509565b600082601f830112611a2457611a24600080fd5b81356109b984826020860161194d565b600082601f830112611a4857611a48600080fd5b81516109b9848260208601611981565b80516104ec816124f3565b600060208284031215611a7857611a78600080fd5b60006109b984846119b5565b60008060008060808587031215611a9d57611a9d600080fd5b6000611aa987876119b5565b94505060208501356001600160401b03811115611ac857611ac8600080fd5b611ad487828801611a10565b9350506040611ae5878288016119ef565b92505060608501356001600160401b03811115611b0457611b04600080fd5b611b1087828801611a10565b91505092959194509250565b60008060408385031215611b3257611b32600080fd5b6000611b3e85856119b5565b9250506020611b4f858286016119ef565b9150509250929050565b600060208284031215611b6e57611b6e600080fd5b81516001600160401b03811115611b8757611b87600080fd5b6109b9848285016119c0565b600060208284031215611ba857611ba8600080fd5b60006109b984846119e4565b600060208284031215611bc957611bc9600080fd5b60006109b984846119ef565b60008060408385031215611beb57611beb600080fd5b6000611bf785856119ef565b9250506020611b4f858286016119b5565b600060208284031215611c1d57611c1d600080fd5b60006109b984846119fa565b600060208284031215611c3e57611c3e600080fd5b60006109b98484611a05565b600060208284031215611c5f57611c5f600080fd5b81356001600160401b03811115611c7857611c78600080fd5b6109b984828501611a10565b600060208284031215611c9957611c99600080fd5b81516001600160401b03811115611cb257611cb2600080fd5b6109b984828501611a34565b60008060008060008060c08789031215611cda57611cda600080fd5b86516001600160401b03811115611cf357611cf3600080fd5b611cff89828a01611a34565b9650506020611d1089828a016119e4565b9550506040611d2189828a01611a58565b9450506060611d3289828a01611a58565b9350506080611d4389828a01611a58565b92505060a0611d5489828a016119e4565b9150509295509295509295565b600060208284031215611d7657611d76600080fd5b60006109b98484611a58565b60006116778383611e1a565b611d9781612391565b82525050565b6000611da7825190565b80845260208401935083602082028501611dc18560200190565b8060005b85811015611df65784840389528151611dde8582611d82565b94506020830160209a909a0199925050600101611dc5565b5091979650505050505050565b801515611d97565b80611d97565b611d97816123ad565b6000611e24825190565b808452602084019350611e3b8185602086016123c4565b611e44816124cd565b9093019392505050565b6000611e58825190565b611e668185602086016123c4565b9290920192915050565b60208082527f537472696e67733a20686578206c656e67746820696e73756666696369656e74910190815260005b5060200190565b601d81526000602082017f5342543a206d696e7420746f20746865207a65726f206164647265737300000081529150611e9e565b602881526000602082017f534254456e756d657261626c653a206f776e657220696e646578206f7574206f8152676620626f756e647360c01b602082015291505b5060400190565b602681526000602082017f5342543a2061646472657373207a65726f206973206e6f7420612076616c69648152651037bbb732b960d11b60208201529150611f1a565b601e81526000602082017f5342543a2063616c6c6572206973206e6f7420746f6b656e206f776e6572000081529150611e9e565b601981526000602082017814d0950e881d1bdad95b88185b1c9958591e481b5a5b9d1959603a1b81529150611e9e565b601581526000602082017414d0950e881a5b9d985b1a59081d1bdad95b881251605a1b81529150611e9e565b602981526000602082017f534254456e756d657261626c653a20676c6f62616c20696e646578206f7574208152686f6620626f756e647360b81b60208201529150611f1a565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081529150611e9e565b602f81526000602082017f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636581526e103937b632b9903337b91039b2b63360891b60208201529150611f1a565b60006120c68285611e4e565b91506120d28284611e4e565b64173539b7b760d91b81529150600582016109b9565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260170160006121148285611e4e565b7001034b99036b4b9b9b4b733903937b6329607d1b815260110191506109b98284611e4e565b602081016104ec8284611d8e565b608081016121568287611d8e565b81810360208301526121688186611e1a565b90506121776040830185611e0b565b81810360608301526121898184611e1a565b9695505050505050565b602080825281016116778184611d9d565b602081016104ec8284611e03565b602081016104ec8284611e0b565b602081016104ec8284611e11565b602080825281016116778184611e1a565b60c080825281016121f08189611e1a565b90506121ff6020830188611e03565b61220c6040830187611e0b565b6122196060830186611e0b565b6122266080830185611e0b565b61223360a0830184611e03565b979650505050505050565b602080825281016104ec81611e70565b602080825281016104ec81611ea5565b602080825281016104ec81611ed9565b602080825281016104ec81611f21565b602080825281016104ec81611f64565b602080825281016104ec81611f98565b602080825281016104ec81611fc8565b602080825281016104ec81611ff4565b602080825281016104ec8161203a565b602080825281016104ec8161206e565b60006122e960405190565b90506108868282612432565b60006001600160401b0382111561230e5761230e6124b7565b5060209081020190565b60006001600160401b03821115612331576123316124b7565b61233a826124cd565b60200192915050565b600082198211156123565761235661245f565b500190565b60008160001904831182151516156123755761237561245f565b500290565b60008282101561238c5761238c61245f565b500390565b60006001600160a01b0382166104ec565b60006104ec82612391565b60006104ec826123a2565b82818337506000910152565b60005b838110156123df5781810151838201526020016123c7565b838111156123ee576000848401525b50505050565b6000816124035761240361245f565b506000190190565b60028104600182168061241f57607f821691505b6020821081141561119957611199612475565b61243b826124cd565b81018181106001600160401b0382111715612458576124586124b7565b6040525050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b601f01601f191690565b6124e081612391565b81146106ef57600080fd5b8015156124e0565b806124e0565b6001600160e01b031981166124e0565b6124e0816123a256fe9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6a2646970667358221220a3b5d8f683cc579fa3d48c3101a6baa6f7602b9d3cd7116ca73d36e4d436ecb864736f6c6343000807003300000000000000000000000048e2042bf980e12b5c50ea78d38042517df0d90c000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000001843656c6f2050726f737065726974792050617373706f7274000000000000000000000000000000000000000000000000000000000000000000000000000000034350500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003168747470733a2f2f6d657461646174612e6d6173612e66696e616e63652f76312e302f6964656e746974792f63656c6f2f000000000000000000000000000000
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.