ETH Price: $3,681.42 (+1.36%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Party

Compiler Version
v0.8.11+commit.d7f03943

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 32 : Party.sol
// SPDX-License-Identifier: MIT

/// @title RaidParty Party Contract

/**
 *   ___      _    _ ___          _
 *  | _ \__ _(_)__| | _ \__ _ _ _| |_ _  _
 *  |   / _` | / _` |  _/ _` | '_|  _| || |
 *  |_|_\__,_|_\__,_|_| \__,_|_|  \__|\_, |
 *                                    |__/
 */

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/utils/ERC1155ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "../utils/Enhancer.sol";
import "../interfaces/IParty.sol";
import "../interfaces/IDamageCalculator.sol";
import "../interfaces/IHero.sol";
import "../interfaces/IFighter.sol";
import "../interfaces/IEnhanceable.sol";
import "../interfaces/IRaid.sol";
import "../lib/Damage.sol";

contract Party is
    IParty,
    Initializable,
    AccessControlUpgradeable,
    Enhancer,
    ERC1155ReceiverUpgradeable,
    ERC721HolderUpgradeable
{
    using Damage for Damage.DamageComponent;

    uint256 private constant FIGHTER_SLOTS = 16;

    IRaid private _raid;
    IDamageCalculator private _damageCalculator;
    IHero private _hero;
    IFighter private _fighter;
    IERC20Upgradeable private _confetti;

    mapping(address => mapping(uint256 => address)) private _ownership;
    mapping(address => PartyData) private _parties;
    mapping(address => Damage.DamageComponent) private _damage;

    function initialize(
        address admin,
        IERC20Upgradeable confetti,
        IHero hero,
        IFighter fighter,
        IDamageCalculator damageCalculator
    ) external initializer {
        __AccessControl_init();
        _confetti = confetti;
        _hero = hero;
        _fighter = fighter;
        _damageCalculator = damageCalculator;
        _setupRole(DEFAULT_ADMIN_ROLE, admin);
    }

    /** Getters / Setters */

    function getHero() external view returns (IHero) {
        return _hero;
    }

    function getFighter() external view returns (IFighter) {
        return _fighter;
    }

    function getDamageCalculator() external view returns (IDamageCalculator) {
        return _damageCalculator;
    }

    function setDamageCalculator(IDamageCalculator calculator)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        _damageCalculator = calculator;
    }

    function getRaid() external view returns (IRaid) {
        return _raid;
    }

    function setRaid(IRaid raid) external onlyRole(DEFAULT_ADMIN_ROLE) {
        _raid = raid;
    }

    function getConfetti() external view returns (IERC20Upgradeable) {
        return _confetti;
    }

    function getUserHero(address user)
        external
        view
        override
        returns (uint256)
    {
        return _parties[user].hero;
    }

    function getUserFighters(address user)
        public
        view
        override
        returns (uint256[] memory)
    {
        uint256[] memory fighters = new uint256[](FIGHTER_SLOTS);
        for (uint8 i = 0; i < FIGHTER_SLOTS; i++) {
            fighters[i] = _parties[user].fighters[i];
        }
        return fighters;
    }

    function getDamage(address user) external view override returns (uint32) {
        return _getDamage(user);
    }

    /** UTILITY */

    // Force update damage
    function updateDamage() external {
        uint32 dmg = uint32(_getDamage(msg.sender));
        _raid.updateDamage(msg.sender, dmg);

        emit DamageUpdated(msg.sender, dmg);
    }

    // Enhances a given item (hero / fighter) without requiring the token be withdrawn
    function enhance(
        Property item,
        uint8 slot,
        uint256 burnTokenId
    ) external {
        require(
            item == Property.HERO || item == Property.FIGHTER,
            "Party::enhance: invalid item"
        );

        IEnhanceable handler;
        uint256 tokenId;
        IERC721Upgradeable token;

        if (item == Property.HERO) {
            require(
                _parties[msg.sender].hero != 0,
                "Party::enhance: hero not present"
            );

            token = IERC721Upgradeable(address(_hero));
            handler = IEnhanceable(address(_hero.getHandler()));
            tokenId = _parties[msg.sender].hero;
        } else {
            require(
                _parties[msg.sender].fighters[slot] != 0,
                "Party::enhance: fighter not present"
            );

            token = IERC721Upgradeable(address(_fighter));
            handler = IEnhanceable(address(_fighter.getHandler()));
            tokenId = _parties[msg.sender].fighters[slot];
        }

        (uint256 cost, bool shouldBurn) = handler.enhancementCost(tokenId);

        if (shouldBurn) {
            token.safeTransferFrom(msg.sender, address(this), burnTokenId);
            token.approve(address(handler), burnTokenId);
        }

        _confetti.transferFrom(msg.sender, address(this), cost);
        _confetti.approve(address(handler), cost);
        handler.enhance(tokenId, burnTokenId);
    }

    // Act applies multiple actions (equip / unequip) for batch execution
    function act(
        Action[] calldata heroActions,
        Action[] calldata fighterActions
    ) external override {
        require(heroActions.length <= 1, "Party::act: too many hero actions");

        uint256[] memory heroesEquipped;
        uint256[] memory heroesUnequipped;
        uint256[] memory fightersEquipped;
        uint256[] memory fightersUnequipped;

        if (heroActions.length > 0) {
            (heroesEquipped, heroesUnequipped) = _act(
                Property.HERO,
                heroActions
            );
        }

        if (fighterActions.length > 0) {
            (fightersEquipped, fightersUnequipped) = _act(
                Property.FIGHTER,
                fighterActions
            );
        }

        if (heroesEquipped.length > 0) {
            _validateParty(msg.sender);
        }

        Damage.DamageComponent[] memory curr = _damageCalculator
            .getDamageComponents(heroesEquipped, fightersEquipped);

        Damage.DamageComponent[] memory prev = _damageCalculator
            .getDamageComponents(heroesUnequipped, fightersUnequipped);

        _updateDamage(msg.sender, prev, curr);
    }

    // Equip applies an item to the callers party
    function equip(
        Property item,
        uint256 id,
        uint8 slot
    ) public override {
        uint256 unequipped = _equip(item, id, slot);

        Damage.DamageComponent[] memory prev;
        Damage.DamageComponent[] memory curr = new Damage.DamageComponent[](1);

        if (unequipped != 0) {
            prev = new Damage.DamageComponent[](1);
        }

        if (item == Property.HERO) {
            if (unequipped != 0) {
                prev[0] = _damageCalculator.getHeroDamageComponent(unequipped);
            }

            curr[0] = _damageCalculator.getHeroDamageComponent(id);
            _validateParty(msg.sender);
        } else if (item == Property.FIGHTER) {
            if (unequipped != 0) {
                prev[0] = _damageCalculator.getFighterDamageComponent(
                    unequipped
                );
            }

            curr[0] = _damageCalculator.getFighterDamageComponent(id);
        }

        _updateDamage(msg.sender, prev, curr);
    }

    // Unequip removes an item from the callers party
    function unequip(Property item, uint8 slot) public override {
        uint256 unequipped = _unequip(item, slot);
        Damage.DamageComponent[] memory prev = new Damage.DamageComponent[](1);

        if (item == Property.HERO) {
            prev[0] = _damageCalculator.getHeroDamageComponent(unequipped);
        } else if (item == Property.FIGHTER) {
            prev[0] = _damageCalculator.getFighterDamageComponent(unequipped);
        }

        _updateDamage(msg.sender, prev, new Damage.DamageComponent[](0));
    }

    // TODO: return excess fighters if psize decreases
    // Callback for damage updates upon enhancement
    function onEnhancement(uint256[] calldata ids, uint8[] calldata prev)
        public
        override
        returns (bytes4)
    {
        require(
            msg.sender == address(_fighter.getHandler()) ||
                msg.sender == address(_hero.getHandler()),
            "Party::onEnhancement: sender must be fighter or hero"
        );

        if (msg.sender == address(_hero.getHandler())) {
            _updateDamageEnhancement(Property.HERO, ids, prev);
        } else {
            _updateDamageEnhancement(Property.FIGHTER, ids, prev);
        }

        return super.onEnhancement(ids, prev);
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(AccessControlUpgradeable, ERC1155ReceiverUpgradeable)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes calldata
    ) external pure override returns (bytes4) {
        return IERC1155ReceiverUpgradeable.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] calldata,
        uint256[] calldata,
        bytes calldata
    ) external pure override returns (bytes4) {
        return IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector;
    }

    /** INTERNAL */

    // Compute a damage update given an array of components
    function _updateDamage(
        address user,
        Damage.DamageComponent[] memory prev,
        Damage.DamageComponent[] memory curr
    ) internal {
        _damage[user] = _damage[user].getDamageUpdate(prev, curr);

        uint32 dmg = uint32(_getDamage(user));
        _raid.updateDamage(user, dmg);

        emit DamageUpdated(user, dmg);
    }

    // Compute damage update given a prev enhancement value
    function _updateDamageEnhancement(
        Property item,
        uint256[] memory ids,
        uint8[] memory prev
    ) internal {
        require(
            item == Property.HERO || item == Property.FIGHTER,
            "Party::_updateDamageEnhancement: invalid item"
        );
        require(
            ids.length == prev.length,
            "Party::onEnhancement: input length mismatch"
        );
        address token;

        if (item == Property.HERO) {
            token = address(_hero);
        } else {
            token = address(_fighter);
        }

        address owner = _ownership[token][ids[0]];
        for (uint256 i = 0; i < ids.length; i++) {
            require(
                _ownership[address(token)][ids[i]] == owner,
                "Party::onEnhancement: tokens not owned by the same user"
            );
        }

        // Check if party size was downgraded
        if (item == Property.HERO && prev[0] >= 5) {
            IHeroURIHandler handler = IHeroURIHandler(_hero.getHandler());
            Stats.HeroStats memory stats = handler.getStats(ids[0]);
            if (
                stats.enhancement < prev[0] &&
                _parties[owner].fighters[stats.partySize] != 0
            ) {
                Damage.DamageComponent[]
                    memory adjustPrev = new Damage.DamageComponent[](1);
                uint256 u = _unequip(Property.FIGHTER, stats.partySize);
                adjustPrev[0] = _damageCalculator.getFighterDamageComponent(u);
                _updateDamage(
                    owner,
                    adjustPrev,
                    new Damage.DamageComponent[](0)
                );
            }
        }

        Damage.DamageComponent[] memory prevComponents;
        Damage.DamageComponent[] memory currComponents;

        if (item == Property.HERO) {
            prevComponents = _damageCalculator.getHeroEnhancementComponents(
                ids,
                prev
            );
            currComponents = _damageCalculator.getDamageComponents(
                ids,
                new uint256[](0)
            );
        } else {
            prevComponents = _damageCalculator.getFighterEnhancementComponents(
                ids,
                prev
            );
            currComponents = _damageCalculator.getDamageComponents(
                new uint256[](0),
                ids
            );
        }

        _damage[owner] = _damage[owner].getDamageUpdate(
            prevComponents,
            currComponents
        );

        uint32 dpb = uint32(_getDamage(owner));
        _raid.updateDamage(owner, dpb);

        emit DamageUpdated(owner, dpb);
    }

    function _equip(
        Property item,
        uint256 id,
        uint8 slot
    ) internal returns (uint256 unequipped) {
        require(
            item == Property.HERO || item == Property.FIGHTER,
            "Party::enhance: invalid item"
        );

        if (item == Property.HERO) {
            // Handle hero equip
            if (_parties[msg.sender].hero != 0) {
                unequipped = _unequip(item, 0);
            }

            _ownership[address(_hero)][id] = msg.sender;
            _parties[msg.sender].hero = id;
            _hero.safeTransferFrom(msg.sender, address(this), id);
        } else if (item == Property.FIGHTER) {
            // Handle fighter equip
            Stats.HeroStats memory stats = IHeroURIHandler(_hero.getHandler())
                .getStats(_parties[msg.sender].hero);
            require(slot < stats.partySize, "Party::equip: bad slot");

            if (_parties[msg.sender].fighters[slot] != 0) {
                unequipped = _unequip(item, slot);
            }

            _ownership[address(_fighter)][id] = msg.sender;
            _parties[msg.sender].fighters[slot] = id;
            _fighter.safeTransferFrom(msg.sender, address(this), id);
        }

        emit Equipped(msg.sender, uint8(item), slot, id);
    }

    function _unequip(Property item, uint8 slot) internal returns (uint256 id) {
        require(
            item == Property.HERO || item == Property.FIGHTER,
            "Party::enhance: invalid item"
        );

        id = 0;

        if (item == Property.HERO) {
            id = _parties[msg.sender].hero;
            require(id != 0, "Party::unequip: hero not present");

            _parties[msg.sender].hero = 0;
            _ownership[address(_hero)][id] = address(0);
            _hero.safeTransferFrom(address(this), msg.sender, id);
        } else if (item == Property.FIGHTER) {
            id = _parties[msg.sender].fighters[slot];
            require(id != 0, "Party::unequip: fighter not present");

            _parties[msg.sender].fighters[slot] = 0;
            _ownership[address(_fighter)][id] = address(0);
            _fighter.safeTransferFrom(address(this), msg.sender, id);
        }

        emit Unequipped(msg.sender, uint8(item), slot, id);
    }

    function _act(Property item, Action[] calldata actions)
        internal
        returns (uint256[] memory, uint256[] memory)
    {
        uint256[] memory equipped = new uint256[](actions.length);
        uint256[] memory unequipped = new uint256[](actions.length);

        uint256 u = 0;

        (uint256 equipCounter, uint256 unequipCounter) = (0, 0);

        // Perform actions
        for (uint256 i = 0; i < actions.length; i++) {
            if (actions[i].action == ActionType.EQUIP) {
                u = _equip(item, actions[i].id, actions[i].slot);

                equipped[equipCounter] = actions[i].id;
                equipCounter += 1;
            } else {
                u = _unequip(item, actions[i].slot);
            }

            if (u != 0) {
                unequipped[unequipCounter] = u;
                unequipCounter += 1;
            }
        }

        // Reset counters and resize arrays
        assembly {
            mstore(
                equipped,
                sub(mload(equipped), sub(actions.length, equipCounter))
            )
            mstore(
                unequipped,
                sub(mload(unequipped), sub(actions.length, unequipCounter))
            )
        }

        return (equipped, unequipped);
    }

    function _validateParty(address user) internal view {
        Stats.HeroStats memory stats = IHeroURIHandler(_hero.getHandler())
            .getStats(_parties[user].hero);

        for (uint256 i = stats.partySize; i < FIGHTER_SLOTS; i++) {
            require(
                _parties[user].fighters[i] == 0,
                "Party::_equip: hero slot mismatch"
            );
        }
    }

    function _getDamage(address user) internal view returns (uint32) {
        uint256 heroId = _parties[user].hero;
        uint32 adj;

        if (heroId == 0) {
            return 0;
        } else if (heroId <= 1111) {
            adj = 1100;
        } else {
            adj = 800;
        }

        return uint32(_damage[user].computeDamage()) + adj;
    }
}

File 2 of 32 : 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));
    }
}

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

File 4 of 32 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __AccessControl_init_unchained();
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    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(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
    }

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

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

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

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

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

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been 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());
        }
    }
    uint256[49] private __gap;
}

File 5 of 32 : ERC1155ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../IERC1155ReceiverUpgradeable.sol";
import "../../../utils/introspection/ERC165Upgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev _Available since v3.1._
 */
abstract contract ERC1155ReceiverUpgradeable is Initializable, ERC165Upgradeable, IERC1155ReceiverUpgradeable {
    function __ERC1155Receiver_init() internal onlyInitializing {
        __ERC165_init_unchained();
        __ERC1155Receiver_init_unchained();
    }

    function __ERC1155Receiver_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {
        return interfaceId == type(IERC1155ReceiverUpgradeable).interfaceId || super.supportsInterface(interfaceId);
    }
    uint256[50] private __gap;
}

File 6 of 32 : ERC721HolderUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721HolderUpgradeable is Initializable, IERC721ReceiverUpgradeable {
    function __ERC721Holder_init() internal onlyInitializing {
        __ERC721Holder_init_unchained();
    }

    function __ERC721Holder_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
    uint256[50] private __gap;
}

File 7 of 32 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165Upgradeable.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721Upgradeable is IERC165Upgradeable {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 8 of 32 : Enhancer.sol
// SPDX-License-Identifier: MIT

/// @title RaidParty Helper Contract for Enhancers

/**
 *   ___      _    _ ___          _
 *  | _ \__ _(_)__| | _ \__ _ _ _| |_ _  _
 *  |   / _` | / _` |  _/ _` | '_|  _| || |
 *  |_|_\__,_|_\__,_|_| \__,_|_|  \__|\_, |
 *                                    |__/
 */

pragma solidity ^0.8.0;

import "../interfaces/IEnhancer.sol";

contract Enhancer is IEnhancer {
    function onEnhancement(uint256[] calldata, uint8[] calldata)
        public
        virtual
        override
        returns (bytes4)
    {
        return this.onEnhancement.selector;
    }
}

File 9 of 32 : IParty.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../lib/Stats.sol";

interface IParty {
    event Equipped(address indexed user, uint8 item, uint8 slot, uint256 id);

    event Unequipped(address indexed user, uint8 item, uint8 slot, uint256 id);

    event DamageUpdated(address indexed user, uint32 damageCurr);

    struct PartyData {
        uint256 hero;
        mapping(uint256 => uint256) fighters;
    }

    struct Action {
        ActionType action;
        uint256 id;
        uint8 slot;
    }

    enum Property {
        HERO,
        FIGHTER
    }

    enum ActionType {
        UNEQUIP,
        EQUIP
    }

    function act(
        Action[] calldata heroActions,
        Action[] calldata fighterActions
    ) external;

    function equip(
        Property item,
        uint256 id,
        uint8 slot
    ) external;

    function unequip(Property item, uint8 slot) external;

    function enhance(
        Property item,
        uint8 slot,
        uint256 burnTokenId
    ) external;

    function getUserHero(address user) external view returns (uint256);

    function getUserFighters(address user)
        external
        view
        returns (uint256[] memory);

    function getDamage(address user) external view returns (uint32);
}

File 10 of 32 : IDamageCalculator.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../lib/Stats.sol";
import "../lib/Damage.sol";

interface IDamageCalculator {
    function getDamageComponents(
        uint256[] calldata heroIds,
        uint256[] calldata fighterIds
    ) external view returns (Damage.DamageComponent[] memory);

    function getHeroEnhancementComponents(
        uint256[] calldata ids,
        uint8[] calldata prev
    ) external view returns (Damage.DamageComponent[] memory);

    function getFighterEnhancementComponents(
        uint256[] calldata ids,
        uint8[] calldata prev
    ) external view returns (Damage.DamageComponent[] memory);

    function getHeroDamageComponent(uint256 id)
        external
        view
        returns (Damage.DamageComponent memory);

    function getFighterDamageComponent(uint256 id)
        external
        view
        returns (Damage.DamageComponent memory);
}

File 11 of 32 : IHero.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IRaidERC721.sol";
import "./IHeroURIHandler.sol";
import "./ISeeder.sol";

interface IHero is IRaidERC721 {
    event HandlerUpdated(address indexed caller, address indexed handler);

    function setHandler(IHeroURIHandler handler) external;

    function getHandler() external view returns (address);

    function getSeeder() external view returns (address);
}

File 12 of 32 : IFighter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IRaidERC721.sol";
import "./IFighterURIHandler.sol";
import "./ISeeder.sol";

interface IFighter is IRaidERC721 {
    event HandlerUpdated(address indexed caller, address indexed handler);

    function setHandler(IFighterURIHandler handler) external;

    function getHandler() external view returns (address);

    function getSeeder() external view returns (address);
}

File 13 of 32 : IEnhanceable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IEnhanceable {
    struct EnhancementRequest {
        uint256 id;
        address requester;
    }

    event EnhancementRequested(
        uint256 indexed tokenId,
        uint256 indexed timestamp
    );

    event EnhancementCompleted(
        uint256 indexed tokenId,
        uint256 indexed timestamp,
        bool success,
        bool degraded
    );

    event SeederUpdated(address indexed caller, address indexed seeder);

    function enhancementCost(uint256 tokenId)
        external
        view
        returns (uint256, bool);

    function enhance(uint256 tokenId, uint256 burnTokenId) external;
}

File 14 of 32 : IRaid.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IRaid {
    struct Round {
        uint16 boss;
        uint32 roll;
        uint32 startBlock;
        uint32 finalBlock;
    }

    struct Raider {
        uint32 dpb;
        uint32 startedAt;
        uint32 startBlock;
        uint32 startRound;
        uint32 startSnapshot;
        uint256 pendingRewards;
    }

    struct Boss {
        uint32 weight;
        uint32 blockHealth;
        uint128 multiplier;
    }

    struct Snapshot {
        uint32 initialBlock;
        uint32 initialRound;
        uint32 finalBlock;
        uint32 finalRound;
        uint256 attackDealt;
    }

    struct RaidData {
        uint16 boss;
        uint32 roundId;
        uint32 health;
        uint32 maxHealth;
        uint256 seed;
    }

    function updateDamage(address user, uint32 _dpb) external;
}

File 15 of 32 : Damage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library Damage {
    struct DamageComponent {
        uint32 m;
        uint32 d;
    }

    uint256 public constant PRECISION = 10;

    function computeDamage(DamageComponent memory dmg)
        public
        pure
        returns (uint256)
    {
        return (dmg.m * dmg.d) / PRECISION;
    }

    // This function assumes a hero is equipped after state change
    function getDamageUpdate(
        Damage.DamageComponent calldata dmg,
        Damage.DamageComponent[] calldata removed,
        Damage.DamageComponent[] calldata added
    ) public pure returns (Damage.DamageComponent memory) {
        Damage.DamageComponent memory updatedDmg = Damage.DamageComponent(
            dmg.m,
            dmg.d
        );

        for (uint256 i = 0; i < removed.length; i++) {
            updatedDmg.m -= removed[i].m;
            updatedDmg.d -= removed[i].d;
        }

        for (uint256 i = 0; i < added.length; i++) {
            updatedDmg.m += added[i].m;
            updatedDmg.d += added[i].d;
        }

        return updatedDmg;
    }

    // This function assumes a hero is equipped after state change
    function getDamageUpdate(
        Damage.DamageComponent calldata dmg,
        Damage.DamageComponent calldata removed,
        Damage.DamageComponent calldata added
    ) public pure returns (Damage.DamageComponent memory) {
        Damage.DamageComponent memory updatedDmg = Damage.DamageComponent(
            dmg.m,
            dmg.d
        );

        updatedDmg.m -= removed.m;
        updatedDmg.d -= removed.d;

        updatedDmg.m += added.m;
        updatedDmg.d += added.d;

        return updatedDmg;
    }
}

File 16 of 32 : 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);
            }
        }
    }
}

File 17 of 32 : IAccessControlUpgradeable.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 IAccessControlUpgradeable {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

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

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

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

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

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

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

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

File 18 of 32 : 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;
}

File 19 of 32 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    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 20 of 32 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
        __ERC165_init_unchained();
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }
    uint256[50] private __gap;
}

File 21 of 32 : IERC165Upgradeable.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 IERC165Upgradeable {
    /**
     * @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 22 of 32 : IERC1155ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165Upgradeable.sol";

/**
 * @dev _Available since v3.1._
 */
interface IERC1155ReceiverUpgradeable is IERC165Upgradeable {
    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        To accept the transfer, this must return
        `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
        (i.e. 0xf23a6e61, or its own function selector).
        @param operator The address which initiated the transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param id The ID of the token being transferred
        @param value The amount of tokens being transferred
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
    */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
        @dev Handles the receipt of a multiple ERC1155 token types. This function
        is called at the end of a `safeBatchTransferFrom` after the balances have
        been updated. To accept the transfer(s), this must return
        `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
        (i.e. 0xbc197c81, or its own function selector).
        @param operator The address which initiated the batch transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param ids An array containing ids of each token being transferred (order and length must match values array)
        @param values An array containing amounts of each token being transferred (order and length must match ids array)
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
    */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 23 of 32 : IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721ReceiverUpgradeable {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 24 of 32 : IEnhancer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IEnhancer {
    function onEnhancement(uint256[] calldata, uint8[] calldata)
        external
        returns (bytes4);
}

File 25 of 32 : Stats.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library Stats {
    struct HeroStats {
        uint8 dmgMultiplier;
        uint8 partySize;
        uint8 enhancement;
    }

    struct FighterStats {
        uint32 dmg;
        uint8 enhancement;
    }

    struct EquipmentStats {
        uint32 dmg;
        uint8 dmgMultiplier;
        uint8 slot;
    }
}

File 26 of 32 : IRaidERC721.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";

interface IRaidERC721 is IERC721 {
    function getSeeder() external view returns (address);

    function burn(uint256 tokenId) external;

    function tokensOfOwner(address owner)
        external
        view
        returns (uint256[] memory);

    function mint(address owner, uint256 amount) external;
}

File 27 of 32 : IHeroURIHandler.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IEnhanceable.sol";
import "../lib/Stats.sol";

interface IHeroURIHandler is IEnhanceable {
    function tokenURI(uint256 tokenId) external view returns (string memory);

    function getStats(uint256 tokenId)
        external
        view
        returns (Stats.HeroStats memory);

    function getSeeder() external view returns (address);
}

File 28 of 32 : ISeeder.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../lib/Randomness.sol";

interface ISeeder {
    event Requested(address indexed origin, uint256 indexed identifier);

    event Seeded(bytes32 identifier, uint256 randomness);

    function getIdReferenceCount(
        bytes32 randomnessId,
        address origin,
        uint256 startIdx
    ) external view returns (uint256);

    function getIdentifiers(
        bytes32 randomnessId,
        address origin,
        uint256 startIdx,
        uint256 count
    ) external view returns (uint256[] memory);

    function requestSeed(uint256 identifier) external;

    function getSeed(address origin, uint256 identifier)
        external
        view
        returns (uint256);

    function getSeedSafe(address origin, uint256 identifier)
        external
        view
        returns (uint256);

    function executeRequestMulti() external;

    function isSeeded(address origin, uint256 identifier)
        external
        view
        returns (bool);

    function setFee(uint256 fee) external;

    function getFee() external view returns (uint256);

    function getData(address origin, uint256 identifier)
        external
        view
        returns (Randomness.SeedData memory);
}

File 29 of 32 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 30 of 32 : 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 31 of 32 : Randomness.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library Randomness {
    struct SeedData {
        uint256 batch;
        bytes32 randomnessId;
    }
}

File 32 of 32 : IFighterURIHandler.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IEnhanceable.sol";
import "../lib/Stats.sol";

interface IFighterURIHandler is IEnhanceable {
    function tokenURI(uint256 tokenId) external view returns (string memory);

    function getStats(uint256 tokenId)
        external
        view
        returns (Stats.FighterStats memory);

    function getSeeder() external view returns (address);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {
    "contracts/lib/Damage.sol": {
      "Damage": "0x9636708935a7b19523556dd1e5ae84a44bf48451"
    }
  }
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint32","name":"damageCurr","type":"uint32"}],"name":"DamageUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint8","name":"item","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"slot","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Equipped","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":"user","type":"address"},{"indexed":false,"internalType":"uint8","name":"item","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"slot","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Unequipped","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"enum IParty.ActionType","name":"action","type":"uint8"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint8","name":"slot","type":"uint8"}],"internalType":"struct IParty.Action[]","name":"heroActions","type":"tuple[]"},{"components":[{"internalType":"enum IParty.ActionType","name":"action","type":"uint8"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint8","name":"slot","type":"uint8"}],"internalType":"struct IParty.Action[]","name":"fighterActions","type":"tuple[]"}],"name":"act","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum IParty.Property","name":"item","type":"uint8"},{"internalType":"uint8","name":"slot","type":"uint8"},{"internalType":"uint256","name":"burnTokenId","type":"uint256"}],"name":"enhance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum IParty.Property","name":"item","type":"uint8"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint8","name":"slot","type":"uint8"}],"name":"equip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getConfetti","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getDamage","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDamageCalculator","outputs":[{"internalType":"contract IDamageCalculator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFighter","outputs":[{"internalType":"contract IFighter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHero","outputs":[{"internalType":"contract IHero","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRaid","outputs":[{"internalType":"contract IRaid","name":"","type":"address"}],"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":"address","name":"user","type":"address"}],"name":"getUserFighters","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserHero","outputs":[{"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":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"contract IERC20Upgradeable","name":"confetti","type":"address"},{"internalType":"contract IHero","name":"hero","type":"address"},{"internalType":"contract IFighter","name":"fighter","type":"address"},{"internalType":"contract IDamageCalculator","name":"damageCalculator","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint8[]","name":"prev","type":"uint8[]"}],"name":"onEnhancement","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"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":"contract IDamageCalculator","name":"calculator","type":"address"}],"name":"setDamageCalculator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IRaid","name":"raid","type":"address"}],"name":"setRaid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum IParty.Property","name":"item","type":"uint8"},{"internalType":"uint8","name":"slot","type":"uint8"}],"name":"unequip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateDamage","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b506140ff806100206000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c8063722a145d116100f9578063a87847a111610097578063cd00ff6211610071578063cd00ff6214610453578063d547741f14610473578063f23a6e6114610486578063f6ec7cfc146104bf57600080fd5b8063a87847a1146103f2578063ae6b160314610405578063bc197c811461041857600080fd5b806391d14854116100d357806391d148541461038b5780639aaa8364146103c4578063a217fddf146103d7578063a444b38a146103df57600080fd5b8063722a145d1461032857806376ea1677146103525780637e0cba021461037a57600080fd5b80631f0f01731161016657806336568abe1161014057806336568abe146102e05780634c63494a146102f357806350670b2e14610304578063581bee2f1461031757600080fd5b80631f0f017314610294578063248a9ca31461029c5780632f2ff15d146102cd57600080fd5b80631414f448116101975780631414f448146102205780631459457a14610231578063150b7a021461024457600080fd5b806301ffc9a7146101be578063085260b8146101e6578063126b889b146101fb575b600080fd5b6101d16101cc366004613522565b6104d2565b60405190151581526020015b60405180910390f35b6101f96101f436600461356b565b6104e3565b005b60fb546001600160a01b03165b6040516001600160a01b0390911681526020016101dd565b60ff546001600160a01b0316610208565b6101f961023f3660046135c1565b610a66565b61027b610252366004613679565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040516001600160e01b031990911681526020016101dd565b6101f9610b90565b6102bf6102aa36600461373d565b60009081526065602052604090206001015490565b6040519081526020016101dd565b6101f96102db366004613756565b610c43565b6101f96102ee366004613756565b610c6e565b60fc546001600160a01b0316610208565b61027b6103123660046137d2565b610cfa565b60fd546001600160a01b0316610208565b6102bf61033636600461383e565b6001600160a01b03166000908152610101602052604090205490565b61036561036036600461383e565b61101e565b60405163ffffffff90911681526020016101dd565b60fe546001600160a01b0316610208565b6101d1610399366004613756565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6101f96103d23660046138a0565b611029565b6102bf600081565b6101f96103ed366004613900565b6111f3565b6101f9610400366004613942565b61150f565b6101f961041336600461383e565b6116fd565b61027b6104263660046139b2565b7fbc197c810000000000000000000000000000000000000000000000000000000098975050505050505050565b61046661046136600461383e565b61172c565b6040516101dd9190613aac565b6101f9610481366004613756565b6117cb565b61027b610494366004613abf565b7ff23a6e61000000000000000000000000000000000000000000000000000000009695505050505050565b6101f96104cd36600461383e565b6117f1565b60006104dd82611820565b92915050565b60008360018111156104f7576104f7613b3b565b14806105145750600183600181111561051257610512613b3b565b145b6105655760405162461bcd60e51b815260206004820152601c60248201527f50617274793a3a656e68616e63653a20696e76616c6964206974656d0000000060448201526064015b60405180910390fd5b600080808086600181111561057c5761057c613b3b565b141561066a5733600090815261010160205260409020546105df5760405162461bcd60e51b815260206004820181905260248201527f50617274793a3a656e68616e63653a206865726f206e6f742070726573656e74604482015260640161055c565b5060fd54604080516312e028fd60e01b815290516001600160a01b039092169182916312e028fd9160048083019260209291908290030181865afa15801561062b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064f9190613b51565b3360009081526101016020526040902054909350915061077c565b3360009081526101016020908152604080832060ff891684526001019091529020546106e45760405162461bcd60e51b815260206004820152602360248201527f50617274793a3a656e68616e63653a2066696768746572206e6f742070726573604482015262195b9d60ea1b606482015260840161055c565b5060fe54604080516312e028fd60e01b815290516001600160a01b039092169182916312e028fd9160048083019260209291908290030181865afa158015610730573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107549190613b51565b3360009081526101016020908152604080832060ff8a16845260010190915290205490935091505b6040517f78a8a2380000000000000000000000000000000000000000000000000000000081526004810183905260009081906001600160a01b038616906378a8a238906024016040805180830381865afa1580156107de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108029190613b83565b9150915080156108d557604051632142170760e11b8152336004820152306024820152604481018790526001600160a01b038416906342842e0e90606401600060405180830381600087803b15801561085a57600080fd5b505af115801561086e573d6000803e3d6000fd5b505060405163095ea7b360e01b81526001600160a01b038881166004830152602482018a90528616925063095ea7b39150604401600060405180830381600087803b1580156108bc57600080fd5b505af11580156108d0573d6000803e3d6000fd5b505050505b60ff546040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018490526001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015610945573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109699190613baf565b5060ff5460405163095ea7b360e01b81526001600160a01b038781166004830152602482018590529091169063095ea7b3906044016020604051808303816000875af11580156109bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e19190613baf565b506040517f5c7e773200000000000000000000000000000000000000000000000000000000815260048101859052602481018790526001600160a01b03861690635c7e773290604401600060405180830381600087803b158015610a4457600080fd5b505af1158015610a58573d6000803e3d6000fd5b505050505050505050505050565b600054610100900460ff16610a815760005460ff1615610a85565b303b155b610af75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161055c565b600054610100900460ff16158015610b19576000805461ffff19166101011790555b610b2161185e565b60ff80546001600160a01b038088166001600160a01b03199283161790925560fd805487841690831617905560fe805486841690831617905560fc805492851692909116919091179055610b766000876118e3565b8015610b88576000805461ff00191690555b505050505050565b6000610b9b336118ed565b60fb5460405163232d1ea960e01b815233600482015263ffffffff831660248201529192506001600160a01b03169063232d1ea990604401600060405180830381600087803b158015610bed57600080fd5b505af1158015610c01573d6000803e3d6000fd5b505060405163ffffffff841681523392507f8758459dfcdfd86c7b6edb4b5c5d334cad1790805f5f6de28ecae055afe441ae915060200160405180910390a250565b600082815260656020526040902060010154610c5f8133611a11565b610c698383611a91565b505050565b6001600160a01b0381163314610cec5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c660000000000000000000000000000000000606482015260840161055c565b610cf68282611b33565b5050565b60fe54604080516312e028fd60e01b815290516000926001600160a01b0316916312e028fd9160048083019260209291908290030181865afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d689190613b51565b6001600160a01b0316336001600160a01b03161480610e0e575060fd60009054906101000a90046001600160a01b03166001600160a01b03166312e028fd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df99190613b51565b6001600160a01b0316336001600160a01b0316145b610e805760405162461bcd60e51b815260206004820152603460248201527f50617274793a3a6f6e456e68616e63656d656e743a2073656e646572206d757360448201527f742062652066696768746572206f72206865726f000000000000000000000000606482015260840161055c565b60fd60009054906101000a90046001600160a01b03166001600160a01b03166312e028fd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ed3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef79190613b51565b6001600160a01b0316336001600160a01b03161415610f8457610f7f600086868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808a02828101820190935289825290935089925088918291850190849080828437600092019190915250611bb692505050565b610ff3565b610ff3600186868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808a02828101820190935289825290935089925088918291850190849080828437600092019190915250611bb692505050565b7f50670b2e000000000000000000000000000000000000000000000000000000005b95945050505050565b60006104dd826118ed565b60018311156110a05760405162461bcd60e51b815260206004820152602160248201527f50617274793a3a6163743a20746f6f206d616e79206865726f20616374696f6e60448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161055c565b606080808086156110bd576110b76000898961256e565b90945092505b84156110d5576110cf6001878761256e565b90925090505b8351156110e5576110e533612784565b60fc546040516316f7a4c960e11b81526000916001600160a01b031690632def4992906111189088908790600401613bca565b600060405180830381865afa158015611135573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261115d9190810190613c61565b60fc546040516316f7a4c960e11b81529192506000916001600160a01b0390911690632def4992906111959088908790600401613bca565b600060405180830381865afa1580156111b2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111da9190810190613c61565b90506111e7338284612932565b50505050505050505050565b6000611200848484612af9565b604080516001808252818301909252919250606091600091816020015b604080518082019091526000808252602082015281526020019060019003908161121d579050509050821561128b5760408051600180825281830190925290816020015b60408051808201909152600080825260208201528152602001906001900390816112615790505091505b600086600181111561129f5761129f613b3b565b14156113ce5782156113365760fc54604051630c8315c560e01b8152600481018590526001600160a01b0390911690630c8315c5906024016040805180830381865afa1580156112f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113179190613d14565b8260008151811061132a5761132a613d30565b60200260200101819052505b60fc54604051630c8315c560e01b8152600481018790526001600160a01b0390911690630c8315c5906024016040805180830381865afa15801561137e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a29190613d14565b816000815181106113b5576113b5613d30565b60200260200101819052506113c933612784565b611504565b60018660018111156113e2576113e2613b3b565b14156115045782156114795760fc5460405163bcecf2b360e01b8152600481018590526001600160a01b039091169063bcecf2b3906024016040805180830381865afa158015611436573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145a9190613d14565b8260008151811061146d5761146d613d30565b60200260200101819052505b60fc5460405163bcecf2b360e01b8152600481018790526001600160a01b039091169063bcecf2b3906024016040805180830381865afa1580156114c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e59190613d14565b816000815181106114f8576114f8613d30565b60200260200101819052505b610b88338383612932565b600061151b8383612f1a565b60408051600180825281830190925291925060009190816020015b6040805180820190915260008082526020820152815260200190600190039081611536579050509050600084600181111561157357611573613b3b565b14156116085760fc54604051630c8315c560e01b8152600481018490526001600160a01b0390911690630c8315c5906024016040805180830381865afa1580156115c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e59190613d14565b816000815181106115f8576115f8613d30565b60200260200101819052506116ad565b600184600181111561161c5761161c613b3b565b14156116ad5760fc5460405163bcecf2b360e01b8152600481018490526001600160a01b039091169063bcecf2b3906024016040805180830381865afa15801561166a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168e9190613d14565b816000815181106116a1576116a1613d30565b60200260200101819052505b604080516000808252602082019092526116f791339184916116f1565b60408051808201909152600080825260208201528152602001906001900390816116ca5790505b50612932565b50505050565b60006117098133611a11565b5060fb80546001600160a01b0319166001600160a01b0392909216919091179055565b604080516010808252610220820190925260609160009190602082016102008036833701905050905060005b60108160ff1610156117c4576001600160a01b03841660009081526101016020908152604080832060ff851680855260019091019092529091205483519091849181106117a7576117a7613d30565b6020908102919091010152806117bc81613d5c565b915050611758565b5092915050565b6000828152606560205260409020600101546117e78133611a11565b610c698383611b33565b60006117fd8133611a11565b5060fc80546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160e01b031982167f4e2312e00000000000000000000000000000000000000000000000000000000014806104dd57506104dd82613268565b600054610100900460ff166118c95760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161055c565b6118d16132cf565b6118d96132cf565b6118e16132cf565b565b610cf68282611a91565b6001600160a01b038116600090815261010160205260408120548181611917575060009392505050565b6104578211611929575061044c61192e565b506103205b6001600160a01b0384166000908152610102602090815260409182902082518084018452905463ffffffff8082168352640100000000909104169181019190915290517fb4bf6d560000000000000000000000000000000000000000000000000000000081528291739636708935a7b19523556dd1e5ae84a44bf484519163b4bf6d56916119be91600401613d7c565b602060405180830381865af41580156119db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ff9190613d9d565b611a099190613db6565b949350505050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610cf657611a4f816001600160a01b0316601461333a565b611a5a83602061333a565b604051602001611a6b929190613e0a565b60408051601f198184030181529082905262461bcd60e51b825261055c91600401613e8b565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610cf65760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611aef3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff1615610cf65760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000836001811115611bca57611bca613b3b565b1480611be757506001836001811115611be557611be5613b3b565b145b611c595760405162461bcd60e51b815260206004820152602d60248201527f50617274793a3a5f75706461746544616d616765456e68616e63656d656e743a60448201527f20696e76616c6964206974656d00000000000000000000000000000000000000606482015260840161055c565b8051825114611cd05760405162461bcd60e51b815260206004820152602b60248201527f50617274793a3a6f6e456e68616e63656d656e743a20696e707574206c656e6760448201527f7468206d69736d61746368000000000000000000000000000000000000000000606482015260840161055c565b600080846001811115611ce557611ce5613b3b565b1415611cfd575060fd546001600160a01b0316611d0b565b5060fe546001600160a01b03165b6001600160a01b0381166000908152610100602052604081208451829086908290611d3857611d38613d30565b6020026020010151815260200190815260200160002060009054906101000a90046001600160a01b0316905060005b8451811015611e5d57816001600160a01b03166101006000856001600160a01b03166001600160a01b031681526020019081526020016000206000878481518110611db457611db4613d30565b6020908102919091018101518252810191909152604001600020546001600160a01b031614611e4b5760405162461bcd60e51b815260206004820152603760248201527f50617274793a3a6f6e456e68616e63656d656e743a20746f6b656e73206e6f7460448201527f206f776e6564206279207468652073616d652075736572000000000000000000606482015260840161055c565b80611e5581613ebe565b915050611d67565b506000856001811115611e7257611e72613b3b565b148015611e9d5750600583600081518110611e8f57611e8f613d30565b602002602001015160ff1610155b156121355760fd54604080516312e028fd60e01b815290516000926001600160a01b0316916312e028fd9160048083019260209291908290030181865afa158015611eec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f109190613b51565b90506000816001600160a01b0316637b30396587600081518110611f3657611f36613d30565b60200260200101516040518263ffffffff1660e01b8152600401611f5c91815260200190565b606060405180830381865afa158015611f79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f9d9190613ed9565b905084600081518110611fb257611fb2613d30565b602002602001015160ff16816040015160ff16108015611ffe57506001600160a01b0383166000908152610101602090815260408083208483015160ff16845260010190915290205415155b1561213257604080516001808252818301909252600091816020015b604080518082019091526000808252602082015281526020019060019003908161201a579050509050600061205460018460200151612f1a565b60fc5460405163bcecf2b360e01b8152600481018390529192506001600160a01b03169063bcecf2b3906024016040805180830381865afa15801561209d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c19190613d14565b826000815181106120d4576120d4613d30565b602090810291909101015261212f858360006040519080825280602002602001820160405280156116f1578160200160408051808201909152600080825260208201528152602001906001900390816116ca57905050612932565b50505b50505b606080600087600181111561214c5761214c613b3b565b141561228c5760fc546040517f35b7a70d0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906335b7a70d9061219d9089908990600401613f4b565b600060405180830381865afa1580156121ba573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121e29190810190613c61565b60fc549092506001600160a01b0316632def4992876000604051908082528060200260200182016040528015612222578160200160208202803683370190505b506040518363ffffffff1660e01b8152600401612240929190613bca565b600060405180830381865afa15801561225d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526122859190810190613c61565b90506123a3565b60fc546040517f38eeacfd0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906338eeacfd906122d79089908990600401613f4b565b600060405180830381865afa1580156122f4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261231c9190810190613c61565b60fc54604080516000815260208101918290526316f7a4c960e11b9091529193506001600160a01b031690632def49929061235b908960248201613bca565b600060405180830381865afa158015612378573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526123a09190810190613c61565b90505b6001600160a01b0383166000908152610102602090815260409182902082518084018452905463ffffffff808216835264010000000090910416918101919091529051632db45f4160e11b8152739636708935a7b19523556dd1e5ae84a44bf4845191635b68be829161241d919086908690600401613ff2565b6040805180830381865af4158015612439573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061245d9190613d14565b6001600160a01b038416600090815261010260209081526040822083518154949092015163ffffffff9081166401000000000267ffffffffffffffff19909516921691909117929092179091556124b3846118ed565b60fb5460405163232d1ea960e01b81526001600160a01b03878116600483015263ffffffff8416602483015292935091169063232d1ea990604401600060405180830381600087803b15801561250857600080fd5b505af115801561251c573d6000803e3d6000fd5b505060405163ffffffff841681526001600160a01b03871692507f8758459dfcdfd86c7b6edb4b5c5d334cad1790805f5f6de28ecae055afe441ae915060200160405180910390a25050505050505050565b60608060008367ffffffffffffffff81111561258c5761258c613632565b6040519080825280602002602001820160405280156125b5578160200160208202803683370190505b50905060008467ffffffffffffffff8111156125d3576125d3613632565b6040519080825280602002602001820160405280156125fc578160200160208202803683370190505b50905060008080805b888110156127645760018a8a8381811061262157612621613d30565b6126379260206060909202019081019150614041565b600181111561264857612648613b3b565b14156126ea5761269d8b8b8b8481811061266457612664613d30565b905060600201602001358c8c8581811061268057612680613d30565b9050606002016040016020810190612698919061405e565b612af9565b93508989828181106126b1576126b1613d30565b905060600201602001358684815181106126cd576126cd613d30565b60209081029190910101526126e360018461407b565b9250612720565b61271d8b8b8b8481811061270057612700613d30565b9050606002016040016020810190612718919061405e565b612f1a565b93505b8315612752578385838151811061273957612739613d30565b602090810291909101015261274f60018361407b565b91505b8061275c81613ebe565b915050612605565b508451918803909103845282519603909503815290969095509350505050565b60fd54604080516312e028fd60e01b815290516000926001600160a01b0316916312e028fd9160048083019260209291908290030181865afa1580156127ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f29190613b51565b6001600160a01b038381166000908152610101602052604090819020549051637b30396560e01b81526004810191909152911690637b30396590602401606060405180830381865afa15801561284c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128709190613ed9565b602081015190915060ff165b6010811015610c69576001600160a01b038316600090815261010160209081526040808320848452600101909152902054156129205760405162461bcd60e51b815260206004820152602160248201527f50617274793a3a5f65717569703a206865726f20736c6f74206d69736d61746360448201527f6800000000000000000000000000000000000000000000000000000000000000606482015260840161055c565b8061292a81613ebe565b91505061287c565b6001600160a01b0383166000908152610102602090815260409182902082518084018452905463ffffffff808216835264010000000090910416918101919091529051632db45f4160e11b8152739636708935a7b19523556dd1e5ae84a44bf4845191635b68be82916129ac919086908690600401613ff2565b6040805180830381865af41580156129c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ec9190613d14565b6001600160a01b038416600090815261010260209081526040822083518154949092015163ffffffff9081166401000000000267ffffffffffffffff1990951692169190911792909217909155612a42846118ed565b60fb5460405163232d1ea960e01b81526001600160a01b03878116600483015263ffffffff8416602483015292935091169063232d1ea990604401600060405180830381600087803b158015612a9757600080fd5b505af1158015612aab573d6000803e3d6000fd5b505060405163ffffffff841681526001600160a01b03871692507f8758459dfcdfd86c7b6edb4b5c5d334cad1790805f5f6de28ecae055afe441ae915060200160405180910390a250505050565b600080846001811115612b0e57612b0e613b3b565b1480612b2b57506001846001811115612b2957612b29613b3b565b145b612b775760405162461bcd60e51b815260206004820152601c60248201527f50617274793a3a656e68616e63653a20696e76616c6964206974656d00000000604482015260640161055c565b6000846001811115612b8b57612b8b613b3b565b1415612c6657336000908152610101602052604090205415612bb557612bb2846000612f1a565b90505b60fd80546001600160a01b03908116600090815261010060209081526040808320888452825280832080546001600160a01b031916339081179091558084526101019092529182902087905592549051632142170760e11b815260048101939093523060248401526044830186905216906342842e0e90606401600060405180830381600087803b158015612c4957600080fd5b505af1158015612c5d573d6000803e3d6000fd5b50505050612ebc565b6001846001811115612c7a57612c7a613b3b565b1415612ebc5760fd54604080516312e028fd60e01b815290516000926001600160a01b0316916312e028fd9160048083019260209291908290030181865afa158015612cca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cee9190613b51565b336000908152610101602052604090819020549051637b30396560e01b81526001600160a01b039290921691637b30396591612d309160040190815260200190565b606060405180830381865afa158015612d4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d719190613ed9565b9050806020015160ff168360ff1610612dcc5760405162461bcd60e51b815260206004820152601660248201527f50617274793a3a65717569703a2062616420736c6f7400000000000000000000604482015260640161055c565b3360009081526101016020908152604080832060ff8716845260010190915290205415612e0057612dfd8584612f1a565b91505b60fe80546001600160a01b03908116600090815261010060209081526040808320898452825280832080546001600160a01b03191633908117909155808452610101835281842060ff8a1685526001019092529182902088905592549051632142170760e11b815260048101939093523060248401526044830187905216906342842e0e90606401600060405180830381600087803b158015612ea257600080fd5b505af1158015612eb6573d6000803e3d6000fd5b50505050505b337f7cf6f24bff7816731421a96b24de1b70ad01bcb505ac549cadd27919a0b5d655856001811115612ef057612ef0613b3b565b6040805160ff92831681529186166020830152810186905260600160405180910390a29392505050565b600080836001811115612f2f57612f2f613b3b565b1480612f4c57506001836001811115612f4a57612f4a613b3b565b145b612f985760405162461bcd60e51b815260206004820152601c60248201527f50617274793a3a656e68616e63653a20696e76616c6964206974656d00000000604482015260640161055c565b50600080836001811115612fae57612fae613b3b565b14156130bf57503360009081526101016020526040902054806130135760405162461bcd60e51b815260206004820181905260248201527f50617274793a3a756e65717569703a206865726f206e6f742070726573656e74604482015260640161055c565b3360008181526101016020908152604080832083905560fd80546001600160a01b03908116855261010084528285208786529093529281902080546001600160a01b031916905591549151632142170760e11b815230600482015260248101939093526044830184905216906342842e0e90606401600060405180830381600087803b1580156130a257600080fd5b505af11580156130b6573d6000803e3d6000fd5b5050505061320b565b60018360018111156130d3576130d3613b3b565b141561320b57503360009081526101016020908152604080832060ff85168452600101909152902054806131555760405162461bcd60e51b815260206004820152602360248201527f50617274793a3a756e65717569703a2066696768746572206e6f742070726573604482015262195b9d60ea1b606482015260840161055c565b3360008181526101016020908152604080832060ff87168452600101825280832083905560fe80546001600160a01b03908116855261010084528285208786529093529281902080546001600160a01b031916905591549151632142170760e11b815230600482015260248101939093526044830184905216906342842e0e90606401600060405180830381600087803b1580156131f257600080fd5b505af1158015613206573d6000803e3d6000fd5b505050505b337f73a8725701d4e16f7b03f4266ff9f53bab4459c9589ebc618dfe8909e76884e684600181111561323f5761323f613b3b565b6040805160ff92831681529186166020830152810184905260600160405180910390a292915050565b60006001600160e01b031982167f7965db0b0000000000000000000000000000000000000000000000000000000014806104dd57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146104dd565b600054610100900460ff166118e15760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161055c565b60606000613349836002614093565b61335490600261407b565b67ffffffffffffffff81111561336c5761336c613632565b6040519080825280601f01601f191660200182016040528015613396576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106133cd576133cd613d30565b60200101906001600160f81b031916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061341857613418613d30565b60200101906001600160f81b031916908160001a905350600061343c846002614093565b61344790600161407b565b90505b60018111156134cc577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061348857613488613d30565b1a60f81b82828151811061349e5761349e613d30565b60200101906001600160f81b031916908160001a90535060049490941c936134c5816140b2565b905061344a565b50831561351b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161055c565b9392505050565b60006020828403121561353457600080fd5b81356001600160e01b03198116811461351b57600080fd5b6002811061355957600080fd5b50565b60ff8116811461355957600080fd5b60008060006060848603121561358057600080fd5b833561358b8161354c565b9250602084013561359b8161355c565b929592945050506040919091013590565b6001600160a01b038116811461355957600080fd5b600080600080600060a086880312156135d957600080fd5b85356135e4816135ac565b945060208601356135f4816135ac565b93506040860135613604816135ac565b92506060860135613614816135ac565b91506080860135613624816135ac565b809150509295509295909350565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561367157613671613632565b604052919050565b6000806000806080858703121561368f57600080fd5b843561369a816135ac565b93506020858101356136ab816135ac565b935060408601359250606086013567ffffffffffffffff808211156136cf57600080fd5b818801915088601f8301126136e357600080fd5b8135818111156136f5576136f5613632565b613707601f8201601f19168501613648565b9150808252898482850101111561371d57600080fd5b808484018584013760008482840101525080935050505092959194509250565b60006020828403121561374f57600080fd5b5035919050565b6000806040838503121561376957600080fd5b82359150602083013561377b816135ac565b809150509250929050565b60008083601f84011261379857600080fd5b50813567ffffffffffffffff8111156137b057600080fd5b6020830191508360208260051b85010111156137cb57600080fd5b9250929050565b600080600080604085870312156137e857600080fd5b843567ffffffffffffffff8082111561380057600080fd5b61380c88838901613786565b9096509450602087013591508082111561382557600080fd5b5061383287828801613786565b95989497509550505050565b60006020828403121561385057600080fd5b813561351b816135ac565b60008083601f84011261386d57600080fd5b50813567ffffffffffffffff81111561388557600080fd5b6020830191508360206060830285010111156137cb57600080fd5b600080600080604085870312156138b657600080fd5b843567ffffffffffffffff808211156138ce57600080fd5b6138da8883890161385b565b909650945060208701359150808211156138f357600080fd5b506138328782880161385b565b60008060006060848603121561391557600080fd5b83356139208161354c565b92506020840135915060408401356139378161355c565b809150509250925092565b6000806040838503121561395557600080fd5b82356139608161354c565b9150602083013561377b8161355c565b60008083601f84011261398257600080fd5b50813567ffffffffffffffff81111561399a57600080fd5b6020830191508360208285010111156137cb57600080fd5b60008060008060008060008060a0898b0312156139ce57600080fd5b88356139d9816135ac565b975060208901356139e9816135ac565b9650604089013567ffffffffffffffff80821115613a0657600080fd5b613a128c838d01613786565b909850965060608b0135915080821115613a2b57600080fd5b613a378c838d01613786565b909650945060808b0135915080821115613a5057600080fd5b50613a5d8b828c01613970565b999c989b5096995094979396929594505050565b600081518084526020808501945080840160005b83811015613aa157815187529582019590820190600101613a85565b509495945050505050565b60208152600061351b6020830184613a71565b60008060008060008060a08789031215613ad857600080fd5b8635613ae3816135ac565b95506020870135613af3816135ac565b94506040870135935060608701359250608087013567ffffffffffffffff811115613b1d57600080fd5b613b2989828a01613970565b979a9699509497509295939492505050565b634e487b7160e01b600052602160045260246000fd5b600060208284031215613b6357600080fd5b815161351b816135ac565b80518015158114613b7e57600080fd5b919050565b60008060408385031215613b9657600080fd5b82519150613ba660208401613b6e565b90509250929050565b600060208284031215613bc157600080fd5b61351b82613b6e565b604081526000613bdd6040830185613a71565b82810360208401526110158185613a71565b805163ffffffff81168114613b7e57600080fd5b600060408284031215613c1557600080fd5b6040516040810181811067ffffffffffffffff82111715613c3857613c38613632565b604052905080613c4783613bef565b8152613c5560208401613bef565b60208201525092915050565b60006020808385031215613c7457600080fd5b825167ffffffffffffffff80821115613c8c57600080fd5b818501915085601f830112613ca057600080fd5b815181811115613cb257613cb2613632565b613cc0848260051b01613648565b818152848101925060069190911b830184019087821115613ce057600080fd5b928401925b81841015613d0957613cf78885613c03565b83528483019250604084019350613ce5565b979650505050505050565b600060408284031215613d2657600080fd5b61351b8383613c03565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff811415613d7357613d73613d46565b60010192915050565b604081016104dd8284805163ffffffff908116835260209182015116910152565b600060208284031215613daf57600080fd5b5051919050565b600063ffffffff808316818516808303821115613dd557613dd5613d46565b01949350505050565b60005b83811015613df9578181015183820152602001613de1565b838111156116f75750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613e42816017850160208801613dde565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351613e7f816028840160208801613dde565b01602801949350505050565b6020815260008251806020840152613eaa816040850160208701613dde565b601f01601f19169190910160400192915050565b6000600019821415613ed257613ed2613d46565b5060010190565b600060608284031215613eeb57600080fd5b6040516060810181811067ffffffffffffffff82111715613f0e57613f0e613632565b6040528251613f1c8161355c565b81526020830151613f2c8161355c565b60208201526040830151613f3f8161355c565b60408201529392505050565b604081526000613f5e6040830185613a71565b82810360208481019190915284518083528582019282019060005b81811015613f9857845160ff1683529383019391830191600101613f79565b5090979650505050505050565b600081518084526020808501945080840160005b83811015613aa157613fdf878351805163ffffffff908116835260209182015116910152565b6040969096019590820190600101613fb9565b61400f8185805163ffffffff908116835260209182015116910152565b6080604082015260006140256080830185613fa5565b82810360608401526140378185613fa5565b9695505050505050565b60006020828403121561405357600080fd5b813561351b8161354c565b60006020828403121561407057600080fd5b813561351b8161355c565b6000821982111561408e5761408e613d46565b500190565b60008160001904831182151516156140ad576140ad613d46565b500290565b6000816140c1576140c1613d46565b50600019019056fea2646970667358221220a4649635a91821d51acf010184a19733ddc8725e8889014dc457bad048e8ec5864736f6c634300080b0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101b95760003560e01c8063722a145d116100f9578063a87847a111610097578063cd00ff6211610071578063cd00ff6214610453578063d547741f14610473578063f23a6e6114610486578063f6ec7cfc146104bf57600080fd5b8063a87847a1146103f2578063ae6b160314610405578063bc197c811461041857600080fd5b806391d14854116100d357806391d148541461038b5780639aaa8364146103c4578063a217fddf146103d7578063a444b38a146103df57600080fd5b8063722a145d1461032857806376ea1677146103525780637e0cba021461037a57600080fd5b80631f0f01731161016657806336568abe1161014057806336568abe146102e05780634c63494a146102f357806350670b2e14610304578063581bee2f1461031757600080fd5b80631f0f017314610294578063248a9ca31461029c5780632f2ff15d146102cd57600080fd5b80631414f448116101975780631414f448146102205780631459457a14610231578063150b7a021461024457600080fd5b806301ffc9a7146101be578063085260b8146101e6578063126b889b146101fb575b600080fd5b6101d16101cc366004613522565b6104d2565b60405190151581526020015b60405180910390f35b6101f96101f436600461356b565b6104e3565b005b60fb546001600160a01b03165b6040516001600160a01b0390911681526020016101dd565b60ff546001600160a01b0316610208565b6101f961023f3660046135c1565b610a66565b61027b610252366004613679565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040516001600160e01b031990911681526020016101dd565b6101f9610b90565b6102bf6102aa36600461373d565b60009081526065602052604090206001015490565b6040519081526020016101dd565b6101f96102db366004613756565b610c43565b6101f96102ee366004613756565b610c6e565b60fc546001600160a01b0316610208565b61027b6103123660046137d2565b610cfa565b60fd546001600160a01b0316610208565b6102bf61033636600461383e565b6001600160a01b03166000908152610101602052604090205490565b61036561036036600461383e565b61101e565b60405163ffffffff90911681526020016101dd565b60fe546001600160a01b0316610208565b6101d1610399366004613756565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6101f96103d23660046138a0565b611029565b6102bf600081565b6101f96103ed366004613900565b6111f3565b6101f9610400366004613942565b61150f565b6101f961041336600461383e565b6116fd565b61027b6104263660046139b2565b7fbc197c810000000000000000000000000000000000000000000000000000000098975050505050505050565b61046661046136600461383e565b61172c565b6040516101dd9190613aac565b6101f9610481366004613756565b6117cb565b61027b610494366004613abf565b7ff23a6e61000000000000000000000000000000000000000000000000000000009695505050505050565b6101f96104cd36600461383e565b6117f1565b60006104dd82611820565b92915050565b60008360018111156104f7576104f7613b3b565b14806105145750600183600181111561051257610512613b3b565b145b6105655760405162461bcd60e51b815260206004820152601c60248201527f50617274793a3a656e68616e63653a20696e76616c6964206974656d0000000060448201526064015b60405180910390fd5b600080808086600181111561057c5761057c613b3b565b141561066a5733600090815261010160205260409020546105df5760405162461bcd60e51b815260206004820181905260248201527f50617274793a3a656e68616e63653a206865726f206e6f742070726573656e74604482015260640161055c565b5060fd54604080516312e028fd60e01b815290516001600160a01b039092169182916312e028fd9160048083019260209291908290030181865afa15801561062b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064f9190613b51565b3360009081526101016020526040902054909350915061077c565b3360009081526101016020908152604080832060ff891684526001019091529020546106e45760405162461bcd60e51b815260206004820152602360248201527f50617274793a3a656e68616e63653a2066696768746572206e6f742070726573604482015262195b9d60ea1b606482015260840161055c565b5060fe54604080516312e028fd60e01b815290516001600160a01b039092169182916312e028fd9160048083019260209291908290030181865afa158015610730573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107549190613b51565b3360009081526101016020908152604080832060ff8a16845260010190915290205490935091505b6040517f78a8a2380000000000000000000000000000000000000000000000000000000081526004810183905260009081906001600160a01b038616906378a8a238906024016040805180830381865afa1580156107de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108029190613b83565b9150915080156108d557604051632142170760e11b8152336004820152306024820152604481018790526001600160a01b038416906342842e0e90606401600060405180830381600087803b15801561085a57600080fd5b505af115801561086e573d6000803e3d6000fd5b505060405163095ea7b360e01b81526001600160a01b038881166004830152602482018a90528616925063095ea7b39150604401600060405180830381600087803b1580156108bc57600080fd5b505af11580156108d0573d6000803e3d6000fd5b505050505b60ff546040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018490526001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015610945573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109699190613baf565b5060ff5460405163095ea7b360e01b81526001600160a01b038781166004830152602482018590529091169063095ea7b3906044016020604051808303816000875af11580156109bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e19190613baf565b506040517f5c7e773200000000000000000000000000000000000000000000000000000000815260048101859052602481018790526001600160a01b03861690635c7e773290604401600060405180830381600087803b158015610a4457600080fd5b505af1158015610a58573d6000803e3d6000fd5b505050505050505050505050565b600054610100900460ff16610a815760005460ff1615610a85565b303b155b610af75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161055c565b600054610100900460ff16158015610b19576000805461ffff19166101011790555b610b2161185e565b60ff80546001600160a01b038088166001600160a01b03199283161790925560fd805487841690831617905560fe805486841690831617905560fc805492851692909116919091179055610b766000876118e3565b8015610b88576000805461ff00191690555b505050505050565b6000610b9b336118ed565b60fb5460405163232d1ea960e01b815233600482015263ffffffff831660248201529192506001600160a01b03169063232d1ea990604401600060405180830381600087803b158015610bed57600080fd5b505af1158015610c01573d6000803e3d6000fd5b505060405163ffffffff841681523392507f8758459dfcdfd86c7b6edb4b5c5d334cad1790805f5f6de28ecae055afe441ae915060200160405180910390a250565b600082815260656020526040902060010154610c5f8133611a11565b610c698383611a91565b505050565b6001600160a01b0381163314610cec5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c660000000000000000000000000000000000606482015260840161055c565b610cf68282611b33565b5050565b60fe54604080516312e028fd60e01b815290516000926001600160a01b0316916312e028fd9160048083019260209291908290030181865afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d689190613b51565b6001600160a01b0316336001600160a01b03161480610e0e575060fd60009054906101000a90046001600160a01b03166001600160a01b03166312e028fd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df99190613b51565b6001600160a01b0316336001600160a01b0316145b610e805760405162461bcd60e51b815260206004820152603460248201527f50617274793a3a6f6e456e68616e63656d656e743a2073656e646572206d757360448201527f742062652066696768746572206f72206865726f000000000000000000000000606482015260840161055c565b60fd60009054906101000a90046001600160a01b03166001600160a01b03166312e028fd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ed3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef79190613b51565b6001600160a01b0316336001600160a01b03161415610f8457610f7f600086868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808a02828101820190935289825290935089925088918291850190849080828437600092019190915250611bb692505050565b610ff3565b610ff3600186868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808a02828101820190935289825290935089925088918291850190849080828437600092019190915250611bb692505050565b7f50670b2e000000000000000000000000000000000000000000000000000000005b95945050505050565b60006104dd826118ed565b60018311156110a05760405162461bcd60e51b815260206004820152602160248201527f50617274793a3a6163743a20746f6f206d616e79206865726f20616374696f6e60448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161055c565b606080808086156110bd576110b76000898961256e565b90945092505b84156110d5576110cf6001878761256e565b90925090505b8351156110e5576110e533612784565b60fc546040516316f7a4c960e11b81526000916001600160a01b031690632def4992906111189088908790600401613bca565b600060405180830381865afa158015611135573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261115d9190810190613c61565b60fc546040516316f7a4c960e11b81529192506000916001600160a01b0390911690632def4992906111959088908790600401613bca565b600060405180830381865afa1580156111b2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111da9190810190613c61565b90506111e7338284612932565b50505050505050505050565b6000611200848484612af9565b604080516001808252818301909252919250606091600091816020015b604080518082019091526000808252602082015281526020019060019003908161121d579050509050821561128b5760408051600180825281830190925290816020015b60408051808201909152600080825260208201528152602001906001900390816112615790505091505b600086600181111561129f5761129f613b3b565b14156113ce5782156113365760fc54604051630c8315c560e01b8152600481018590526001600160a01b0390911690630c8315c5906024016040805180830381865afa1580156112f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113179190613d14565b8260008151811061132a5761132a613d30565b60200260200101819052505b60fc54604051630c8315c560e01b8152600481018790526001600160a01b0390911690630c8315c5906024016040805180830381865afa15801561137e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a29190613d14565b816000815181106113b5576113b5613d30565b60200260200101819052506113c933612784565b611504565b60018660018111156113e2576113e2613b3b565b14156115045782156114795760fc5460405163bcecf2b360e01b8152600481018590526001600160a01b039091169063bcecf2b3906024016040805180830381865afa158015611436573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145a9190613d14565b8260008151811061146d5761146d613d30565b60200260200101819052505b60fc5460405163bcecf2b360e01b8152600481018790526001600160a01b039091169063bcecf2b3906024016040805180830381865afa1580156114c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e59190613d14565b816000815181106114f8576114f8613d30565b60200260200101819052505b610b88338383612932565b600061151b8383612f1a565b60408051600180825281830190925291925060009190816020015b6040805180820190915260008082526020820152815260200190600190039081611536579050509050600084600181111561157357611573613b3b565b14156116085760fc54604051630c8315c560e01b8152600481018490526001600160a01b0390911690630c8315c5906024016040805180830381865afa1580156115c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e59190613d14565b816000815181106115f8576115f8613d30565b60200260200101819052506116ad565b600184600181111561161c5761161c613b3b565b14156116ad5760fc5460405163bcecf2b360e01b8152600481018490526001600160a01b039091169063bcecf2b3906024016040805180830381865afa15801561166a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168e9190613d14565b816000815181106116a1576116a1613d30565b60200260200101819052505b604080516000808252602082019092526116f791339184916116f1565b60408051808201909152600080825260208201528152602001906001900390816116ca5790505b50612932565b50505050565b60006117098133611a11565b5060fb80546001600160a01b0319166001600160a01b0392909216919091179055565b604080516010808252610220820190925260609160009190602082016102008036833701905050905060005b60108160ff1610156117c4576001600160a01b03841660009081526101016020908152604080832060ff851680855260019091019092529091205483519091849181106117a7576117a7613d30565b6020908102919091010152806117bc81613d5c565b915050611758565b5092915050565b6000828152606560205260409020600101546117e78133611a11565b610c698383611b33565b60006117fd8133611a11565b5060fc80546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160e01b031982167f4e2312e00000000000000000000000000000000000000000000000000000000014806104dd57506104dd82613268565b600054610100900460ff166118c95760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161055c565b6118d16132cf565b6118d96132cf565b6118e16132cf565b565b610cf68282611a91565b6001600160a01b038116600090815261010160205260408120548181611917575060009392505050565b6104578211611929575061044c61192e565b506103205b6001600160a01b0384166000908152610102602090815260409182902082518084018452905463ffffffff8082168352640100000000909104169181019190915290517fb4bf6d560000000000000000000000000000000000000000000000000000000081528291739636708935a7b19523556dd1e5ae84a44bf484519163b4bf6d56916119be91600401613d7c565b602060405180830381865af41580156119db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ff9190613d9d565b611a099190613db6565b949350505050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610cf657611a4f816001600160a01b0316601461333a565b611a5a83602061333a565b604051602001611a6b929190613e0a565b60408051601f198184030181529082905262461bcd60e51b825261055c91600401613e8b565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610cf65760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611aef3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff1615610cf65760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000836001811115611bca57611bca613b3b565b1480611be757506001836001811115611be557611be5613b3b565b145b611c595760405162461bcd60e51b815260206004820152602d60248201527f50617274793a3a5f75706461746544616d616765456e68616e63656d656e743a60448201527f20696e76616c6964206974656d00000000000000000000000000000000000000606482015260840161055c565b8051825114611cd05760405162461bcd60e51b815260206004820152602b60248201527f50617274793a3a6f6e456e68616e63656d656e743a20696e707574206c656e6760448201527f7468206d69736d61746368000000000000000000000000000000000000000000606482015260840161055c565b600080846001811115611ce557611ce5613b3b565b1415611cfd575060fd546001600160a01b0316611d0b565b5060fe546001600160a01b03165b6001600160a01b0381166000908152610100602052604081208451829086908290611d3857611d38613d30565b6020026020010151815260200190815260200160002060009054906101000a90046001600160a01b0316905060005b8451811015611e5d57816001600160a01b03166101006000856001600160a01b03166001600160a01b031681526020019081526020016000206000878481518110611db457611db4613d30565b6020908102919091018101518252810191909152604001600020546001600160a01b031614611e4b5760405162461bcd60e51b815260206004820152603760248201527f50617274793a3a6f6e456e68616e63656d656e743a20746f6b656e73206e6f7460448201527f206f776e6564206279207468652073616d652075736572000000000000000000606482015260840161055c565b80611e5581613ebe565b915050611d67565b506000856001811115611e7257611e72613b3b565b148015611e9d5750600583600081518110611e8f57611e8f613d30565b602002602001015160ff1610155b156121355760fd54604080516312e028fd60e01b815290516000926001600160a01b0316916312e028fd9160048083019260209291908290030181865afa158015611eec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f109190613b51565b90506000816001600160a01b0316637b30396587600081518110611f3657611f36613d30565b60200260200101516040518263ffffffff1660e01b8152600401611f5c91815260200190565b606060405180830381865afa158015611f79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f9d9190613ed9565b905084600081518110611fb257611fb2613d30565b602002602001015160ff16816040015160ff16108015611ffe57506001600160a01b0383166000908152610101602090815260408083208483015160ff16845260010190915290205415155b1561213257604080516001808252818301909252600091816020015b604080518082019091526000808252602082015281526020019060019003908161201a579050509050600061205460018460200151612f1a565b60fc5460405163bcecf2b360e01b8152600481018390529192506001600160a01b03169063bcecf2b3906024016040805180830381865afa15801561209d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c19190613d14565b826000815181106120d4576120d4613d30565b602090810291909101015261212f858360006040519080825280602002602001820160405280156116f1578160200160408051808201909152600080825260208201528152602001906001900390816116ca57905050612932565b50505b50505b606080600087600181111561214c5761214c613b3b565b141561228c5760fc546040517f35b7a70d0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906335b7a70d9061219d9089908990600401613f4b565b600060405180830381865afa1580156121ba573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121e29190810190613c61565b60fc549092506001600160a01b0316632def4992876000604051908082528060200260200182016040528015612222578160200160208202803683370190505b506040518363ffffffff1660e01b8152600401612240929190613bca565b600060405180830381865afa15801561225d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526122859190810190613c61565b90506123a3565b60fc546040517f38eeacfd0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906338eeacfd906122d79089908990600401613f4b565b600060405180830381865afa1580156122f4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261231c9190810190613c61565b60fc54604080516000815260208101918290526316f7a4c960e11b9091529193506001600160a01b031690632def49929061235b908960248201613bca565b600060405180830381865afa158015612378573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526123a09190810190613c61565b90505b6001600160a01b0383166000908152610102602090815260409182902082518084018452905463ffffffff808216835264010000000090910416918101919091529051632db45f4160e11b8152739636708935a7b19523556dd1e5ae84a44bf4845191635b68be829161241d919086908690600401613ff2565b6040805180830381865af4158015612439573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061245d9190613d14565b6001600160a01b038416600090815261010260209081526040822083518154949092015163ffffffff9081166401000000000267ffffffffffffffff19909516921691909117929092179091556124b3846118ed565b60fb5460405163232d1ea960e01b81526001600160a01b03878116600483015263ffffffff8416602483015292935091169063232d1ea990604401600060405180830381600087803b15801561250857600080fd5b505af115801561251c573d6000803e3d6000fd5b505060405163ffffffff841681526001600160a01b03871692507f8758459dfcdfd86c7b6edb4b5c5d334cad1790805f5f6de28ecae055afe441ae915060200160405180910390a25050505050505050565b60608060008367ffffffffffffffff81111561258c5761258c613632565b6040519080825280602002602001820160405280156125b5578160200160208202803683370190505b50905060008467ffffffffffffffff8111156125d3576125d3613632565b6040519080825280602002602001820160405280156125fc578160200160208202803683370190505b50905060008080805b888110156127645760018a8a8381811061262157612621613d30565b6126379260206060909202019081019150614041565b600181111561264857612648613b3b565b14156126ea5761269d8b8b8b8481811061266457612664613d30565b905060600201602001358c8c8581811061268057612680613d30565b9050606002016040016020810190612698919061405e565b612af9565b93508989828181106126b1576126b1613d30565b905060600201602001358684815181106126cd576126cd613d30565b60209081029190910101526126e360018461407b565b9250612720565b61271d8b8b8b8481811061270057612700613d30565b9050606002016040016020810190612718919061405e565b612f1a565b93505b8315612752578385838151811061273957612739613d30565b602090810291909101015261274f60018361407b565b91505b8061275c81613ebe565b915050612605565b508451918803909103845282519603909503815290969095509350505050565b60fd54604080516312e028fd60e01b815290516000926001600160a01b0316916312e028fd9160048083019260209291908290030181865afa1580156127ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f29190613b51565b6001600160a01b038381166000908152610101602052604090819020549051637b30396560e01b81526004810191909152911690637b30396590602401606060405180830381865afa15801561284c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128709190613ed9565b602081015190915060ff165b6010811015610c69576001600160a01b038316600090815261010160209081526040808320848452600101909152902054156129205760405162461bcd60e51b815260206004820152602160248201527f50617274793a3a5f65717569703a206865726f20736c6f74206d69736d61746360448201527f6800000000000000000000000000000000000000000000000000000000000000606482015260840161055c565b8061292a81613ebe565b91505061287c565b6001600160a01b0383166000908152610102602090815260409182902082518084018452905463ffffffff808216835264010000000090910416918101919091529051632db45f4160e11b8152739636708935a7b19523556dd1e5ae84a44bf4845191635b68be82916129ac919086908690600401613ff2565b6040805180830381865af41580156129c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ec9190613d14565b6001600160a01b038416600090815261010260209081526040822083518154949092015163ffffffff9081166401000000000267ffffffffffffffff1990951692169190911792909217909155612a42846118ed565b60fb5460405163232d1ea960e01b81526001600160a01b03878116600483015263ffffffff8416602483015292935091169063232d1ea990604401600060405180830381600087803b158015612a9757600080fd5b505af1158015612aab573d6000803e3d6000fd5b505060405163ffffffff841681526001600160a01b03871692507f8758459dfcdfd86c7b6edb4b5c5d334cad1790805f5f6de28ecae055afe441ae915060200160405180910390a250505050565b600080846001811115612b0e57612b0e613b3b565b1480612b2b57506001846001811115612b2957612b29613b3b565b145b612b775760405162461bcd60e51b815260206004820152601c60248201527f50617274793a3a656e68616e63653a20696e76616c6964206974656d00000000604482015260640161055c565b6000846001811115612b8b57612b8b613b3b565b1415612c6657336000908152610101602052604090205415612bb557612bb2846000612f1a565b90505b60fd80546001600160a01b03908116600090815261010060209081526040808320888452825280832080546001600160a01b031916339081179091558084526101019092529182902087905592549051632142170760e11b815260048101939093523060248401526044830186905216906342842e0e90606401600060405180830381600087803b158015612c4957600080fd5b505af1158015612c5d573d6000803e3d6000fd5b50505050612ebc565b6001846001811115612c7a57612c7a613b3b565b1415612ebc5760fd54604080516312e028fd60e01b815290516000926001600160a01b0316916312e028fd9160048083019260209291908290030181865afa158015612cca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cee9190613b51565b336000908152610101602052604090819020549051637b30396560e01b81526001600160a01b039290921691637b30396591612d309160040190815260200190565b606060405180830381865afa158015612d4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d719190613ed9565b9050806020015160ff168360ff1610612dcc5760405162461bcd60e51b815260206004820152601660248201527f50617274793a3a65717569703a2062616420736c6f7400000000000000000000604482015260640161055c565b3360009081526101016020908152604080832060ff8716845260010190915290205415612e0057612dfd8584612f1a565b91505b60fe80546001600160a01b03908116600090815261010060209081526040808320898452825280832080546001600160a01b03191633908117909155808452610101835281842060ff8a1685526001019092529182902088905592549051632142170760e11b815260048101939093523060248401526044830187905216906342842e0e90606401600060405180830381600087803b158015612ea257600080fd5b505af1158015612eb6573d6000803e3d6000fd5b50505050505b337f7cf6f24bff7816731421a96b24de1b70ad01bcb505ac549cadd27919a0b5d655856001811115612ef057612ef0613b3b565b6040805160ff92831681529186166020830152810186905260600160405180910390a29392505050565b600080836001811115612f2f57612f2f613b3b565b1480612f4c57506001836001811115612f4a57612f4a613b3b565b145b612f985760405162461bcd60e51b815260206004820152601c60248201527f50617274793a3a656e68616e63653a20696e76616c6964206974656d00000000604482015260640161055c565b50600080836001811115612fae57612fae613b3b565b14156130bf57503360009081526101016020526040902054806130135760405162461bcd60e51b815260206004820181905260248201527f50617274793a3a756e65717569703a206865726f206e6f742070726573656e74604482015260640161055c565b3360008181526101016020908152604080832083905560fd80546001600160a01b03908116855261010084528285208786529093529281902080546001600160a01b031916905591549151632142170760e11b815230600482015260248101939093526044830184905216906342842e0e90606401600060405180830381600087803b1580156130a257600080fd5b505af11580156130b6573d6000803e3d6000fd5b5050505061320b565b60018360018111156130d3576130d3613b3b565b141561320b57503360009081526101016020908152604080832060ff85168452600101909152902054806131555760405162461bcd60e51b815260206004820152602360248201527f50617274793a3a756e65717569703a2066696768746572206e6f742070726573604482015262195b9d60ea1b606482015260840161055c565b3360008181526101016020908152604080832060ff87168452600101825280832083905560fe80546001600160a01b03908116855261010084528285208786529093529281902080546001600160a01b031916905591549151632142170760e11b815230600482015260248101939093526044830184905216906342842e0e90606401600060405180830381600087803b1580156131f257600080fd5b505af1158015613206573d6000803e3d6000fd5b505050505b337f73a8725701d4e16f7b03f4266ff9f53bab4459c9589ebc618dfe8909e76884e684600181111561323f5761323f613b3b565b6040805160ff92831681529186166020830152810184905260600160405180910390a292915050565b60006001600160e01b031982167f7965db0b0000000000000000000000000000000000000000000000000000000014806104dd57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146104dd565b600054610100900460ff166118e15760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161055c565b60606000613349836002614093565b61335490600261407b565b67ffffffffffffffff81111561336c5761336c613632565b6040519080825280601f01601f191660200182016040528015613396576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106133cd576133cd613d30565b60200101906001600160f81b031916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061341857613418613d30565b60200101906001600160f81b031916908160001a905350600061343c846002614093565b61344790600161407b565b90505b60018111156134cc577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061348857613488613d30565b1a60f81b82828151811061349e5761349e613d30565b60200101906001600160f81b031916908160001a90535060049490941c936134c5816140b2565b905061344a565b50831561351b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161055c565b9392505050565b60006020828403121561353457600080fd5b81356001600160e01b03198116811461351b57600080fd5b6002811061355957600080fd5b50565b60ff8116811461355957600080fd5b60008060006060848603121561358057600080fd5b833561358b8161354c565b9250602084013561359b8161355c565b929592945050506040919091013590565b6001600160a01b038116811461355957600080fd5b600080600080600060a086880312156135d957600080fd5b85356135e4816135ac565b945060208601356135f4816135ac565b93506040860135613604816135ac565b92506060860135613614816135ac565b91506080860135613624816135ac565b809150509295509295909350565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561367157613671613632565b604052919050565b6000806000806080858703121561368f57600080fd5b843561369a816135ac565b93506020858101356136ab816135ac565b935060408601359250606086013567ffffffffffffffff808211156136cf57600080fd5b818801915088601f8301126136e357600080fd5b8135818111156136f5576136f5613632565b613707601f8201601f19168501613648565b9150808252898482850101111561371d57600080fd5b808484018584013760008482840101525080935050505092959194509250565b60006020828403121561374f57600080fd5b5035919050565b6000806040838503121561376957600080fd5b82359150602083013561377b816135ac565b809150509250929050565b60008083601f84011261379857600080fd5b50813567ffffffffffffffff8111156137b057600080fd5b6020830191508360208260051b85010111156137cb57600080fd5b9250929050565b600080600080604085870312156137e857600080fd5b843567ffffffffffffffff8082111561380057600080fd5b61380c88838901613786565b9096509450602087013591508082111561382557600080fd5b5061383287828801613786565b95989497509550505050565b60006020828403121561385057600080fd5b813561351b816135ac565b60008083601f84011261386d57600080fd5b50813567ffffffffffffffff81111561388557600080fd5b6020830191508360206060830285010111156137cb57600080fd5b600080600080604085870312156138b657600080fd5b843567ffffffffffffffff808211156138ce57600080fd5b6138da8883890161385b565b909650945060208701359150808211156138f357600080fd5b506138328782880161385b565b60008060006060848603121561391557600080fd5b83356139208161354c565b92506020840135915060408401356139378161355c565b809150509250925092565b6000806040838503121561395557600080fd5b82356139608161354c565b9150602083013561377b8161355c565b60008083601f84011261398257600080fd5b50813567ffffffffffffffff81111561399a57600080fd5b6020830191508360208285010111156137cb57600080fd5b60008060008060008060008060a0898b0312156139ce57600080fd5b88356139d9816135ac565b975060208901356139e9816135ac565b9650604089013567ffffffffffffffff80821115613a0657600080fd5b613a128c838d01613786565b909850965060608b0135915080821115613a2b57600080fd5b613a378c838d01613786565b909650945060808b0135915080821115613a5057600080fd5b50613a5d8b828c01613970565b999c989b5096995094979396929594505050565b600081518084526020808501945080840160005b83811015613aa157815187529582019590820190600101613a85565b509495945050505050565b60208152600061351b6020830184613a71565b60008060008060008060a08789031215613ad857600080fd5b8635613ae3816135ac565b95506020870135613af3816135ac565b94506040870135935060608701359250608087013567ffffffffffffffff811115613b1d57600080fd5b613b2989828a01613970565b979a9699509497509295939492505050565b634e487b7160e01b600052602160045260246000fd5b600060208284031215613b6357600080fd5b815161351b816135ac565b80518015158114613b7e57600080fd5b919050565b60008060408385031215613b9657600080fd5b82519150613ba660208401613b6e565b90509250929050565b600060208284031215613bc157600080fd5b61351b82613b6e565b604081526000613bdd6040830185613a71565b82810360208401526110158185613a71565b805163ffffffff81168114613b7e57600080fd5b600060408284031215613c1557600080fd5b6040516040810181811067ffffffffffffffff82111715613c3857613c38613632565b604052905080613c4783613bef565b8152613c5560208401613bef565b60208201525092915050565b60006020808385031215613c7457600080fd5b825167ffffffffffffffff80821115613c8c57600080fd5b818501915085601f830112613ca057600080fd5b815181811115613cb257613cb2613632565b613cc0848260051b01613648565b818152848101925060069190911b830184019087821115613ce057600080fd5b928401925b81841015613d0957613cf78885613c03565b83528483019250604084019350613ce5565b979650505050505050565b600060408284031215613d2657600080fd5b61351b8383613c03565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff811415613d7357613d73613d46565b60010192915050565b604081016104dd8284805163ffffffff908116835260209182015116910152565b600060208284031215613daf57600080fd5b5051919050565b600063ffffffff808316818516808303821115613dd557613dd5613d46565b01949350505050565b60005b83811015613df9578181015183820152602001613de1565b838111156116f75750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613e42816017850160208801613dde565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351613e7f816028840160208801613dde565b01602801949350505050565b6020815260008251806020840152613eaa816040850160208701613dde565b601f01601f19169190910160400192915050565b6000600019821415613ed257613ed2613d46565b5060010190565b600060608284031215613eeb57600080fd5b6040516060810181811067ffffffffffffffff82111715613f0e57613f0e613632565b6040528251613f1c8161355c565b81526020830151613f2c8161355c565b60208201526040830151613f3f8161355c565b60408201529392505050565b604081526000613f5e6040830185613a71565b82810360208481019190915284518083528582019282019060005b81811015613f9857845160ff1683529383019391830191600101613f79565b5090979650505050505050565b600081518084526020808501945080840160005b83811015613aa157613fdf878351805163ffffffff908116835260209182015116910152565b6040969096019590820190600101613fb9565b61400f8185805163ffffffff908116835260209182015116910152565b6080604082015260006140256080830185613fa5565b82810360608401526140378185613fa5565b9695505050505050565b60006020828403121561405357600080fd5b813561351b8161354c565b60006020828403121561407057600080fd5b813561351b8161355c565b6000821982111561408e5761408e613d46565b500190565b60008160001904831182151516156140ad576140ad613d46565b500290565b6000816140c1576140c1613d46565b50600019019056fea2646970667358221220a4649635a91821d51acf010184a19733ddc8725e8889014dc457bad048e8ec5864736f6c634300080b0033

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

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.