ETH Price: $2,882.09 (-10.55%)
Gas: 17 Gwei

Contract

0xc69661B848B02Ce0288C58C0AA01D0d99Cb85dfc
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Consume Token162335382022-12-21 14:01:35561 days ago1671631295IN
0xc69661B8...99Cb85dfc
0 ETH0.0007861114.48041166
Grant Role161914432022-12-15 16:59:35567 days ago1671123575IN
0xc69661B8...99Cb85dfc
0 ETH0.0045740445.15831108
Grant Role151745202022-07-19 17:48:52716 days ago1658252932IN
0xc69661B8...99Cb85dfc
0 ETH0.0025644621.66138423
Add Approved Tok...151742892022-07-19 17:04:47716 days ago1658250287IN
0xc69661B8...99Cb85dfc
0 ETH0.0028273437.6783964
Add Approved Tok...151742882022-07-19 17:04:25716 days ago1658250265IN
0xc69661B8...99Cb85dfc
0 ETH0.0031549334.24104037
Add Approved Col...151742822022-07-19 17:03:27716 days ago1658250207IN
0xc69661B8...99Cb85dfc
0 ETH0.0025500733.99828242
Add Approved Col...151742792022-07-19 17:03:04716 days ago1658250184IN
0xc69661B8...99Cb85dfc
0 ETH0.0026641735.51383629
Add Approved Col...151742782022-07-19 17:02:58716 days ago1658250178IN
0xc69661B8...99Cb85dfc
0 ETH0.0034099337.01700437
Grant Role151742572022-07-19 16:58:14716 days ago1658249894IN
0xc69661B8...99Cb85dfc
0 ETH0.0036907236.4375983
Grant Role151742542022-07-19 16:57:31716 days ago1658249851IN
0xc69661B8...99Cb85dfc
0 ETH0.0035835235.37916285
Grant Role151742512022-07-19 16:57:04716 days ago1658249824IN
0xc69661B8...99Cb85dfc
0 ETH0.004045539.94018584
Grant Role151742482022-07-19 16:56:36716 days ago1658249796IN
0xc69661B8...99Cb85dfc
0 ETH0.0049627341.91890904
0x60806040151742332022-07-19 16:53:41716 days ago1658249621IN
 Create: Levels
0 ETH0.0551055336.23995936

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Levels

Compiler Version
v0.8.14+commit.80d49f37

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 11 : Levels.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;

import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "./interfaces/IFancyBearHoneyConsumption.sol";

contract Levels is AccessControlEnumerable {

    struct ConsumptionData {
        uint256 eth;
        mapping(address => uint256) tokens;
    }

    using EnumerableSet for EnumerableSet.AddressSet;

    bytes32 public constant CONSUMER_ROLE = keccak256("CONSUMER_ROLE");
    bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
    
    EnumerableSet.AddressSet private approvedCollections;
    EnumerableSet.AddressSet private approvedTokens;

    mapping(address => mapping(uint256 => ConsumptionData)) private consumptionData;

    address public fancyBearContract;
    address public honeyContract;
    IFancyBearHoneyConsumption public honeyConsumptionContract;

    event TokenConsumed(address indexed _collectionAddress, uint256 indexed _collectionTokenId, address indexed _tokenAddress, uint256 _amount);
    event ETHConsumed(address indexed _collectionAddress, uint256 indexed _collectionTokenId, uint256 _amount);
    event CollectionAdded(address indexed _collectionAddress);
    event CollectionRemoved(address indexed _collectionAddress);
    event TokenAdded(address indexed _tokenAddress);
    event TokenRemoved(address indexed _tokenAddress);

    constructor(address _fancyBearContract, address _honeyContract, IFancyBearHoneyConsumption _honeyConsumptionContract) {
        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);

        fancyBearContract = _fancyBearContract;
        honeyContract = _honeyContract;
        honeyConsumptionContract = _honeyConsumptionContract;
    }

    function addApprovedCollection(address _collectionAddress) public onlyRole(MANAGER_ROLE) {
        approvedCollections.add(_collectionAddress);
        emit CollectionAdded(_collectionAddress);
    }

    function removeApprovedCollection(address _collectionAddress) public onlyRole(MANAGER_ROLE) {
        approvedCollections.remove(_collectionAddress);
        emit CollectionRemoved(_collectionAddress);
    }

    function getApprovedCollections() public view returns (address[] memory) {
        return approvedCollections.values();
    }

    function addApprovedToken(address _tokenAddress) public onlyRole(MANAGER_ROLE) {
        approvedTokens.add(_tokenAddress);
        emit TokenAdded(_tokenAddress);
    }

    function removeApprovedTokens(address _tokenAddress) public onlyRole(MANAGER_ROLE) {
        approvedTokens.remove(_tokenAddress);
        emit TokenRemoved(_tokenAddress);
    }

    function getApprovedTokens() public view returns (address[] memory) {
        return approvedTokens.values();
    }

    function getConsumedToken(address _collectionAddress, uint256 _collectionTokenId, address _tokenAddress) public view returns (uint256) {
        
        require(approvedCollections.contains(_collectionAddress), "getConsumedToken: Not an approved collection");
        require(approvedTokens.contains(_tokenAddress), "getConsumedToken: Not an approved token");

        if(_collectionAddress == fancyBearContract && _tokenAddress == honeyContract){
            return consumptionData[_collectionAddress][_collectionTokenId].tokens[_tokenAddress] + honeyConsumptionContract.honeyConsumed(_collectionTokenId);
        }
        else{
            return consumptionData[_collectionAddress][_collectionTokenId].tokens[_tokenAddress];
        }
    }

    function consumeToken(address _collectionAddress, uint256 _collectionTokenId, address _tokenAddress, uint256 _amount) public onlyRole(CONSUMER_ROLE) {
        
        require(approvedCollections.contains(_collectionAddress), "tokenConsumption: Not an approved collection");
        require(approvedTokens.contains(_tokenAddress), "tokenConsumption: Not an approved token");
        require(_amount > 0, "tokenConsumption: must consume more than 0");

        consumptionData[_collectionAddress][_collectionTokenId].tokens[_tokenAddress] += _amount;

        emit TokenConsumed(_collectionAddress, _collectionTokenId, _tokenAddress, _amount);
    }

    function consumeETH(address _collectionAddress, uint256 _collectionTokenId, uint256 _amount) public onlyRole(CONSUMER_ROLE){
        require(approvedCollections.contains(_collectionAddress), "consumeETH: Not an approved collection");
        require(_amount > 0, "consumeETH: must consume more than 0");

        consumptionData[_collectionAddress][_collectionTokenId].eth += _amount;

        emit ETHConsumed(_collectionAddress, _collectionTokenId, _amount);
    }

    function getTokensConsumed(address _collectionAddress, uint256 _collectionTokenId) public view returns (address[] memory, uint256[] memory, uint256) {
        
        uint256[] memory amounts = new uint256[](approvedTokens.length());
        address[] memory tokenAddresses = new address[](approvedTokens.length());
        
        uint256 i;
        for(;i < approvedTokens.length();){

            tokenAddresses[i] = approvedTokens.at(i);
            amounts[i] = getConsumedToken(_collectionAddress, _collectionTokenId, tokenAddresses[i]);
            
            unchecked{
                i++;
            }

        }

        return (tokenAddresses, amounts, consumptionData[_collectionAddress][_collectionTokenId].eth);
    }

    function getConsumedETH(address _collectionAddress, uint256 _collectionTokenId) public view returns (uint256) {
        return consumptionData[_collectionAddress][_collectionTokenId].eth;
    }

}

File 2 of 11 : IFancyBearHoneyConsumption.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

abstract contract IFancyBearHoneyConsumption {

    mapping(uint256 => uint256) public honeyConsumed;
    function consumeHoney(uint256 _tokenId, uint256 _honeyAmount) public virtual;
    
}

File 3 of 11 : 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;
    }
}

File 4 of 11 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 5 of 11 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 6 of 11 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 8 of 11 : IAccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerable is IAccessControl {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 10 of 11 : AccessControlEnumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlEnumerable.sol";
import "./AccessControl.sol";
import "../utils/structs/EnumerableSet.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
    using EnumerableSet for EnumerableSet.AddressSet;

    mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;

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

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
        return _roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
        return _roleMembers[role].length();
    }

    /**
     * @dev Overload {_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override {
        super._grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override {
        super._revokeRole(role, account);
        _roleMembers[role].remove(account);
    }
}

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

pragma solidity ^0.8.0;

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

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

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

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

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

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

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "london",
  "libraries": {},
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_fancyBearContract","type":"address"},{"internalType":"address","name":"_honeyContract","type":"address"},{"internalType":"contract IFancyBearHoneyConsumption","name":"_honeyConsumptionContract","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_collectionAddress","type":"address"}],"name":"CollectionAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_collectionAddress","type":"address"}],"name":"CollectionRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_collectionAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"_collectionTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"ETHConsumed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"TokenAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_collectionAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"_collectionTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"_tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"TokenConsumed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"TokenRemoved","type":"event"},{"inputs":[],"name":"CONSUMER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collectionAddress","type":"address"}],"name":"addApprovedCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"addApprovedToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collectionAddress","type":"address"},{"internalType":"uint256","name":"_collectionTokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"consumeETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collectionAddress","type":"address"},{"internalType":"uint256","name":"_collectionTokenId","type":"uint256"},{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"consumeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fancyBearContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getApprovedCollections","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getApprovedTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collectionAddress","type":"address"},{"internalType":"uint256","name":"_collectionTokenId","type":"uint256"}],"name":"getConsumedETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collectionAddress","type":"address"},{"internalType":"uint256","name":"_collectionTokenId","type":"uint256"},{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"getConsumedToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collectionAddress","type":"address"},{"internalType":"uint256","name":"_collectionTokenId","type":"uint256"}],"name":"getTokensConsumed","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"honeyConsumptionContract","outputs":[{"internalType":"contract IFancyBearHoneyConsumption","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"honeyContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collectionAddress","type":"address"}],"name":"removeApprovedCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"removeApprovedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b50604051620019d8380380620019d88339810160408190526200003491620001f3565b6200004160003362000084565b600780546001600160a01b039485166001600160a01b03199182161790915560088054938516938216939093179092556009805491909316911617905562000247565b6200009b8282620000c760201b62000d881760201c565b6000828152600160209081526040909120620000c291839062000e0c62000168821b17901c565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000164576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001233390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b60006200017f836001600160a01b03841662000188565b90505b92915050565b6000818152600183016020526040812054620001d15750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000182565b50600062000182565b6001600160a01b0381168114620001f057600080fd5b50565b6000806000606084860312156200020957600080fd5b83516200021681620001da565b60208501519093506200022981620001da565b60408501519092506200023c81620001da565b809150509250925092565b61178180620002576000396000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c80636afc0c5f116100de57806391d1485411610097578063ca15c87311610071578063ca15c87314610386578063cd10534b14610399578063d547741f146103ac578063ec87621c146103bf57600080fd5b806391d14854146103585780639e55378e1461036b578063a217fddf1461037e57600080fd5b80636afc0c5f146102cc5780636f3703ff146102e157806374d0e2b0146102f45780637d1a944c1461032a57806380b57fd1146103325780639010d07c1461034557600080fd5b8063386da39d11610130578063386da39d146102375780633ea232e11461024a57806347f56b691461026c5780634bc02da61461027f578063624a8da7146102a657806364345789146102b957600080fd5b806301ffc9a71461017857806304011f9b146101a05780631dcbad03146101c1578063248a9ca3146101ec5780632f2ff15d1461020f57806336568abe14610224575b600080fd5b61018b610186366004611321565b6103d4565b60405190151581526020015b60405180910390f35b6101b36101ae366004611367565b6103ff565b604051908152602001610197565b6009546101d4906001600160a01b031681565b6040516001600160a01b039091168152602001610197565b6101b36101fa3660046113a3565b60009081526020819052604090206001015490565b61022261021d3660046113bc565b6105f3565b005b6102226102323660046113bc565b61061e565b6007546101d4906001600160a01b031681565b61025d6102583660046113e8565b61069c565b60405161019793929190611456565b61022261027a3660046114b6565b61080e565b6101b37f9d56108290ea0bc9c5c59c3ad357dca9d1b29ed7f3ae1443bef2fa2159bdf5e881565b6008546101d4906001600160a01b031681565b6102226102c73660046114fa565b610a0e565b6102d4610a6b565b6040516101979190611515565b6102226102ef3660046114fa565b610a7c565b6101b36103023660046113e8565b6001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6102d4610ad9565b610222610340366004611528565b610ae5565b6101d461035336600461155b565b610c50565b61018b6103663660046113bc565b610c68565b6102226103793660046114fa565b610c91565b6101b3600081565b6101b36103943660046113a3565b610cee565b6102226103a73660046114fa565b610d05565b6102226103ba3660046113bc565b610d62565b6101b360008051602061172c83398151915281565b60006001600160e01b03198216635a05180f60e01b14806103f957506103f982610e21565b92915050565b600061040c600285610e56565b6104725760405162461bcd60e51b815260206004820152602c60248201527f676574436f6e73756d6564546f6b656e3a204e6f7420616e20617070726f766560448201526b321031b7b63632b1ba34b7b760a11b60648201526084015b60405180910390fd5b61047d600483610e56565b6104d95760405162461bcd60e51b815260206004820152602760248201527f676574436f6e73756d6564546f6b656e3a204e6f7420616e20617070726f766560448201526632103a37b5b2b760c91b6064820152608401610469565b6007546001600160a01b03858116911614801561050357506008546001600160a01b038381169116145b156105b8576009546040516302abc55b60e41b8152600481018590526001600160a01b0390911690632abc55b090602401602060405180830381865afa158015610551573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610575919061157d565b6001600160a01b038086166000908152600660209081526040808320888452825280832093871683526001909301905220546105b191906115ac565b90506105ec565b506001600160a01b038084166000908152600660209081526040808320868452825280832093851683526001909301905220545b9392505050565b60008281526020819052604090206001015461060f8133610e78565b6106198383610edc565b505050565b6001600160a01b038116331461068e5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610469565b6106988282610efe565b5050565b6060806000806106ac6004610f20565b67ffffffffffffffff8111156106c4576106c46115c4565b6040519080825280602002602001820160405280156106ed578160200160208202803683370190505b50905060006106fc6004610f20565b67ffffffffffffffff811115610714576107146115c4565b60405190808252806020026020018201604052801561073d578160200160208202803683370190505b50905060005b61074d6004610f20565b8110156107da5761075f600482610f2a565b828281518110610771576107716115da565b60200260200101906001600160a01b031690816001600160a01b0316815250506107b588888484815181106107a8576107a86115da565b60200260200101516103ff565b8382815181106107c7576107c76115da565b6020908102919091010152600101610743565b506001600160a01b038716600090815260066020908152604080832089845290915290205490945090925090509250925092565b7f9d56108290ea0bc9c5c59c3ad357dca9d1b29ed7f3ae1443bef2fa2159bdf5e86108398133610e78565b610844600286610e56565b6108a55760405162461bcd60e51b815260206004820152602c60248201527f746f6b656e436f6e73756d7074696f6e3a204e6f7420616e20617070726f766560448201526b321031b7b63632b1ba34b7b760a11b6064820152608401610469565b6108b0600484610e56565b61090c5760405162461bcd60e51b815260206004820152602760248201527f746f6b656e436f6e73756d7074696f6e3a204e6f7420616e20617070726f766560448201526632103a37b5b2b760c91b6064820152608401610469565b6000821161096f5760405162461bcd60e51b815260206004820152602a60248201527f746f6b656e436f6e73756d7074696f6e3a206d75737420636f6e73756d65206d60448201526906f7265207468616e20360b41b6064820152608401610469565b6001600160a01b038086166000908152600660209081526040808320888452825280832093871683526001909301905290812080548492906109b29084906115ac565b92505081905550826001600160a01b031684866001600160a01b03167fdb3f50cb9f21c8e0bcb41b350299e44aae958c269cb83b3c4d43cc416af0cfeb856040516109ff91815260200190565b60405180910390a45050505050565b60008051602061172c833981519152610a278133610e78565b610a32600483610f36565b506040516001600160a01b038316907f4c910b69fe65a61f7531b9c5042b2329ca7179c77290aa7e2eb3afa3c8511fd390600090a25050565b6060610a776004610f4b565b905090565b60008051602061172c833981519152610a958133610e78565b610aa0600283610e0c565b506040516001600160a01b038316907f7701426aaa4c0c88a30924a7aba88dce66b18c4020b54e4e19c9e0eb0abc299290600090a25050565b6060610a776002610f4b565b7f9d56108290ea0bc9c5c59c3ad357dca9d1b29ed7f3ae1443bef2fa2159bdf5e8610b108133610e78565b610b1b600285610e56565b610b765760405162461bcd60e51b815260206004820152602660248201527f636f6e73756d654554483a204e6f7420616e20617070726f76656420636f6c6c60448201526532b1ba34b7b760d11b6064820152608401610469565b60008211610bd25760405162461bcd60e51b8152602060048201526024808201527f636f6e73756d654554483a206d75737420636f6e73756d65206d6f72652074686044820152630616e20360e41b6064820152608401610469565b6001600160a01b038416600090815260066020908152604080832086845290915281208054849290610c059084906115ac565b909155505060405182815283906001600160a01b038616907fe18e4a0e38d140197a83439dfe8adf43a29759042448678159d52dd6670831ce9060200160405180910390a350505050565b60008281526001602052604081206105ec9083610f2a565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60008051602061172c833981519152610caa8133610e78565b610cb5600283610f36565b506040516001600160a01b038316907fa0691bd707b2f65c33c8343d61c274df72c6b5007937dcfbc31aa5a0d0f6fe3c90600090a25050565b60008181526001602052604081206103f990610f20565b60008051602061172c833981519152610d1e8133610e78565b610d29600483610e0c565b506040516001600160a01b038316907f784c8f4dbf0ffedd6e72c76501c545a70f8b203b30a26ce542bf92ba87c248a490600090a25050565b600082815260208190526040902060010154610d7e8133610e78565b6106198383610efe565b610d928282610c68565b610698576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610dc83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006105ec836001600160a01b038416610f58565b60006001600160e01b03198216637965db0b60e01b14806103f957506301ffc9a760e01b6001600160e01b03198316146103f9565b6001600160a01b038116600090815260018301602052604081205415156105ec565b610e828282610c68565b61069857610e9a816001600160a01b03166014610fa7565b610ea5836020610fa7565b604051602001610eb6929190611620565b60408051601f198184030181529082905262461bcd60e51b825261046991600401611695565b610ee68282610d88565b60008281526001602052604090206106199082610e0c565b610f088282611143565b60008281526001602052604090206106199082610f36565b60006103f9825490565b60006105ec83836111a8565b60006105ec836001600160a01b0384166111d2565b606060006105ec836112c5565b6000818152600183016020526040812054610f9f575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556103f9565b5060006103f9565b60606000610fb68360026116c8565b610fc19060026115ac565b67ffffffffffffffff811115610fd957610fd96115c4565b6040519080825280601f01601f191660200182016040528015611003576020820181803683370190505b509050600360fc1b8160008151811061101e5761101e6115da565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061104d5761104d6115da565b60200101906001600160f81b031916908160001a90535060006110718460026116c8565b61107c9060016115ac565b90505b60018111156110f4576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106110b0576110b06115da565b1a60f81b8282815181106110c6576110c66115da565b60200101906001600160f81b031916908160001a90535060049490941c936110ed816116e7565b905061107f565b5083156105ec5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610469565b61114d8282610c68565b15610698576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008260000182815481106111bf576111bf6115da565b9060005260206000200154905092915050565b600081815260018301602052604081205480156112bb5760006111f66001836116fe565b855490915060009061120a906001906116fe565b905081811461126f57600086600001828154811061122a5761122a6115da565b906000526020600020015490508087600001848154811061124d5761124d6115da565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061128057611280611715565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506103f9565b60009150506103f9565b60608160000180548060200260200160405190810160405280929190818152602001828054801561131557602002820191906000526020600020905b815481526020019060010190808311611301575b50505050509050919050565b60006020828403121561133357600080fd5b81356001600160e01b0319811681146105ec57600080fd5b80356001600160a01b038116811461136257600080fd5b919050565b60008060006060848603121561137c57600080fd5b6113858461134b565b92506020840135915061139a6040850161134b565b90509250925092565b6000602082840312156113b557600080fd5b5035919050565b600080604083850312156113cf57600080fd5b823591506113df6020840161134b565b90509250929050565b600080604083850312156113fb57600080fd5b6114048361134b565b946020939093013593505050565b600081518084526020808501945080840160005b8381101561144b5781516001600160a01b031687529582019590820190600101611426565b509495945050505050565b6060815260006114696060830186611412565b82810360208481019190915285518083528682019282019060005b818110156114a057845183529383019391830191600101611484565b5050809350505050826040830152949350505050565b600080600080608085870312156114cc57600080fd5b6114d58561134b565b9350602085013592506114ea6040860161134b565b9396929550929360600135925050565b60006020828403121561150c57600080fd5b6105ec8261134b565b6020815260006105ec6020830184611412565b60008060006060848603121561153d57600080fd5b6115468461134b565b95602085013595506040909401359392505050565b6000806040838503121561156e57600080fd5b50508035926020909101359150565b60006020828403121561158f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600082198211156115bf576115bf611596565b500190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60005b8381101561160b5781810151838201526020016115f3565b8381111561161a576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516116588160178501602088016115f0565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516116898160288401602088016115f0565b01602801949350505050565b60208152600082518060208401526116b48160408501602087016115f0565b601f01601f19169190910160400192915050565b60008160001904831182151516156116e2576116e2611596565b500290565b6000816116f6576116f6611596565b506000190190565b60008282101561171057611710611596565b500390565b634e487b7160e01b600052603160045260246000fdfe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a2646970667358221220c70e8f437d349e38462fcaf72ab09be20485087cde43ce1c7a9b6feb6b5095f764736f6c634300080e003300000000000000000000000087084ec881d5a15c918057f326790db177d218f200000000000000000000000033b4fe5e40e4903a0849ca97b3292eac3eb0aa36000000000000000000000000628bec3f759d9a6d49829288a0e546282d284b7e

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101735760003560e01c80636afc0c5f116100de57806391d1485411610097578063ca15c87311610071578063ca15c87314610386578063cd10534b14610399578063d547741f146103ac578063ec87621c146103bf57600080fd5b806391d14854146103585780639e55378e1461036b578063a217fddf1461037e57600080fd5b80636afc0c5f146102cc5780636f3703ff146102e157806374d0e2b0146102f45780637d1a944c1461032a57806380b57fd1146103325780639010d07c1461034557600080fd5b8063386da39d11610130578063386da39d146102375780633ea232e11461024a57806347f56b691461026c5780634bc02da61461027f578063624a8da7146102a657806364345789146102b957600080fd5b806301ffc9a71461017857806304011f9b146101a05780631dcbad03146101c1578063248a9ca3146101ec5780632f2ff15d1461020f57806336568abe14610224575b600080fd5b61018b610186366004611321565b6103d4565b60405190151581526020015b60405180910390f35b6101b36101ae366004611367565b6103ff565b604051908152602001610197565b6009546101d4906001600160a01b031681565b6040516001600160a01b039091168152602001610197565b6101b36101fa3660046113a3565b60009081526020819052604090206001015490565b61022261021d3660046113bc565b6105f3565b005b6102226102323660046113bc565b61061e565b6007546101d4906001600160a01b031681565b61025d6102583660046113e8565b61069c565b60405161019793929190611456565b61022261027a3660046114b6565b61080e565b6101b37f9d56108290ea0bc9c5c59c3ad357dca9d1b29ed7f3ae1443bef2fa2159bdf5e881565b6008546101d4906001600160a01b031681565b6102226102c73660046114fa565b610a0e565b6102d4610a6b565b6040516101979190611515565b6102226102ef3660046114fa565b610a7c565b6101b36103023660046113e8565b6001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6102d4610ad9565b610222610340366004611528565b610ae5565b6101d461035336600461155b565b610c50565b61018b6103663660046113bc565b610c68565b6102226103793660046114fa565b610c91565b6101b3600081565b6101b36103943660046113a3565b610cee565b6102226103a73660046114fa565b610d05565b6102226103ba3660046113bc565b610d62565b6101b360008051602061172c83398151915281565b60006001600160e01b03198216635a05180f60e01b14806103f957506103f982610e21565b92915050565b600061040c600285610e56565b6104725760405162461bcd60e51b815260206004820152602c60248201527f676574436f6e73756d6564546f6b656e3a204e6f7420616e20617070726f766560448201526b321031b7b63632b1ba34b7b760a11b60648201526084015b60405180910390fd5b61047d600483610e56565b6104d95760405162461bcd60e51b815260206004820152602760248201527f676574436f6e73756d6564546f6b656e3a204e6f7420616e20617070726f766560448201526632103a37b5b2b760c91b6064820152608401610469565b6007546001600160a01b03858116911614801561050357506008546001600160a01b038381169116145b156105b8576009546040516302abc55b60e41b8152600481018590526001600160a01b0390911690632abc55b090602401602060405180830381865afa158015610551573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610575919061157d565b6001600160a01b038086166000908152600660209081526040808320888452825280832093871683526001909301905220546105b191906115ac565b90506105ec565b506001600160a01b038084166000908152600660209081526040808320868452825280832093851683526001909301905220545b9392505050565b60008281526020819052604090206001015461060f8133610e78565b6106198383610edc565b505050565b6001600160a01b038116331461068e5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610469565b6106988282610efe565b5050565b6060806000806106ac6004610f20565b67ffffffffffffffff8111156106c4576106c46115c4565b6040519080825280602002602001820160405280156106ed578160200160208202803683370190505b50905060006106fc6004610f20565b67ffffffffffffffff811115610714576107146115c4565b60405190808252806020026020018201604052801561073d578160200160208202803683370190505b50905060005b61074d6004610f20565b8110156107da5761075f600482610f2a565b828281518110610771576107716115da565b60200260200101906001600160a01b031690816001600160a01b0316815250506107b588888484815181106107a8576107a86115da565b60200260200101516103ff565b8382815181106107c7576107c76115da565b6020908102919091010152600101610743565b506001600160a01b038716600090815260066020908152604080832089845290915290205490945090925090509250925092565b7f9d56108290ea0bc9c5c59c3ad357dca9d1b29ed7f3ae1443bef2fa2159bdf5e86108398133610e78565b610844600286610e56565b6108a55760405162461bcd60e51b815260206004820152602c60248201527f746f6b656e436f6e73756d7074696f6e3a204e6f7420616e20617070726f766560448201526b321031b7b63632b1ba34b7b760a11b6064820152608401610469565b6108b0600484610e56565b61090c5760405162461bcd60e51b815260206004820152602760248201527f746f6b656e436f6e73756d7074696f6e3a204e6f7420616e20617070726f766560448201526632103a37b5b2b760c91b6064820152608401610469565b6000821161096f5760405162461bcd60e51b815260206004820152602a60248201527f746f6b656e436f6e73756d7074696f6e3a206d75737420636f6e73756d65206d60448201526906f7265207468616e20360b41b6064820152608401610469565b6001600160a01b038086166000908152600660209081526040808320888452825280832093871683526001909301905290812080548492906109b29084906115ac565b92505081905550826001600160a01b031684866001600160a01b03167fdb3f50cb9f21c8e0bcb41b350299e44aae958c269cb83b3c4d43cc416af0cfeb856040516109ff91815260200190565b60405180910390a45050505050565b60008051602061172c833981519152610a278133610e78565b610a32600483610f36565b506040516001600160a01b038316907f4c910b69fe65a61f7531b9c5042b2329ca7179c77290aa7e2eb3afa3c8511fd390600090a25050565b6060610a776004610f4b565b905090565b60008051602061172c833981519152610a958133610e78565b610aa0600283610e0c565b506040516001600160a01b038316907f7701426aaa4c0c88a30924a7aba88dce66b18c4020b54e4e19c9e0eb0abc299290600090a25050565b6060610a776002610f4b565b7f9d56108290ea0bc9c5c59c3ad357dca9d1b29ed7f3ae1443bef2fa2159bdf5e8610b108133610e78565b610b1b600285610e56565b610b765760405162461bcd60e51b815260206004820152602660248201527f636f6e73756d654554483a204e6f7420616e20617070726f76656420636f6c6c60448201526532b1ba34b7b760d11b6064820152608401610469565b60008211610bd25760405162461bcd60e51b8152602060048201526024808201527f636f6e73756d654554483a206d75737420636f6e73756d65206d6f72652074686044820152630616e20360e41b6064820152608401610469565b6001600160a01b038416600090815260066020908152604080832086845290915281208054849290610c059084906115ac565b909155505060405182815283906001600160a01b038616907fe18e4a0e38d140197a83439dfe8adf43a29759042448678159d52dd6670831ce9060200160405180910390a350505050565b60008281526001602052604081206105ec9083610f2a565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60008051602061172c833981519152610caa8133610e78565b610cb5600283610f36565b506040516001600160a01b038316907fa0691bd707b2f65c33c8343d61c274df72c6b5007937dcfbc31aa5a0d0f6fe3c90600090a25050565b60008181526001602052604081206103f990610f20565b60008051602061172c833981519152610d1e8133610e78565b610d29600483610e0c565b506040516001600160a01b038316907f784c8f4dbf0ffedd6e72c76501c545a70f8b203b30a26ce542bf92ba87c248a490600090a25050565b600082815260208190526040902060010154610d7e8133610e78565b6106198383610efe565b610d928282610c68565b610698576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610dc83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006105ec836001600160a01b038416610f58565b60006001600160e01b03198216637965db0b60e01b14806103f957506301ffc9a760e01b6001600160e01b03198316146103f9565b6001600160a01b038116600090815260018301602052604081205415156105ec565b610e828282610c68565b61069857610e9a816001600160a01b03166014610fa7565b610ea5836020610fa7565b604051602001610eb6929190611620565b60408051601f198184030181529082905262461bcd60e51b825261046991600401611695565b610ee68282610d88565b60008281526001602052604090206106199082610e0c565b610f088282611143565b60008281526001602052604090206106199082610f36565b60006103f9825490565b60006105ec83836111a8565b60006105ec836001600160a01b0384166111d2565b606060006105ec836112c5565b6000818152600183016020526040812054610f9f575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556103f9565b5060006103f9565b60606000610fb68360026116c8565b610fc19060026115ac565b67ffffffffffffffff811115610fd957610fd96115c4565b6040519080825280601f01601f191660200182016040528015611003576020820181803683370190505b509050600360fc1b8160008151811061101e5761101e6115da565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061104d5761104d6115da565b60200101906001600160f81b031916908160001a90535060006110718460026116c8565b61107c9060016115ac565b90505b60018111156110f4576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106110b0576110b06115da565b1a60f81b8282815181106110c6576110c66115da565b60200101906001600160f81b031916908160001a90535060049490941c936110ed816116e7565b905061107f565b5083156105ec5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610469565b61114d8282610c68565b15610698576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008260000182815481106111bf576111bf6115da565b9060005260206000200154905092915050565b600081815260018301602052604081205480156112bb5760006111f66001836116fe565b855490915060009061120a906001906116fe565b905081811461126f57600086600001828154811061122a5761122a6115da565b906000526020600020015490508087600001848154811061124d5761124d6115da565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061128057611280611715565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506103f9565b60009150506103f9565b60608160000180548060200260200160405190810160405280929190818152602001828054801561131557602002820191906000526020600020905b815481526020019060010190808311611301575b50505050509050919050565b60006020828403121561133357600080fd5b81356001600160e01b0319811681146105ec57600080fd5b80356001600160a01b038116811461136257600080fd5b919050565b60008060006060848603121561137c57600080fd5b6113858461134b565b92506020840135915061139a6040850161134b565b90509250925092565b6000602082840312156113b557600080fd5b5035919050565b600080604083850312156113cf57600080fd5b823591506113df6020840161134b565b90509250929050565b600080604083850312156113fb57600080fd5b6114048361134b565b946020939093013593505050565b600081518084526020808501945080840160005b8381101561144b5781516001600160a01b031687529582019590820190600101611426565b509495945050505050565b6060815260006114696060830186611412565b82810360208481019190915285518083528682019282019060005b818110156114a057845183529383019391830191600101611484565b5050809350505050826040830152949350505050565b600080600080608085870312156114cc57600080fd5b6114d58561134b565b9350602085013592506114ea6040860161134b565b9396929550929360600135925050565b60006020828403121561150c57600080fd5b6105ec8261134b565b6020815260006105ec6020830184611412565b60008060006060848603121561153d57600080fd5b6115468461134b565b95602085013595506040909401359392505050565b6000806040838503121561156e57600080fd5b50508035926020909101359150565b60006020828403121561158f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600082198211156115bf576115bf611596565b500190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60005b8381101561160b5781810151838201526020016115f3565b8381111561161a576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516116588160178501602088016115f0565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516116898160288401602088016115f0565b01602801949350505050565b60208152600082518060208401526116b48160408501602087016115f0565b601f01601f19169190910160400192915050565b60008160001904831182151516156116e2576116e2611596565b500290565b6000816116f6576116f6611596565b506000190190565b60008282101561171057611710611596565b500390565b634e487b7160e01b600052603160045260246000fdfe241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08a2646970667358221220c70e8f437d349e38462fcaf72ab09be20485087cde43ce1c7a9b6feb6b5095f764736f6c634300080e0033

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

00000000000000000000000087084ec881d5a15c918057f326790db177d218f200000000000000000000000033b4fe5e40e4903a0849ca97b3292eac3eb0aa36000000000000000000000000628bec3f759d9a6d49829288a0e546282d284b7e

-----Decoded View---------------
Arg [0] : _fancyBearContract (address): 0x87084ec881d5A15C918057F326790dB177D218F2
Arg [1] : _honeyContract (address): 0x33B4fE5e40E4903A0849cA97B3292eac3EB0aA36
Arg [2] : _honeyConsumptionContract (address): 0x628BEC3f759D9a6d49829288a0E546282d284b7E

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000087084ec881d5a15c918057f326790db177d218f2
Arg [1] : 00000000000000000000000033b4fe5e40e4903a0849ca97b3292eac3eb0aa36
Arg [2] : 000000000000000000000000628bec3f759d9a6d49829288a0e546282d284b7e


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.