Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- MakerBadges
- Optimization enabled
- true
- Compiler version
- v0.8.0+commit.c7dfd78e
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2021-06-06T18:01:09.225606Z
Constructor Arguments
68747470733a2f2f6261646765732e6d616b657264616f2e636f6d2f746f6b656e2f000000000000000000000000b27bc0b1eca340a4579642e8ab3d76f6a5815303
Arg [0] (address) : 0x65732e6d616b657264616f2e636f6d2f746f6b65
Contract source code
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
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) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File contracts/ERC2771Context.sol
// based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol
pragma solidity ^0.8.0;
/*
* @dev Context variant with ERC2771 support.
*/
abstract contract ERC2771Context is Context {
address internal _trustedForwarder;
constructor(address trustedForwarder) {
_trustedForwarder = trustedForwarder;
}
function isTrustedForwarder(address forwarder) public view virtual returns (bool) {
return forwarder == _trustedForwarder;
}
function _msgSender() internal view virtual override returns (address sender) {
if (isTrustedForwarder(msg.sender)) {
// The assembly code is more direct than the Solidity version using `abi.decode`.
assembly {
sender := shr(96, calldataload(sub(calldatasize(), 20)))
}
} else {
return super._msgSender();
}
}
function _msgData() internal view virtual override returns (bytes calldata) {
if (isTrustedForwarder(msg.sender)) {
return msg.data[:msg.data.length - 20];
} else {
return super._msgData();
}
}
}
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant alphabet = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = alphabet[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
// File @openzeppelin/contracts/utils/introspection/[email protected]
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File @openzeppelin/contracts/utils/introspection/[email protected]
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
// File @openzeppelin/contracts/access/[email protected]
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
function hasRole(bytes32 role, address account) external view returns (bool);
function getRoleAdmin(bytes32 role) external view returns (bytes32);
function grantRole(bytes32 role, address account) external;
function revokeRole(bytes32 role, address account) external;
function renounceRole(bytes32 role, address account) external;
}
/**
* @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 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 {_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 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]{20}) is missing role (0x[0-9a-f]{32})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role, _msgSender());
_;
}
/**
* @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 override returns (bool) {
return _roles[role].members[account];
}
/**
* @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]{20}) is missing role (0x[0-9a-f]{32})$/
*/
function _checkRole(bytes32 role, address account) internal view {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view 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.
*/
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.
*/
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 granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
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.
*
* [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}.
* ====
*/
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 {
emit RoleAdminChanged(role, getRoleAdmin(role), adminRole);
_roles[role].adminRole = adminRole;
}
function _grantRole(bytes32 role, address account) private {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
function _revokeRole(bytes32 role, address account) private {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}
// File @openzeppelin/contracts/utils/structs/[email protected]
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
// File @openzeppelin/contracts/access/[email protected]
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerable {
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}
/**
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
*/
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
using EnumerableSet for EnumerableSet.AddressSet;
mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) public view override returns (address) {
return _roleMembers[role].at(index);
}
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) public view override returns (uint256) {
return _roleMembers[role].length();
}
/**
* @dev Overload {grantRole} to track enumerable memberships
*/
function grantRole(bytes32 role, address account) public virtual override {
super.grantRole(role, account);
_roleMembers[role].add(account);
}
/**
* @dev Overload {revokeRole} to track enumerable memberships
*/
function revokeRole(bytes32 role, address account) public virtual override {
super.revokeRole(role, account);
_roleMembers[role].remove(account);
}
/**
* @dev Overload {renounceRole} to track enumerable memberships
*/
function renounceRole(bytes32 role, address account) public virtual override {
super.renounceRole(role, account);
_roleMembers[role].remove(account);
}
/**
* @dev Overload {_setupRole} to track enumerable memberships
*/
function _setupRole(bytes32 role, address account) internal virtual override {
super._setupRole(role, account);
_roleMembers[role].add(account);
}
}
// File @openzeppelin/contracts/security/[email protected]
pragma solidity ^0.8.0;
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
// File @openzeppelin/contracts/utils/cryptography/[email protected]
pragma solidity ^0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
// Divide the signature in r, s and v variables
bytes32 r;
bytes32 s;
uint8 v;
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
// solhint-disable-next-line no-inline-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
} else if (signature.length == 64) {
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
// solhint-disable-next-line no-inline-assembly
assembly {
let vs := mload(add(signature, 0x40))
r := mload(add(signature, 0x20))
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
} else {
revert("ECDSA: invalid signature length");
}
return recover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
require(
uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,
"ECDSA: invalid signature 's' value"
);
require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value");
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
require(signer != address(0), "ECDSA: invalid signature");
return signer;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
// File @openzeppelin/contracts/utils/cryptography/[email protected]
pragma solidity ^0.8.0;
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
* thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
* they need in their contracts using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* _Available since v3.4._
*/
abstract contract EIP712 {
/* solhint-disable var-name-mixedcase */
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;
bytes32 private immutable _TYPE_HASH;
/* solhint-enable var-name-mixedcase */
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
bytes32 hashedName = keccak256(bytes(name));
bytes32 hashedVersion = keccak256(bytes(version));
bytes32 typeHash =
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
_HASHED_NAME = hashedName;
_HASHED_VERSION = hashedVersion;
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
_TYPE_HASH = typeHash;
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 name,
bytes32 version
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, name, version, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
}
// File @openzeppelin/contracts/metatx/[email protected]
pragma solidity ^0.8.0;
/*
* @dev Simple minimal forwarder to be used together with an ERC2771 compatible contract. See {ERC2771Context}.
*/
contract MinimalForwarder is EIP712 {
using ECDSA for bytes32;
struct ForwardRequest {
address from;
address to;
uint256 value;
uint256 gas;
uint256 nonce;
bytes data;
}
bytes32 private constant TYPEHASH =
keccak256("ForwardRequest(address from,address to,uint256 value,uint256 gas,uint256 nonce,bytes data)");
mapping(address => uint256) private _nonces;
constructor() EIP712("MinimalForwarder", "0.0.1") {}
function getNonce(address from) public view returns (uint256) {
return _nonces[from];
}
function verify(ForwardRequest calldata req, bytes calldata signature) public view returns (bool) {
address signer =
_hashTypedDataV4(
keccak256(abi.encode(TYPEHASH, req.from, req.to, req.value, req.gas, req.nonce, keccak256(req.data)))
)
.recover(signature);
return _nonces[req.from] == req.nonce && signer == req.from;
}
function execute(ForwardRequest calldata req, bytes calldata signature)
public
payable
returns (bool, bytes memory)
{
require(verify(req, signature), "MinimalForwarder: signature does not match request");
_nonces[req.from] = req.nonce + 1;
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) =
req.to.call{gas: req.gas, value: req.value}(abi.encodePacked(req.data, req.from));
// Validate that the relayer has sent enough gas for the call.
// See https://ronan.eth.link/blog/ethereum-gas-dangers/
assert(gasleft() > req.gas / 63);
return (success, returndata);
}
}
// File contracts/BadgeRoles.sol
pragma solidity 0.8.0;
/// @title Non-transferable Badges for Maker Ecosystem Activity, CDIP 18, 29
/// @author Nazzareno Massari @naszam
/// @notice BadgeRoles Access Management for Default Admin, Templater and Pauser Role
/// @dev See https://github.com/makerdao/community/issues/537
/// @dev See https://github.com/makerdao/community/issues/721
/// @dev All function calls are currently implemented without side effects through TDD approach
/// @dev OpenZeppelin Library is used for secure contract development
contract BadgeRoles is AccessControlEnumerable, Pausable, ERC2771Context {
/// @dev Roles
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
bytes32 public constant TEMPLATER_ROLE = keccak256("TEMPLATER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
constructor(MinimalForwarder forwarder) ERC2771Context(address(forwarder)) {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(ADMIN_ROLE, _msgSender());
_setupRole(TEMPLATER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
}
/// @dev Functions
/// @notice Add a new Admin
/// @dev Access restricted only to Default Admin
/// @param account Address of the new Admin
/// @return True if account is added as Admin
function addAdmin(address account) external returns (bool) {
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "MakerBadges: caller is not the default admin");
require(account != address(0), "MakerBadges: account is the zero address");
grantRole(ADMIN_ROLE, account);
return true;
}
/// @notice Remove an Admin
/// @dev Access restricted only to Default Admin
/// @param account Address of the Admin
/// @return True if account is removed as Admin
function removeAdmin(address account) external returns (bool) {
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "MakerBadges: caller is not the default admin");
revokeRole(ADMIN_ROLE, account);
return true;
}
/// @notice Add a new Templater
/// @dev Access restricted only to Default Admin
/// @param account Address of the new Templater
/// @return True if account is added as Templater
function addTemplater(address account) external returns (bool) {
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "MakerBadges: caller is not the default admin");
require(account != address(0), "MakerBadges: account is the zero address");
grantRole(TEMPLATER_ROLE, account);
return true;
}
/// @notice Remove a Templater
/// @dev Access restricted only to Default Admin
/// @param account Address of the Templater
/// @return True if account is removed as Templater
function removeTemplater(address account) external returns (bool) {
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "MakerBadges: caller is not the default admin");
revokeRole(TEMPLATER_ROLE, account);
return true;
}
/// @notice Pause all the functions
/// @dev the caller must have the 'PAUSER_ROLE'
function pause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "MakerBadges: must have pauser role to pause");
_pause();
}
/// @notice Unpause all the functions
/// @dev the caller must have the 'PAUSER_ROLE'
function unpause() external {
require(hasRole(PAUSER_ROLE, _msgSender()), "MakerBadges: must have pauser role to unpause");
_unpause();
}
function _msgSender() internal view virtual override(Context, ERC2771Context) returns (address sender) {
return super._msgSender();
}
function _msgData() internal view virtual override(Context, ERC2771Context) returns (bytes calldata) {
return super._msgData();
}
}
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented or decremented by one. 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;}
}
}
// File @openzeppelin/contracts/token/ERC721/[email protected]
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
// File @openzeppelin/contracts/token/ERC721/[email protected]
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
// File @openzeppelin/contracts/token/ERC721/extensions/[email protected]
pragma solidity ^0.8.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File @openzeppelin/contracts/token/ERC721/[email protected]
pragma solidity ^0.8.0;
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
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;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @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(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. Empty by default, can be overriden
* in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* 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 Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @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 {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
// solhint-disable-next-line no-inline-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @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 {}
}
// File @openzeppelin/contracts/token/ERC721/extensions/[email protected]
pragma solidity ^0.8.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @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 tokenId);
/**
* @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);
}
// File @openzeppelin/contracts/token/ERC721/extensions/[email protected]
pragma solidity ^0.8.0;
/**
* @dev This implements an optional extension of {ERC721} 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 ERC721Enumerable is ERC721, IERC721Enumerable {
// 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, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: 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 = ERC721.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 = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
// File @openzeppelin/contracts/utils/cryptography/[email protected]
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
// Check if the computed hash (root) is equal to the provided root
return computedHash == root;
}
}
// File contracts/MakerBadges.sol
/// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.0;
/// @title Non-transferable Badges for Maker Ecosystem Activity, CDIP 18, 29
/// @author Nazzareno Massari @naszam
/// @notice MakerBadges to manage Templates and activate Non-transferable MakerBadges by redeemers
/// @dev See https://github.com/makerdao/community/issues/537
/// @dev See https://github.com/makerdao/community/issues/721
/// @dev All function calls are currently implemented without side effects through TDD approach
/// @dev OpenZeppelin Library is used for secure contract development
/*
╔╦╗╔═╗╦╔═╔═╗╦═╗ ╔╗ ╔═╗╔╦╗╔═╗╔═╗╔═╗
║║║╠═╣╠╩╗║╣ ╠╦╝ ╠╩╗╠═╣ ║║║ ╦║╣ ╚═╗
╩ ╩╩ ╩╩ ╩╚═╝╩╚═ ╚═╝╩ ╩═╩╝╚═╝╚═╝╚═╝
*/
contract MakerBadges is BadgeRoles, ERC721Enumerable {
/// @dev Libraries
using Counters for Counters.Counter;
using MerkleProof for bytes32[];
Counters.Counter private _templateIdTracker;
string public baseTokenURI;
bytes32[] private roots;
struct BadgeTemplate {
string name;
string description;
string image;
}
mapping(uint256 => BadgeTemplate) public templates;
mapping(uint256 => uint256) public templateQuantities;
/// @dev Events
event NewTemplate(uint256 indexed templateId, string name, string description, string image);
event TemplateUpdated(uint256 indexed templateId, string name, string description, string image);
event BadgeActivated(uint256 indexed tokenId, uint256 indexed templateId);
constructor(MinimalForwarder forwarder) ERC721("MakerBadges", "MAKER") BadgeRoles(forwarder) {
baseTokenURI = "https://badges.makerdao.com/token/";
}
/// @notice Set the baseURI
/// @dev Update the baseURI specified in the constructor
/// @param baseURI New baseURI
function setBaseURI(string calldata baseURI) external {
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "MakerBadges: caller is not the default admin");
baseTokenURI = baseURI;
}
/// @notice Set Merkle Tree Root Hashes array
/// @dev Called by admin to update roots for different address batches by templateId
/// @param _roots Root hashes of the Merkle Trees by templateId
function setRootHashes(bytes32[] calldata _roots) external whenNotPaused {
require(hasRole(ADMIN_ROLE, _msgSender()), "MakerBadges: caller is not an admin");
roots = _roots;
}
/// @dev Templates
/// @notice Create a new template
/// @dev Access restricted to only Templaters
/// @param name The name of the new template
/// @param description A description of the new template
/// @param image A filename of the new template
function createTemplate(
string calldata name,
string calldata description,
string calldata image
) external whenNotPaused {
require(hasRole(TEMPLATER_ROLE, _msgSender()), "MakerBadges: caller is not a template owner");
uint256 templateId = _templateIdTracker.current();
templates[templateId].name = name;
templates[templateId].description = description;
templates[templateId].image = image;
_templateIdTracker.increment();
emit NewTemplate(templateId, name, description, image);
}
/// @notice Update a template
/// @dev Access restricted to only Templaters
/// @param templateId Template Id
/// @param name The name of the template
/// @param description The description of the template
/// @param image The filename of the template
function updateTemplate(
uint256 templateId,
string calldata name,
string calldata description,
string calldata image
) external whenNotPaused {
require(hasRole(TEMPLATER_ROLE, _msgSender()), "MakerBadges: caller is not a template owner");
require(_templateIdTracker.current() > templateId, "MakerBadges: no template with that id");
templates[templateId].name = name;
templates[templateId].description = description;
templates[templateId].image = image;
emit TemplateUpdated(templateId, name, description, image);
}
/// @notice Getter function for templates count
/// @dev Return lenght of template array
/// @return count The current number of templates
function getTemplatesCount() external view whenNotPaused returns (uint256 count) {
return _templateIdTracker.current();
}
/// @dev Badges
/// @notice Activate Badge by redeemers
/// @dev Verify if the caller is a redeemer
/// @param proof Merkle Proof
/// @param templateId Template Id
/// @return True If the new Badge is Activated
function activateBadge(bytes32[] calldata proof, uint256 templateId) external whenNotPaused returns (bool) {
require(_templateIdTracker.current() > templateId, "MakerBadges: no template with that id");
require(
proof.verify(roots[templateId], keccak256(abi.encodePacked(_msgSender()))),
"MakerBadges: caller is not a redeemer"
);
uint256 _tokenId = _getTokenId(_msgSender(), templateId);
/// @dev Increase the quantities
templateQuantities[templateId] += 1;
require(_mintWithTokenURI(_msgSender(), _tokenId), "MakerBadges: badge not minted");
emit BadgeActivated(_tokenId, templateId);
return true;
}
/// @notice Getter function for redeemer associated with the tokenId
/// @dev Check if the tokenId exists
/// @param tokenId Token Id of the Badge
/// @return redeemer Redeemer address associated with the tokenId
function getBadgeRedeemer(uint256 tokenId) external view whenNotPaused returns (address redeemer) {
require(_exists(tokenId), "MakerBadges: no token with that id");
(redeemer, ) = _unpackTokenId(tokenId);
}
/// @notice Getter function for templateId associated with the tokenId
/// @dev Check if the tokenId exists
/// @param tokenId Token Id of the Badge
/// @return templateId Template Id associated with the tokenId
function getBadgeTemplate(uint256 tokenId) external view whenNotPaused returns (uint256 templateId) {
require(_exists(tokenId), "MakerBadges: no token with that id");
(, templateId) = _unpackTokenId(tokenId);
}
/// @notice ERC721 _transfer() Disabled
/// @dev _transfer() has been overriden
/// @dev reverts on transferFrom() and safeTransferFrom()
function _transfer(
address from,
address to,
uint256 tokenId
) internal override {
require(false, "MakerBadges: badge transfer disabled");
super._transfer(from, to, tokenId);
}
/// @notice Generate tokenId
/// @dev Augur twist by concatenate redeemer and templateId
/// @param redeemer Redeemer Address
/// @param templateId Template Id
/// @param _tokenId Token Id
function _getTokenId(address redeemer, uint256 templateId) private pure returns (uint256 _tokenId) {
bytes memory _tokenIdBytes = abi.encodePacked(redeemer, uint96(templateId));
assembly {
_tokenId := mload(add(_tokenIdBytes, add(0x20, 0)))
}
}
/// @notice Unpack tokenId
/// @param tokenId Token Id of the Badge
/// @return redeemer Redeemer Address
/// @return templateId Template Id
function _unpackTokenId(uint256 tokenId) private pure returns (address redeemer, uint256 templateId) {
assembly {
redeemer := shr(96, and(tokenId, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000))
templateId := and(tokenId, 0x0000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF)
}
}
/// @notice Mint new token with tokenURI
/// @dev Automatically concatenate baseURI with tokenURI via abi.encodePacked
/// @param to Owner of the new token
/// @param tokenId Token Id of the Baddge
/// @return True if the new token is minted
function _mintWithTokenURI(address to, uint256 tokenId) private returns (bool) {
_mint(to, tokenId);
return true;
}
/// @notice Getter function for baseTokenURI
/// @dev Override _baseURI()
function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(AccessControlEnumerable, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
function _msgSender() internal view virtual override(Context, BadgeRoles) returns (address sender) {
return super._msgSender();
}
function _msgData() internal view virtual override(Context, BadgeRoles) returns (bytes calldata) {
return super._msgData();
}
}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"forwarder","internalType":"contract MinimalForwarder"}]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"approved","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"ApprovalForAll","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"bool","name":"approved","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"BadgeActivated","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"uint256","name":"templateId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"NewTemplate","inputs":[{"type":"uint256","name":"templateId","internalType":"uint256","indexed":true},{"type":"string","name":"name","internalType":"string","indexed":false},{"type":"string","name":"description","internalType":"string","indexed":false},{"type":"string","name":"image","internalType":"string","indexed":false}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TemplateUpdated","inputs":[{"type":"uint256","name":"templateId","internalType":"uint256","indexed":true},{"type":"string","name":"name","internalType":"string","indexed":false},{"type":"string","name":"description","internalType":"string","indexed":false},{"type":"string","name":"image","internalType":"string","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"PAUSER_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"TEMPLATER_ROLE","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"activateBadge","inputs":[{"type":"bytes32[]","name":"proof","internalType":"bytes32[]"},{"type":"uint256","name":"templateId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"addAdmin","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"addTemplater","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approve","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"baseTokenURI","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"createTemplate","inputs":[{"type":"string","name":"name","internalType":"string"},{"type":"string","name":"description","internalType":"string"},{"type":"string","name":"image","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getApproved","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"redeemer","internalType":"address"}],"name":"getBadgeRedeemer","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"templateId","internalType":"uint256"}],"name":"getBadgeTemplate","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getRoleMember","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRoleMemberCount","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"count","internalType":"uint256"}],"name":"getTemplatesCount","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isApprovedForAll","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isTrustedForwarder","inputs":[{"type":"address","name":"forwarder","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ownerOf","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"removeAdmin","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"removeTemplater","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"bytes","name":"_data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setApprovalForAll","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"bool","name":"approved","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBaseURI","inputs":[{"type":"string","name":"baseURI","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRootHashes","inputs":[{"type":"bytes32[]","name":"_roots","internalType":"bytes32[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"templateQuantities","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"name","internalType":"string"},{"type":"string","name":"description","internalType":"string"},{"type":"string","name":"image","internalType":"string"}],"name":"templates","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenByIndex","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenOfOwnerByIndex","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"tokenURI","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateTemplate","inputs":[{"type":"uint256","name":"templateId","internalType":"uint256"},{"type":"string","name":"name","internalType":"string"},{"type":"string","name":"description","internalType":"string"},{"type":"string","name":"image","internalType":"string"}]}]
Contract Creation Code
0x60806040523480156200001157600080fd5b5060405162003c3538038062003c35833981016040819052620000349162000461565b604080518082018252600b81526a4d616b657242616467657360a81b6020808301919091528251808401909352600583526426a0a5a2a960d91b90830152600280546001600160a81b0319166101006001600160a01b038616021790559082620000a96000620000a36200019d565b620001ba565b620000d87fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775620000a36200019d565b620001077f82fc59a2af283c7e52e3f7cf8d269383062c6603a1ab4300e32135abe128a476620000a36200019d565b620001367f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a620000a36200019d565b5081516200014c906003906020850190620003bb565b50805162000162906004906020840190620003bb565b50505060405180606001604052806022815260200162003c136022913980516200019591600e91602090910190620003bb565b5050620004ce565b6000620001b4620001fd60201b620015741760201c565b90505b90565b620001d182826200021460201b6200157e1760201c565b6000828152600160209081526040909120620001f89183906200158c62000224821b17901c565b505050565b6000620001b46200024460201b620015a11760201c565b62000220828262000284565b5050565b60006200023b836001600160a01b0384166200030e565b90505b92915050565b600062000251336200035d565b1562000267575060131936013560601c620001b7565b6200027c6200037660201b620015cf1760201c565b9050620001b7565b6200029082826200037a565b62000220576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620002ca6200019d565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006200031c8383620003a3565b62000354575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200023e565b5060006200023e565b60025461010090046001600160a01b0390811691161490565b3390565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60009081526001919091016020526040902054151590565b828054620003c99062000491565b90600052602060002090601f016020900481019282620003ed576000855562000438565b82601f106200040857805160ff191683800117855562000438565b8280016001018555821562000438579182015b82811115620004385782518255916020019190600101906200041b565b50620004469291506200044a565b5090565b5b808211156200044657600081556001016200044b565b60006020828403121562000473578081fd5b81516001600160a01b03811681146200048a578182fd5b9392505050565b600281046001821680620004a657607f821691505b60208210811415620004c857634e487b7160e01b600052602260045260246000fd5b50919050565b61373580620004de6000396000f3fe608060405234801561001057600080fd5b506004361061028a5760003560e01c8063704802751161015c578063b88d4fde116100ce578063d547741f11610087578063d547741f14610567578063d547cfb71461057a578063e63ab1e914610582578063e6c0d7141461058a578063e985e9c51461059d578063fb2a5f12146105b05761028a565b8063b88d4fde146104e6578063bc525652146104f9578063c87b56dd1461051b578063ca15c8731461052e578063ccb4bcb614610541578063d214f400146105545761028a565b806391d148541161012057806391d148541461049557806395d89b41146104a8578063a217fddf146104b0578063a22cb465146104b8578063aca57703146104cb578063b5900eea146104de5761028a565b8063704802751461044c57806370a082311461045f57806375b238fc146104725780638456cb591461047a5780639010d07c146104825761028a565b806336568abe116102005780634f6ccce7116101b95780634f6ccce7146103f057806355f804b314610403578063572b6c05146104165780635c975abb146104295780636352211e146104315780636cdd0a16146104445761028a565b806336568abe146103895780633f4ba83a1461039c57806342842e0e146103a45780634311110f146103b75780634ba360ba146103ca5780634de46fd0146103dd5761028a565b806318160ddd1161025257806318160ddd1461031557806322e3becf1461032a57806323b872dd1461033d578063248a9ca3146103505780632f2ff15d146103635780632f745c59146103765761028a565b806301ffc9a71461028f57806306fdde03146102b8578063081812fc146102cd578063095ea7b3146102ed5780631785f53c14610302575b600080fd5b6102a261029d366004612951565b6105c3565b6040516102af9190612c98565b60405180910390f35b6102c06105d6565b6040516102af9190612cf5565b6102e06102db3660046128f6565b610669565b6040516102af9190612c47565b6103006102fb366004612843565b6106b5565b005b6102a26103103660046126b6565b61074d565b61031d610797565b6040516102af9190612ca3565b6102a26103383660046128ac565b61079d565b61030061034b366004612702565b610946565b61031d61035e3660046128f6565b61097e565b61030061037136600461290e565b610993565b61031d610384366004612843565b6109b5565b61030061039736600461290e565b610a0a565b610300610a2c565b6103006103b2366004612702565b610a7e565b6102e06103c53660046128f6565b610a99565b6102a26103d83660046126b6565b610af5565b61031d6103eb3660046128f6565b610b37565b61031d6103fe3660046128f6565b610b93565b610300610411366004612989565b610bee565b6102a26104243660046126b6565b610c23565b6102a2610c3c565b6102e061043f3660046128f6565b610c45565b61031d610c7a565b6102a261045a3660046126b6565b610c8c565b61031d61046d3660046126b6565b610cf4565b61031d610d38565b610300610d4a565b6102e0610490366004612930565b610d9a565b6102a26104a336600461290e565b610db2565b6102c0610ddb565b61031d610dea565b6103006104c6366004612809565b610def565b6103006104d936600461286c565b610ebd565b61031d610f24565b6103006104f436600461273d565b610f5a565b61050c6105073660046128f6565b610f99565b6040516102af93929190612d08565b6102c06105293660046128f6565b611153565b61031d61053c3660046128f6565b6111d5565b61030061054f3660046129bd565b6111ec565b610300610562366004612a53565b6112ff565b61030061057536600461290e565b611410565b6102c061141a565b61031d6114a8565b6102a26105983660046126b6565b6114cc565b6102a26105ab3660046126d0565b611534565b61031d6105be3660046128f6565b611562565b60006105ce826115d3565b90505b919050565b6060600380546105e5906135fa565b80601f0160208091040260200160405190810160405280929190818152602001828054610611906135fa565b801561065e5780601f106106335761010080835404028352916020019161065e565b820191906000526020600020905b81548152906001019060200180831161064157829003601f168201915b505050505090505b90565b6000610674826115f8565b6106995760405162461bcd60e51b81526004016106909061321d565b60405180910390fd5b506000908152600760205260409020546001600160a01b031690565b60006106c082610c45565b9050806001600160a01b0316836001600160a01b031614156106f45760405162461bcd60e51b8152600401610690906132fc565b806001600160a01b0316610706611615565b6001600160a01b031614806107225750610722816105ab611615565b61073e5760405162461bcd60e51b8152600401610690906130c1565b610748838361161f565b505050565b600061075b816104a3611615565b6107775760405162461bcd60e51b815260040161069090613425565b61078f6000805160206136e083398151915283611410565b506001919050565b600b5490565b60006107a7610c3c565b156107c45760405162461bcd60e51b815260040161069090613097565b816107cf600d61168d565b116107ec5760405162461bcd60e51b815260040161069090612de6565b610886600f838154811061081057634e487b7160e01b600052603260045260246000fd5b9060005260206000200154610823611615565b6040516020016108339190612b49565b604051602081830303815290604052805190602001208686808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509294939250506116919050565b6108a25760405162461bcd60e51b815260040161069090612e2b565b60006108b56108af611615565b8461174c565b905060016011600085815260200190815260200160002060008282546108db9190613555565b909155506108f290506108ec611615565b8261177e565b61090e5760405162461bcd60e51b81526004016106909061311e565b604051839082907f04c63a7e9b06ee8caac5113b74753a2f77a920260734c3003531843116b445a290600090a3506001949350505050565b610957610951611615565b82611793565b6109735760405162461bcd60e51b81526004016106909061333d565b610748838383611818565b60009081526020819052604090206001015490565b61099d8282611830565b6000828152600160205260409020610748908261158c565b60006109c083610cf4565b82106109de5760405162461bcd60e51b815260040161069090612e70565b506001600160a01b03821660009081526009602090815260408083208484529091529020545b92915050565b610a148282611854565b60008281526001602052604090206107489082611896565b610a587f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a6104a3611615565b610a745760405162461bcd60e51b815260040161069090613471565b610a7c6118ab565b565b61074883838360405180602001604052806000815250610f5a565b6000610aa3610c3c565b15610ac05760405162461bcd60e51b815260040161069090613097565b610ac9826115f8565b610ae55760405162461bcd60e51b815260040161069090612f50565b610aee82611919565b5092915050565b6000610b03816104a3611615565b610b1f5760405162461bcd60e51b815260040161069090613425565b61078f6000805160206136c083398151915283611410565b6000610b41610c3c565b15610b5e5760405162461bcd60e51b815260040161069090613097565b610b67826115f8565b610b835760405162461bcd60e51b815260040161069090612f50565b610b8c82611919565b9392505050565b6000610b9d610797565b8210610bbb5760405162461bcd60e51b81526004016106909061338e565b600b8281548110610bdc57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b610bfb60006104a3611615565b610c175760405162461bcd60e51b815260040161069090613425565b610748600e8383612543565b60025461010090046001600160a01b0390811691161490565b60025460ff1690565b6000818152600560205260408120546001600160a01b0316806105ce5760405162461bcd60e51b81526004016106909061319f565b6000805160206136c083398151915281565b6000610c9a816104a3611615565b610cb65760405162461bcd60e51b815260040161069090613425565b6001600160a01b038216610cdc5760405162461bcd60e51b8152600401610690906134be565b61078f6000805160206136e083398151915283610993565b60006001600160a01b038216610d1c5760405162461bcd60e51b815260040161069090613155565b506001600160a01b031660009081526006602052604090205490565b6000805160206136e083398151915281565b610d767f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a6104a3611615565b610d925760405162461bcd60e51b8152600401610690906133da565b610a7c611932565b6000828152600160205260408120610b8c908361198d565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600480546105e5906135fa565b600081565b610df7611615565b6001600160a01b0316826001600160a01b03161415610e285760405162461bcd60e51b815260040161069090612fc9565b8060086000610e35611615565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155610e79611615565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610eb19190612c98565b60405180910390a35050565b610ec5610c3c565b15610ee25760405162461bcd60e51b815260040161069090613097565b610efc6000805160206136e08339815191526104a3611615565b610f185760405162461bcd60e51b815260040161069090612f0d565b610748600f83836125c7565b6000610f2e610c3c565b15610f4b5760405162461bcd60e51b815260040161069090613097565b610f55600d61168d565b905090565b610f6b610f65611615565b83611793565b610f875760405162461bcd60e51b81526004016106909061333d565b610f9384848484611999565b50505050565b601060205260009081526040902080548190610fb4906135fa565b80601f0160208091040260200160405190810160405280929190818152602001828054610fe0906135fa565b801561102d5780601f106110025761010080835404028352916020019161102d565b820191906000526020600020905b81548152906001019060200180831161101057829003601f168201915b505050505090806001018054611042906135fa565b80601f016020809104026020016040519081016040528092919081815260200182805461106e906135fa565b80156110bb5780601f10611090576101008083540402835291602001916110bb565b820191906000526020600020905b81548152906001019060200180831161109e57829003601f168201915b5050505050908060020180546110d0906135fa565b80601f01602080910402602001604051908101604052809291908181526020018280546110fc906135fa565b80156111495780601f1061111e57610100808354040283529160200191611149565b820191906000526020600020905b81548152906001019060200180831161112c57829003601f168201915b5050505050905083565b606061115e826115f8565b61117a5760405162461bcd60e51b815260040161069090613269565b60006111846119cc565b905060008151116111a45760405180602001604052806000815250610b8c565b806111ae846119db565b6040516020016111bf929190612ba3565b6040516020818303038152906040529392505050565b60008181526001602052604081206105ce90611af6565b6111f4610c3c565b156112115760405162461bcd60e51b815260040161069090613097565b61122b6000805160206136c08339815191526104a3611615565b6112475760405162461bcd60e51b81526004016106909061304c565b6000611253600d61168d565b600081815260106020526040902090915061126f908888612543565b50600081815260106020526040902061128c906001018686612543565b5060008181526010602052604090206112a9906002018484612543565b506112b4600d611b01565b807f335347d3c0abbe88e13ee17ff9db9ff2aabea3e099f1ffd10807e9c7f9cf82ad8888888888886040516112ee96959493929190612cac565b60405180910390a250505050505050565b611307610c3c565b156113245760405162461bcd60e51b815260040161069090613097565b61133e6000805160206136c08339815191526104a3611615565b61135a5760405162461bcd60e51b81526004016106909061304c565b86611365600d61168d565b116113825760405162461bcd60e51b815260040161069090612de6565b600087815260106020526040902061139b908787612543565b5060008781526010602052604090206113b8906001018585612543565b5060008781526010602052604090206113d5906002018383612543565b50867fcfea559888b71c63137ce2f6354ae40661672d1ea2d56b2db88cdd200ff42b738787878787876040516112ee96959493929190612cac565b610a148282611b0a565b600e8054611427906135fa565b80601f0160208091040260200160405190810160405280929190818152602001828054611453906135fa565b80156114a05780601f10611475576101008083540402835291602001916114a0565b820191906000526020600020905b81548152906001019060200180831161148357829003601f168201915b505050505081565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b60006114da816104a3611615565b6114f65760405162461bcd60e51b815260040161069090613425565b6001600160a01b03821661151c5760405162461bcd60e51b8152600401610690906134be565b61078f6000805160206136c083398151915283610993565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b60116020526000908152604090205481565b6000610f556115a1565b6115888282611b29565b5050565b6000610b8c836001600160a01b038416611bae565b60006115ac33610c23565b156115c0575060131936013560601c610666565b6115c86115cf565b9050610666565b3390565b60006001600160e01b0319821663780e9d6360e01b14806105ce57506105ce82611bf8565b6000908152600560205260409020546001600160a01b0316151590565b6000610f55611574565b600081815260076020526040902080546001600160a01b0319166001600160a01b038416908117909155819061165482610c45565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b5490565b600081815b85518110156117415760008682815181106116c157634e487b7160e01b600052603260045260246000fd5b602002602001015190508083116117025782816040516020016116e5929190612b95565b60405160208183030381529060405280519060200120925061172e565b8083604051602001611715929190612b95565b6040516020818303038152906040528051906020012092505b508061173981613635565b915050611696565b509092149392505050565b6000808383604051602001611762929190612b66565b60408051601f1981840301815291905260200151949350505050565b600061178a8383611c38565b50600192915050565b600061179e826115f8565b6117ba5760405162461bcd60e51b815260040161069090613000565b60006117c583610c45565b9050806001600160a01b0316846001600160a01b031614806118005750836001600160a01b03166117f584610669565b6001600160a01b0316145b8061181057506118108185611534565b949350505050565b60405162461bcd60e51b8152600401610690906132b8565b6118398261097e565b61184a81611845611615565b611d17565b6107488383611b29565b61185c611615565b6001600160a01b0316816001600160a01b03161461188c5760405162461bcd60e51b815260040161069090613506565b6115888282611d7b565b6000610b8c836001600160a01b038416611dfe565b6118b3610c3c565b6118cf5760405162461bcd60e51b815260040161069090612db8565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611902611615565b60405161190f9190612c47565b60405180910390a1565b606081901c916bffffffffffffffffffffffff90911690565b61193a610c3c565b156119575760405162461bcd60e51b815260040161069090613097565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611902611615565b6000610b8c8383611f15565b6119a4848484611818565b6119b084848484611f6e565b610f935760405162461bcd60e51b815260040161069090612ebb565b6060600e80546105e5906135fa565b606081611a0057506040805180820190915260018152600360fc1b60208201526105d1565b8160005b8115611a2a5780611a1481613635565b9150611a239050600a8361356d565b9150611a04565b60008167ffffffffffffffff811115611a5357634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611a7d576020820181803683370190505b5090505b841561181057611a926001836135a0565b9150611a9f600a86613650565b611aaa906030613555565b60f81b818381518110611acd57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350611aef600a8661356d565b9450611a81565b60006105ce8261168d565b80546001019055565b611b138261097e565b611b1f81611845611615565b6107488383611d7b565b611b338282610db2565b611588576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611b6a611615565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611bba8383612089565b611bf057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a04565b506000610a04565b60006001600160e01b031982166380ac58cd60e01b1480611c2957506001600160e01b03198216635b5e139f60e01b145b806105ce57506105ce826120a1565b6001600160a01b038216611c5e5760405162461bcd60e51b8152600401610690906131e8565b611c67816115f8565b15611c845760405162461bcd60e51b815260040161069090612f92565b611c90600083836120c6565b6001600160a01b0382166000908152600660205260408120805460019290611cb9908490613555565b909155505060008181526005602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b611d218282610db2565b61158857611d39816001600160a01b0316601461214f565b611d4483602061214f565b604051602001611d55929190612bd2565b60408051601f198184030181529082905262461bcd60e51b825261069091600401612cf5565b611d858282610db2565b15611588576000828152602081815260408083206001600160a01b03851684529091529020805460ff19169055611dba611615565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60008181526001830160205260408120548015611f0b576000611e226001836135a0565b8554909150600090611e36906001906135a0565b90506000866000018281548110611e5d57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080876000018481548110611e8e57634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260018901909152604090208490558654879080611ecf57634e487b7160e01b600052603160045260246000fd5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610a04565b6000915050610a04565b81546000908210611f385760405162461bcd60e51b815260040161069090612d41565b826000018281548110611f5b57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6000611f82846001600160a01b0316612301565b1561207e57836001600160a01b031663150b7a02611f9e611615565b8786866040518563ffffffff1660e01b8152600401611fc09493929190612c5b565b602060405180830381600087803b158015611fda57600080fd5b505af192505050801561200a575060408051601f3d908101601f191682019092526120079181019061296d565b60015b612064573d808015612038576040519150601f19603f3d011682016040523d82523d6000602084013e61203d565b606091505b50805161205c5760405162461bcd60e51b815260040161069090612ebb565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611810565b506001949350505050565b60009081526001919091016020526040902054151590565b60006001600160e01b03198216635a05180f60e01b14806105ce57506105ce82612307565b6120d1838383610748565b6001600160a01b0383166120ed576120e88161232c565b612110565b816001600160a01b0316836001600160a01b031614612110576121108382612370565b6001600160a01b03821661212c576121278161240d565b610748565b826001600160a01b0316826001600160a01b0316146107485761074882826124e6565b6060600061215e836002613581565b612169906002613555565b67ffffffffffffffff81111561218f57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156121b9576020820181803683370190505b509050600360fc1b816000815181106121e257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061221f57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000612243846002613581565b61224e906001613555565b90505b60018111156122e2576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061229057634e487b7160e01b600052603260045260246000fd5b1a60f81b8282815181106122b457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c936122db816135e3565b9050612251565b508315610b8c5760405162461bcd60e51b815260040161069090612d83565b3b151590565b60006001600160e01b03198216637965db0b60e01b14806105ce57506105ce8261252a565b600b80546000838152600c60205260408120829055600182018355919091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90155565b6000600161237d84610cf4565b61238791906135a0565b6000838152600a60205260409020549091508082146123da576001600160a01b03841660009081526009602090815260408083208584528252808320548484528184208190558352600a90915290208190555b506000918252600a602090815260408084208490556001600160a01b039094168352600981528383209183525290812055565b600b5460009061241f906001906135a0565b6000838152600c6020526040812054600b805493945090928490811061245557634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080600b838154811061248457634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152600c9091526040808220849055858252812055600b8054806124ca57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b60006124f183610cf4565b6001600160a01b0390931660009081526009602090815260408083208684528252808320859055938252600a9052919091209190915550565b6001600160e01b031981166301ffc9a760e01b14919050565b82805461254f906135fa565b90600052602060002090601f01602090048101928261257157600085556125b7565b82601f1061258a5782800160ff198235161785556125b7565b828001600101855582156125b7579182015b828111156125b757823582559160200191906001019061259c565b506125c3929150612601565b5090565b8280548282559060005260206000209081019282156125b757916020028201828111156125b757823582559160200191906001019061259c565b5b808211156125c35760008155600101612602565b80356001600160a01b03811681146105d157600080fd5b60008083601f84011261263e578081fd5b50813567ffffffffffffffff811115612655578182fd5b602083019150836020808302850101111561266f57600080fd5b9250929050565b60008083601f840112612687578182fd5b50813567ffffffffffffffff81111561269e578182fd5b60208301915083602082850101111561266f57600080fd5b6000602082840312156126c7578081fd5b610b8c82612616565b600080604083850312156126e2578081fd5b6126eb83612616565b91506126f960208401612616565b90509250929050565b600080600060608486031215612716578081fd5b61271f84612616565b925061272d60208501612616565b9150604084013590509250925092565b60008060008060808587031215612752578081fd5b61275b85612616565b9350602061276a818701612616565b935060408601359250606086013567ffffffffffffffff8082111561278d578384fd5b818801915088601f8301126127a0578384fd5b8135818111156127b2576127b2613690565b604051601f8201601f19168101850183811182821017156127d5576127d5613690565b60405281815283820185018b10156127eb578586fd5b81858501868301379081019093019390935250939692955090935050565b6000806040838503121561281b578182fd5b61282483612616565b915060208301358015158114612838578182fd5b809150509250929050565b60008060408385031215612855578182fd5b61285e83612616565b946020939093013593505050565b6000806020838503121561287e578182fd5b823567ffffffffffffffff811115612894578283fd5b6128a08582860161262d565b90969095509350505050565b6000806000604084860312156128c0578283fd5b833567ffffffffffffffff8111156128d6578384fd5b6128e28682870161262d565b909790965060209590950135949350505050565b600060208284031215612907578081fd5b5035919050565b60008060408385031215612920578182fd5b823591506126f960208401612616565b60008060408385031215612942578182fd5b50508035926020909101359150565b600060208284031215612962578081fd5b8135610b8c816136a6565b60006020828403121561297e578081fd5b8151610b8c816136a6565b6000806020838503121561299b578182fd5b823567ffffffffffffffff8111156129b1578283fd5b6128a085828601612676565b600080600080600080606087890312156129d5578384fd5b863567ffffffffffffffff808211156129ec578586fd5b6129f88a838b01612676565b90985096506020890135915080821115612a10578586fd5b612a1c8a838b01612676565b90965094506040890135915080821115612a34578384fd5b50612a4189828a01612676565b979a9699509497509295939492505050565b60008060008060008060006080888a031215612a6d578485fd5b87359650602088013567ffffffffffffffff80821115612a8b578687fd5b612a978b838c01612676565b909850965060408a0135915080821115612aaf578283fd5b612abb8b838c01612676565b909650945060608a0135915080821115612ad3578283fd5b50612ae08a828b01612676565b989b979a50959850939692959293505050565b60008151808452612b0b8160208601602086016135b7565b601f01601f19169290920160200192915050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff1916825260a01b6001600160a01b031916601482015260200190565b918252602082015260400190565b60008351612bb58184602088016135b7565b835190830190612bc98183602088016135b7565b01949350505050565b60007f416363657373436f6e74726f6c3a206163636f756e742000000000000000000082528351612c0a8160178501602088016135b7565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612c3b8160288401602088016135b7565b01602801949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612c8e90830184612af3565b9695505050505050565b901515815260200190565b90815260200190565b600060608252612cc060608301888a612b1f565b8281036020840152612cd3818789612b1f565b90508281036040840152612ce8818587612b1f565b9998505050505050505050565b600060208252610b8c6020830184612af3565b600060608252612d1b6060830186612af3565b8281036020840152612d2d8186612af3565b90508281036040840152612c8e8185612af3565b60208082526022908201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604082015261647360f01b606082015260800190565b6020808252818101527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604082015260600190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b60208082526025908201527f4d616b65724261646765733a206e6f2074656d706c6174652077697468207468604082015264185d081a5960da1b606082015260800190565b60208082526025908201527f4d616b65724261646765733a2063616c6c6572206973206e6f7420612072656460408201526432b2b6b2b960d91b606082015260800190565b6020808252602b908201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560408201526a74206f6620626f756e647360a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526023908201527f4d616b65724261646765733a2063616c6c6572206973206e6f7420616e20616460408201526236b4b760e91b606082015260800190565b60208082526022908201527f4d616b65724261646765733a206e6f20746f6b656e20776974682074686174206040820152611a5960f21b606082015260800190565b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604082015260600190565b60208082526019908201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604082015260600190565b6020808252602c908201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252602b908201527f4d616b65724261646765733a2063616c6c6572206973206e6f7420612074656d60408201526a383630ba329037bbb732b960a91b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526038908201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760408201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606082015260800190565b6020808252601d908201527f4d616b65724261646765733a206261646765206e6f74206d696e746564000000604082015260600190565b6020808252602a908201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604082015269726f206164647265737360b01b606082015260800190565b60208082526029908201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460408201526832b73a103a37b5b2b760b91b606082015260800190565b6020808252818101527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252602f908201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60408201526e3732bc34b9ba32b73a103a37b5b2b760891b606082015260800190565b60208082526024908201527f4d616b65724261646765733a206261646765207472616e736665722064697361604082015263189b195960e21b606082015260800190565b60208082526021908201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656040820152603960f91b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602c908201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60408201526b7574206f6620626f756e647360a01b606082015260800190565b6020808252602b908201527f4d616b65724261646765733a206d75737420686176652070617573657220726f60408201526a6c6520746f20706175736560a81b606082015260800190565b6020808252602c908201527f4d616b65724261646765733a2063616c6c6572206973206e6f7420746865206460408201526b32b330bab63a1030b236b4b760a11b606082015260800190565b6020808252602d908201527f4d616b65724261646765733a206d75737420686176652070617573657220726f60408201526c6c6520746f20756e706175736560981b606082015260800190565b60208082526028908201527f4d616b65724261646765733a206163636f756e7420697320746865207a65726f604082015267206164647265737360c01b606082015260800190565b6020808252602f908201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560408201526e103937b632b9903337b91039b2b63360891b606082015260800190565b6000821982111561356857613568613664565b500190565b60008261357c5761357c61367a565b500490565b600081600019048311821515161561359b5761359b613664565b500290565b6000828210156135b2576135b2613664565b500390565b60005b838110156135d25781810151838201526020016135ba565b83811115610f935750506000910152565b6000816135f2576135f2613664565b506000190190565b60028104600182168061360e57607f821691505b6020821081141561362f57634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561364957613649613664565b5060010190565b60008261365f5761365f61367a565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b0319811681146136bc57600080fd5b5056fe82fc59a2af283c7e52e3f7cf8d269383062c6603a1ab4300e32135abe128a476a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a2646970667358221220e573581fdb2006cc64ff5389a7946d05d34dbc0aeebd8188f62c27e4b1373bc264736f6c6343000800003368747470733a2f2f6261646765732e6d616b657264616f2e636f6d2f746f6b656e2f000000000000000000000000b27bc0b1eca340a4579642e8ab3d76f6a5815303
Deployed ByteCode
0x608060405234801561001057600080fd5b506004361061028a5760003560e01c8063704802751161015c578063b88d4fde116100ce578063d547741f11610087578063d547741f14610567578063d547cfb71461057a578063e63ab1e914610582578063e6c0d7141461058a578063e985e9c51461059d578063fb2a5f12146105b05761028a565b8063b88d4fde146104e6578063bc525652146104f9578063c87b56dd1461051b578063ca15c8731461052e578063ccb4bcb614610541578063d214f400146105545761028a565b806391d148541161012057806391d148541461049557806395d89b41146104a8578063a217fddf146104b0578063a22cb465146104b8578063aca57703146104cb578063b5900eea146104de5761028a565b8063704802751461044c57806370a082311461045f57806375b238fc146104725780638456cb591461047a5780639010d07c146104825761028a565b806336568abe116102005780634f6ccce7116101b95780634f6ccce7146103f057806355f804b314610403578063572b6c05146104165780635c975abb146104295780636352211e146104315780636cdd0a16146104445761028a565b806336568abe146103895780633f4ba83a1461039c57806342842e0e146103a45780634311110f146103b75780634ba360ba146103ca5780634de46fd0146103dd5761028a565b806318160ddd1161025257806318160ddd1461031557806322e3becf1461032a57806323b872dd1461033d578063248a9ca3146103505780632f2ff15d146103635780632f745c59146103765761028a565b806301ffc9a71461028f57806306fdde03146102b8578063081812fc146102cd578063095ea7b3146102ed5780631785f53c14610302575b600080fd5b6102a261029d366004612951565b6105c3565b6040516102af9190612c98565b60405180910390f35b6102c06105d6565b6040516102af9190612cf5565b6102e06102db3660046128f6565b610669565b6040516102af9190612c47565b6103006102fb366004612843565b6106b5565b005b6102a26103103660046126b6565b61074d565b61031d610797565b6040516102af9190612ca3565b6102a26103383660046128ac565b61079d565b61030061034b366004612702565b610946565b61031d61035e3660046128f6565b61097e565b61030061037136600461290e565b610993565b61031d610384366004612843565b6109b5565b61030061039736600461290e565b610a0a565b610300610a2c565b6103006103b2366004612702565b610a7e565b6102e06103c53660046128f6565b610a99565b6102a26103d83660046126b6565b610af5565b61031d6103eb3660046128f6565b610b37565b61031d6103fe3660046128f6565b610b93565b610300610411366004612989565b610bee565b6102a26104243660046126b6565b610c23565b6102a2610c3c565b6102e061043f3660046128f6565b610c45565b61031d610c7a565b6102a261045a3660046126b6565b610c8c565b61031d61046d3660046126b6565b610cf4565b61031d610d38565b610300610d4a565b6102e0610490366004612930565b610d9a565b6102a26104a336600461290e565b610db2565b6102c0610ddb565b61031d610dea565b6103006104c6366004612809565b610def565b6103006104d936600461286c565b610ebd565b61031d610f24565b6103006104f436600461273d565b610f5a565b61050c6105073660046128f6565b610f99565b6040516102af93929190612d08565b6102c06105293660046128f6565b611153565b61031d61053c3660046128f6565b6111d5565b61030061054f3660046129bd565b6111ec565b610300610562366004612a53565b6112ff565b61030061057536600461290e565b611410565b6102c061141a565b61031d6114a8565b6102a26105983660046126b6565b6114cc565b6102a26105ab3660046126d0565b611534565b61031d6105be3660046128f6565b611562565b60006105ce826115d3565b90505b919050565b6060600380546105e5906135fa565b80601f0160208091040260200160405190810160405280929190818152602001828054610611906135fa565b801561065e5780601f106106335761010080835404028352916020019161065e565b820191906000526020600020905b81548152906001019060200180831161064157829003601f168201915b505050505090505b90565b6000610674826115f8565b6106995760405162461bcd60e51b81526004016106909061321d565b60405180910390fd5b506000908152600760205260409020546001600160a01b031690565b60006106c082610c45565b9050806001600160a01b0316836001600160a01b031614156106f45760405162461bcd60e51b8152600401610690906132fc565b806001600160a01b0316610706611615565b6001600160a01b031614806107225750610722816105ab611615565b61073e5760405162461bcd60e51b8152600401610690906130c1565b610748838361161f565b505050565b600061075b816104a3611615565b6107775760405162461bcd60e51b815260040161069090613425565b61078f6000805160206136e083398151915283611410565b506001919050565b600b5490565b60006107a7610c3c565b156107c45760405162461bcd60e51b815260040161069090613097565b816107cf600d61168d565b116107ec5760405162461bcd60e51b815260040161069090612de6565b610886600f838154811061081057634e487b7160e01b600052603260045260246000fd5b9060005260206000200154610823611615565b6040516020016108339190612b49565b604051602081830303815290604052805190602001208686808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509294939250506116919050565b6108a25760405162461bcd60e51b815260040161069090612e2b565b60006108b56108af611615565b8461174c565b905060016011600085815260200190815260200160002060008282546108db9190613555565b909155506108f290506108ec611615565b8261177e565b61090e5760405162461bcd60e51b81526004016106909061311e565b604051839082907f04c63a7e9b06ee8caac5113b74753a2f77a920260734c3003531843116b445a290600090a3506001949350505050565b610957610951611615565b82611793565b6109735760405162461bcd60e51b81526004016106909061333d565b610748838383611818565b60009081526020819052604090206001015490565b61099d8282611830565b6000828152600160205260409020610748908261158c565b60006109c083610cf4565b82106109de5760405162461bcd60e51b815260040161069090612e70565b506001600160a01b03821660009081526009602090815260408083208484529091529020545b92915050565b610a148282611854565b60008281526001602052604090206107489082611896565b610a587f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a6104a3611615565b610a745760405162461bcd60e51b815260040161069090613471565b610a7c6118ab565b565b61074883838360405180602001604052806000815250610f5a565b6000610aa3610c3c565b15610ac05760405162461bcd60e51b815260040161069090613097565b610ac9826115f8565b610ae55760405162461bcd60e51b815260040161069090612f50565b610aee82611919565b5092915050565b6000610b03816104a3611615565b610b1f5760405162461bcd60e51b815260040161069090613425565b61078f6000805160206136c083398151915283611410565b6000610b41610c3c565b15610b5e5760405162461bcd60e51b815260040161069090613097565b610b67826115f8565b610b835760405162461bcd60e51b815260040161069090612f50565b610b8c82611919565b9392505050565b6000610b9d610797565b8210610bbb5760405162461bcd60e51b81526004016106909061338e565b600b8281548110610bdc57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b610bfb60006104a3611615565b610c175760405162461bcd60e51b815260040161069090613425565b610748600e8383612543565b60025461010090046001600160a01b0390811691161490565b60025460ff1690565b6000818152600560205260408120546001600160a01b0316806105ce5760405162461bcd60e51b81526004016106909061319f565b6000805160206136c083398151915281565b6000610c9a816104a3611615565b610cb65760405162461bcd60e51b815260040161069090613425565b6001600160a01b038216610cdc5760405162461bcd60e51b8152600401610690906134be565b61078f6000805160206136e083398151915283610993565b60006001600160a01b038216610d1c5760405162461bcd60e51b815260040161069090613155565b506001600160a01b031660009081526006602052604090205490565b6000805160206136e083398151915281565b610d767f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a6104a3611615565b610d925760405162461bcd60e51b8152600401610690906133da565b610a7c611932565b6000828152600160205260408120610b8c908361198d565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600480546105e5906135fa565b600081565b610df7611615565b6001600160a01b0316826001600160a01b03161415610e285760405162461bcd60e51b815260040161069090612fc9565b8060086000610e35611615565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155610e79611615565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610eb19190612c98565b60405180910390a35050565b610ec5610c3c565b15610ee25760405162461bcd60e51b815260040161069090613097565b610efc6000805160206136e08339815191526104a3611615565b610f185760405162461bcd60e51b815260040161069090612f0d565b610748600f83836125c7565b6000610f2e610c3c565b15610f4b5760405162461bcd60e51b815260040161069090613097565b610f55600d61168d565b905090565b610f6b610f65611615565b83611793565b610f875760405162461bcd60e51b81526004016106909061333d565b610f9384848484611999565b50505050565b601060205260009081526040902080548190610fb4906135fa565b80601f0160208091040260200160405190810160405280929190818152602001828054610fe0906135fa565b801561102d5780601f106110025761010080835404028352916020019161102d565b820191906000526020600020905b81548152906001019060200180831161101057829003601f168201915b505050505090806001018054611042906135fa565b80601f016020809104026020016040519081016040528092919081815260200182805461106e906135fa565b80156110bb5780601f10611090576101008083540402835291602001916110bb565b820191906000526020600020905b81548152906001019060200180831161109e57829003601f168201915b5050505050908060020180546110d0906135fa565b80601f01602080910402602001604051908101604052809291908181526020018280546110fc906135fa565b80156111495780601f1061111e57610100808354040283529160200191611149565b820191906000526020600020905b81548152906001019060200180831161112c57829003601f168201915b5050505050905083565b606061115e826115f8565b61117a5760405162461bcd60e51b815260040161069090613269565b60006111846119cc565b905060008151116111a45760405180602001604052806000815250610b8c565b806111ae846119db565b6040516020016111bf929190612ba3565b6040516020818303038152906040529392505050565b60008181526001602052604081206105ce90611af6565b6111f4610c3c565b156112115760405162461bcd60e51b815260040161069090613097565b61122b6000805160206136c08339815191526104a3611615565b6112475760405162461bcd60e51b81526004016106909061304c565b6000611253600d61168d565b600081815260106020526040902090915061126f908888612543565b50600081815260106020526040902061128c906001018686612543565b5060008181526010602052604090206112a9906002018484612543565b506112b4600d611b01565b807f335347d3c0abbe88e13ee17ff9db9ff2aabea3e099f1ffd10807e9c7f9cf82ad8888888888886040516112ee96959493929190612cac565b60405180910390a250505050505050565b611307610c3c565b156113245760405162461bcd60e51b815260040161069090613097565b61133e6000805160206136c08339815191526104a3611615565b61135a5760405162461bcd60e51b81526004016106909061304c565b86611365600d61168d565b116113825760405162461bcd60e51b815260040161069090612de6565b600087815260106020526040902061139b908787612543565b5060008781526010602052604090206113b8906001018585612543565b5060008781526010602052604090206113d5906002018383612543565b50867fcfea559888b71c63137ce2f6354ae40661672d1ea2d56b2db88cdd200ff42b738787878787876040516112ee96959493929190612cac565b610a148282611b0a565b600e8054611427906135fa565b80601f0160208091040260200160405190810160405280929190818152602001828054611453906135fa565b80156114a05780601f10611475576101008083540402835291602001916114a0565b820191906000526020600020905b81548152906001019060200180831161148357829003601f168201915b505050505081565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b60006114da816104a3611615565b6114f65760405162461bcd60e51b815260040161069090613425565b6001600160a01b03821661151c5760405162461bcd60e51b8152600401610690906134be565b61078f6000805160206136c083398151915283610993565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b60116020526000908152604090205481565b6000610f556115a1565b6115888282611b29565b5050565b6000610b8c836001600160a01b038416611bae565b60006115ac33610c23565b156115c0575060131936013560601c610666565b6115c86115cf565b9050610666565b3390565b60006001600160e01b0319821663780e9d6360e01b14806105ce57506105ce82611bf8565b6000908152600560205260409020546001600160a01b0316151590565b6000610f55611574565b600081815260076020526040902080546001600160a01b0319166001600160a01b038416908117909155819061165482610c45565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b5490565b600081815b85518110156117415760008682815181106116c157634e487b7160e01b600052603260045260246000fd5b602002602001015190508083116117025782816040516020016116e5929190612b95565b60405160208183030381529060405280519060200120925061172e565b8083604051602001611715929190612b95565b6040516020818303038152906040528051906020012092505b508061173981613635565b915050611696565b509092149392505050565b6000808383604051602001611762929190612b66565b60408051601f1981840301815291905260200151949350505050565b600061178a8383611c38565b50600192915050565b600061179e826115f8565b6117ba5760405162461bcd60e51b815260040161069090613000565b60006117c583610c45565b9050806001600160a01b0316846001600160a01b031614806118005750836001600160a01b03166117f584610669565b6001600160a01b0316145b8061181057506118108185611534565b949350505050565b60405162461bcd60e51b8152600401610690906132b8565b6118398261097e565b61184a81611845611615565b611d17565b6107488383611b29565b61185c611615565b6001600160a01b0316816001600160a01b03161461188c5760405162461bcd60e51b815260040161069090613506565b6115888282611d7b565b6000610b8c836001600160a01b038416611dfe565b6118b3610c3c565b6118cf5760405162461bcd60e51b815260040161069090612db8565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611902611615565b60405161190f9190612c47565b60405180910390a1565b606081901c916bffffffffffffffffffffffff90911690565b61193a610c3c565b156119575760405162461bcd60e51b815260040161069090613097565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611902611615565b6000610b8c8383611f15565b6119a4848484611818565b6119b084848484611f6e565b610f935760405162461bcd60e51b815260040161069090612ebb565b6060600e80546105e5906135fa565b606081611a0057506040805180820190915260018152600360fc1b60208201526105d1565b8160005b8115611a2a5780611a1481613635565b9150611a239050600a8361356d565b9150611a04565b60008167ffffffffffffffff811115611a5357634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611a7d576020820181803683370190505b5090505b841561181057611a926001836135a0565b9150611a9f600a86613650565b611aaa906030613555565b60f81b818381518110611acd57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350611aef600a8661356d565b9450611a81565b60006105ce8261168d565b80546001019055565b611b138261097e565b611b1f81611845611615565b6107488383611d7b565b611b338282610db2565b611588576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611b6a611615565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611bba8383612089565b611bf057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a04565b506000610a04565b60006001600160e01b031982166380ac58cd60e01b1480611c2957506001600160e01b03198216635b5e139f60e01b145b806105ce57506105ce826120a1565b6001600160a01b038216611c5e5760405162461bcd60e51b8152600401610690906131e8565b611c67816115f8565b15611c845760405162461bcd60e51b815260040161069090612f92565b611c90600083836120c6565b6001600160a01b0382166000908152600660205260408120805460019290611cb9908490613555565b909155505060008181526005602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b611d218282610db2565b61158857611d39816001600160a01b0316601461214f565b611d4483602061214f565b604051602001611d55929190612bd2565b60408051601f198184030181529082905262461bcd60e51b825261069091600401612cf5565b611d858282610db2565b15611588576000828152602081815260408083206001600160a01b03851684529091529020805460ff19169055611dba611615565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60008181526001830160205260408120548015611f0b576000611e226001836135a0565b8554909150600090611e36906001906135a0565b90506000866000018281548110611e5d57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080876000018481548110611e8e57634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260018901909152604090208490558654879080611ecf57634e487b7160e01b600052603160045260246000fd5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610a04565b6000915050610a04565b81546000908210611f385760405162461bcd60e51b815260040161069090612d41565b826000018281548110611f5b57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6000611f82846001600160a01b0316612301565b1561207e57836001600160a01b031663150b7a02611f9e611615565b8786866040518563ffffffff1660e01b8152600401611fc09493929190612c5b565b602060405180830381600087803b158015611fda57600080fd5b505af192505050801561200a575060408051601f3d908101601f191682019092526120079181019061296d565b60015b612064573d808015612038576040519150601f19603f3d011682016040523d82523d6000602084013e61203d565b606091505b50805161205c5760405162461bcd60e51b815260040161069090612ebb565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611810565b506001949350505050565b60009081526001919091016020526040902054151590565b60006001600160e01b03198216635a05180f60e01b14806105ce57506105ce82612307565b6120d1838383610748565b6001600160a01b0383166120ed576120e88161232c565b612110565b816001600160a01b0316836001600160a01b031614612110576121108382612370565b6001600160a01b03821661212c576121278161240d565b610748565b826001600160a01b0316826001600160a01b0316146107485761074882826124e6565b6060600061215e836002613581565b612169906002613555565b67ffffffffffffffff81111561218f57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156121b9576020820181803683370190505b509050600360fc1b816000815181106121e257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061221f57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000612243846002613581565b61224e906001613555565b90505b60018111156122e2576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061229057634e487b7160e01b600052603260045260246000fd5b1a60f81b8282815181106122b457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c936122db816135e3565b9050612251565b508315610b8c5760405162461bcd60e51b815260040161069090612d83565b3b151590565b60006001600160e01b03198216637965db0b60e01b14806105ce57506105ce8261252a565b600b80546000838152600c60205260408120829055600182018355919091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90155565b6000600161237d84610cf4565b61238791906135a0565b6000838152600a60205260409020549091508082146123da576001600160a01b03841660009081526009602090815260408083208584528252808320548484528184208190558352600a90915290208190555b506000918252600a602090815260408084208490556001600160a01b039094168352600981528383209183525290812055565b600b5460009061241f906001906135a0565b6000838152600c6020526040812054600b805493945090928490811061245557634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080600b838154811061248457634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152600c9091526040808220849055858252812055600b8054806124ca57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b60006124f183610cf4565b6001600160a01b0390931660009081526009602090815260408083208684528252808320859055938252600a9052919091209190915550565b6001600160e01b031981166301ffc9a760e01b14919050565b82805461254f906135fa565b90600052602060002090601f01602090048101928261257157600085556125b7565b82601f1061258a5782800160ff198235161785556125b7565b828001600101855582156125b7579182015b828111156125b757823582559160200191906001019061259c565b506125c3929150612601565b5090565b8280548282559060005260206000209081019282156125b757916020028201828111156125b757823582559160200191906001019061259c565b5b808211156125c35760008155600101612602565b80356001600160a01b03811681146105d157600080fd5b60008083601f84011261263e578081fd5b50813567ffffffffffffffff811115612655578182fd5b602083019150836020808302850101111561266f57600080fd5b9250929050565b60008083601f840112612687578182fd5b50813567ffffffffffffffff81111561269e578182fd5b60208301915083602082850101111561266f57600080fd5b6000602082840312156126c7578081fd5b610b8c82612616565b600080604083850312156126e2578081fd5b6126eb83612616565b91506126f960208401612616565b90509250929050565b600080600060608486031215612716578081fd5b61271f84612616565b925061272d60208501612616565b9150604084013590509250925092565b60008060008060808587031215612752578081fd5b61275b85612616565b9350602061276a818701612616565b935060408601359250606086013567ffffffffffffffff8082111561278d578384fd5b818801915088601f8301126127a0578384fd5b8135818111156127b2576127b2613690565b604051601f8201601f19168101850183811182821017156127d5576127d5613690565b60405281815283820185018b10156127eb578586fd5b81858501868301379081019093019390935250939692955090935050565b6000806040838503121561281b578182fd5b61282483612616565b915060208301358015158114612838578182fd5b809150509250929050565b60008060408385031215612855578182fd5b61285e83612616565b946020939093013593505050565b6000806020838503121561287e578182fd5b823567ffffffffffffffff811115612894578283fd5b6128a08582860161262d565b90969095509350505050565b6000806000604084860312156128c0578283fd5b833567ffffffffffffffff8111156128d6578384fd5b6128e28682870161262d565b909790965060209590950135949350505050565b600060208284031215612907578081fd5b5035919050565b60008060408385031215612920578182fd5b823591506126f960208401612616565b60008060408385031215612942578182fd5b50508035926020909101359150565b600060208284031215612962578081fd5b8135610b8c816136a6565b60006020828403121561297e578081fd5b8151610b8c816136a6565b6000806020838503121561299b578182fd5b823567ffffffffffffffff8111156129b1578283fd5b6128a085828601612676565b600080600080600080606087890312156129d5578384fd5b863567ffffffffffffffff808211156129ec578586fd5b6129f88a838b01612676565b90985096506020890135915080821115612a10578586fd5b612a1c8a838b01612676565b90965094506040890135915080821115612a34578384fd5b50612a4189828a01612676565b979a9699509497509295939492505050565b60008060008060008060006080888a031215612a6d578485fd5b87359650602088013567ffffffffffffffff80821115612a8b578687fd5b612a978b838c01612676565b909850965060408a0135915080821115612aaf578283fd5b612abb8b838c01612676565b909650945060608a0135915080821115612ad3578283fd5b50612ae08a828b01612676565b989b979a50959850939692959293505050565b60008151808452612b0b8160208601602086016135b7565b601f01601f19169290920160200192915050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60609290921b6bffffffffffffffffffffffff1916825260a01b6001600160a01b031916601482015260200190565b918252602082015260400190565b60008351612bb58184602088016135b7565b835190830190612bc98183602088016135b7565b01949350505050565b60007f416363657373436f6e74726f6c3a206163636f756e742000000000000000000082528351612c0a8160178501602088016135b7565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612c3b8160288401602088016135b7565b01602801949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612c8e90830184612af3565b9695505050505050565b901515815260200190565b90815260200190565b600060608252612cc060608301888a612b1f565b8281036020840152612cd3818789612b1f565b90508281036040840152612ce8818587612b1f565b9998505050505050505050565b600060208252610b8c6020830184612af3565b600060608252612d1b6060830186612af3565b8281036020840152612d2d8186612af3565b90508281036040840152612c8e8185612af3565b60208082526022908201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604082015261647360f01b606082015260800190565b6020808252818101527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604082015260600190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b60208082526025908201527f4d616b65724261646765733a206e6f2074656d706c6174652077697468207468604082015264185d081a5960da1b606082015260800190565b60208082526025908201527f4d616b65724261646765733a2063616c6c6572206973206e6f7420612072656460408201526432b2b6b2b960d91b606082015260800190565b6020808252602b908201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560408201526a74206f6620626f756e647360a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526023908201527f4d616b65724261646765733a2063616c6c6572206973206e6f7420616e20616460408201526236b4b760e91b606082015260800190565b60208082526022908201527f4d616b65724261646765733a206e6f20746f6b656e20776974682074686174206040820152611a5960f21b606082015260800190565b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604082015260600190565b60208082526019908201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604082015260600190565b6020808252602c908201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252602b908201527f4d616b65724261646765733a2063616c6c6572206973206e6f7420612074656d60408201526a383630ba329037bbb732b960a91b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526038908201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760408201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606082015260800190565b6020808252601d908201527f4d616b65724261646765733a206261646765206e6f74206d696e746564000000604082015260600190565b6020808252602a908201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604082015269726f206164647265737360b01b606082015260800190565b60208082526029908201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460408201526832b73a103a37b5b2b760b91b606082015260800190565b6020808252818101527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252602f908201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60408201526e3732bc34b9ba32b73a103a37b5b2b760891b606082015260800190565b60208082526024908201527f4d616b65724261646765733a206261646765207472616e736665722064697361604082015263189b195960e21b606082015260800190565b60208082526021908201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656040820152603960f91b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602c908201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60408201526b7574206f6620626f756e647360a01b606082015260800190565b6020808252602b908201527f4d616b65724261646765733a206d75737420686176652070617573657220726f60408201526a6c6520746f20706175736560a81b606082015260800190565b6020808252602c908201527f4d616b65724261646765733a2063616c6c6572206973206e6f7420746865206460408201526b32b330bab63a1030b236b4b760a11b606082015260800190565b6020808252602d908201527f4d616b65724261646765733a206d75737420686176652070617573657220726f60408201526c6c6520746f20756e706175736560981b606082015260800190565b60208082526028908201527f4d616b65724261646765733a206163636f756e7420697320746865207a65726f604082015267206164647265737360c01b606082015260800190565b6020808252602f908201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560408201526e103937b632b9903337b91039b2b63360891b606082015260800190565b6000821982111561356857613568613664565b500190565b60008261357c5761357c61367a565b500490565b600081600019048311821515161561359b5761359b613664565b500290565b6000828210156135b2576135b2613664565b500390565b60005b838110156135d25781810151838201526020016135ba565b83811115610f935750506000910152565b6000816135f2576135f2613664565b506000190190565b60028104600182168061360e57607f821691505b6020821081141561362f57634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561364957613649613664565b5060010190565b60008261365f5761365f61367a565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b0319811681146136bc57600080fd5b5056fe82fc59a2af283c7e52e3f7cf8d269383062c6603a1ab4300e32135abe128a476a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a2646970667358221220e573581fdb2006cc64ff5389a7946d05d34dbc0aeebd8188f62c27e4b1373bc264736f6c63430008000033