ETH Price: $2,768.52 (+5.53%)
Gas: 1.2 Gwei

Contract

0x7c967Fbc3c2B1efeA292a5b4b139B87ac58CA53C
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw169717182023-04-03 23:23:59508 days ago1680564239IN
0x7c967Fbc...ac58CA53C
0 ETH0.0015414726.04233352
Withdraw164054142023-01-14 13:42:47587 days ago1673703767IN
0x7c967Fbc...ac58CA53C
0 ETH0.0013332117.47535572
Withdraw155233502022-09-12 22:10:47711 days ago1663020647IN
0x7c967Fbc...ac58CA53C
0 ETH0.0034007644.57627858
Withdraw Ethers154952952022-09-08 7:29:26715 days ago1662622166IN
0x7c967Fbc...ac58CA53C
0 ETH0.0013326531.08739189
Withdraw153570242022-08-17 6:08:26737 days ago1660716506IN
0x7c967Fbc...ac58CA53C
0 ETH0.0014727624.88159902
Withdraw153470592022-08-15 16:28:15739 days ago1660580895IN
0x7c967Fbc...ac58CA53C
0 ETH0.001988826.06864594
Withdraw152964602022-08-07 17:06:10747 days ago1659891970IN
0x7c967Fbc...ac58CA53C
0 ETH0.001908232.23810389
Withdraw152572502022-08-01 14:35:30753 days ago1659364530IN
0x7c967Fbc...ac58CA53C
0 ETH0.0013427217.6
Withdraw151886922022-07-21 22:32:58764 days ago1658442778IN
0x7c967Fbc...ac58CA53C
0 ETH0.0012546616.44574247
Withdraw151801532022-07-20 14:56:24765 days ago1658328984IN
0x7c967Fbc...ac58CA53C
0 ETH0.0037666563.63567841
Withdraw151452642022-07-15 5:01:25770 days ago1657861285IN
0x7c967Fbc...ac58CA53C
0 ETH0.0004503815.62152607
Withdraw151452642022-07-15 5:01:25770 days ago1657861285IN
0x7c967Fbc...ac58CA53C
0 ETH0.0009246515.62152607
Withdraw151418952022-07-14 16:35:42771 days ago1657816542IN
0x7c967Fbc...ac58CA53C
0 ETH0.0041762670.55577505
Withdraw151417002022-07-14 15:52:31771 days ago1657813951IN
0x7c967Fbc...ac58CA53C
0 ETH0.004000652.43869575
Withdraw150905002022-07-06 18:15:17779 days ago1657131317IN
0x7c967Fbc...ac58CA53C
0 ETH0.004336756.84423228
Withdraw147839292022-05-16 3:32:56830 days ago1652671976IN
0x7c967Fbc...ac58CA53C
0 ETH0.0011177118.88326767
Withdraw145932792022-04-16 0:55:26860 days ago1650070526IN
0x7c967Fbc...ac58CA53C
0 ETH0.0014526924.54246333
Withdraw145635592022-04-11 9:20:48865 days ago1649668848IN
0x7c967Fbc...ac58CA53C
0 ETH0.0014050123.7369552
Withdraw145558782022-04-10 4:40:20866 days ago1649565620IN
0x7c967Fbc...ac58CA53C
0 ETH0.0021552328.25021596
Withdraw145449202022-04-08 11:44:21868 days ago1649418261IN
0x7c967Fbc...ac58CA53C
0 ETH0.0023401939.53624768
Withdraw145448782022-04-08 11:33:21868 days ago1649417601IN
0x7c967Fbc...ac58CA53C
0 ETH0.0025319742.7764265
Withdraw145161172022-04-03 23:33:51873 days ago1649028831IN
0x7c967Fbc...ac58CA53C
0 ETH0.0024119840.74925234
Withdraw142487272022-02-21 9:58:48914 days ago1645437528IN
0x7c967Fbc...ac58CA53C
0 ETH0.0036408361.50990988
Withdraw142329882022-02-18 23:22:02917 days ago1645226522IN
0x7c967Fbc...ac58CA53C
0 ETH0.0034770958.74359654
Withdraw141936722022-02-12 21:24:21923 days ago1644701061IN
0x7c967Fbc...ac58CA53C
0 ETH0.00939905123.2
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
154952952022-09-08 7:29:26715 days ago1662622166
0x7c967Fbc...ac58CA53C
0.27 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DragonArena

Compiler Version
v0.8.0+commit.c7dfd78e

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
File 1 of 22 : DragonArena.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "./structs/DragonInfo.sol";
import "./structs/FightInfo.sol";
import "./utils/Random.sol";
import "./LockableReceiver.sol";
import "./DragonToken.sol";

contract DragonArena is LockableReceiver { 

    using SafeMath for uint;
    using Address for address payable;

    mapping(uint => uint) private _fights;
    mapping(uint => uint) private _dragonFights;
    mapping(uint => uint) private _attackers;

    uint private _fightPrice;

    event JoinFight(address indexed originator, uint fightId, uint dragonId);
    event FightFinished(address indexed operator, uint fightId, uint winnerId, bool technicalDefeat);
    event FightCancelled(address indexed operator, uint fightId);

    constructor(address accessControl, address dragonToken, uint weiFightPrice) 
    LockableReceiver(accessControl, dragonToken) {
        _fightPrice = weiFightPrice;
    }

    function price() external view returns(uint) {
        return _fightPrice;
    }

    function attackerFight(uint attackerId) public view returns (uint) {
        return _attackers[attackerId];
    }

    function fightOf(uint dragonId) public view returns (uint) {
        return _dragonFights[dragonId];
    }

    function setPrice(uint newPrice) external onlyRole(CFO_ROLE) {
        uint previousPrice = _fightPrice;
        _fightPrice = newPrice;
        emit ValueChanged("fightPrice", previousPrice, newPrice);
    }

    function getFightId(bytes calldata fightToken) public pure returns (uint) {
        return uint(keccak256(fightToken));
    }

    function fightInfo(uint fightId) external view returns (FightInfo.Details memory) {
        return FightInfo.getDetails(_fights[fightId]);
    }

    function joinFight(uint dragonId, bytes calldata fightToken) 
    external payable
    onlyHolder(dragonId) {
        require(fightOf(dragonId) == 0, "DragonArena: a dragon with the given id has already joined another fight");
        (uint value, FightInfo.Details memory fight) = FightInfo.readDetailsFromToken(fightToken);
        require(fight.dragon1Id > 0 && fight.dragon2Id > 0 
            && fight.dragon1Id != fight.dragon2Id 
            && ((fight.fightType == FightInfo.Types.Regular && fight.betAmount == 0)
                || (fight.fightType == FightInfo.Types.Money && fight.betAmount > 0)), "DragonArena: bad fight token");
        require(dragonId == fight.dragon1Id || dragonId == fight.dragon2Id, 
            "DragonArena: a dragon with the given id is not associated with this fight");
        require(msg.value >= (_fightPrice + fight.betAmount), "DragonArena: incorrect amount sent to the contract");

        uint fightId = getFightId(fightToken);
        // if it's an attacker dragon and a dragon-defender hasn't joined the fight yet then revert the transaction
        if (dragonId == fight.dragon1Id && fightOf(fight.dragon2Id) != fightId) { 
            revert("DragonArena: the dragon-defender must accept the fight first");
        }
        // if there is another record with the same dragon-attacker
        if (dragonId == fight.dragon2Id && attackerFight(fight.dragon1Id) > 0) { 
            revert("DragonArena: there is another fight with the same dragon-attacker");
        }
        
        if (_fights[fightId] == 0) {
            _fights[fightId] = value;
        }
        _attackers[fight.dragon1Id] = fightId;
        _dragonFights[dragonId] = fightId;

        emit JoinFight(_msgSender(), fightId, dragonId);
    }

    function startFight(uint fightId) external onlyRole(COO_ROLE) {
        uint fightValue = _fights[fightId];
        require(fightValue > 0, "DragonArena: a fight with the given id doesn't exist");
        FightInfo.Details memory fight = FightInfo.getDetails(fightValue);

        require(isLocked(fight.dragon1Id) && isLocked(fight.dragon2Id), 
            "DragonArena: both the dragons must be locked on the contract before starting a fight");
        
        DragonToken dragonToken = DragonToken(tokenContract());

        //init the strengths before fighting
        dragonToken.setStrength(fight.dragon1Id);
        dragonToken.setStrength(fight.dragon2Id);

        (uint winnerId, uint loserId, bool technicalDefeat) = _checkTechnicalDefeat(fight);

        if (!technicalDefeat) {
            DragonInfo.Details memory dd1 = dragonToken.dragonInfo(fight.dragon1Id);
            DragonInfo.Details memory dd2 = dragonToken.dragonInfo(fight.dragon2Id);
            (winnerId, loserId) = 
                _randomFightResult(fight.dragon1Id, dd1.strength, fight.dragon2Id, dd2.strength, fightId);
        }

        _transferTrophy(winnerId, loserId, fight, technicalDefeat);
        
        delete _attackers[fight.dragon1Id];
        delete _dragonFights[fight.dragon1Id];
        delete _dragonFights[fight.dragon2Id];
        delete _fights[fightId];

        emit FightFinished(_msgSender(), fightId, winnerId, technicalDefeat);
    }

    function cancelFight(uint fightId) external onlyRole(COO_ROLE) {
        uint fightValue = _fights[fightId];
        require(fightValue > 0, "DragonArena: a fight with the given id doesn't exist");
        FightInfo.Details memory fight = FightInfo.getDetails(fightValue);
        
        delete _attackers[fight.dragon1Id];
        delete _dragonFights[fight.dragon1Id];
        delete _dragonFights[fight.dragon2Id];
        delete _fights[fightId];

        emit FightCancelled(_msgSender(), fightId);
    }

    function withdraw(uint tokenId) public override virtual  {
        require(fightOf(tokenId) == 0 && attackerFight(tokenId) == 0, "DragonArena: unable to withdraw");
        super.withdraw(tokenId);
    }

    function _checkTechnicalDefeat(FightInfo.Details memory fight) internal view returns (uint, uint, bool) {
        uint f1 = _dragonFights[fight.dragon1Id];
        uint f2 = _dragonFights[fight.dragon2Id];
        require(f1 > 0 || f2 > 0, "DragonArena: none of the dragons has joined the fight");
        return  (f1 == 0) ? (fight.dragon2Id, fight.dragon1Id, true) : 
                (f2 == 0) ? (fight.dragon1Id, fight.dragon2Id, true) : 
                (0, 0, false);
    }

    function _transferTrophy(uint winnerId, uint loserId, FightInfo.Details memory fight, bool technicalDefeat) internal {
        if (fight.fightType == FightInfo.Types.Regular || technicalDefeat) {
            _lock(loserId, holderOf(winnerId));
            _transferTokenToHolder(loserId);
        }
        else if (fight.fightType == FightInfo.Types.Money) {
            payable(holderOf(winnerId)).sendValue(fight.betAmount*2);
        }
    }

    function _randomFightResult(uint dragon1Id, uint dragon1Strength, uint dragon2Id, uint dragon2Strength, uint salt)
    internal view returns (uint, uint) {

        uint totalStrength = dragon1Strength + dragon2Strength;
        uint result = Random.rand(salt ^ block.difficulty).mod(totalStrength);

        uint minId;
        uint maxId;
        uint minStrength;

        if (dragon1Strength < dragon2Strength) {
            minId = dragon1Id;
            minStrength = dragon1Strength;
            maxId = dragon2Id;
        } else {
            minId = dragon2Id;
            minStrength = dragon2Strength;
            maxId = dragon1Id;
        }

        if (result < minStrength) {
            return (minId, maxId);
        }
        else {
            return (maxId, minId);
        }
    }
}

File 2 of 22 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 3 of 22 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        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 Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(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 4 of 22 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a / b + (a % b == 0 ? 0 : 1);
    }
}

File 5 of 22 : DragonInfo.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

library DragonInfo {
    
    uint constant MASK = 0xF000000000000000000000000;

    enum Types { 
        Unknown,
        Common, 
        Rare16, 
        Rare17, 
        Rare18, 
        Rare19,
        Epic20, 
        Epic21,
        Epic22,
        Epic23,
        Epic24, 
        Legendary
    }

    struct Details { 
        uint genes;
        uint eggId;
        uint parent1Id;
        uint parent2Id;
        uint generation;
        uint strength;
        Types dragonType;
    }

    function getDetails(uint value) internal pure returns (Details memory) {
        return Details (
            {
                genes: uint256(uint104(value)),
                parent1Id: uint256(uint32(value >> 104)),
                parent2Id: uint256(uint32(value >> 136)),
                generation: uint256(uint16(value >> 168)),
                strength: uint256(uint16(value >> 184)),
                dragonType: Types(uint16(value >> 200)),
                eggId: uint256(uint32(value >> 216))
            }
        );
    }

    function getValue(Details memory details) internal pure returns (uint) {
        uint result = uint(details.genes);
        result |= details.parent1Id << 104;
        result |= details.parent2Id << 136;
        result |= details.generation << 168;
        result |= details.strength << 184;
        result |= uint(details.dragonType) << 200;
        result |= details.eggId << 216;
        return result;
    }

    function calcType(uint genes) internal pure returns (Types) {
        uint mask = MASK;
        uint numRare = 0;
        uint numEpic = 0;
        for (uint i = 0; i < 10; i++) { //just Rare and Epic genes are important to check
            if (genes & mask > 0) {
                if (i < 5) { //Epic-range
                    numEpic++;
                }
                else { //Rare-range
                    numRare++;
                }
            }
            mask = mask >> 4;
        }
        Types result = Types.Unknown;
        if (numEpic == 5 && numRare == 5) {
            result = Types.Legendary;
        }
        else if (numEpic < 5 && numRare == 5) {
            result = Types(6 + numEpic);
        }
        else if (numEpic == 0 && numRare < 5) {
            result = Types(1 + numRare);
        }
        else if (numEpic == 0 && numRare == 0) {
            result = Types.Common;
        }

        return result;
    }

    function calcStrength(uint genes) internal pure returns (uint) {
        uint mask = MASK;
        uint strength = 0;
        for (uint i = 0; i < 25; i++) { 
            uint gLevel = (genes & mask) >> ((24 - i) * 4);
            if (i < 6) { //Epic
                strength += 3 * (25 - i) * gLevel;
            } 
            else if (i < 10) { //Rare 
                strength += 2 * (25 - i) * gLevel;
            }
            else { //Common-range
                if (gLevel > 0) {
                    strength += (25 - i) * gLevel;
                }
                else {
                    strength += (25 - i);
                }
            }
            mask = mask >> 4;
        }
        return strength;
    }

    function calcGeneration(uint g1, uint g2) internal pure returns (uint) {
        return (g1 >= g2 ? g1 : g2) + 1;
    }
}

File 6 of 22 : FightInfo.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

import "../utils/BytesLib.sol";

library FightInfo {
    enum Types { Regular, Money }

    struct Details {
        uint dragon1Id;
        uint dragon2Id;
        Types fightType;
        uint betAmount;
    }

    function getValue(Details calldata info) internal pure returns (uint) {
        uint result = uint(info.dragon1Id);
        result |= info.dragon2Id << 32;
        result |= uint(info.fightType) << 64;
        result |= info.betAmount << 72;
        return result;
    }

    function readDetailsFromToken(bytes calldata fightToken) internal pure returns (uint, Details memory) {
        uint value = BytesLib.toUint256(fightToken, 0);
        return (value, getDetails(value));
    }

    function getDetails(uint value) internal pure returns (Details memory) {
        return Details (
            {
                dragon1Id: uint256(uint32(value)),
                dragon2Id: uint256(uint32(value >> 32)),
                fightType: Types(uint8(value >> 64)),
                betAmount: uint256(uint184(value >> 72))
            }
        );
    }
}

File 7 of 22 : Random.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

library Random {
    function rand(uint salt) internal view returns (uint) {
        return uint(keccak256(abi.encodePacked(block.difficulty, block.timestamp, salt)));
    }

    function randFrom(uint[] memory array, uint from, uint to, uint randomValue)
    internal pure returns (uint) {
        uint count = to - from;
        return array[from + randomValue % count];
    }

    function shuffle(uint[] memory array, uint randomValue) internal pure returns (uint[] memory) {
        for (uint i = 0; i < array.length; i++) {
            uint n = i + randomValue % (array.length - i);
            uint temp = array[n];
            array[n] = array[i];
            array[i] = temp;
        }
        return array;
    }
}

File 8 of 22 : LockableReceiver.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./access/BaseAccessControl.sol";

abstract contract LockableReceiver is BaseAccessControl, IERC721Receiver {
    
    using Address for address payable;

    address private _tokenContractAddress;
    mapping(uint => address) private _lockedTokens;

    event TokenLocked(uint tokenId, address indexed holder);
    event TokenWithdrawn(uint tokenId, address indexed holder);
    event EthersWithdrawn(address indexed operator, address indexed to, uint amount);

    constructor (address accessControl, address tokenContractAddress) 
    BaseAccessControl(accessControl) {
        _tokenContractAddress = tokenContractAddress;
    }

    modifier whenLocked(uint tokenId) {
        require(isLocked(tokenId), "LockableReceiver: token must be locked");
        _;
    }

    modifier onlyHolder(uint tokenId) {
        require(holderOf(tokenId) == _msgSender(), "LockableReceiver: caller is not the token holder");
        _;
    }

    function onERC721Received(address operator, address /*from*/, uint /*tokenId*/, bytes calldata /*data*/) 
        external virtual override returns (bytes4) {
        require(operator == address(this), "LockableReceiver: the caller is not a valid operator");
        return this.onERC721Received.selector;
    }

    function receiveApproval(address sender, uint tokenId, address _tokenContract, bytes calldata data) external virtual {
        require(tokenContract() == _msgSender(), "LockableReceiver: not enough privileges to call the method");
        require(_tokenContract == tokenContract(), "LockableReceiver: unable to receive the given token");
    
        IERC721(tokenContract()).safeTransferFrom(sender, address(this), tokenId, data);
        
        _lock(tokenId, sender);
        processERC721(sender, tokenId, data);
    }

    function processERC721(address from, uint tokenId, bytes calldata data) internal virtual {
    }

    function _lock(uint tokenId, address holder) internal {
        _lockedTokens[tokenId] = holder;
        emit TokenLocked(tokenId, holder);
    }

    function _unlock(uint tokenId) internal {
        delete _lockedTokens[tokenId];
    }

    function tokenContract() public view returns (address) {
        return _tokenContractAddress;
    }

    function setTokenContract(address newAddress) external onlyRole(CEO_ROLE) {
        address previousAddress = _tokenContractAddress;
        _tokenContractAddress = newAddress;
        emit AddressChanged("tokenContract", previousAddress, newAddress);
    }

    function isLocked(uint tokenId) public view returns (bool) {
        return _lockedTokens[tokenId] != address(0);
    }

    function holderOf(uint tokenId) public view returns (address) {
        return _lockedTokens[tokenId];
    }

    function withdrawEthers(uint amount, address payable to) external virtual onlyRole(CFO_ROLE) {
        to.sendValue(amount);
        emit EthersWithdrawn(_msgSender(), to, amount);
    }

    function withdraw(uint tokenId) public virtual onlyHolder(tokenId) {
        _transferTokenToHolder(tokenId);
        emit TokenWithdrawn(tokenId, _msgSender());
    }

    function _transferTokenToHolder(uint tokenId) internal virtual {
        address holder = holderOf(tokenId);
        if (holder != address(0)) {
            IERC721(tokenContract()).safeTransferFrom(address(this), holder, tokenId);
            _unlock(tokenId);
        }
    }
}

File 9 of 22 : DragonToken.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./access/BaseAccessControl.sol";
import "./structs/DragonInfo.sol";

contract DragonToken is ERC721, BaseAccessControl {

    using Address for address;
    using Counters for Counters.Counter;
    
    Counters.Counter private _dragonIds;

    // Mapping token id to dragon details
    mapping(uint => uint) private _info;
    // Mapping token id to cid
    mapping(uint => string) private _cids;

    string private _defaultMetadataCid;
    address private _dragonCreator;

    constructor(string memory defaultCid, address accessControl) 
    ERC721("CryptoDragons", "CD")
    BaseAccessControl(accessControl) {        
        _defaultMetadataCid = defaultCid;
    }

    function approveAndCall(address spender, uint256 tokenId, bytes calldata extraData) external returns (bool success) {
        _approve(spender, tokenId);
        (bool _success, ) = 
            spender.call(
                abi.encodeWithSignature("receiveApproval(address,uint256,address,bytes)", 
                _msgSender(), 
                tokenId, 
                address(this), 
                extraData) 
            );
        if(!_success) { 
            revert("DragonToken: spender internal error"); 
        }
        return true;
    }

    function tokenURI(uint tokenId) public view virtual override returns (string memory) {
        string memory cid = _cids[tokenId];
        return string(abi.encodePacked("ipfs://", (bytes(cid).length > 0) ? cid : defaultMetadataCid()));
    }

    function dragonCreatorAddress() public view returns(address) {
        return _dragonCreator;
    }

    function setDragonCreatorAddress(address newAddress) external onlyRole(CEO_ROLE) {
        address previousAddress = _dragonCreator;
        _dragonCreator = newAddress;
        emit AddressChanged("dragonCreator", previousAddress, newAddress);
    }

    function hasMetadataCid(uint tokenId) public view returns(bool) {
        return bytes(_cids[tokenId]).length > 0;
    }

    function setMetadataCid(uint tokenId, string calldata cid) external onlyRole(COO_ROLE) {
        require(bytes(cid).length >= 46, "DragonToken: bad CID");
        require(!hasMetadataCid(tokenId), "DragonToken: CID is already set");
        _cids[tokenId] = cid;
    }

    function defaultMetadataCid() public view returns (string memory){
        return _defaultMetadataCid;
    }

    function setDefaultMetadataCid(string calldata newDefaultCid) external onlyRole(COO_ROLE) {
        _defaultMetadataCid = newDefaultCid;
    }

    function dragonInfo(uint dragonId) public view returns (DragonInfo.Details memory) {
        return DragonInfo.getDetails(_info[dragonId]);
    }

    function strengthOf(uint dragonId) external view returns (uint) {
        DragonInfo.Details memory details = dragonInfo(dragonId);
        return details.strength > 0 ? details.strength : DragonInfo.calcStrength(details.genes);
    }

    function isSiblings(uint dragon1Id, uint dragon2Id) external view returns (bool) {
        DragonInfo.Details memory info1 = dragonInfo(dragon1Id);
        DragonInfo.Details memory info2 = dragonInfo(dragon2Id);
        return 
            (info1.generation > 1 && info2.generation > 1) && //the 1st generation of dragons doesn't have siblings
            (info1.parent1Id == info2.parent1Id || info1.parent1Id == info2.parent2Id || 
            info1.parent2Id == info2.parent1Id || info1.parent2Id == info2.parent2Id);
    }

    function isParent(uint dragon1Id, uint dragon2Id) external view returns (bool) {
        DragonInfo.Details memory info = dragonInfo(dragon1Id);
        return info.parent1Id == dragon2Id || info.parent2Id == dragon2Id;
    }

    function mint(address to, DragonInfo.Details calldata info) external returns (uint) {
        require(_msgSender() == dragonCreatorAddress(), "DragonToken: not enough privileges to call the method");
        
        _dragonIds.increment();
        uint newDragonId = uint(_dragonIds.current());
        
        _info[newDragonId] = DragonInfo.getValue(info);
        _mint(to, newDragonId);

        return newDragonId;
    }

    function setStrength(uint dragonId) external returns (uint) {
        DragonInfo.Details memory details = dragonInfo(dragonId);
        if (details.strength == 0) {
            details.strength = DragonInfo.calcStrength(details.genes);
            _info[dragonId] = DragonInfo.getValue(details);
        }
        return details.strength;
    }
}

File 10 of 22 : BytesLib.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

library BytesLib {
    function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {
        require(_bytes.length >= _start + 20, "toAddress_outOfBounds");
        address tempAddress;

        assembly {
            tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)
        }

        return tempAddress;
    }
    
    function toUint256(bytes memory _bytes, uint _start) internal pure returns (uint) {
        require(_bytes.length >= _start + 32, "toUint256_outOfBounds");
        uint tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x20), _start))
        }

        return tempUint;
    }

    function toTuple128(bytes memory _bytes, uint256 _start) internal pure returns (uint, uint) {
        require(_bytes.length >= _start + 32, "toTuple16_outOfBounds");
        uint tempUint;
        uint n1;
        uint n2;

        assembly {
            tempUint := mload(add(add(_bytes, 0x20), _start))
            n1 := and(shr(0x80, tempUint), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
            n2 := and(tempUint, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
        }

        return (n1, n2);
    }
}

File 11 of 22 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 12 of 22 : IERC721.sol
// SPDX-License-Identifier: MIT

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 13 of 22 : BaseAccessControl.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/IAccessControl.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "../interfaces/IChangeableVariables.sol";

abstract contract BaseAccessControl is Context, IChangeableVariables {

    bytes32 public constant CEO_ROLE = keccak256("CEO");
    bytes32 public constant CFO_ROLE = keccak256("CFO");
    bytes32 public constant COO_ROLE = keccak256("COO");

    address private _accessControl;

    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    constructor (address accessControl) Context() {
        _accessControl = accessControl;
    }

    function accessControlAddress() public view returns (address) {
        return _accessControl;
    }

    function setAccessControlAddress(address newAddress) external onlyRole(CEO_ROLE) {
        address previousAddress = _accessControl;
        _accessControl = newAddress;
        emit AddressChanged("accessControl", previousAddress, newAddress);
    }

    function hasRole(bytes32 role, address account) public view returns (bool) {
        return IAccessControl(accessControlAddress()).hasRole(role, account);
    }

    function _checkRole(bytes32 role, address account) internal view {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }
}

File 14 of 22 : IERC165.sol
// SPDX-License-Identifier: MIT

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 15 of 22 : IAccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 16 of 22 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

File 17 of 22 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

File 18 of 22 : IChangeableVariables.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.0;

interface IChangeableVariables {
    event AddressChanged(string fieldName, address previousAddress, address newAddress);
    event ValueChanged(string fieldName, uint previousValue, uint newValue);
    event BoolValueChanged(string fieldName, bool previousValue, bool newValue);
}

File 19 of 22 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

File 20 of 22 : Counters.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 21 of 22 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 22 of 22 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"accessControl","type":"address"},{"internalType":"address","name":"dragonToken","type":"address"},{"internalType":"uint256","name":"weiFightPrice","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"fieldName","type":"string"},{"indexed":false,"internalType":"address","name":"previousAddress","type":"address"},{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"AddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"fieldName","type":"string"},{"indexed":false,"internalType":"bool","name":"previousValue","type":"bool"},{"indexed":false,"internalType":"bool","name":"newValue","type":"bool"}],"name":"BoolValueChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EthersWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"uint256","name":"fightId","type":"uint256"}],"name":"FightCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"uint256","name":"fightId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"winnerId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"technicalDefeat","type":"bool"}],"name":"FightFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"originator","type":"address"},{"indexed":false,"internalType":"uint256","name":"fightId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dragonId","type":"uint256"}],"name":"JoinFight","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"holder","type":"address"}],"name":"TokenLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"holder","type":"address"}],"name":"TokenWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"fieldName","type":"string"},{"indexed":false,"internalType":"uint256","name":"previousValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"ValueChanged","type":"event"},{"inputs":[],"name":"CEO_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CFO_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"COO_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"accessControlAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"attackerId","type":"uint256"}],"name":"attackerFight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"fightId","type":"uint256"}],"name":"cancelFight","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fightId","type":"uint256"}],"name":"fightInfo","outputs":[{"components":[{"internalType":"uint256","name":"dragon1Id","type":"uint256"},{"internalType":"uint256","name":"dragon2Id","type":"uint256"},{"internalType":"enum FightInfo.Types","name":"fightType","type":"uint8"},{"internalType":"uint256","name":"betAmount","type":"uint256"}],"internalType":"struct FightInfo.Details","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"dragonId","type":"uint256"}],"name":"fightOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"fightToken","type":"bytes"}],"name":"getFightId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","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":"uint256","name":"tokenId","type":"uint256"}],"name":"holderOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"dragonId","type":"uint256"},{"internalType":"bytes","name":"fightToken","type":"bytes"}],"name":"joinFight","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","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":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"_tokenContract","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"receiveApproval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAddress","type":"address"}],"name":"setAccessControlAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAddress","type":"address"}],"name":"setTokenContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fightId","type":"uint256"}],"name":"startFight","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokenContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address payable","name":"to","type":"address"}],"name":"withdrawEthers","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162003de938038062003de98339818101604052810190620000379190620000fc565b828281806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505080600681905550505050620001c4565b600081519050620000df8162000190565b92915050565b600081519050620000f681620001aa565b92915050565b6000806000606084860312156200011257600080fd5b60006200012286828701620000ce565b93505060206200013586828701620000ce565b92505060406200014886828701620000e5565b9150509250925092565b60006200015f8262000166565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6200019b8162000152565b8114620001a757600080fd5b50565b620001b58162000186565b8114620001c157600080fd5b50565b613c1580620001d46000396000f3fe6080604052600436106101405760003560e01c806391b7f5ed116100b6578063bbcd5bbe1161006f578063bbcd5bbe1461044d578063dbacc23714610476578063e8d56b8b146104b3578063f4004701146104dc578063f6aacfb114610519578063f9ca62d91461055657610140565b806391b7f5ed1461034a57806391d14854146103735780639bd1c356146103b05780639f6f50ed146103cc578063a035b1fe146103f7578063b514be631461042257610140565b80633acfd44f116101085780633acfd44f1461023a57806355a373d6146102655780635ef922bb146102905780635fe5506f146102cd57806366741377146102f65780638f4ffcb11461032157610140565b806305bbe8d814610145578063150b7a02146101825780632a6e5e11146101bf5780632e1a7d4d146101e857806331d0382014610211575b600080fd5b34801561015157600080fd5b5061016c600480360381019061016791906127b9565b610593565b6040516101799190613780565b60405180910390f35b34801561018e57600080fd5b506101a960048036038101906101a491906125e6565b6105b0565b6040516101b69190613434565b60405180910390f35b3480156101cb57600080fd5b506101e660048036038101906101e1919061280b565b610633565b005b3480156101f457600080fd5b5061020f600480360381019061020a91906127b9565b6106ff565b005b34801561021d57600080fd5b50610238600480360381019061023391906127b9565b61076a565b005b34801561024657600080fd5b5061024f610bcb565b60405161025c91906133f0565b60405180910390f35b34801561027157600080fd5b5061027a610bef565b6040516102879190613335565b60405180910390f35b34801561029c57600080fd5b506102b760048036038101906102b291906127b9565b610c19565b6040516102c49190613765565b60405180910390f35b3480156102d957600080fd5b506102f460048036038101906102ef91906127b9565b610c44565b005b34801561030257600080fd5b5061030b610da1565b6040516103189190613335565b60405180910390f35b34801561032d57600080fd5b5061034860048036038101906103439190612666565b610dca565b005b34801561035657600080fd5b50610371600480360381019061036c91906127b9565b610f52565b005b34801561037f57600080fd5b5061039a6004803603810190610395919061270f565b610fd0565b6040516103a791906133d5565b60405180910390f35b6103ca60048036038101906103c59190612847565b61106c565b005b3480156103d857600080fd5b506103e161150c565b6040516103ee91906133f0565b60405180910390f35b34801561040357600080fd5b5061040c611530565b6040516104199190613780565b60405180910390f35b34801561042e57600080fd5b5061043761153a565b60405161044491906133f0565b60405180910390f35b34801561045957600080fd5b50610474600480360381019061046f91906125bd565b61155e565b005b34801561048257600080fd5b5061049d600480360381019061049891906127b9565b611636565b6040516104aa9190613335565b60405180910390f35b3480156104bf57600080fd5b506104da60048036038101906104d591906125bd565b611673565b005b3480156104e857600080fd5b5061050360048036038101906104fe919061274b565b611749565b6040516105109190613780565b60405180910390f35b34801561052557600080fd5b50610540600480360381019061053b91906127b9565b61176e565b60405161054d91906133d5565b60405180910390f35b34801561056257600080fd5b5061057d600480360381019061057891906127b9565b6117da565b60405161058a9190613780565b60405180910390f35b600060046000838152602001908152602001600020549050919050565b60003073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614610620576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610617906135cd565b60405180910390fd5b63150b7a0260e01b905095945050505050565b7f33fa24d9aab6b79237248a16094d5f78ea83bb51e42c123ce925a264e7d816cc610665816106606117f7565b6117ff565b61068e838373ffffffffffffffffffffffffffffffffffffffff1661189c90919063ffffffff16565b8173ffffffffffffffffffffffffffffffffffffffff166106ad6117f7565b73ffffffffffffffffffffffffffffffffffffffff167f372bb9ce23c45af0229f3ad425305ebadfb790c0b0453fa3077a02d7d8c987bb856040516106f29190613780565b60405180910390a3505050565b600061070a82610593565b14801561071f5750600061071d826117da565b145b61075e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107559061366d565b60405180910390fd5b61076781611990565b50565b7fefa080c67ecf4a6bf40c9dc64173420c08f359250ca6562d7c80f7c7b9b1396961079c816107976117f7565b6117ff565b600060036000848152602001908152602001600020549050600081116107f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ee90613725565b60405180910390fd5b600061080282611a70565b9050610811816000015161176e565b80156108265750610825816020015161176e565b5b610865576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085c9061350d565b60405180910390fd5b600061086f610bef565b90508073ffffffffffffffffffffffffffffffffffffffff16637e7849ff83600001516040518263ffffffff1660e01b81526004016108ae9190613780565b602060405180830381600087803b1580156108c857600080fd5b505af11580156108dc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090091906127e2565b508073ffffffffffffffffffffffffffffffffffffffff16637e7849ff83602001516040518263ffffffff1660e01b815260040161093e9190613780565b602060405180830381600087803b15801561095857600080fd5b505af115801561096c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099091906127e2565b50600080600061099f85611b44565b92509250925080610af45760008473ffffffffffffffffffffffffffffffffffffffff1663225b38fd87600001516040518263ffffffff1660e01b81526004016109e99190613780565b60e06040518083038186803b158015610a0157600080fd5b505afa158015610a15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a399190612790565b905060008573ffffffffffffffffffffffffffffffffffffffff1663225b38fd88602001516040518263ffffffff1660e01b8152600401610a7a9190613780565b60e06040518083038186803b158015610a9257600080fd5b505afa158015610aa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aca9190612790565b9050610ae987600001518360a0015189602001518460a001518e611c16565b809550819650505050505b610b0083838784611c9d565b6005600086600001518152602001908152602001600020600090556004600086600001518152602001908152602001600020600090556004600086602001518152602001908152602001600020600090556003600089815260200190815260200160002060009055610b706117f7565b73ffffffffffffffffffffffffffffffffffffffff167f2d9c88b11be04614bf09782282a5573f8eac48eafce40c782ce4dba21fdc4f01898584604051610bb9939291906137c4565b60405180910390a25050505050505050565b7fefa080c67ecf4a6bf40c9dc64173420c08f359250ca6562d7c80f7c7b9b1396981565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610c216123d0565b610c3d6003600084815260200190815260200160002054611a70565b9050919050565b7fefa080c67ecf4a6bf40c9dc64173420c08f359250ca6562d7c80f7c7b9b13969610c7681610c716117f7565b6117ff565b60006003600084815260200190815260200160002054905060008111610cd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc890613725565b60405180910390fd5b6000610cdc82611a70565b90506005600082600001518152602001908152602001600020600090556004600082600001518152602001908152602001600020600090556004600082602001518152602001908152602001600020600090556003600085815260200190815260200160002060009055610d4e6117f7565b73ffffffffffffffffffffffffffffffffffffffff167f3e1afbbac8116846aca29cd7c86ccddbfaf2d62826bbc44d64a8dc52f92d61af85604051610d939190613780565b60405180910390a250505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610dd26117f7565b73ffffffffffffffffffffffffffffffffffffffff16610df0610bef565b73ffffffffffffffffffffffffffffffffffffffff1614610e46576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3d90613491565b60405180910390fd5b610e4e610bef565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610ebb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb29061358d565b60405180910390fd5b610ec3610bef565b73ffffffffffffffffffffffffffffffffffffffff1663b88d4fde86308786866040518663ffffffff1660e01b8152600401610f03959493929190613387565b600060405180830381600087803b158015610f1d57600080fd5b505af1158015610f31573d6000803e3d6000fd5b50505050610f3f8486611e07565b610f4b85858484611eab565b5050505050565b7f33fa24d9aab6b79237248a16094d5f78ea83bb51e42c123ce925a264e7d816cc610f8481610f7f6117f7565b6117ff565b60006006549050826006819055507fe98e5fcd3d43c7e5dd114bafcc428bc7ff8525b014fe3b51fc721ba5671f98fb8184604051610fc39291906136ad565b60405180910390a1505050565b6000610fda610da1565b73ffffffffffffffffffffffffffffffffffffffff166391d1485484846040518363ffffffff1660e01b815260040161101492919061340b565b60206040518083038186803b15801561102c57600080fd5b505afa158015611040573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106491906126e6565b905092915050565b826110756117f7565b73ffffffffffffffffffffffffffffffffffffffff1661109482611636565b73ffffffffffffffffffffffffffffffffffffffff16146110ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e19061352d565b60405180910390fd5b60006110f585610593565b14611135576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112c906135ad565b60405180910390fd5b6000806111428585611eb1565b915091506000816000015111801561115e575060008160200151115b801561117257508060200151816000015114155b80156112905750600060018111156111b3577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b816040015160018111156111f0577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b148015611201575060008160600151145b8061128f5750600180811115611240577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8160400151600181111561127d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b14801561128e575060008160600151115b5b5b6112cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c69061362d565b60405180910390fd5b80600001518614806112e45750806020015186145b611323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131a906134b1565b60405180910390fd5b8060600151600654611335919061386f565b341015611377576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136e9061356d565b60405180910390fd5b60006113838686611749565b90508160000151871480156113a45750806113a18360200151610593565b14155b156113e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113db90613745565b60405180910390fd5b8160200151871480156114035750600061140183600001516117da565b115b15611443576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143a9061354d565b60405180910390fd5b600060036000838152602001908152602001600020541415611478578260036000838152602001908152602001600020819055505b806005600084600001518152602001908152602001600020819055508060046000898152602001908152602001600020819055506114b46117f7565b73ffffffffffffffffffffffffffffffffffffffff167f6df0317433e5e92b71d2c7e9e7b1f5f7a08b092395be345111a77dd7d607fa7b82896040516114fb92919061379b565b60405180910390a250505050505050565b7f33fa24d9aab6b79237248a16094d5f78ea83bb51e42c123ce925a264e7d816cc81565b6000600654905090565b7fdc0d7a095c4e917ecbeb7deda7c942ff9744013d419e37549215a413915e421d81565b7fdc0d7a095c4e917ecbeb7deda7c942ff9744013d419e37549215a413915e421d6115908161158b6117f7565b6117ff565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f4ca142703425bec1d507d5581fac3a3e61eadcbeafbd7c0a03e2897d96de1cc581846040516116299291906136e9565b60405180910390a1505050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b7fdc0d7a095c4e917ecbeb7deda7c942ff9744013d419e37549215a413915e421d6116a5816116a06117f7565b6117ff565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f4ca142703425bec1d507d5581fac3a3e61eadcbeafbd7c0a03e2897d96de1cc5818460405161173c9291906134d1565b60405180910390a1505050565b6000828260405161175b929190613290565b604051809103902060001c905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600060056000838152602001908152602001600020549050919050565b600033905090565b6118098282610fd0565b6118985761182e8173ffffffffffffffffffffffffffffffffffffffff166014611f24565b61183c8360001c6020611f24565b60405160200161184d9291906132be565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188f919061344f565b60405180910390fd5b5050565b804710156118df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118d69061360d565b60405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff1682604051611905906132a9565b60006040518083038185875af1925050503d8060008114611942576040519150601f19603f3d011682016040523d82523d6000602084013e611947565b606091505b505090508061198b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611982906135ed565b60405180910390fd5b505050565b806119996117f7565b73ffffffffffffffffffffffffffffffffffffffff166119b882611636565b73ffffffffffffffffffffffffffffffffffffffff1614611a0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a059061352d565b60405180910390fd5b611a178261221e565b611a1f6117f7565b73ffffffffffffffffffffffffffffffffffffffff167f61dc2e6e64c7a742717c1eae2958f9bc011c40d616afd06af648eff740c2b04d83604051611a649190613780565b60405180910390a25050565b611a786123d0565b60405180608001604052808363ffffffff168152602001602084901c63ffffffff168152602001604084901c60ff166001811115611adf577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6001811115611b17577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8152602001604884901c76ffffffffffffffffffffffffffffffffffffffffffffff168152509050919050565b6000806000806004600086600001518152602001908152602001600020549050600060046000876020015181526020019081526020016000205490506000821180611b8f5750600081115b611bce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bc59061364d565b60405180910390fd5b60008214611bfa5760008114611be8576000806000611bf5565b8560000151866020015160015b611c07565b8560200151866000015160015b94509450945050509193909250565b60008060008487611c27919061386f565b90506000611c4882611c3a4488186122e3565b61231a90919063ffffffff16565b90506000806000888b1015611c65578b92508a9050899150611c6f565b8992508890508b91505b80841015611c87578282965096505050505050611c93565b81839650965050505050505b9550959350505050565b60006001811115611cd7577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b82604001516001811115611d14577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1480611d1d5750805b15611d4257611d3483611d2f86611636565b611e07565b611d3d8361221e565b611e01565b600180811115611d7b577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b82604001516001811115611db8577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415611e0057611dff60028360600151611dd291906138c5565b611ddb86611636565b73ffffffffffffffffffffffffffffffffffffffff1661189c90919063ffffffff16565b5b5b50505050565b806002600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f9ecfd70e9ff36df72989324a49559383d39f9290d700b10cf5ac10dcb68d264383604051611e9f9190613780565b60405180910390a25050565b50505050565b6000611ebb6123d0565b6000611f0c85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000612330565b905080611f1882611a70565b92509250509250929050565b606060006002836002611f3791906138c5565b611f41919061386f565b67ffffffffffffffff811115611f80577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611fb25781602001600182028036833780820191505090505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612010577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061209a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600060018460026120da91906138c5565b6120e4919061386f565b90505b60018111156121d0577f3031323334353637383961626364656600000000000000000000000000000000600f86166010811061214c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b1a60f81b828281518110612189577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c9450806121c990613a16565b90506120e7565b5060008414612214576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161220b90613471565b60405180910390fd5b8091505092915050565b600061222982611636565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146122df57612267610bef565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e3083856040518463ffffffff1660e01b81526004016122a393929190613350565b600060405180830381600087803b1580156122bd57600080fd5b505af11580156122d1573d6000803e3d6000fd5b505050506122de82612397565b5b5050565b60004442836040516020016122fa939291906132f8565b6040516020818303038152906040528051906020012060001c9050919050565b600081836123289190613a4a565b905092915050565b600060208261233f919061386f565b83511015612382576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123799061368d565b60405180910390fd5b60008260208501015190508091505092915050565b6002600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550565b6040518060800160405280600081526020016000815260200160006001811115612423577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8152602001600081525090565b60008135905061243f81613b5c565b92915050565b60008135905061245481613b73565b92915050565b60008151905061246981613b8a565b92915050565b60008135905061247e81613ba1565b92915050565b60008083601f84011261249657600080fd5b8235905067ffffffffffffffff8111156124af57600080fd5b6020830191508360018202830111156124c757600080fd5b9250929050565b6000815190506124dd81613bb8565b92915050565b600060e082840312156124f557600080fd5b6124ff60e06137fb565b9050600061250f848285016125a8565b6000830152506020612523848285016125a8565b6020830152506040612537848285016125a8565b604083015250606061254b848285016125a8565b606083015250608061255f848285016125a8565b60808301525060a0612573848285016125a8565b60a08301525060c0612587848285016124ce565b60c08301525092915050565b6000813590506125a281613bc8565b92915050565b6000815190506125b781613bc8565b92915050565b6000602082840312156125cf57600080fd5b60006125dd84828501612430565b91505092915050565b6000806000806000608086880312156125fe57600080fd5b600061260c88828901612430565b955050602061261d88828901612430565b945050604061262e88828901612593565b935050606086013567ffffffffffffffff81111561264b57600080fd5b61265788828901612484565b92509250509295509295909350565b60008060008060006080868803121561267e57600080fd5b600061268c88828901612430565b955050602061269d88828901612593565b94505060406126ae88828901612430565b935050606086013567ffffffffffffffff8111156126cb57600080fd5b6126d788828901612484565b92509250509295509295909350565b6000602082840312156126f857600080fd5b60006127068482850161245a565b91505092915050565b6000806040838503121561272257600080fd5b60006127308582860161246f565b925050602061274185828601612430565b9150509250929050565b6000806020838503121561275e57600080fd5b600083013567ffffffffffffffff81111561277857600080fd5b61278485828601612484565b92509250509250929050565b600060e082840312156127a257600080fd5b60006127b0848285016124e3565b91505092915050565b6000602082840312156127cb57600080fd5b60006127d984828501612593565b91505092915050565b6000602082840312156127f457600080fd5b6000612802848285016125a8565b91505092915050565b6000806040838503121561281e57600080fd5b600061282c85828601612593565b925050602061283d85828601612445565b9150509250929050565b60008060006040848603121561285c57600080fd5b600061286a86828701612593565b935050602084013567ffffffffffffffff81111561288757600080fd5b61289386828701612484565b92509250509250925092565b6128a88161391f565b82525050565b6128b781613943565b82525050565b6128c68161394f565b82525050565b6128d581613959565b82525050565b60006128e78385613837565b93506128f48385846139d4565b6128fd83613b37565b840190509392505050565b60006129148385613848565b93506129218385846139d4565b82840190509392505050565b612936816139c2565b82525050565b60006129478261382c565b6129518185613853565b93506129618185602086016139e3565b61296a81613b37565b840191505092915050565b60006129808261382c565b61298a8185613864565b935061299a8185602086016139e3565b80840191505092915050565b60006129b3602083613853565b91507f537472696e67733a20686578206c656e67746820696e73756666696369656e746000830152602082019050919050565b60006129f3603a83613853565b91507f4c6f636b61626c6552656365697665723a206e6f7420656e6f7567682070726960008301527f76696c6567657320746f2063616c6c20746865206d6574686f640000000000006020830152604082019050919050565b6000612a59604983613853565b91507f447261676f6e4172656e613a206120647261676f6e207769746820746865206760008301527f6976656e206964206973206e6f74206173736f6369617465642077697468207460208301527f68697320666967687400000000000000000000000000000000000000000000006040830152606082019050919050565b6000612ae5600d83613853565b91507f616363657373436f6e74726f6c000000000000000000000000000000000000006000830152602082019050919050565b6000612b25605483613853565b91507f447261676f6e4172656e613a20626f74682074686520647261676f6e73206d7560008301527f7374206265206c6f636b6564206f6e2074686520636f6e74726163742062656660208301527f6f7265207374617274696e6720612066696768740000000000000000000000006040830152606082019050919050565b6000612bb1603083613853565b91507f4c6f636b61626c6552656365697665723a2063616c6c6572206973206e6f742060008301527f74686520746f6b656e20686f6c646572000000000000000000000000000000006020830152604082019050919050565b6000612c17604183613853565b91507f447261676f6e4172656e613a20746865726520697320616e6f7468657220666960008301527f6768742077697468207468652073616d6520647261676f6e2d61747461636b6560208301527f72000000000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000612ca3603283613853565b91507f447261676f6e4172656e613a20696e636f727265637420616d6f756e7420736560008301527f6e7420746f2074686520636f6e747261637400000000000000000000000000006020830152604082019050919050565b6000612d09603383613853565b91507f4c6f636b61626c6552656365697665723a20756e61626c6520746f207265636560008301527f6976652074686520676976656e20746f6b656e000000000000000000000000006020830152604082019050919050565b6000612d6f604883613853565b91507f447261676f6e4172656e613a206120647261676f6e207769746820746865206760008301527f6976656e2069642068617320616c7265616479206a6f696e656420616e6f746860208301527f65722066696768740000000000000000000000000000000000000000000000006040830152606082019050919050565b6000612dfb603483613853565b91507f4c6f636b61626c6552656365697665723a207468652063616c6c65722069732060008301527f6e6f7420612076616c6964206f70657261746f720000000000000000000000006020830152604082019050919050565b6000612e61603a83613853565b91507f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260008301527f6563697069656e74206d617920686176652072657665727465640000000000006020830152604082019050919050565b6000612ec7601d83613853565b91507f416464726573733a20696e73756666696369656e742062616c616e63650000006000830152602082019050919050565b6000612f07601c83613853565b91507f447261676f6e4172656e613a2062616420666967687420746f6b656e000000006000830152602082019050919050565b6000612f47603583613853565b91507f447261676f6e4172656e613a206e6f6e65206f662074686520647261676f6e7360008301527f20686173206a6f696e65642074686520666967687400000000000000000000006020830152604082019050919050565b6000612fad601f83613853565b91507f447261676f6e4172656e613a20756e61626c6520746f207769746864726177006000830152602082019050919050565b6000612fed601583613853565b91507f746f55696e743235365f6f75744f66426f756e647300000000000000000000006000830152602082019050919050565b600061302d600a83613853565b91507f66696768745072696365000000000000000000000000000000000000000000006000830152602082019050919050565b600061306d600d83613853565b91507f746f6b656e436f6e7472616374000000000000000000000000000000000000006000830152602082019050919050565b60006130ad603483613853565b91507f447261676f6e4172656e613a206120666967687420776974682074686520676960008301527f76656e20696420646f65736e27742065786973740000000000000000000000006020830152604082019050919050565b6000613113600083613848565b9150600082019050919050565b600061312d601783613864565b91507f416363657373436f6e74726f6c3a206163636f756e74200000000000000000006000830152601782019050919050565b600061316d603c83613853565b91507f447261676f6e4172656e613a2074686520647261676f6e2d646566656e64657260008301527f206d7573742061636365707420746865206669676874206669727374000000006020830152604082019050919050565b60006131d3601183613864565b91507f206973206d697373696e6720726f6c65200000000000000000000000000000006000830152601182019050919050565b60808201600082015161321c600085018261325b565b50602082015161322f602085018261325b565b506040820151613242604085018261292d565b506060820151613255606085018261325b565b50505050565b613264816139b8565b82525050565b613273816139b8565b82525050565b61328a613285826139b8565b613a40565b82525050565b600061329d828486612908565b91508190509392505050565b60006132b482613106565b9150819050919050565b60006132c982613120565b91506132d58285612975565b91506132e0826131c6565b91506132ec8284612975565b91508190509392505050565b60006133048286613279565b6020820191506133148285613279565b6020820191506133248284613279565b602082019150819050949350505050565b600060208201905061334a600083018461289f565b92915050565b6000606082019050613365600083018661289f565b613372602083018561289f565b61337f604083018461326a565b949350505050565b600060808201905061339c600083018861289f565b6133a9602083018761289f565b6133b6604083018661326a565b81810360608301526133c98184866128db565b90509695505050505050565b60006020820190506133ea60008301846128ae565b92915050565b600060208201905061340560008301846128bd565b92915050565b600060408201905061342060008301856128bd565b61342d602083018461289f565b9392505050565b600060208201905061344960008301846128cc565b92915050565b60006020820190508181036000830152613469818461293c565b905092915050565b6000602082019050818103600083015261348a816129a6565b9050919050565b600060208201905081810360008301526134aa816129e6565b9050919050565b600060208201905081810360008301526134ca81612a4c565b9050919050565b600060608201905081810360008301526134ea81612ad8565b90506134f9602083018561289f565b613506604083018461289f565b9392505050565b6000602082019050818103600083015261352681612b18565b9050919050565b6000602082019050818103600083015261354681612ba4565b9050919050565b6000602082019050818103600083015261356681612c0a565b9050919050565b6000602082019050818103600083015261358681612c96565b9050919050565b600060208201905081810360008301526135a681612cfc565b9050919050565b600060208201905081810360008301526135c681612d62565b9050919050565b600060208201905081810360008301526135e681612dee565b9050919050565b6000602082019050818103600083015261360681612e54565b9050919050565b6000602082019050818103600083015261362681612eba565b9050919050565b6000602082019050818103600083015261364681612efa565b9050919050565b6000602082019050818103600083015261366681612f3a565b9050919050565b6000602082019050818103600083015261368681612fa0565b9050919050565b600060208201905081810360008301526136a681612fe0565b9050919050565b600060608201905081810360008301526136c681613020565b90506136d5602083018561326a565b6136e2604083018461326a565b9392505050565b6000606082019050818103600083015261370281613060565b9050613711602083018561289f565b61371e604083018461289f565b9392505050565b6000602082019050818103600083015261373e816130a0565b9050919050565b6000602082019050818103600083015261375e81613160565b9050919050565b600060808201905061377a6000830184613206565b92915050565b6000602082019050613795600083018461326a565b92915050565b60006040820190506137b0600083018561326a565b6137bd602083018461326a565b9392505050565b60006060820190506137d9600083018661326a565b6137e6602083018561326a565b6137f360408301846128ae565b949350505050565b6000604051905081810181811067ffffffffffffffff8211171561382257613821613b08565b5b8060405250919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b600061387a826139b8565b9150613885836139b8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138ba576138b9613a7b565b5b828201905092915050565b60006138d0826139b8565b91506138db836139b8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561391457613913613a7b565b5b828202905092915050565b600061392a82613998565b9050919050565b600061393c82613998565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600081905061399382613b48565b919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006139cd82613985565b9050919050565b82818337600083830152505050565b60005b83811015613a015780820151818401526020810190506139e6565b83811115613a10576000848401525b50505050565b6000613a21826139b8565b91506000821415613a3557613a34613a7b565b5b600182039050919050565b6000819050919050565b6000613a55826139b8565b9150613a60836139b8565b925082613a7057613a6f613aaa565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60028110613b5957613b58613ad9565b5b50565b613b658161391f565b8114613b7057600080fd5b50565b613b7c81613931565b8114613b8757600080fd5b50565b613b9381613943565b8114613b9e57600080fd5b50565b613baa8161394f565b8114613bb557600080fd5b50565b600c8110613bc557600080fd5b50565b613bd1816139b8565b8114613bdc57600080fd5b5056fea26469706673582212206957e2ca5ca408e633b974021cf6e2a059ca9435ed1a6cf0aa9bdd6a042d233364736f6c63430008000033000000000000000000000000c713a40aa9bff56aee0e8ff9542b758d83af9fea0000000000000000000000003943cf9bd3aca41a66ec911a6395727db274856e000000000000000000000000000000000000000000000000000aa87bee538000

Deployed Bytecode

0x6080604052600436106101405760003560e01c806391b7f5ed116100b6578063bbcd5bbe1161006f578063bbcd5bbe1461044d578063dbacc23714610476578063e8d56b8b146104b3578063f4004701146104dc578063f6aacfb114610519578063f9ca62d91461055657610140565b806391b7f5ed1461034a57806391d14854146103735780639bd1c356146103b05780639f6f50ed146103cc578063a035b1fe146103f7578063b514be631461042257610140565b80633acfd44f116101085780633acfd44f1461023a57806355a373d6146102655780635ef922bb146102905780635fe5506f146102cd57806366741377146102f65780638f4ffcb11461032157610140565b806305bbe8d814610145578063150b7a02146101825780632a6e5e11146101bf5780632e1a7d4d146101e857806331d0382014610211575b600080fd5b34801561015157600080fd5b5061016c600480360381019061016791906127b9565b610593565b6040516101799190613780565b60405180910390f35b34801561018e57600080fd5b506101a960048036038101906101a491906125e6565b6105b0565b6040516101b69190613434565b60405180910390f35b3480156101cb57600080fd5b506101e660048036038101906101e1919061280b565b610633565b005b3480156101f457600080fd5b5061020f600480360381019061020a91906127b9565b6106ff565b005b34801561021d57600080fd5b50610238600480360381019061023391906127b9565b61076a565b005b34801561024657600080fd5b5061024f610bcb565b60405161025c91906133f0565b60405180910390f35b34801561027157600080fd5b5061027a610bef565b6040516102879190613335565b60405180910390f35b34801561029c57600080fd5b506102b760048036038101906102b291906127b9565b610c19565b6040516102c49190613765565b60405180910390f35b3480156102d957600080fd5b506102f460048036038101906102ef91906127b9565b610c44565b005b34801561030257600080fd5b5061030b610da1565b6040516103189190613335565b60405180910390f35b34801561032d57600080fd5b5061034860048036038101906103439190612666565b610dca565b005b34801561035657600080fd5b50610371600480360381019061036c91906127b9565b610f52565b005b34801561037f57600080fd5b5061039a6004803603810190610395919061270f565b610fd0565b6040516103a791906133d5565b60405180910390f35b6103ca60048036038101906103c59190612847565b61106c565b005b3480156103d857600080fd5b506103e161150c565b6040516103ee91906133f0565b60405180910390f35b34801561040357600080fd5b5061040c611530565b6040516104199190613780565b60405180910390f35b34801561042e57600080fd5b5061043761153a565b60405161044491906133f0565b60405180910390f35b34801561045957600080fd5b50610474600480360381019061046f91906125bd565b61155e565b005b34801561048257600080fd5b5061049d600480360381019061049891906127b9565b611636565b6040516104aa9190613335565b60405180910390f35b3480156104bf57600080fd5b506104da60048036038101906104d591906125bd565b611673565b005b3480156104e857600080fd5b5061050360048036038101906104fe919061274b565b611749565b6040516105109190613780565b60405180910390f35b34801561052557600080fd5b50610540600480360381019061053b91906127b9565b61176e565b60405161054d91906133d5565b60405180910390f35b34801561056257600080fd5b5061057d600480360381019061057891906127b9565b6117da565b60405161058a9190613780565b60405180910390f35b600060046000838152602001908152602001600020549050919050565b60003073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614610620576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610617906135cd565b60405180910390fd5b63150b7a0260e01b905095945050505050565b7f33fa24d9aab6b79237248a16094d5f78ea83bb51e42c123ce925a264e7d816cc610665816106606117f7565b6117ff565b61068e838373ffffffffffffffffffffffffffffffffffffffff1661189c90919063ffffffff16565b8173ffffffffffffffffffffffffffffffffffffffff166106ad6117f7565b73ffffffffffffffffffffffffffffffffffffffff167f372bb9ce23c45af0229f3ad425305ebadfb790c0b0453fa3077a02d7d8c987bb856040516106f29190613780565b60405180910390a3505050565b600061070a82610593565b14801561071f5750600061071d826117da565b145b61075e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107559061366d565b60405180910390fd5b61076781611990565b50565b7fefa080c67ecf4a6bf40c9dc64173420c08f359250ca6562d7c80f7c7b9b1396961079c816107976117f7565b6117ff565b600060036000848152602001908152602001600020549050600081116107f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ee90613725565b60405180910390fd5b600061080282611a70565b9050610811816000015161176e565b80156108265750610825816020015161176e565b5b610865576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085c9061350d565b60405180910390fd5b600061086f610bef565b90508073ffffffffffffffffffffffffffffffffffffffff16637e7849ff83600001516040518263ffffffff1660e01b81526004016108ae9190613780565b602060405180830381600087803b1580156108c857600080fd5b505af11580156108dc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090091906127e2565b508073ffffffffffffffffffffffffffffffffffffffff16637e7849ff83602001516040518263ffffffff1660e01b815260040161093e9190613780565b602060405180830381600087803b15801561095857600080fd5b505af115801561096c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099091906127e2565b50600080600061099f85611b44565b92509250925080610af45760008473ffffffffffffffffffffffffffffffffffffffff1663225b38fd87600001516040518263ffffffff1660e01b81526004016109e99190613780565b60e06040518083038186803b158015610a0157600080fd5b505afa158015610a15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a399190612790565b905060008573ffffffffffffffffffffffffffffffffffffffff1663225b38fd88602001516040518263ffffffff1660e01b8152600401610a7a9190613780565b60e06040518083038186803b158015610a9257600080fd5b505afa158015610aa6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aca9190612790565b9050610ae987600001518360a0015189602001518460a001518e611c16565b809550819650505050505b610b0083838784611c9d565b6005600086600001518152602001908152602001600020600090556004600086600001518152602001908152602001600020600090556004600086602001518152602001908152602001600020600090556003600089815260200190815260200160002060009055610b706117f7565b73ffffffffffffffffffffffffffffffffffffffff167f2d9c88b11be04614bf09782282a5573f8eac48eafce40c782ce4dba21fdc4f01898584604051610bb9939291906137c4565b60405180910390a25050505050505050565b7fefa080c67ecf4a6bf40c9dc64173420c08f359250ca6562d7c80f7c7b9b1396981565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610c216123d0565b610c3d6003600084815260200190815260200160002054611a70565b9050919050565b7fefa080c67ecf4a6bf40c9dc64173420c08f359250ca6562d7c80f7c7b9b13969610c7681610c716117f7565b6117ff565b60006003600084815260200190815260200160002054905060008111610cd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc890613725565b60405180910390fd5b6000610cdc82611a70565b90506005600082600001518152602001908152602001600020600090556004600082600001518152602001908152602001600020600090556004600082602001518152602001908152602001600020600090556003600085815260200190815260200160002060009055610d4e6117f7565b73ffffffffffffffffffffffffffffffffffffffff167f3e1afbbac8116846aca29cd7c86ccddbfaf2d62826bbc44d64a8dc52f92d61af85604051610d939190613780565b60405180910390a250505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610dd26117f7565b73ffffffffffffffffffffffffffffffffffffffff16610df0610bef565b73ffffffffffffffffffffffffffffffffffffffff1614610e46576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3d90613491565b60405180910390fd5b610e4e610bef565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610ebb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb29061358d565b60405180910390fd5b610ec3610bef565b73ffffffffffffffffffffffffffffffffffffffff1663b88d4fde86308786866040518663ffffffff1660e01b8152600401610f03959493929190613387565b600060405180830381600087803b158015610f1d57600080fd5b505af1158015610f31573d6000803e3d6000fd5b50505050610f3f8486611e07565b610f4b85858484611eab565b5050505050565b7f33fa24d9aab6b79237248a16094d5f78ea83bb51e42c123ce925a264e7d816cc610f8481610f7f6117f7565b6117ff565b60006006549050826006819055507fe98e5fcd3d43c7e5dd114bafcc428bc7ff8525b014fe3b51fc721ba5671f98fb8184604051610fc39291906136ad565b60405180910390a1505050565b6000610fda610da1565b73ffffffffffffffffffffffffffffffffffffffff166391d1485484846040518363ffffffff1660e01b815260040161101492919061340b565b60206040518083038186803b15801561102c57600080fd5b505afa158015611040573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106491906126e6565b905092915050565b826110756117f7565b73ffffffffffffffffffffffffffffffffffffffff1661109482611636565b73ffffffffffffffffffffffffffffffffffffffff16146110ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e19061352d565b60405180910390fd5b60006110f585610593565b14611135576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112c906135ad565b60405180910390fd5b6000806111428585611eb1565b915091506000816000015111801561115e575060008160200151115b801561117257508060200151816000015114155b80156112905750600060018111156111b3577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b816040015160018111156111f0577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b148015611201575060008160600151145b8061128f5750600180811115611240577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8160400151600181111561127d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b14801561128e575060008160600151115b5b5b6112cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c69061362d565b60405180910390fd5b80600001518614806112e45750806020015186145b611323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131a906134b1565b60405180910390fd5b8060600151600654611335919061386f565b341015611377576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136e9061356d565b60405180910390fd5b60006113838686611749565b90508160000151871480156113a45750806113a18360200151610593565b14155b156113e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113db90613745565b60405180910390fd5b8160200151871480156114035750600061140183600001516117da565b115b15611443576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143a9061354d565b60405180910390fd5b600060036000838152602001908152602001600020541415611478578260036000838152602001908152602001600020819055505b806005600084600001518152602001908152602001600020819055508060046000898152602001908152602001600020819055506114b46117f7565b73ffffffffffffffffffffffffffffffffffffffff167f6df0317433e5e92b71d2c7e9e7b1f5f7a08b092395be345111a77dd7d607fa7b82896040516114fb92919061379b565b60405180910390a250505050505050565b7f33fa24d9aab6b79237248a16094d5f78ea83bb51e42c123ce925a264e7d816cc81565b6000600654905090565b7fdc0d7a095c4e917ecbeb7deda7c942ff9744013d419e37549215a413915e421d81565b7fdc0d7a095c4e917ecbeb7deda7c942ff9744013d419e37549215a413915e421d6115908161158b6117f7565b6117ff565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f4ca142703425bec1d507d5581fac3a3e61eadcbeafbd7c0a03e2897d96de1cc581846040516116299291906136e9565b60405180910390a1505050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b7fdc0d7a095c4e917ecbeb7deda7c942ff9744013d419e37549215a413915e421d6116a5816116a06117f7565b6117ff565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f4ca142703425bec1d507d5581fac3a3e61eadcbeafbd7c0a03e2897d96de1cc5818460405161173c9291906134d1565b60405180910390a1505050565b6000828260405161175b929190613290565b604051809103902060001c905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600060056000838152602001908152602001600020549050919050565b600033905090565b6118098282610fd0565b6118985761182e8173ffffffffffffffffffffffffffffffffffffffff166014611f24565b61183c8360001c6020611f24565b60405160200161184d9291906132be565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188f919061344f565b60405180910390fd5b5050565b804710156118df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118d69061360d565b60405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff1682604051611905906132a9565b60006040518083038185875af1925050503d8060008114611942576040519150601f19603f3d011682016040523d82523d6000602084013e611947565b606091505b505090508061198b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611982906135ed565b60405180910390fd5b505050565b806119996117f7565b73ffffffffffffffffffffffffffffffffffffffff166119b882611636565b73ffffffffffffffffffffffffffffffffffffffff1614611a0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a059061352d565b60405180910390fd5b611a178261221e565b611a1f6117f7565b73ffffffffffffffffffffffffffffffffffffffff167f61dc2e6e64c7a742717c1eae2958f9bc011c40d616afd06af648eff740c2b04d83604051611a649190613780565b60405180910390a25050565b611a786123d0565b60405180608001604052808363ffffffff168152602001602084901c63ffffffff168152602001604084901c60ff166001811115611adf577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6001811115611b17577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8152602001604884901c76ffffffffffffffffffffffffffffffffffffffffffffff168152509050919050565b6000806000806004600086600001518152602001908152602001600020549050600060046000876020015181526020019081526020016000205490506000821180611b8f5750600081115b611bce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bc59061364d565b60405180910390fd5b60008214611bfa5760008114611be8576000806000611bf5565b8560000151866020015160015b611c07565b8560200151866000015160015b94509450945050509193909250565b60008060008487611c27919061386f565b90506000611c4882611c3a4488186122e3565b61231a90919063ffffffff16565b90506000806000888b1015611c65578b92508a9050899150611c6f565b8992508890508b91505b80841015611c87578282965096505050505050611c93565b81839650965050505050505b9550959350505050565b60006001811115611cd7577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b82604001516001811115611d14577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1480611d1d5750805b15611d4257611d3483611d2f86611636565b611e07565b611d3d8361221e565b611e01565b600180811115611d7b577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b82604001516001811115611db8577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415611e0057611dff60028360600151611dd291906138c5565b611ddb86611636565b73ffffffffffffffffffffffffffffffffffffffff1661189c90919063ffffffff16565b5b5b50505050565b806002600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f9ecfd70e9ff36df72989324a49559383d39f9290d700b10cf5ac10dcb68d264383604051611e9f9190613780565b60405180910390a25050565b50505050565b6000611ebb6123d0565b6000611f0c85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506000612330565b905080611f1882611a70565b92509250509250929050565b606060006002836002611f3791906138c5565b611f41919061386f565b67ffffffffffffffff811115611f80577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611fb25781602001600182028036833780820191505090505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612010577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061209a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600060018460026120da91906138c5565b6120e4919061386f565b90505b60018111156121d0577f3031323334353637383961626364656600000000000000000000000000000000600f86166010811061214c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b1a60f81b828281518110612189577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600485901c9450806121c990613a16565b90506120e7565b5060008414612214576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161220b90613471565b60405180910390fd5b8091505092915050565b600061222982611636565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146122df57612267610bef565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e3083856040518463ffffffff1660e01b81526004016122a393929190613350565b600060405180830381600087803b1580156122bd57600080fd5b505af11580156122d1573d6000803e3d6000fd5b505050506122de82612397565b5b5050565b60004442836040516020016122fa939291906132f8565b6040516020818303038152906040528051906020012060001c9050919050565b600081836123289190613a4a565b905092915050565b600060208261233f919061386f565b83511015612382576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123799061368d565b60405180910390fd5b60008260208501015190508091505092915050565b6002600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550565b6040518060800160405280600081526020016000815260200160006001811115612423577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8152602001600081525090565b60008135905061243f81613b5c565b92915050565b60008135905061245481613b73565b92915050565b60008151905061246981613b8a565b92915050565b60008135905061247e81613ba1565b92915050565b60008083601f84011261249657600080fd5b8235905067ffffffffffffffff8111156124af57600080fd5b6020830191508360018202830111156124c757600080fd5b9250929050565b6000815190506124dd81613bb8565b92915050565b600060e082840312156124f557600080fd5b6124ff60e06137fb565b9050600061250f848285016125a8565b6000830152506020612523848285016125a8565b6020830152506040612537848285016125a8565b604083015250606061254b848285016125a8565b606083015250608061255f848285016125a8565b60808301525060a0612573848285016125a8565b60a08301525060c0612587848285016124ce565b60c08301525092915050565b6000813590506125a281613bc8565b92915050565b6000815190506125b781613bc8565b92915050565b6000602082840312156125cf57600080fd5b60006125dd84828501612430565b91505092915050565b6000806000806000608086880312156125fe57600080fd5b600061260c88828901612430565b955050602061261d88828901612430565b945050604061262e88828901612593565b935050606086013567ffffffffffffffff81111561264b57600080fd5b61265788828901612484565b92509250509295509295909350565b60008060008060006080868803121561267e57600080fd5b600061268c88828901612430565b955050602061269d88828901612593565b94505060406126ae88828901612430565b935050606086013567ffffffffffffffff8111156126cb57600080fd5b6126d788828901612484565b92509250509295509295909350565b6000602082840312156126f857600080fd5b60006127068482850161245a565b91505092915050565b6000806040838503121561272257600080fd5b60006127308582860161246f565b925050602061274185828601612430565b9150509250929050565b6000806020838503121561275e57600080fd5b600083013567ffffffffffffffff81111561277857600080fd5b61278485828601612484565b92509250509250929050565b600060e082840312156127a257600080fd5b60006127b0848285016124e3565b91505092915050565b6000602082840312156127cb57600080fd5b60006127d984828501612593565b91505092915050565b6000602082840312156127f457600080fd5b6000612802848285016125a8565b91505092915050565b6000806040838503121561281e57600080fd5b600061282c85828601612593565b925050602061283d85828601612445565b9150509250929050565b60008060006040848603121561285c57600080fd5b600061286a86828701612593565b935050602084013567ffffffffffffffff81111561288757600080fd5b61289386828701612484565b92509250509250925092565b6128a88161391f565b82525050565b6128b781613943565b82525050565b6128c68161394f565b82525050565b6128d581613959565b82525050565b60006128e78385613837565b93506128f48385846139d4565b6128fd83613b37565b840190509392505050565b60006129148385613848565b93506129218385846139d4565b82840190509392505050565b612936816139c2565b82525050565b60006129478261382c565b6129518185613853565b93506129618185602086016139e3565b61296a81613b37565b840191505092915050565b60006129808261382c565b61298a8185613864565b935061299a8185602086016139e3565b80840191505092915050565b60006129b3602083613853565b91507f537472696e67733a20686578206c656e67746820696e73756666696369656e746000830152602082019050919050565b60006129f3603a83613853565b91507f4c6f636b61626c6552656365697665723a206e6f7420656e6f7567682070726960008301527f76696c6567657320746f2063616c6c20746865206d6574686f640000000000006020830152604082019050919050565b6000612a59604983613853565b91507f447261676f6e4172656e613a206120647261676f6e207769746820746865206760008301527f6976656e206964206973206e6f74206173736f6369617465642077697468207460208301527f68697320666967687400000000000000000000000000000000000000000000006040830152606082019050919050565b6000612ae5600d83613853565b91507f616363657373436f6e74726f6c000000000000000000000000000000000000006000830152602082019050919050565b6000612b25605483613853565b91507f447261676f6e4172656e613a20626f74682074686520647261676f6e73206d7560008301527f7374206265206c6f636b6564206f6e2074686520636f6e74726163742062656660208301527f6f7265207374617274696e6720612066696768740000000000000000000000006040830152606082019050919050565b6000612bb1603083613853565b91507f4c6f636b61626c6552656365697665723a2063616c6c6572206973206e6f742060008301527f74686520746f6b656e20686f6c646572000000000000000000000000000000006020830152604082019050919050565b6000612c17604183613853565b91507f447261676f6e4172656e613a20746865726520697320616e6f7468657220666960008301527f6768742077697468207468652073616d6520647261676f6e2d61747461636b6560208301527f72000000000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000612ca3603283613853565b91507f447261676f6e4172656e613a20696e636f727265637420616d6f756e7420736560008301527f6e7420746f2074686520636f6e747261637400000000000000000000000000006020830152604082019050919050565b6000612d09603383613853565b91507f4c6f636b61626c6552656365697665723a20756e61626c6520746f207265636560008301527f6976652074686520676976656e20746f6b656e000000000000000000000000006020830152604082019050919050565b6000612d6f604883613853565b91507f447261676f6e4172656e613a206120647261676f6e207769746820746865206760008301527f6976656e2069642068617320616c7265616479206a6f696e656420616e6f746860208301527f65722066696768740000000000000000000000000000000000000000000000006040830152606082019050919050565b6000612dfb603483613853565b91507f4c6f636b61626c6552656365697665723a207468652063616c6c65722069732060008301527f6e6f7420612076616c6964206f70657261746f720000000000000000000000006020830152604082019050919050565b6000612e61603a83613853565b91507f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260008301527f6563697069656e74206d617920686176652072657665727465640000000000006020830152604082019050919050565b6000612ec7601d83613853565b91507f416464726573733a20696e73756666696369656e742062616c616e63650000006000830152602082019050919050565b6000612f07601c83613853565b91507f447261676f6e4172656e613a2062616420666967687420746f6b656e000000006000830152602082019050919050565b6000612f47603583613853565b91507f447261676f6e4172656e613a206e6f6e65206f662074686520647261676f6e7360008301527f20686173206a6f696e65642074686520666967687400000000000000000000006020830152604082019050919050565b6000612fad601f83613853565b91507f447261676f6e4172656e613a20756e61626c6520746f207769746864726177006000830152602082019050919050565b6000612fed601583613853565b91507f746f55696e743235365f6f75744f66426f756e647300000000000000000000006000830152602082019050919050565b600061302d600a83613853565b91507f66696768745072696365000000000000000000000000000000000000000000006000830152602082019050919050565b600061306d600d83613853565b91507f746f6b656e436f6e7472616374000000000000000000000000000000000000006000830152602082019050919050565b60006130ad603483613853565b91507f447261676f6e4172656e613a206120666967687420776974682074686520676960008301527f76656e20696420646f65736e27742065786973740000000000000000000000006020830152604082019050919050565b6000613113600083613848565b9150600082019050919050565b600061312d601783613864565b91507f416363657373436f6e74726f6c3a206163636f756e74200000000000000000006000830152601782019050919050565b600061316d603c83613853565b91507f447261676f6e4172656e613a2074686520647261676f6e2d646566656e64657260008301527f206d7573742061636365707420746865206669676874206669727374000000006020830152604082019050919050565b60006131d3601183613864565b91507f206973206d697373696e6720726f6c65200000000000000000000000000000006000830152601182019050919050565b60808201600082015161321c600085018261325b565b50602082015161322f602085018261325b565b506040820151613242604085018261292d565b506060820151613255606085018261325b565b50505050565b613264816139b8565b82525050565b613273816139b8565b82525050565b61328a613285826139b8565b613a40565b82525050565b600061329d828486612908565b91508190509392505050565b60006132b482613106565b9150819050919050565b60006132c982613120565b91506132d58285612975565b91506132e0826131c6565b91506132ec8284612975565b91508190509392505050565b60006133048286613279565b6020820191506133148285613279565b6020820191506133248284613279565b602082019150819050949350505050565b600060208201905061334a600083018461289f565b92915050565b6000606082019050613365600083018661289f565b613372602083018561289f565b61337f604083018461326a565b949350505050565b600060808201905061339c600083018861289f565b6133a9602083018761289f565b6133b6604083018661326a565b81810360608301526133c98184866128db565b90509695505050505050565b60006020820190506133ea60008301846128ae565b92915050565b600060208201905061340560008301846128bd565b92915050565b600060408201905061342060008301856128bd565b61342d602083018461289f565b9392505050565b600060208201905061344960008301846128cc565b92915050565b60006020820190508181036000830152613469818461293c565b905092915050565b6000602082019050818103600083015261348a816129a6565b9050919050565b600060208201905081810360008301526134aa816129e6565b9050919050565b600060208201905081810360008301526134ca81612a4c565b9050919050565b600060608201905081810360008301526134ea81612ad8565b90506134f9602083018561289f565b613506604083018461289f565b9392505050565b6000602082019050818103600083015261352681612b18565b9050919050565b6000602082019050818103600083015261354681612ba4565b9050919050565b6000602082019050818103600083015261356681612c0a565b9050919050565b6000602082019050818103600083015261358681612c96565b9050919050565b600060208201905081810360008301526135a681612cfc565b9050919050565b600060208201905081810360008301526135c681612d62565b9050919050565b600060208201905081810360008301526135e681612dee565b9050919050565b6000602082019050818103600083015261360681612e54565b9050919050565b6000602082019050818103600083015261362681612eba565b9050919050565b6000602082019050818103600083015261364681612efa565b9050919050565b6000602082019050818103600083015261366681612f3a565b9050919050565b6000602082019050818103600083015261368681612fa0565b9050919050565b600060208201905081810360008301526136a681612fe0565b9050919050565b600060608201905081810360008301526136c681613020565b90506136d5602083018561326a565b6136e2604083018461326a565b9392505050565b6000606082019050818103600083015261370281613060565b9050613711602083018561289f565b61371e604083018461289f565b9392505050565b6000602082019050818103600083015261373e816130a0565b9050919050565b6000602082019050818103600083015261375e81613160565b9050919050565b600060808201905061377a6000830184613206565b92915050565b6000602082019050613795600083018461326a565b92915050565b60006040820190506137b0600083018561326a565b6137bd602083018461326a565b9392505050565b60006060820190506137d9600083018661326a565b6137e6602083018561326a565b6137f360408301846128ae565b949350505050565b6000604051905081810181811067ffffffffffffffff8211171561382257613821613b08565b5b8060405250919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b600061387a826139b8565b9150613885836139b8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138ba576138b9613a7b565b5b828201905092915050565b60006138d0826139b8565b91506138db836139b8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561391457613913613a7b565b5b828202905092915050565b600061392a82613998565b9050919050565b600061393c82613998565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600081905061399382613b48565b919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006139cd82613985565b9050919050565b82818337600083830152505050565b60005b83811015613a015780820151818401526020810190506139e6565b83811115613a10576000848401525b50505050565b6000613a21826139b8565b91506000821415613a3557613a34613a7b565b5b600182039050919050565b6000819050919050565b6000613a55826139b8565b9150613a60836139b8565b925082613a7057613a6f613aaa565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60028110613b5957613b58613ad9565b5b50565b613b658161391f565b8114613b7057600080fd5b50565b613b7c81613931565b8114613b8757600080fd5b50565b613b9381613943565b8114613b9e57600080fd5b50565b613baa8161394f565b8114613bb557600080fd5b50565b600c8110613bc557600080fd5b50565b613bd1816139b8565b8114613bdc57600080fd5b5056fea26469706673582212206957e2ca5ca408e633b974021cf6e2a059ca9435ed1a6cf0aa9bdd6a042d233364736f6c63430008000033

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

000000000000000000000000c713a40aa9bff56aee0e8ff9542b758d83af9fea0000000000000000000000003943cf9bd3aca41a66ec911a6395727db274856e000000000000000000000000000000000000000000000000000aa87bee538000

-----Decoded View---------------
Arg [0] : accessControl (address): 0xc713A40AA9bfF56aeE0E8fF9542b758d83af9fEa
Arg [1] : dragonToken (address): 0x3943cF9BD3ACA41a66eC911A6395727DB274856E
Arg [2] : weiFightPrice (uint256): 3000000000000000

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000c713a40aa9bff56aee0e8ff9542b758d83af9fea
Arg [1] : 0000000000000000000000003943cf9bd3aca41a66ec911a6395727db274856e
Arg [2] : 000000000000000000000000000000000000000000000000000aa87bee538000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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