Address Details
contract

0x03B156d52dd98Ab56e9b6ddC7573E51128607750

Contract Name
MicrocreditImplementation
Creator
0xa34737–43edab at 0x2b26fd–5832bc
Balance
0 CELO ( )
Locked CELO Balance
0.00 CELO
Voting CELO Balance
0.00 CELO
Pending Unlocked Gold
0.00 CELO
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
17760251
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
MicrocreditImplementation




Optimization enabled
true
Compiler version
v0.8.4+commit.c7e474f2




Optimization runs
200
EVM Version
istanbul




Verified at
2023-05-09T14:52:30.909620Z

contracts/microcredit/MicrocreditImplementation.sol

//SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.4;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "./interfaces/MicrocreditStorageV1.sol";

contract MicrocreditImplementation is
    Initializable,
    OwnableUpgradeable,
    PausableUpgradeable,
    ReentrancyGuardUpgradeable,
    MicrocreditStorageV1
{
    using SafeERC20Upgradeable for IERC20;
    using EnumerableSet for EnumerableSet.AddressSet;

    event ManagerAdded(address indexed managerAddress);

    event ManagerRemoved(address indexed managerAddress);

    event LoanAdded(
        address indexed userAddress,
        uint256 loanId,
        uint256 amount,
        uint256 period,
        uint256 dailyInterest,
        uint256 claimDeadline
    );

    event LoanCanceled(address indexed userAddress, uint256 loanId);

    event UserAddressChanged(address indexed oldWalletAddress, address indexed newWalletAddress);

    event LoanClaimed(address indexed userAddress, uint256 loanId);

    event RepaymentAdded(
        address indexed userAddress,
        uint256 loanId,
        uint256 repaymentAmount,
        uint256 currentDebt
    );

    modifier onlyManagers() {
        require(_managerList.contains(msg.sender), "Microcredit: caller is not a manager");
        _;
    }

    /**
     * @notice Used to initialize the Microcredit contract
     *
     * @param _cUSDAddress      The address of the cUSD token
     * @param _revenueAddress   The address that collects all the interest
     */
    function initialize(address _cUSDAddress, address _revenueAddress) public initializer {
        __Ownable_init();
        __Pausable_init();
        __ReentrancyGuard_init();

        cUSD = IERC20(_cUSDAddress);
        revenueAddress = _revenueAddress;
    }

    /**
     * @notice Returns the current implementation version
     */
    function getVersion() external pure override returns (uint256) {
        return 1;
    }

    /**
     * @notice Returns the information of a user
     *
     * @param _userAddress           address of the user
     * @return userId                the userId
     * @return movedTo               the number of the user's loans
     * @return loansLength           the number of the user's loans
     */
    function walletMetadata(address _userAddress)
        external
        view
        override
        returns (
            uint256 userId,
            address movedTo,
            uint256 loansLength
        )
    {
        WalletMetadata memory _metadata = _walletMetadata[_userAddress];

        userId = _metadata.userId;
        movedTo = _metadata.movedTo;
        loansLength = _users[_metadata.userId].loans.length;
    }

    /**
     * @notice Returns the length of the walletList
     */
    function walletListLength() external view override returns (uint256) {
        return _walletList.length();
    }

    /**
     * @notice Returns an address from the walletList
     *
     * @param _index index value
     * @return address of the user
     */
    function walletListAt(uint256 _index) external view override returns (address) {
        return _walletList.at(_index);
    }

    /**
     * @notice Returns an address from the managerList
     *
     * @param _index index value
     * @return address of the manager
     */
    function managerListAt(uint256 _index) external view override returns (address) {
        return _managerList.at(_index);
    }

    /**
     * @notice Returns the length of the managerList
     */
    function managerListLength() external view override returns (uint256) {
        return _managerList.length();
    }

    function userLoans(address _userAddress, uint256 _loanId)
        external
        view
        override
        returns (
            uint256 amountBorrowed,
            uint256 period,
            uint256 dailyInterest,
            uint256 claimDeadline,
            uint256 startDate,
            uint256 currentDebt,
            uint256 lastComputedDebt,
            uint256 amountRepayed,
            uint256 repaymentsLength,
            uint256 lastComputedDate
        )
    {
        _checkUserLoan(_userAddress, _loanId);

        WalletMetadata memory _metadata = _walletMetadata[_userAddress];
        User memory _user = _users[_metadata.userId];
        Loan memory _loan = _user.loans[_loanId];

        amountBorrowed = _loan.amountBorrowed;
        period = _loan.period;
        dailyInterest = _loan.dailyInterest;
        claimDeadline = _loan.claimDeadline;
        startDate = _loan.startDate;
        lastComputedDebt = _loan.lastComputedDebt;
        currentDebt = _calculateCurrentDebt(_loan);
        amountRepayed = _loan.amountRepayed;
        repaymentsLength = _loan.repayments.length;
        lastComputedDate = _loan.lastComputedDate;
    }

    function userLoanRepayments(
        address _userAddress,
        uint256 _loanId,
        uint256 _repaymentId
    ) external view override returns (uint256 date, uint256 amount) {
        _checkUserLoan(_userAddress, _loanId);

        WalletMetadata memory _metadata = _walletMetadata[_userAddress];
        User memory _user = _users[_metadata.userId];
        Loan memory _loan = _user.loans[_loanId];

        require(_loan.repayments.length > _repaymentId, "Microcredit: Repayment doesn't exist");

        date = _loan.repayments[_repaymentId].date;
        amount = _loan.repayments[_repaymentId].amount;
    }

    function updateRevenueAddress(address _newRevenueAddress) external override onlyOwner {
        revenueAddress = _newRevenueAddress;
    }

    function addManagers(address[] calldata _managerAddresses) external override onlyOwner {
        uint256 _length = _managerAddresses.length;
        uint256 _index;

        for (_index = 0; _index < _length; _index++) {
            _managerList.add(_managerAddresses[_index]);
            emit ManagerAdded(_managerAddresses[_index]);
        }
    }

    function removeManagers(address[] calldata _managerAddresses) external override onlyOwner {
        uint256 _length = _managerAddresses.length;
        uint256 _index;

        for (_index = 0; _index < _length; _index++) {
            _managerList.remove(_managerAddresses[_index]);
            emit ManagerRemoved(_managerAddresses[_index]);
        }
    }

    function addLoan(
        address _userAddress,
        uint256 _amount,
        uint256 _period,
        uint256 _dailyInterest,
        uint256 _claimDeadline
    ) external override onlyManagers {
        _addLoan(_userAddress, _amount, _period, _dailyInterest, _claimDeadline);
    }

    function addLoans(
        address[] calldata _userAddresses,
        uint256[] calldata _amounts,
        uint256[] calldata _periods,
        uint256[] calldata _dailyInterests,
        uint256[] calldata _claimDeadlines
    ) external override onlyManagers {
        uint256 _loansNumber = _userAddresses.length;
        require(
            _loansNumber == _amounts.length,
            "Microcredit: calldata information arity mismatch"
        );
        require(
            _loansNumber == _periods.length,
            "Microcredit: calldata information arity mismatch"
        );
        require(
            _loansNumber == _dailyInterests.length,
            "Microcredit: calldata information arity mismatch"
        );
        require(
            _loansNumber == _claimDeadlines.length,
            "Microcredit: calldata information arity mismatch"
        );

        uint256 _index;

        for (_index = 0; _index < _loansNumber; _index++) {
            _addLoan(
                _userAddresses[_index],
                _amounts[_index],
                _periods[_index],
                _dailyInterests[_index],
                _claimDeadlines[_index]
            );
        }
    }

    function cancelLoans(address[] calldata _userAddresses, uint256[] calldata _loansIds)
        external
        override
        onlyManagers
    {
        require(
            _userAddresses.length == _loansIds.length,
            "Microcredit: calldata information arity mismatch"
        );

        uint256 _index;

        for (_index = 0; _index < _userAddresses.length; _index++) {
            _cancelLoan(_userAddresses[_index], _loansIds[_index]);
        }
    }

    function changeUserAddress(address _oldWalletAddress, address _newWalletAddress)
        external
        override
        onlyManagers
    {
        WalletMetadata storage _oldWalletMetadata = _walletMetadata[_oldWalletAddress];
        require(
            _oldWalletMetadata.userId > 0 && _oldWalletMetadata.movedTo == address(0),
            "Microcredit: This user cannot be moved"
        );

        WalletMetadata storage _newWalletMetadata = _walletMetadata[_newWalletAddress];
        require(_newWalletMetadata.userId == 0, "Microcredit: Target wallet address is invalid");

        _oldWalletMetadata.movedTo = _newWalletAddress;
        _newWalletMetadata.userId = _oldWalletMetadata.userId;

        _walletList.add(_newWalletAddress);

        emit UserAddressChanged(_oldWalletAddress, _newWalletAddress);
    }

    function claimLoan(uint256 _loanId) external override nonReentrant {
        _checkUserLoan(msg.sender, _loanId);

        WalletMetadata memory _metadata = _walletMetadata[msg.sender];
        User storage _user = _users[_metadata.userId];
        Loan storage _loan = _user.loans[_loanId];

        require(_loan.startDate == 0, "Microcredit: Loan already claimed");
        require(_loan.claimDeadline != 0, "Microcredit: Loan canceled");
        require(_loan.claimDeadline >= block.timestamp, "Microcredit: Loan expired");

        _loan.startDate = block.timestamp;

        _loan.lastComputedDebt = (_loan.amountBorrowed * (1e18 + _loan.dailyInterest / 100)) / 1e18;
        _loan.lastComputedDate = block.timestamp;

        cUSD.safeTransfer(msg.sender, _loan.amountBorrowed);

        emit LoanClaimed(msg.sender, _loanId);
    }

    function repayLoan(uint256 _loanId, uint256 _repaymentAmount) external override nonReentrant {
        require(_repaymentAmount > 0, "Microcredit: Invalid amount");

        _checkUserLoan(msg.sender, _loanId);

        WalletMetadata memory _metadata = _walletMetadata[msg.sender];
        User storage _user = _users[_metadata.userId];
        Loan storage _loan = _user.loans[_loanId];

        require(_loan.startDate > 0, "Microcredit: Loan not claimed");
        require(_loan.lastComputedDebt > 0, "Microcredit: Loan has already been fully repayed");

        uint256 _currentDebt = _calculateCurrentDebt(_loan);

        if (_currentDebt < _repaymentAmount) {
            _repaymentAmount = _currentDebt;
        }

        uint256 _revenueAmount;
        uint256 _loanAmount;

        if (
            _loan.amountRepayed + _repaymentAmount <= _loan.amountBorrowed ||
            revenueAddress == address(0)
        ) {
            //all repaymentAmount should go to microcredit address
            cUSD.safeTransferFrom(msg.sender, address(this), _repaymentAmount);
        } else if (_loan.amountRepayed >= _loan.amountBorrowed) {
            //all repaymentAmount should go to revenue address
            cUSD.safeTransferFrom(msg.sender, revenueAddress, _repaymentAmount);
        } else {
            //a part of the repayment should go to microcredit address and the rest should go to the revenue address
            uint256 _loanDiff = _loan.amountBorrowed - _loan.amountRepayed;
            cUSD.safeTransferFrom(msg.sender, address(this), _loanDiff);
            cUSD.safeTransferFrom(msg.sender, revenueAddress, _repaymentAmount - _loanDiff);
        }

        Repayment storage _repayment = _loan.repayments.push();
        _repayment.date = block.timestamp;
        _repayment.amount = _repaymentAmount;

        _loan.lastComputedDebt = _currentDebt - _repaymentAmount;
        _loan.amountRepayed += _repaymentAmount;

        uint256 _days = (block.timestamp - _loan.lastComputedDate) / 86400; //86400 = 1 day in seconds

        _loan.lastComputedDate = _loan.lastComputedDate + _days * 86400;

        emit RepaymentAdded(msg.sender, _loanId, _repaymentAmount, _loan.lastComputedDebt);
    }

    /**
     * @notice Transfers an amount of an ERC20 from this contract to an address
     *
     * @param _token address of the ERC20 token
     * @param _to address of the receiver
     * @param _amount amount of the transaction
     */
    function transferERC20(
        IERC20 _token,
        address _to,
        uint256 _amount
    ) external override nonReentrant onlyOwner {
        _token.safeTransfer(_to, _amount);
    }

    function _checkUserLoan(address _userAddress, uint256 _loanId) internal view {
        WalletMetadata memory _metadata = _walletMetadata[_userAddress];

        require(
            _metadata.userId > 0 && _metadata.movedTo == address(0),
            "Microcredit: Invalid wallet address"
        );

        User memory _user = _users[_metadata.userId];

        require(_user.loans.length > _loanId, "Microcredit: Loan doesn't exist");
    }

    function _calculateCurrentDebt(Loan memory _loan) internal view returns (uint256) {
        if (_loan.lastComputedDebt == 0) {
            return 0;
        }

        uint256 _days = (block.timestamp - _loan.lastComputedDate) / 86400; //86400 = 1 day in seconds

        uint256 _currentDebt = _loan.lastComputedDebt;

        while (_days > 0) {
            _currentDebt = (_currentDebt * (1e18 + _loan.dailyInterest / 100)) / 1e18;
            _days--;
        }

        return _currentDebt;
    }

    function _addLoan(
        address _userAddress,
        uint256 _amount,
        uint256 _period,
        uint256 _dailyInterest,
        uint256 _claimDeadline
    ) internal {
        require(_claimDeadline > block.timestamp, "Microcredit: invalid claimDeadline");

        WalletMetadata storage _metadata = _walletMetadata[_userAddress];
        require(_metadata.movedTo == address(0), "Microcredit: The user has been moved");

        if (_metadata.userId == 0) {
            _usersLength++;
            _metadata.userId = _usersLength;
            _walletList.add(_userAddress);
        }

        User storage _user = _users[_metadata.userId];

        uint256 _loansLength = _user.loans.length;

        if (_loansLength > 0) {
            Loan memory _previousLoan = _user.loans[_loansLength - 1];
            require(
                (_previousLoan.startDate > 0 && _previousLoan.lastComputedDebt == 0) || // loan claimed and fully paid
                    (_previousLoan.startDate == 0 &&
                        _previousLoan.claimDeadline < block.timestamp) || //loan unclaimed and expired
                    (_previousLoan.claimDeadline == 0), //loan canceled
                "Microcredit: The user already has an active loan"
            );
        }

        Loan storage _loan = _user.loans.push();

        _loan.amountBorrowed = _amount;
        _loan.period = _period;
        _loan.dailyInterest = _dailyInterest;
        _loan.claimDeadline = _claimDeadline;

        emit LoanAdded(
            _userAddress,
            _user.loans.length - 1,
            _amount,
            _period,
            _dailyInterest,
            _claimDeadline
        );
    }

    function _cancelLoan(address _userAddress, uint256 _loanId) internal {
        _checkUserLoan(_userAddress, _loanId);

        WalletMetadata memory _metadata = _walletMetadata[_userAddress];
        User storage _user = _users[_metadata.userId];
        Loan storage _loan = _user.loans[_loanId];

        require(_loan.startDate == 0, "Microcredit: Loan already claimed");
        require(_loan.claimDeadline != 0, "Microcredit: Loan already canceled");

        _loan.claimDeadline = 0; //set claimDeadline to 0 to prevent claiming (cancel the loan)

        emit LoanCanceled(_userAddress, _loanId);
    }
}
        

/_openzeppelin/contracts/utils/structs/EnumerableSet.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

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;

            if (lastIndex != toDeleteIndex) {
                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) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}
          

/_openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

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

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

/_openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}
          

/_openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @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.
     */
    function __Pausable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _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());
    }
    uint256[49] private __gap;
}
          

/_openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol

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

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

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

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

/_openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}
          

/_openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../../../utils/AddressUpgradeable.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20Upgradeable {
    using AddressUpgradeable for address;

    function safeTransfer(
        IERC20Upgradeable token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20Upgradeable token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
          

/_openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    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;
        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");

        (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");

        (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");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
          

/_openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol

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

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}
          

/contracts/microcredit/interfaces/IMicrocredit.sol

//SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.4;

import {IERC20Upgradeable as IERC20} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

interface IMicrocredit {
    struct WalletMetadata {
        uint256 userId;
        address movedTo;
    }

    struct User {
        Loan[] loans;
    }

    struct Repayment {
        uint256 date;
        uint256 amount;
    }

    struct Loan {
        uint256 amountBorrowed;
        uint256 period;                   // the number of seconds after a loan should be fully repaid
        uint256 dailyInterest;
        uint256 claimDeadline;
        uint256 startDate;                // the timestamp the user claimed the amountBorrowed
        uint256 lastComputedDebt;
        uint256 amountRepayed;
        Repayment[] repayments;
        uint256 lastComputedDate;
    }

    function getVersion() external pure returns(uint256);
    function cUSD() external view returns(IERC20);
    function revenueAddress() external view returns(address);
    function walletMetadata(address userAddress)
        external view returns(uint256 userId, address movedTo, uint256 loansLength);
    function userLoans(address userAddress, uint256 loanId) external view returns(
        uint256 amountBorrowed,
        uint256 period,
        uint256 dailyInterest,
        uint256 claimDeadline,
        uint256 startDate,
        uint256 lastComputedDebt,
        uint256 currentDebt,
        uint256 amountRepayed,
        uint256 repaymentsLength,
        uint256 lastComputedDate
    );
    function userLoanRepayments(address userAddress, uint256 loanId, uint256 repaymentId)
        external view returns( uint256 date, uint256 amount);
    function walletListAt(uint256 index) external view returns (address);
    function walletListLength() external view returns (uint256);
    function managerListAt(uint256 index) external view returns (address);
    function managerListLength() external view returns (uint256);
    function updateRevenueAddress(address newRevenueAddress) external;
    function addManagers(address[] calldata managerAddresses) external;
    function removeManagers(address[] calldata managerAddresses) external;
    function addLoan(
        address userAddress,
        uint256 amount,
        uint256 period,
        uint256 dailyInterest,
        uint256 claimDeadline
    ) external;
    function addLoans(
        address[] calldata userAddresses,
        uint256[] calldata amounts,
        uint256[] calldata periods,
        uint256[] calldata dailyInterests,
        uint256[] calldata claimDeadlines
    ) external;
    function cancelLoans(
        address[] calldata userAddresses,
        uint256[] calldata loansIds
    ) external;
    function changeUserAddress(address oldWalletAddress, address newWalletAddress) external;
    function claimLoan(uint256 loanId) external;
    function repayLoan(uint256 loanId, uint256 repaymentAmount) external;
    function transferERC20(IERC20 _token, address _to, uint256 _amount) external;
}
          

/contracts/microcredit/interfaces/MicrocreditStorageV1.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.4;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "./IMicrocredit.sol";

/**
 * @title Storage for Microcredit
 * @notice For future upgrades, do not change MicrocreditStorageV1. Create a new
 * contract which implements MicrocreditStorageV1 and following the naming convention
 * MicrocreditStorageVx.
 */
abstract contract MicrocreditStorageV1 is IMicrocredit {
    IERC20 public override cUSD;

    uint256 internal  _usersLength;
    mapping(uint256 => User) internal _users;

    mapping(address => WalletMetadata) internal _walletMetadata;
    EnumerableSet.AddressSet internal _walletList;

    EnumerableSet.AddressSet internal _managerList;
    address public override revenueAddress;
}
          

Contract ABI

[{"type":"event","name":"LoanAdded","inputs":[{"type":"address","name":"userAddress","internalType":"address","indexed":true},{"type":"uint256","name":"loanId","internalType":"uint256","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"period","internalType":"uint256","indexed":false},{"type":"uint256","name":"dailyInterest","internalType":"uint256","indexed":false},{"type":"uint256","name":"claimDeadline","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"LoanCanceled","inputs":[{"type":"address","name":"userAddress","internalType":"address","indexed":true},{"type":"uint256","name":"loanId","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"LoanClaimed","inputs":[{"type":"address","name":"userAddress","internalType":"address","indexed":true},{"type":"uint256","name":"loanId","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ManagerAdded","inputs":[{"type":"address","name":"managerAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ManagerRemoved","inputs":[{"type":"address","name":"managerAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RepaymentAdded","inputs":[{"type":"address","name":"userAddress","internalType":"address","indexed":true},{"type":"uint256","name":"loanId","internalType":"uint256","indexed":false},{"type":"uint256","name":"repaymentAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"currentDebt","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"UserAddressChanged","inputs":[{"type":"address","name":"oldWalletAddress","internalType":"address","indexed":true},{"type":"address","name":"newWalletAddress","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addLoan","inputs":[{"type":"address","name":"_userAddress","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"uint256","name":"_period","internalType":"uint256"},{"type":"uint256","name":"_dailyInterest","internalType":"uint256"},{"type":"uint256","name":"_claimDeadline","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addLoans","inputs":[{"type":"address[]","name":"_userAddresses","internalType":"address[]"},{"type":"uint256[]","name":"_amounts","internalType":"uint256[]"},{"type":"uint256[]","name":"_periods","internalType":"uint256[]"},{"type":"uint256[]","name":"_dailyInterests","internalType":"uint256[]"},{"type":"uint256[]","name":"_claimDeadlines","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addManagers","inputs":[{"type":"address[]","name":"_managerAddresses","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20Upgradeable"}],"name":"cUSD","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"cancelLoans","inputs":[{"type":"address[]","name":"_userAddresses","internalType":"address[]"},{"type":"uint256[]","name":"_loansIds","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeUserAddress","inputs":[{"type":"address","name":"_oldWalletAddress","internalType":"address"},{"type":"address","name":"_newWalletAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimLoan","inputs":[{"type":"uint256","name":"_loanId","internalType":"uint256"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getVersion","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_cUSDAddress","internalType":"address"},{"type":"address","name":"_revenueAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"managerListAt","inputs":[{"type":"uint256","name":"_index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"managerListLength","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeManagers","inputs":[{"type":"address[]","name":"_managerAddresses","internalType":"address[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"repayLoan","inputs":[{"type":"uint256","name":"_loanId","internalType":"uint256"},{"type":"uint256","name":"_repaymentAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"revenueAddress","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferERC20","inputs":[{"type":"address","name":"_token","internalType":"contract IERC20Upgradeable"},{"type":"address","name":"_to","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateRevenueAddress","inputs":[{"type":"address","name":"_newRevenueAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"date","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"}],"name":"userLoanRepayments","inputs":[{"type":"address","name":"_userAddress","internalType":"address"},{"type":"uint256","name":"_loanId","internalType":"uint256"},{"type":"uint256","name":"_repaymentId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"amountBorrowed","internalType":"uint256"},{"type":"uint256","name":"period","internalType":"uint256"},{"type":"uint256","name":"dailyInterest","internalType":"uint256"},{"type":"uint256","name":"claimDeadline","internalType":"uint256"},{"type":"uint256","name":"startDate","internalType":"uint256"},{"type":"uint256","name":"currentDebt","internalType":"uint256"},{"type":"uint256","name":"lastComputedDebt","internalType":"uint256"},{"type":"uint256","name":"amountRepayed","internalType":"uint256"},{"type":"uint256","name":"repaymentsLength","internalType":"uint256"},{"type":"uint256","name":"lastComputedDate","internalType":"uint256"}],"name":"userLoans","inputs":[{"type":"address","name":"_userAddress","internalType":"address"},{"type":"uint256","name":"_loanId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"walletListAt","inputs":[{"type":"uint256","name":"_index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"walletListLength","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"userId","internalType":"uint256"},{"type":"address","name":"movedTo","internalType":"address"},{"type":"uint256","name":"loansLength","internalType":"uint256"}],"name":"walletMetadata","inputs":[{"type":"address","name":"_userAddress","internalType":"address"}]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b50612c9e806100206000396000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c8063715018a6116100de5780639db5dbe411610097578063d8bad5bd11610071578063d8bad5bd1461037e578063eef1b515146103db578063f2fde38b146103ee578063fdd288591461040157600080fd5b80639db5dbe414610345578063adb9712614610358578063b410908d1461036b57600080fd5b8063715018a6146102cb57806378d5bcc1146102d357806380407735146102fb5780638a700b531461030e5780638c5f9e74146103215780638da5cb5b1461033457600080fd5b806353a469b31161013057806353a469b3146101fc5780635c975abb1461020f5780635d916afd1461022557806360c4477a146102385780636323f5e91461024057806368fcaf84146102b857600080fd5b80630d8e6e2c1461017857806310f3ee291461018e5780631fccf672146101a3578063387d0263146101ce5780633a17596b146101d6578063485cc955146101e9575b600080fd5b60015b6040519081526020015b60405180910390f35b6101a161019c366004612769565b610414565b005b60c9546101b6906001600160a01b031681565b6040516001600160a01b039091168152602001610185565b61017b610516565b6101a16101e4366004612726565b610527565b6101a16101f736600461268f565b610562565b6101a161020a36600461295d565b610665565b60655460ff166040519015158152602001610185565b6101a1610233366004612812565b610881565b61017b610a29565b61029561024e366004612673565b6001600160a01b03908116600090815260cc6020908152604080832081518083018352815480825260019092015490951694830185905280845260cb909252909120549092565b604080519384526001600160a01b03909216602084015290820152606001610185565b6101b66102c636600461295d565b610a35565b6101a1610a48565b6102e66102e13660046126f2565b610a7e565b60408051928352602083019190915201610185565b6101a16103093660046127a9565b610ce8565b6101a161031c366004612975565b610daf565b6101a161032f366004612769565b611213565b6033546001600160a01b03166101b6565b6101a161035336600461291d565b611306565b6101b661036636600461295d565b611376565b60d1546101b6906001600160a01b031681565b61039161038c3660046126c7565b611383565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925260a086015260c085015260e084015261010083015261012082015261014001610185565b6101a16103e936600461268f565b611588565b6101a16103fc366004612673565b61172d565b6101a161040f366004612673565b6117c8565b6033546001600160a01b031633146104475760405162461bcd60e51b815260040161043e90612aba565b60405180910390fd5b8060005b818110156105105761049384848381811061047657634e487b7160e01b600052603260045260246000fd5b905060200201602081019061048b9190612673565b60cf90611814565b508383828181106104b457634e487b7160e01b600052603260045260246000fd5b90506020020160208101906104c99190612673565b6001600160a01b03167fef69f7d97228658c92417be1b16b19058315de71fecb435d07b7d23728b6bd3160405160405180910390a28061050881612c22565b91505061044b565b50505050565b600061052260cf611830565b905090565b61053260cf3361183a565b61054e5760405162461bcd60e51b815260040161043e906129e5565b61055b858585858561185c565b5050505050565b600054610100900460ff1661057d5760005460ff1615610581565b303b155b6105e45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161043e565b600054610100900460ff16158015610606576000805461ffff19166101011790555b61060e611bc7565b610616611bfe565b61061e611c35565b60c980546001600160a01b038086166001600160a01b03199283161790925560d18054928516929091169190911790558015610660576000805461ff00191690555b505050565b600260975414156106885760405162461bcd60e51b815260040161043e90612b3a565b60026097556106973382611c64565b33600090815260cc602090815260408083208151808301835281548082526001909201546001600160a01b03168185015290845260cb90925282208054919290918290859081106106f857634e487b7160e01b600052603260045260246000fd5b90600052602060002090600902019050806004015460001461072c5760405162461bcd60e51b815260040161043e90612a79565b600381015461077d5760405162461bcd60e51b815260206004820152601a60248201527f4d6963726f6372656469743a204c6f616e2063616e63656c6564000000000000604482015260640161043e565b42816003015410156107d15760405162461bcd60e51b815260206004820152601960248201527f4d6963726f6372656469743a204c6f616e206578706972656400000000000000604482015260640161043e565b4260048201556002810154670de0b6b3a7640000906107f290606490612b89565b61080490670de0b6b3a7640000612b71565b82546108109190612ba9565b61081a9190612b89565b6005820155426008820155805460c954610841916001600160a01b03909116903390611e91565b60405184815233907fba0cbe8ef8ef3c6984adc684d0c9b9a4d2d4c79b4678b63c38651fa48d21c62c9060200160405180910390a2505060016097555050565b61088c60cf3361183a565b6108a85760405162461bcd60e51b815260040161043e906129e5565b888781146108c85760405162461bcd60e51b815260040161043e90612a29565b8086146108e75760405162461bcd60e51b815260040161043e90612a29565b8084146109065760405162461bcd60e51b815260040161043e90612a29565b8082146109255760405162461bcd60e51b815260040161043e90612a29565b60005b81811015610a1b57610a098c8c8381811061095357634e487b7160e01b600052603260045260246000fd5b90506020020160208101906109689190612673565b8b8b8481811061098857634e487b7160e01b600052603260045260246000fd5b905060200201358a8a858181106109af57634e487b7160e01b600052603260045260246000fd5b905060200201358989868181106109d657634e487b7160e01b600052603260045260246000fd5b905060200201358888878181106109fd57634e487b7160e01b600052603260045260246000fd5b9050602002013561185c565b80610a1381612c22565b915050610928565b505050505050505050505050565b600061052260cd611830565b6000610a4260cf83611ef4565b92915050565b6033546001600160a01b03163314610a725760405162461bcd60e51b815260040161043e90612aba565b610a7c6000611f00565b565b600080610a8b8585611c64565b6001600160a01b03808616600090815260cc6020908152604080832081518083018352815480825260019092015490951685840152835260cb8252808320815181548085028201840184529381018481529093919284928491879085015b82821015610bdf5783829060005260206000209060090201604051806101200160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820154815260200160078201805480602002602001604051908101604052809291908181526020016000905b82821015610bbe57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610b78565b50505050815260200160088201548152505081526020019060010190610ae9565b50505050815250509050600081600001518781518110610c0f57634e487b7160e01b600052603260045260246000fd5b60200260200101519050858160e001515111610c795760405162461bcd60e51b8152602060048201526024808201527f4d6963726f6372656469743a2052657061796d656e7420646f65736e277420656044820152631e1a5cdd60e21b606482015260840161043e565b8060e001518681518110610c9d57634e487b7160e01b600052603260045260246000fd5b60200260200101516000015194508060e001518681518110610ccf57634e487b7160e01b600052603260045260246000fd5b6020026020010151602001519350505050935093915050565b610cf360cf3361183a565b610d0f5760405162461bcd60e51b815260040161043e906129e5565b828114610d2e5760405162461bcd60e51b815260040161043e90612a29565b60005b8381101561055b57610d9d858583818110610d5c57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610d719190612673565b848484818110610d9157634e487b7160e01b600052603260045260246000fd5b90506020020135611f52565b80610da781612c22565b915050610d31565b60026097541415610dd25760405162461bcd60e51b815260040161043e90612b3a565b600260975580610e245760405162461bcd60e51b815260206004820152601b60248201527f4d6963726f6372656469743a20496e76616c696420616d6f756e740000000000604482015260640161043e565b610e2e3383611c64565b33600090815260cc602090815260408083208151808301835281548082526001909201546001600160a01b03168185015290845260cb9092528220805491929091829086908110610e8f57634e487b7160e01b600052603260045260246000fd5b906000526020600020906009020190506000816004015411610ef35760405162461bcd60e51b815260206004820152601d60248201527f4d6963726f6372656469743a204c6f616e206e6f7420636c61696d6564000000604482015260640161043e565b6000816005015411610f605760405162461bcd60e51b815260206004820152603060248201527f4d6963726f6372656469743a204c6f616e2068617320616c726561647920626560448201526f195b88199d5b1b1e481c995c185e595960821b606482015260840161043e565b600061103a82604051806101200160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820154815260200160078201805480602002602001604051908101604052809291908181526020016000905b8282101561102357838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610fdd565b50505050815260200160088201548152505061209b565b905084811015611048578094505b60008083600001548785600601546110609190612b71565b111580611076575060d1546001600160a01b0316155b156110985760c954611093906001600160a01b031633308a612136565b611123565b83546006850154106110c35760d15460c954611093916001600160a01b03918216913391168a612136565b600684015484546000916110d691612bc8565b60c9549091506110f1906001600160a01b0316333084612136565b60d1546111219033906001600160a01b031661110d848c612bc8565b60c9546001600160a01b0316929190612136565b505b6007840180546001818101835560009283526020909220426002909202019081559081018890556111548885612bc8565b8560050181905550878560060160008282546111709190612b71565b90915550506008850154600090620151809061118c9042612bc8565b6111969190612b89565b90506111a58162015180612ba9565b86600801546111b49190612b71565b60088701556005860154604080518c8152602081018c90529081019190915233907f36bd188317b9b3af98bbc5bfd88a0bccb96582fa2c955815ea9916dfeeb02d9e9060600160405180910390a2505060016097555050505050505050565b6033546001600160a01b0316331461123d5760405162461bcd60e51b815260040161043e90612aba565b8060005b818110156105105761128984848381811061126c57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906112819190612673565b60cf9061216e565b508383828181106112aa57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906112bf9190612673565b6001600160a01b03167f3b4a40cccf2058c593542587329dd385be4f0b588db5471fbd9598e56dd7093a60405160405180910390a2806112fe81612c22565b915050611241565b600260975414156113295760405162461bcd60e51b815260040161043e90612b3a565b60026097556033546001600160a01b031633146113585760405162461bcd60e51b815260040161043e90612aba565b61136c6001600160a01b0384168383611e91565b5050600160975550565b6000610a4260cd83611ef4565b60008060008060008060008060008061139c8c8c611c64565b6001600160a01b03808d16600090815260cc6020908152604080832081518083018352815480825260019092015490951685840152835260cb8252808320815181548085028201840184529381018481529093919284928491879085015b828210156114f05783829060005260206000209060090201604051806101200160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820154815260200160078201805480602002602001604051908101604052809291908181526020016000905b828210156114cf57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611489565b505050508152602001600882015481525050815260200190600101906113fa565b50505050815250509050600081600001518e8151811061152057634e487b7160e01b600052603260045260246000fd5b6020026020010151905080600001519c5080602001519b5080604001519a5080606001519950806080015198508060a00151965061155d8161209b565b97508060c0015195508060e0015151945080610100015193505050509295989b9194979a5092959850565b61159360cf3361183a565b6115af5760405162461bcd60e51b815260040161043e906129e5565b6001600160a01b038216600090815260cc602052604090208054158015906115e2575060018101546001600160a01b0316155b61163d5760405162461bcd60e51b815260206004820152602660248201527f4d6963726f6372656469743a205468697320757365722063616e6e6f74206265604482015265081b5bdd995960d21b606482015260840161043e565b6001600160a01b038216600090815260cc602052604090208054156116ba5760405162461bcd60e51b815260206004820152602d60248201527f4d6963726f6372656469743a205461726765742077616c6c657420616464726560448201526c1cdcc81a5cc81a5b9d985b1a59609a1b606482015260840161043e565b6001820180546001600160a01b0319166001600160a01b038516179055815481556116e660cd8461216e565b50826001600160a01b0316846001600160a01b03167ffe697da51e9b8089b3ac92361b06886b93f48f935848aa4da1148c15b262840a60405160405180910390a350505050565b6033546001600160a01b031633146117575760405162461bcd60e51b815260040161043e90612aba565b6001600160a01b0381166117bc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161043e565b6117c581611f00565b50565b6033546001600160a01b031633146117f25760405162461bcd60e51b815260040161043e90612aba565b60d180546001600160a01b0319166001600160a01b0392909216919091179055565b6000611829836001600160a01b038416612183565b9392505050565b6000610a42825490565b6001600160a01b03811660009081526001830160205260408120541515611829565b4281116118b65760405162461bcd60e51b815260206004820152602260248201527f4d6963726f6372656469743a20696e76616c696420636c61696d446561646c696044820152616e6560f01b606482015260840161043e565b6001600160a01b03808616600090815260cc602052604090206001810154909116156119305760405162461bcd60e51b8152602060048201526024808201527f4d6963726f6372656469743a20546865207573657220686173206265656e206d6044820152631bdd995960e21b606482015260840161043e565b805461195d5760ca805490600061194683612c22565b909155505060ca54815561195b60cd8761216e565b505b8054600090815260cb6020526040902080548015611b2557600082611983600184612bc8565b815481106119a157634e487b7160e01b600052603260045260246000fd5b9060005260206000209060090201604051806101200160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820154815260200160078201805480602002602001604051908101604052809291908181526020016000905b82821015611a6c57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611a26565b505050508152602001600882015481525050905060008160800151118015611a96575060a0810151155b80611ab157506080810151158015611ab15750428160600151105b80611abe57506060810151155b611b235760405162461bcd60e51b815260206004820152603060248201527f4d6963726f6372656469743a20546865207573657220616c726561647920686160448201526f399030b71030b1ba34bb32903637b0b760811b606482015260840161043e565b505b81546001818101845560008481526020902060099092029091018881558082018890556002810187905560038101869055835490916001600160a01b038b16917fdf5f35c1edc69bc65031bb54e429851779e0db0a2d5f763a0eabdd9bec9429f291611b9091612bc8565b60408051918252602082018c905281018a9052606081018990526080810188905260a00160405180910390a2505050505050505050565b600054610100900460ff16611bee5760405162461bcd60e51b815260040161043e90612aef565b611bf66122a0565b610a7c6122c7565b600054610100900460ff16611c255760405162461bcd60e51b815260040161043e90612aef565b611c2d6122a0565b610a7c6122f7565b600054610100900460ff16611c5c5760405162461bcd60e51b815260040161043e90612aef565b610a7c61232a565b6001600160a01b03808316600090815260cc602090815260409182902082518084019093528054808452600190910154909316908201529015801590611cb5575060208101516001600160a01b0316155b611d0d5760405162461bcd60e51b815260206004820152602360248201527f4d6963726f6372656469743a20496e76616c69642077616c6c6574206164647260448201526265737360e81b606482015260840161043e565b8051600090815260cb60209081526040808320815181548085028201840184529381018481529093919284928491879085015b82821015611e365783829060005260206000209060090201604051806101200160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820154815260200160078201805480602002602001604051908101604052809291908181526020016000905b82821015611e1557838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611dcf565b50505050815260200160088201548152505081526020019060010190611d40565b5050509152505080515190915083106105105760405162461bcd60e51b815260206004820152601f60248201527f4d6963726f6372656469743a204c6f616e20646f65736e277420657869737400604482015260640161043e565b6040516001600160a01b03831660248201526044810182905261066090849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612358565b6000611829838361242a565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611f5c8282611c64565b6001600160a01b03808316600090815260cc6020908152604080832081518083018352815480825260019092015490951685840152835260cb90915281208054909190829085908110611fbf57634e487b7160e01b600052603260045260246000fd5b906000526020600020906009020190508060040154600014611ff35760405162461bcd60e51b815260040161043e90612a79565b600381015461204f5760405162461bcd60e51b815260206004820152602260248201527f4d6963726f6372656469743a204c6f616e20616c72656164792063616e63656c604482015261195960f21b606482015260840161043e565b600060038201556040518481526001600160a01b038616907f2f0f5933c0b9b1d9fee69327e7789ce07ef1be486122748fc2a079742067a8089060200160405180910390a25050505050565b60008160a00151600014156120b257506000919050565b600062015180836101000151426120c99190612bc8565b6120d39190612b89565b60a08401519091505b811561182957670de0b6b3a7640000606485604001516120fc9190612b89565b61210e90670de0b6b3a7640000612b71565b6121189083612ba9565b6121229190612b89565b90508161212e81612c0b565b9250506120dc565b6040516001600160a01b03808516602483015283166044820152606481018290526105109085906323b872dd60e01b90608401611ebd565b6000611829836001600160a01b038416612462565b600081815260018301602052604081205480156122965760006121a7600183612bc8565b85549091506000906121bb90600190612bc8565b905081811461223c5760008660000182815481106121e957634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508087600001848154811061221a57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b855486908061225b57634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a42565b6000915050610a42565b600054610100900460ff16610a7c5760405162461bcd60e51b815260040161043e90612aef565b600054610100900460ff166122ee5760405162461bcd60e51b815260040161043e90612aef565b610a7c33611f00565b600054610100900460ff1661231e5760405162461bcd60e51b815260040161043e90612aef565b6065805460ff19169055565b600054610100900460ff166123515760405162461bcd60e51b815260040161043e90612aef565b6001609755565b60006123ad826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124b19092919063ffffffff16565b80519091501561066057808060200190518101906123cb91906128fd565b6106605760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161043e565b600082600001828154811061244f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b60008181526001830160205260408120546124a957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a42565b506000610a42565b60606124c084846000856124c8565b949350505050565b6060824710156125295760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161043e565b843b6125775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161043e565b600080866001600160a01b031685876040516125939190612996565b60006040518083038185875af1925050503d80600081146125d0576040519150601f19603f3d011682016040523d82523d6000602084013e6125d5565b606091505b50915091506125e58282866125f0565b979650505050505050565b606083156125ff575081611829565b82511561260f5782518084602001fd5b8160405162461bcd60e51b815260040161043e91906129b2565b60008083601f84011261263a578182fd5b50813567ffffffffffffffff811115612651578182fd5b6020830191508360208260051b850101111561266c57600080fd5b9250929050565b600060208284031215612684578081fd5b813561182981612c53565b600080604083850312156126a1578081fd5b82356126ac81612c53565b915060208301356126bc81612c53565b809150509250929050565b600080604083850312156126d9578182fd5b82356126e481612c53565b946020939093013593505050565b600080600060608486031215612706578081fd5b833561271181612c53565b95602085013595506040909401359392505050565b600080600080600060a0868803121561273d578081fd5b853561274881612c53565b97602087013597506040870135966060810135965060800135945092505050565b6000806020838503121561277b578182fd5b823567ffffffffffffffff811115612791578283fd5b61279d85828601612629565b90969095509350505050565b600080600080604085870312156127be578384fd5b843567ffffffffffffffff808211156127d5578586fd5b6127e188838901612629565b909650945060208701359150808211156127f9578384fd5b5061280687828801612629565b95989497509550505050565b60008060008060008060008060008060a08b8d031215612830578485fd5b8a3567ffffffffffffffff80821115612847578687fd5b6128538e838f01612629565b909c509a5060208d013591508082111561286b578687fd5b6128778e838f01612629565b909a50985060408d013591508082111561288f578687fd5b61289b8e838f01612629565b909850965060608d01359150808211156128b3578586fd5b6128bf8e838f01612629565b909650945060808d01359150808211156128d7578384fd5b506128e48d828e01612629565b915080935050809150509295989b9194979a5092959850565b60006020828403121561290e578081fd5b81518015158114611829578182fd5b600080600060608486031215612931578283fd5b833561293c81612c53565b9250602084013561294c81612c53565b929592945050506040919091013590565b60006020828403121561296e578081fd5b5035919050565b60008060408385031215612987578182fd5b50508035926020909101359150565b600082516129a8818460208701612bdf565b9190910192915050565b60208152600082518060208401526129d1816040850160208701612bdf565b601f01601f19169190910160400192915050565b60208082526024908201527f4d6963726f6372656469743a2063616c6c6572206973206e6f742061206d616e60408201526330b3b2b960e11b606082015260800190565b60208082526030908201527f4d6963726f6372656469743a2063616c6c6461746120696e666f726d6174696f60408201526f0dc40c2e4d2e8f240dad2e6dac2e8c6d60831b606082015260800190565b60208082526021908201527f4d6963726f6372656469743a204c6f616e20616c726561647920636c61696d656040820152601960fa1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008219821115612b8457612b84612c3d565b500190565b600082612ba457634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612bc357612bc3612c3d565b500290565b600082821015612bda57612bda612c3d565b500390565b60005b83811015612bfa578181015183820152602001612be2565b838111156105105750506000910152565b600081612c1a57612c1a612c3d565b506000190190565b6000600019821415612c3657612c36612c3d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146117c557600080fdfea2646970667358221220ae297a5daf17a821300c2558391dc9ce4afebaf57d263451fd293da29c4ccf5264736f6c63430008040033

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106101735760003560e01c8063715018a6116100de5780639db5dbe411610097578063d8bad5bd11610071578063d8bad5bd1461037e578063eef1b515146103db578063f2fde38b146103ee578063fdd288591461040157600080fd5b80639db5dbe414610345578063adb9712614610358578063b410908d1461036b57600080fd5b8063715018a6146102cb57806378d5bcc1146102d357806380407735146102fb5780638a700b531461030e5780638c5f9e74146103215780638da5cb5b1461033457600080fd5b806353a469b31161013057806353a469b3146101fc5780635c975abb1461020f5780635d916afd1461022557806360c4477a146102385780636323f5e91461024057806368fcaf84146102b857600080fd5b80630d8e6e2c1461017857806310f3ee291461018e5780631fccf672146101a3578063387d0263146101ce5780633a17596b146101d6578063485cc955146101e9575b600080fd5b60015b6040519081526020015b60405180910390f35b6101a161019c366004612769565b610414565b005b60c9546101b6906001600160a01b031681565b6040516001600160a01b039091168152602001610185565b61017b610516565b6101a16101e4366004612726565b610527565b6101a16101f736600461268f565b610562565b6101a161020a36600461295d565b610665565b60655460ff166040519015158152602001610185565b6101a1610233366004612812565b610881565b61017b610a29565b61029561024e366004612673565b6001600160a01b03908116600090815260cc6020908152604080832081518083018352815480825260019092015490951694830185905280845260cb909252909120549092565b604080519384526001600160a01b03909216602084015290820152606001610185565b6101b66102c636600461295d565b610a35565b6101a1610a48565b6102e66102e13660046126f2565b610a7e565b60408051928352602083019190915201610185565b6101a16103093660046127a9565b610ce8565b6101a161031c366004612975565b610daf565b6101a161032f366004612769565b611213565b6033546001600160a01b03166101b6565b6101a161035336600461291d565b611306565b6101b661036636600461295d565b611376565b60d1546101b6906001600160a01b031681565b61039161038c3660046126c7565b611383565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925260a086015260c085015260e084015261010083015261012082015261014001610185565b6101a16103e936600461268f565b611588565b6101a16103fc366004612673565b61172d565b6101a161040f366004612673565b6117c8565b6033546001600160a01b031633146104475760405162461bcd60e51b815260040161043e90612aba565b60405180910390fd5b8060005b818110156105105761049384848381811061047657634e487b7160e01b600052603260045260246000fd5b905060200201602081019061048b9190612673565b60cf90611814565b508383828181106104b457634e487b7160e01b600052603260045260246000fd5b90506020020160208101906104c99190612673565b6001600160a01b03167fef69f7d97228658c92417be1b16b19058315de71fecb435d07b7d23728b6bd3160405160405180910390a28061050881612c22565b91505061044b565b50505050565b600061052260cf611830565b905090565b61053260cf3361183a565b61054e5760405162461bcd60e51b815260040161043e906129e5565b61055b858585858561185c565b5050505050565b600054610100900460ff1661057d5760005460ff1615610581565b303b155b6105e45760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161043e565b600054610100900460ff16158015610606576000805461ffff19166101011790555b61060e611bc7565b610616611bfe565b61061e611c35565b60c980546001600160a01b038086166001600160a01b03199283161790925560d18054928516929091169190911790558015610660576000805461ff00191690555b505050565b600260975414156106885760405162461bcd60e51b815260040161043e90612b3a565b60026097556106973382611c64565b33600090815260cc602090815260408083208151808301835281548082526001909201546001600160a01b03168185015290845260cb90925282208054919290918290859081106106f857634e487b7160e01b600052603260045260246000fd5b90600052602060002090600902019050806004015460001461072c5760405162461bcd60e51b815260040161043e90612a79565b600381015461077d5760405162461bcd60e51b815260206004820152601a60248201527f4d6963726f6372656469743a204c6f616e2063616e63656c6564000000000000604482015260640161043e565b42816003015410156107d15760405162461bcd60e51b815260206004820152601960248201527f4d6963726f6372656469743a204c6f616e206578706972656400000000000000604482015260640161043e565b4260048201556002810154670de0b6b3a7640000906107f290606490612b89565b61080490670de0b6b3a7640000612b71565b82546108109190612ba9565b61081a9190612b89565b6005820155426008820155805460c954610841916001600160a01b03909116903390611e91565b60405184815233907fba0cbe8ef8ef3c6984adc684d0c9b9a4d2d4c79b4678b63c38651fa48d21c62c9060200160405180910390a2505060016097555050565b61088c60cf3361183a565b6108a85760405162461bcd60e51b815260040161043e906129e5565b888781146108c85760405162461bcd60e51b815260040161043e90612a29565b8086146108e75760405162461bcd60e51b815260040161043e90612a29565b8084146109065760405162461bcd60e51b815260040161043e90612a29565b8082146109255760405162461bcd60e51b815260040161043e90612a29565b60005b81811015610a1b57610a098c8c8381811061095357634e487b7160e01b600052603260045260246000fd5b90506020020160208101906109689190612673565b8b8b8481811061098857634e487b7160e01b600052603260045260246000fd5b905060200201358a8a858181106109af57634e487b7160e01b600052603260045260246000fd5b905060200201358989868181106109d657634e487b7160e01b600052603260045260246000fd5b905060200201358888878181106109fd57634e487b7160e01b600052603260045260246000fd5b9050602002013561185c565b80610a1381612c22565b915050610928565b505050505050505050505050565b600061052260cd611830565b6000610a4260cf83611ef4565b92915050565b6033546001600160a01b03163314610a725760405162461bcd60e51b815260040161043e90612aba565b610a7c6000611f00565b565b600080610a8b8585611c64565b6001600160a01b03808616600090815260cc6020908152604080832081518083018352815480825260019092015490951685840152835260cb8252808320815181548085028201840184529381018481529093919284928491879085015b82821015610bdf5783829060005260206000209060090201604051806101200160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820154815260200160078201805480602002602001604051908101604052809291908181526020016000905b82821015610bbe57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610b78565b50505050815260200160088201548152505081526020019060010190610ae9565b50505050815250509050600081600001518781518110610c0f57634e487b7160e01b600052603260045260246000fd5b60200260200101519050858160e001515111610c795760405162461bcd60e51b8152602060048201526024808201527f4d6963726f6372656469743a2052657061796d656e7420646f65736e277420656044820152631e1a5cdd60e21b606482015260840161043e565b8060e001518681518110610c9d57634e487b7160e01b600052603260045260246000fd5b60200260200101516000015194508060e001518681518110610ccf57634e487b7160e01b600052603260045260246000fd5b6020026020010151602001519350505050935093915050565b610cf360cf3361183a565b610d0f5760405162461bcd60e51b815260040161043e906129e5565b828114610d2e5760405162461bcd60e51b815260040161043e90612a29565b60005b8381101561055b57610d9d858583818110610d5c57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610d719190612673565b848484818110610d9157634e487b7160e01b600052603260045260246000fd5b90506020020135611f52565b80610da781612c22565b915050610d31565b60026097541415610dd25760405162461bcd60e51b815260040161043e90612b3a565b600260975580610e245760405162461bcd60e51b815260206004820152601b60248201527f4d6963726f6372656469743a20496e76616c696420616d6f756e740000000000604482015260640161043e565b610e2e3383611c64565b33600090815260cc602090815260408083208151808301835281548082526001909201546001600160a01b03168185015290845260cb9092528220805491929091829086908110610e8f57634e487b7160e01b600052603260045260246000fd5b906000526020600020906009020190506000816004015411610ef35760405162461bcd60e51b815260206004820152601d60248201527f4d6963726f6372656469743a204c6f616e206e6f7420636c61696d6564000000604482015260640161043e565b6000816005015411610f605760405162461bcd60e51b815260206004820152603060248201527f4d6963726f6372656469743a204c6f616e2068617320616c726561647920626560448201526f195b88199d5b1b1e481c995c185e595960821b606482015260840161043e565b600061103a82604051806101200160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820154815260200160078201805480602002602001604051908101604052809291908181526020016000905b8282101561102357838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610fdd565b50505050815260200160088201548152505061209b565b905084811015611048578094505b60008083600001548785600601546110609190612b71565b111580611076575060d1546001600160a01b0316155b156110985760c954611093906001600160a01b031633308a612136565b611123565b83546006850154106110c35760d15460c954611093916001600160a01b03918216913391168a612136565b600684015484546000916110d691612bc8565b60c9549091506110f1906001600160a01b0316333084612136565b60d1546111219033906001600160a01b031661110d848c612bc8565b60c9546001600160a01b0316929190612136565b505b6007840180546001818101835560009283526020909220426002909202019081559081018890556111548885612bc8565b8560050181905550878560060160008282546111709190612b71565b90915550506008850154600090620151809061118c9042612bc8565b6111969190612b89565b90506111a58162015180612ba9565b86600801546111b49190612b71565b60088701556005860154604080518c8152602081018c90529081019190915233907f36bd188317b9b3af98bbc5bfd88a0bccb96582fa2c955815ea9916dfeeb02d9e9060600160405180910390a2505060016097555050505050505050565b6033546001600160a01b0316331461123d5760405162461bcd60e51b815260040161043e90612aba565b8060005b818110156105105761128984848381811061126c57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906112819190612673565b60cf9061216e565b508383828181106112aa57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906112bf9190612673565b6001600160a01b03167f3b4a40cccf2058c593542587329dd385be4f0b588db5471fbd9598e56dd7093a60405160405180910390a2806112fe81612c22565b915050611241565b600260975414156113295760405162461bcd60e51b815260040161043e90612b3a565b60026097556033546001600160a01b031633146113585760405162461bcd60e51b815260040161043e90612aba565b61136c6001600160a01b0384168383611e91565b5050600160975550565b6000610a4260cd83611ef4565b60008060008060008060008060008061139c8c8c611c64565b6001600160a01b03808d16600090815260cc6020908152604080832081518083018352815480825260019092015490951685840152835260cb8252808320815181548085028201840184529381018481529093919284928491879085015b828210156114f05783829060005260206000209060090201604051806101200160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820154815260200160078201805480602002602001604051908101604052809291908181526020016000905b828210156114cf57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611489565b505050508152602001600882015481525050815260200190600101906113fa565b50505050815250509050600081600001518e8151811061152057634e487b7160e01b600052603260045260246000fd5b6020026020010151905080600001519c5080602001519b5080604001519a5080606001519950806080015198508060a00151965061155d8161209b565b97508060c0015195508060e0015151945080610100015193505050509295989b9194979a5092959850565b61159360cf3361183a565b6115af5760405162461bcd60e51b815260040161043e906129e5565b6001600160a01b038216600090815260cc602052604090208054158015906115e2575060018101546001600160a01b0316155b61163d5760405162461bcd60e51b815260206004820152602660248201527f4d6963726f6372656469743a205468697320757365722063616e6e6f74206265604482015265081b5bdd995960d21b606482015260840161043e565b6001600160a01b038216600090815260cc602052604090208054156116ba5760405162461bcd60e51b815260206004820152602d60248201527f4d6963726f6372656469743a205461726765742077616c6c657420616464726560448201526c1cdcc81a5cc81a5b9d985b1a59609a1b606482015260840161043e565b6001820180546001600160a01b0319166001600160a01b038516179055815481556116e660cd8461216e565b50826001600160a01b0316846001600160a01b03167ffe697da51e9b8089b3ac92361b06886b93f48f935848aa4da1148c15b262840a60405160405180910390a350505050565b6033546001600160a01b031633146117575760405162461bcd60e51b815260040161043e90612aba565b6001600160a01b0381166117bc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161043e565b6117c581611f00565b50565b6033546001600160a01b031633146117f25760405162461bcd60e51b815260040161043e90612aba565b60d180546001600160a01b0319166001600160a01b0392909216919091179055565b6000611829836001600160a01b038416612183565b9392505050565b6000610a42825490565b6001600160a01b03811660009081526001830160205260408120541515611829565b4281116118b65760405162461bcd60e51b815260206004820152602260248201527f4d6963726f6372656469743a20696e76616c696420636c61696d446561646c696044820152616e6560f01b606482015260840161043e565b6001600160a01b03808616600090815260cc602052604090206001810154909116156119305760405162461bcd60e51b8152602060048201526024808201527f4d6963726f6372656469743a20546865207573657220686173206265656e206d6044820152631bdd995960e21b606482015260840161043e565b805461195d5760ca805490600061194683612c22565b909155505060ca54815561195b60cd8761216e565b505b8054600090815260cb6020526040902080548015611b2557600082611983600184612bc8565b815481106119a157634e487b7160e01b600052603260045260246000fd5b9060005260206000209060090201604051806101200160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820154815260200160078201805480602002602001604051908101604052809291908181526020016000905b82821015611a6c57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611a26565b505050508152602001600882015481525050905060008160800151118015611a96575060a0810151155b80611ab157506080810151158015611ab15750428160600151105b80611abe57506060810151155b611b235760405162461bcd60e51b815260206004820152603060248201527f4d6963726f6372656469743a20546865207573657220616c726561647920686160448201526f399030b71030b1ba34bb32903637b0b760811b606482015260840161043e565b505b81546001818101845560008481526020902060099092029091018881558082018890556002810187905560038101869055835490916001600160a01b038b16917fdf5f35c1edc69bc65031bb54e429851779e0db0a2d5f763a0eabdd9bec9429f291611b9091612bc8565b60408051918252602082018c905281018a9052606081018990526080810188905260a00160405180910390a2505050505050505050565b600054610100900460ff16611bee5760405162461bcd60e51b815260040161043e90612aef565b611bf66122a0565b610a7c6122c7565b600054610100900460ff16611c255760405162461bcd60e51b815260040161043e90612aef565b611c2d6122a0565b610a7c6122f7565b600054610100900460ff16611c5c5760405162461bcd60e51b815260040161043e90612aef565b610a7c61232a565b6001600160a01b03808316600090815260cc602090815260409182902082518084019093528054808452600190910154909316908201529015801590611cb5575060208101516001600160a01b0316155b611d0d5760405162461bcd60e51b815260206004820152602360248201527f4d6963726f6372656469743a20496e76616c69642077616c6c6574206164647260448201526265737360e81b606482015260840161043e565b8051600090815260cb60209081526040808320815181548085028201840184529381018481529093919284928491879085015b82821015611e365783829060005260206000209060090201604051806101200160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820154815260200160078201805480602002602001604051908101604052809291908181526020016000905b82821015611e1557838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611dcf565b50505050815260200160088201548152505081526020019060010190611d40565b5050509152505080515190915083106105105760405162461bcd60e51b815260206004820152601f60248201527f4d6963726f6372656469743a204c6f616e20646f65736e277420657869737400604482015260640161043e565b6040516001600160a01b03831660248201526044810182905261066090849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612358565b6000611829838361242a565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611f5c8282611c64565b6001600160a01b03808316600090815260cc6020908152604080832081518083018352815480825260019092015490951685840152835260cb90915281208054909190829085908110611fbf57634e487b7160e01b600052603260045260246000fd5b906000526020600020906009020190508060040154600014611ff35760405162461bcd60e51b815260040161043e90612a79565b600381015461204f5760405162461bcd60e51b815260206004820152602260248201527f4d6963726f6372656469743a204c6f616e20616c72656164792063616e63656c604482015261195960f21b606482015260840161043e565b600060038201556040518481526001600160a01b038616907f2f0f5933c0b9b1d9fee69327e7789ce07ef1be486122748fc2a079742067a8089060200160405180910390a25050505050565b60008160a00151600014156120b257506000919050565b600062015180836101000151426120c99190612bc8565b6120d39190612b89565b60a08401519091505b811561182957670de0b6b3a7640000606485604001516120fc9190612b89565b61210e90670de0b6b3a7640000612b71565b6121189083612ba9565b6121229190612b89565b90508161212e81612c0b565b9250506120dc565b6040516001600160a01b03808516602483015283166044820152606481018290526105109085906323b872dd60e01b90608401611ebd565b6000611829836001600160a01b038416612462565b600081815260018301602052604081205480156122965760006121a7600183612bc8565b85549091506000906121bb90600190612bc8565b905081811461223c5760008660000182815481106121e957634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508087600001848154811061221a57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b855486908061225b57634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a42565b6000915050610a42565b600054610100900460ff16610a7c5760405162461bcd60e51b815260040161043e90612aef565b600054610100900460ff166122ee5760405162461bcd60e51b815260040161043e90612aef565b610a7c33611f00565b600054610100900460ff1661231e5760405162461bcd60e51b815260040161043e90612aef565b6065805460ff19169055565b600054610100900460ff166123515760405162461bcd60e51b815260040161043e90612aef565b6001609755565b60006123ad826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124b19092919063ffffffff16565b80519091501561066057808060200190518101906123cb91906128fd565b6106605760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161043e565b600082600001828154811061244f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b60008181526001830160205260408120546124a957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a42565b506000610a42565b60606124c084846000856124c8565b949350505050565b6060824710156125295760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161043e565b843b6125775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161043e565b600080866001600160a01b031685876040516125939190612996565b60006040518083038185875af1925050503d80600081146125d0576040519150601f19603f3d011682016040523d82523d6000602084013e6125d5565b606091505b50915091506125e58282866125f0565b979650505050505050565b606083156125ff575081611829565b82511561260f5782518084602001fd5b8160405162461bcd60e51b815260040161043e91906129b2565b60008083601f84011261263a578182fd5b50813567ffffffffffffffff811115612651578182fd5b6020830191508360208260051b850101111561266c57600080fd5b9250929050565b600060208284031215612684578081fd5b813561182981612c53565b600080604083850312156126a1578081fd5b82356126ac81612c53565b915060208301356126bc81612c53565b809150509250929050565b600080604083850312156126d9578182fd5b82356126e481612c53565b946020939093013593505050565b600080600060608486031215612706578081fd5b833561271181612c53565b95602085013595506040909401359392505050565b600080600080600060a0868803121561273d578081fd5b853561274881612c53565b97602087013597506040870135966060810135965060800135945092505050565b6000806020838503121561277b578182fd5b823567ffffffffffffffff811115612791578283fd5b61279d85828601612629565b90969095509350505050565b600080600080604085870312156127be578384fd5b843567ffffffffffffffff808211156127d5578586fd5b6127e188838901612629565b909650945060208701359150808211156127f9578384fd5b5061280687828801612629565b95989497509550505050565b60008060008060008060008060008060a08b8d031215612830578485fd5b8a3567ffffffffffffffff80821115612847578687fd5b6128538e838f01612629565b909c509a5060208d013591508082111561286b578687fd5b6128778e838f01612629565b909a50985060408d013591508082111561288f578687fd5b61289b8e838f01612629565b909850965060608d01359150808211156128b3578586fd5b6128bf8e838f01612629565b909650945060808d01359150808211156128d7578384fd5b506128e48d828e01612629565b915080935050809150509295989b9194979a5092959850565b60006020828403121561290e578081fd5b81518015158114611829578182fd5b600080600060608486031215612931578283fd5b833561293c81612c53565b9250602084013561294c81612c53565b929592945050506040919091013590565b60006020828403121561296e578081fd5b5035919050565b60008060408385031215612987578182fd5b50508035926020909101359150565b600082516129a8818460208701612bdf565b9190910192915050565b60208152600082518060208401526129d1816040850160208701612bdf565b601f01601f19169190910160400192915050565b60208082526024908201527f4d6963726f6372656469743a2063616c6c6572206973206e6f742061206d616e60408201526330b3b2b960e11b606082015260800190565b60208082526030908201527f4d6963726f6372656469743a2063616c6c6461746120696e666f726d6174696f60408201526f0dc40c2e4d2e8f240dad2e6dac2e8c6d60831b606082015260800190565b60208082526021908201527f4d6963726f6372656469743a204c6f616e20616c726561647920636c61696d656040820152601960fa1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008219821115612b8457612b84612c3d565b500190565b600082612ba457634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612bc357612bc3612c3d565b500290565b600082821015612bda57612bda612c3d565b500390565b60005b83811015612bfa578181015183820152602001612be2565b838111156105105750506000910152565b600081612c1a57612c1a612c3d565b506000190190565b6000600019821415612c3657612c36612c3d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146117c557600080fdfea2646970667358221220ae297a5daf17a821300c2558391dc9ce4afebaf57d263451fd293da29c4ccf5264736f6c63430008040033