ETH Price: $3,218.04 (+2.62%)

Contract

0xb1328D36E921Ff548C96959757e3e7B70FdC2b4E
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040140666372022-01-24 6:14:241021 days ago1643004864IN
 Create: RiftData
0 ETH0.0661935775

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RiftData

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 7 : RiftData.sol
/*

 ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄       ▄▄▄▄▄▄▄▄▄▄   ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄ 
▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌     ▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▐░█▀▀▀▀▀▀▀█░▌ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀  ▀▀▀▀█░█▀▀▀▀      ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌
▐░▌       ▐░▌     ▐░▌     ▐░▌               ▐░▌          ▐░▌       ▐░▌▐░▌       ▐░▌     ▐░▌     ▐░▌       ▐░▌
▐░█▄▄▄▄▄▄▄█░▌     ▐░▌     ▐░█▄▄▄▄▄▄▄▄▄      ▐░▌          ▐░▌       ▐░▌▐░█▄▄▄▄▄▄▄█░▌     ▐░▌     ▐░█▄▄▄▄▄▄▄█░▌
▐░░░░░░░░░░░▌     ▐░▌     ▐░░░░░░░░░░░▌     ▐░▌          ▐░▌       ▐░▌▐░░░░░░░░░░░▌     ▐░▌     ▐░░░░░░░░░░░▌
▐░█▀▀▀▀█░█▀▀      ▐░▌     ▐░█▀▀▀▀▀▀▀▀▀      ▐░▌          ▐░▌       ▐░▌▐░█▀▀▀▀▀▀▀█░▌     ▐░▌     ▐░█▀▀▀▀▀▀▀█░▌
▐░▌     ▐░▌       ▐░▌     ▐░▌               ▐░▌          ▐░▌       ▐░▌▐░▌       ▐░▌     ▐░▌     ▐░▌       ▐░▌
▐░▌      ▐░▌  ▄▄▄▄█░█▄▄▄▄ ▐░▌               ▐░▌          ▐░█▄▄▄▄▄▄▄█░▌▐░▌       ▐░▌     ▐░▌     ▐░▌       ▐░▌
▐░▌       ▐░▌▐░░░░░░░░░░░▌▐░▌               ▐░▌          ▐░░░░░░░░░░▌ ▐░▌       ▐░▌     ▐░▌     ▐░▌       ▐░▌
 ▀         ▀  ▀▀▀▀▀▀▀▀▀▀▀  ▀                 ▀            ▀▀▀▀▀▀▀▀▀▀   ▀         ▀       ▀       ▀         ▀ 
     by chris and tony                                                                                                       
*/

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;

import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

struct RiftBag {
        uint16 charges;
        uint32 chargesUsed;
        uint16 level;
        uint64 xp;
        uint64 lastChargePurchase;
    }

interface IRiftData {
    function updateXP(uint256 xp, uint256 bagId) external;
    function addKarma(uint64 k, address holder) external;
    function removeKarma(uint64 k, address holder) external;
    function karma(address holder) external view returns (uint64);
    function karmaTotal() external view returns (uint256);
    function karmaHolders() external view returns (uint256);
    function addXP(uint256 xp, uint256 bagId) external;
    function getLevel(uint256 bagId) external view returns (uint256);
    function xpMap(uint256 bagId) external view returns (uint256);
}

/*
    Logic free storage of Rift Data. 
    The intent of this storage is twofold:
    1. The data manipulation performed by the Rift is novel (especially to the authors), 
        and this store acts as a failsafe in case a new Rift contract needs to be deployed.
    2. The authors' intent is to grant control of this data to more controllers (a DAO, L2 rollup, etc).
*/
contract RiftData is IRiftData, OwnableUpgradeable {
    mapping(address => bool) public riftControllers;

    uint256 public karmaTotal;
    uint256 public karmaHolders;

    mapping(uint256 => RiftBag) internal _bags;
    mapping(address => uint64) public karma;
    mapping(address => bool) public xpControllers;
    mapping(uint256 => uint256) public xpMap;

     function initialize() public initializer {
        // __Ownable_init();
     }

    function addRiftController(address addr) external onlyOwner {
        riftControllers[addr] = true;
    }

    function removeRiftController(address addr) external onlyOwner {
        riftControllers[addr] = false;
    }

    function addXPController(address addr) external onlyOwner {
        xpControllers[addr] = true;
    }

    function removeXPController(address addr) external onlyOwner {
        xpControllers[addr] = false;
    }

    modifier onlyRiftController() {
        require(riftControllers[msg.sender], "NOT RIFTCONTROLLER!");
        _;
    }

    modifier onlyXPController() {
        require(xpControllers[msg.sender], "NOT XPCONTROLLER!");
        _;
    }

    function updateXP(uint256 xp, uint256 bagId) external override onlyRiftController {
        xpMap[bagId] = xp;
    }

    function addXP(uint256 xp, uint256 bagId) external override onlyXPController {
        xpMap[bagId] += xp;
    }

    function addKarma(uint64 k, address holder) external override onlyRiftController {
        if (karma[holder] == 0) { karmaHolders += 1; }
        karmaTotal += k;
        karma[holder] += k;
    }

    function removeKarma(uint64 k, address holder) external override onlyRiftController {
        k > karma[holder] ? karma[holder] = 0 : karma[holder] -= k;
    }

    function getLevel(uint256 bagId) external override view returns (uint256) {
        uint256 _xp = xpMap[bagId];
        if (_xp < 65) return 1;
        else if (_xp < 70) return 2;
        else {
            return 1 + (sqrt(625+75*_xp)-25)/50; // roughly 15% increase xp per level
        }
    }

    // migrates xp from old system to new
    function migrateXP(uint256[] memory bagIds) external onlyOwner {
        for (uint i=0; i < bagIds.length; i++) {
             xpMap[bagIds[i]] += _bags[bagIds[i]].xp + (_bags[bagIds[i]].level * 125);
        }
    }
}

/// @notice Calculates the square root of x, rounding down.
/// @dev Uses the Babylonian method https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.
/// @param x The uint256 number for which to calculate the square root.
/// @return result The result as an uint256.
function sqrt(uint256 x) pure returns (uint256 result) {
    if (x == 0) {
        return 0;
    }

    // Calculate the square root of the perfect square of a power of two that is the closest to x.
    uint256 xAux = uint256(x);
    result = 1;
    if (xAux >= 0x100000000000000000000000000000000) {
        xAux >>= 128;
        result <<= 64;
    }
    if (xAux >= 0x10000000000000000) {
        xAux >>= 64;
        result <<= 32;
    }
    if (xAux >= 0x100000000) {
        xAux >>= 32;
        result <<= 16;
    }
    if (xAux >= 0x10000) {
        xAux >>= 16;
        result <<= 8;
    }
    if (xAux >= 0x100) {
        xAux >>= 8;
        result <<= 4;
    }
    if (xAux >= 0x10) {
        xAux >>= 4;
        result <<= 2;
    }
    if (xAux >= 0x8) {
        result <<= 1;
    }

    // The operations can never overflow because the result is max 2^127 when it enters this block.
    unchecked {
        result = (result + x / result) >> 1;
        result = (result + x / result) >> 1;
        result = (result + x / result) >> 1;
        result = (result + x / result) >> 1;
        result = (result + x / result) >> 1;
        result = (result + x / result) >> 1;
        result = (result + x / result) >> 1; // Seven iterations should be enough
        uint256 roundedDownResult = x / result;
        return result >= roundedDownResult ? roundedDownResult : result;
    }
}

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

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

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

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

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

File 3 of 7 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

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

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

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

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

File 4 of 7 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

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

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

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

    uint256 private _status;

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

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

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

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

        _;

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

File 5 of 7 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
    uint256[49] private __gap;
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint64","name":"k","type":"uint64"},{"internalType":"address","name":"holder","type":"address"}],"name":"addKarma","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"addRiftController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"xp","type":"uint256"},{"internalType":"uint256","name":"bagId","type":"uint256"}],"name":"addXP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"addXPController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"bagId","type":"uint256"}],"name":"getLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"karma","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"karmaHolders","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"karmaTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"bagIds","type":"uint256[]"}],"name":"migrateXP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"k","type":"uint64"},{"internalType":"address","name":"holder","type":"address"}],"name":"removeKarma","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"removeRiftController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"removeXPController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"riftControllers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"xp","type":"uint256"},{"internalType":"uint256","name":"bagId","type":"uint256"}],"name":"updateXP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"xpControllers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"xpMap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50610f01806100206000396000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c8063982c6e22116100ad578063da034e2011610071578063da034e20146102a6578063e789c531146102b9578063f2fde38b146102cc578063f57eafe5146102df578063f781909d146102e857600080fd5b8063982c6e221461021a5780639b7bc5291461024d578063a63322e314610260578063b0082cdf14610280578063d1e99fdd1461029357600080fd5b806380dbfc47116100f457806380dbfc47146101be5780638129fc1c146101d157806386481d40146101d957806387515f0c146101ec5780638da5cb5b146101ff57600080fd5b80630f6dc18c146101315780633a2ee8551461014d5780634ea0c5361461018e5780635146ea0e146101a3578063715018a6146101b6575b600080fd5b61013a60665481565b6040519081526020015b60405180910390f35b61017661015b366004610bb5565b6069602052600090815260409020546001600160401b031681565b6040516001600160401b039091168152602001610144565b6101a161019c366004610bb5565b61030b565b005b6101a16101b1366004610bd0565b610362565b6101a16103dc565b6101a16101cc366004610c08565b610412565b6101a1610543565b61013a6101e7366004610cc5565b6105fc565b6101a16101fa366004610bb5565b610678565b6033546040516001600160a01b039091168152602001610144565b61023d610228366004610bb5565b60656020526000908152604090205460ff1681565b6040519015158152602001610144565b6101a161025b366004610cde565b6106c6565b61013a61026e366004610cc5565b606b6020526000908152604090205481565b6101a161028e366004610bd0565b6107a3565b6101a16102a1366004610bb5565b6107e3565b6101a16102b4366004610cde565b61082e565b6101a16102c7366004610bb5565b6108ed565b6101a16102da366004610bb5565b610938565b61013a60675481565b61023d6102f6366004610bb5565b606a6020526000908152604090205460ff1681565b6033546001600160a01b0316331461033e5760405162461bcd60e51b815260040161033590610d1f565b60405180910390fd5b6001600160a01b03166000908152606a60205260409020805460ff19166001179055565b336000908152606a602052604090205460ff166103b55760405162461bcd60e51b81526020600482015260116024820152704e4f54205850434f4e54524f4c4c45522160781b6044820152606401610335565b6000818152606b6020526040812080548492906103d3908490610d6a565b90915550505050565b6033546001600160a01b031633146104065760405162461bcd60e51b815260040161033590610d1f565b61041060006109cc565b565b6033546001600160a01b0316331461043c5760405162461bcd60e51b815260040161033590610d1f565b60005b815181101561053f576068600083838151811061045e5761045e610d82565b6020026020010151815260200190815260200160002060000160069054906101000a900461ffff16607d6104929190610d98565b61ffff16606860008484815181106104ac576104ac610d82565b6020026020010151815260200190815260200160002060000160089054906101000a90046001600160401b03166104e39190610dc2565b6001600160401b0316606b600084848151811061050257610502610d82565b6020026020010151815260200190815260200160002060008282546105279190610d6a565b9091555081905061053781610ded565b91505061043f565b5050565b600054610100900460ff1661055e5760005460ff1615610562565b303b155b6105c55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610335565b600054610100900460ff161580156105e7576000805461ffff19166101011790555b80156105f9576000805461ff00191690555b50565b6000818152606b6020526040812054604181101561061d5750600192915050565b604681101561062f5750600292915050565b6032601961065261064184604b610e08565b61064d90610271610d6a565b610a1e565b61065c9190610e27565b6106669190610e54565b610671906001610d6a565b9392505050565b6033546001600160a01b031633146106a25760405162461bcd60e51b815260040161033590610d1f565b6001600160a01b03166000908152606560205260409020805460ff19166001179055565b3360009081526065602052604090205460ff166106f55760405162461bcd60e51b815260040161033590610e76565b6001600160a01b0381166000908152606960205260409020546001600160401b039081169083161161077a576001600160a01b038116600090815260696020526040812080548492906107529084906001600160401b0316610ea3565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505050565b6001600160a01b03166000908152606960205260409020805467ffffffffffffffff1916905550565b3360009081526065602052604090205460ff166107d25760405162461bcd60e51b815260040161033590610e76565b6000908152606b6020526040902055565b6033546001600160a01b0316331461080d5760405162461bcd60e51b815260040161033590610d1f565b6001600160a01b03166000908152606560205260409020805460ff19169055565b3360009081526065602052604090205460ff1661085d5760405162461bcd60e51b815260040161033590610e76565b6001600160a01b0381166000908152606960205260409020546001600160401b031661089c576001606760008282546108969190610d6a565b90915550505b816001600160401b0316606660008282546108b79190610d6a565b90915550506001600160a01b038116600090815260696020526040812080548492906107529084906001600160401b0316610dc2565b6033546001600160a01b031633146109175760405162461bcd60e51b815260040161033590610d1f565b6001600160a01b03166000908152606a60205260409020805460ff19169055565b6033546001600160a01b031633146109625760405162461bcd60e51b815260040161033590610d1f565b6001600160a01b0381166109c75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610335565b6105f9815b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081610a2d57506000919050565b50600181600160801b8110610a475760409190911b9060801c5b680100000000000000008110610a625760209190911b9060401c5b6401000000008110610a795760109190911b9060201c5b620100008110610a8e5760089190911b9060101c5b6101008110610aa25760049190911b9060081c5b60108110610ab55760029190911b9060041c5b60088110610ac557600182901b91505b6001828481610ad657610ad6610e3e565b048301901c91506001828481610aee57610aee610e3e565b048301901c91506001828481610b0657610b06610e3e565b048301901c91506001828481610b1e57610b1e610e3e565b048301901c91506001828481610b3657610b36610e3e565b048301901c91506001828481610b4e57610b4e610e3e565b048301901c91506001828481610b6657610b66610e3e565b048301901c91506000828481610b7e57610b7e610e3e565b04905080831015610b8f5782610b91565b805b949350505050565b80356001600160a01b0381168114610bb057600080fd5b919050565b600060208284031215610bc757600080fd5b61067182610b99565b60008060408385031215610be357600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215610c1b57600080fd5b82356001600160401b0380821115610c3257600080fd5b818501915085601f830112610c4657600080fd5b813581811115610c5857610c58610bf2565b8060051b604051601f19603f83011681018181108582111715610c7d57610c7d610bf2565b604052918252848201925083810185019188831115610c9b57600080fd5b938501935b82851015610cb957843584529385019392850192610ca0565b98975050505050505050565b600060208284031215610cd757600080fd5b5035919050565b60008060408385031215610cf157600080fd5b82356001600160401b0381168114610d0857600080fd5b9150610d1660208401610b99565b90509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008219821115610d7d57610d7d610d54565b500190565b634e487b7160e01b600052603260045260246000fd5b600061ffff80831681851681830481118215151615610db957610db9610d54565b02949350505050565b60006001600160401b03808316818516808303821115610de457610de4610d54565b01949350505050565b6000600019821415610e0157610e01610d54565b5060010190565b6000816000190483118215151615610e2257610e22610d54565b500290565b600082821015610e3957610e39610d54565b500390565b634e487b7160e01b600052601260045260246000fd5b600082610e7157634e487b7160e01b600052601260045260246000fd5b500490565b6020808252601390820152724e4f542052494654434f4e54524f4c4c45522160681b604082015260600190565b60006001600160401b0383811690831681811015610ec357610ec3610d54565b03939250505056fea2646970667358221220325c7f3d0826d9d4822fe988db328928dca31e943b12e88f59f47c99692742d064736f6c63430008090033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061012c5760003560e01c8063982c6e22116100ad578063da034e2011610071578063da034e20146102a6578063e789c531146102b9578063f2fde38b146102cc578063f57eafe5146102df578063f781909d146102e857600080fd5b8063982c6e221461021a5780639b7bc5291461024d578063a63322e314610260578063b0082cdf14610280578063d1e99fdd1461029357600080fd5b806380dbfc47116100f457806380dbfc47146101be5780638129fc1c146101d157806386481d40146101d957806387515f0c146101ec5780638da5cb5b146101ff57600080fd5b80630f6dc18c146101315780633a2ee8551461014d5780634ea0c5361461018e5780635146ea0e146101a3578063715018a6146101b6575b600080fd5b61013a60665481565b6040519081526020015b60405180910390f35b61017661015b366004610bb5565b6069602052600090815260409020546001600160401b031681565b6040516001600160401b039091168152602001610144565b6101a161019c366004610bb5565b61030b565b005b6101a16101b1366004610bd0565b610362565b6101a16103dc565b6101a16101cc366004610c08565b610412565b6101a1610543565b61013a6101e7366004610cc5565b6105fc565b6101a16101fa366004610bb5565b610678565b6033546040516001600160a01b039091168152602001610144565b61023d610228366004610bb5565b60656020526000908152604090205460ff1681565b6040519015158152602001610144565b6101a161025b366004610cde565b6106c6565b61013a61026e366004610cc5565b606b6020526000908152604090205481565b6101a161028e366004610bd0565b6107a3565b6101a16102a1366004610bb5565b6107e3565b6101a16102b4366004610cde565b61082e565b6101a16102c7366004610bb5565b6108ed565b6101a16102da366004610bb5565b610938565b61013a60675481565b61023d6102f6366004610bb5565b606a6020526000908152604090205460ff1681565b6033546001600160a01b0316331461033e5760405162461bcd60e51b815260040161033590610d1f565b60405180910390fd5b6001600160a01b03166000908152606a60205260409020805460ff19166001179055565b336000908152606a602052604090205460ff166103b55760405162461bcd60e51b81526020600482015260116024820152704e4f54205850434f4e54524f4c4c45522160781b6044820152606401610335565b6000818152606b6020526040812080548492906103d3908490610d6a565b90915550505050565b6033546001600160a01b031633146104065760405162461bcd60e51b815260040161033590610d1f565b61041060006109cc565b565b6033546001600160a01b0316331461043c5760405162461bcd60e51b815260040161033590610d1f565b60005b815181101561053f576068600083838151811061045e5761045e610d82565b6020026020010151815260200190815260200160002060000160069054906101000a900461ffff16607d6104929190610d98565b61ffff16606860008484815181106104ac576104ac610d82565b6020026020010151815260200190815260200160002060000160089054906101000a90046001600160401b03166104e39190610dc2565b6001600160401b0316606b600084848151811061050257610502610d82565b6020026020010151815260200190815260200160002060008282546105279190610d6a565b9091555081905061053781610ded565b91505061043f565b5050565b600054610100900460ff1661055e5760005460ff1615610562565b303b155b6105c55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610335565b600054610100900460ff161580156105e7576000805461ffff19166101011790555b80156105f9576000805461ff00191690555b50565b6000818152606b6020526040812054604181101561061d5750600192915050565b604681101561062f5750600292915050565b6032601961065261064184604b610e08565b61064d90610271610d6a565b610a1e565b61065c9190610e27565b6106669190610e54565b610671906001610d6a565b9392505050565b6033546001600160a01b031633146106a25760405162461bcd60e51b815260040161033590610d1f565b6001600160a01b03166000908152606560205260409020805460ff19166001179055565b3360009081526065602052604090205460ff166106f55760405162461bcd60e51b815260040161033590610e76565b6001600160a01b0381166000908152606960205260409020546001600160401b039081169083161161077a576001600160a01b038116600090815260696020526040812080548492906107529084906001600160401b0316610ea3565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505050565b6001600160a01b03166000908152606960205260409020805467ffffffffffffffff1916905550565b3360009081526065602052604090205460ff166107d25760405162461bcd60e51b815260040161033590610e76565b6000908152606b6020526040902055565b6033546001600160a01b0316331461080d5760405162461bcd60e51b815260040161033590610d1f565b6001600160a01b03166000908152606560205260409020805460ff19169055565b3360009081526065602052604090205460ff1661085d5760405162461bcd60e51b815260040161033590610e76565b6001600160a01b0381166000908152606960205260409020546001600160401b031661089c576001606760008282546108969190610d6a565b90915550505b816001600160401b0316606660008282546108b79190610d6a565b90915550506001600160a01b038116600090815260696020526040812080548492906107529084906001600160401b0316610dc2565b6033546001600160a01b031633146109175760405162461bcd60e51b815260040161033590610d1f565b6001600160a01b03166000908152606a60205260409020805460ff19169055565b6033546001600160a01b031633146109625760405162461bcd60e51b815260040161033590610d1f565b6001600160a01b0381166109c75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610335565b6105f9815b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600081610a2d57506000919050565b50600181600160801b8110610a475760409190911b9060801c5b680100000000000000008110610a625760209190911b9060401c5b6401000000008110610a795760109190911b9060201c5b620100008110610a8e5760089190911b9060101c5b6101008110610aa25760049190911b9060081c5b60108110610ab55760029190911b9060041c5b60088110610ac557600182901b91505b6001828481610ad657610ad6610e3e565b048301901c91506001828481610aee57610aee610e3e565b048301901c91506001828481610b0657610b06610e3e565b048301901c91506001828481610b1e57610b1e610e3e565b048301901c91506001828481610b3657610b36610e3e565b048301901c91506001828481610b4e57610b4e610e3e565b048301901c91506001828481610b6657610b66610e3e565b048301901c91506000828481610b7e57610b7e610e3e565b04905080831015610b8f5782610b91565b805b949350505050565b80356001600160a01b0381168114610bb057600080fd5b919050565b600060208284031215610bc757600080fd5b61067182610b99565b60008060408385031215610be357600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215610c1b57600080fd5b82356001600160401b0380821115610c3257600080fd5b818501915085601f830112610c4657600080fd5b813581811115610c5857610c58610bf2565b8060051b604051601f19603f83011681018181108582111715610c7d57610c7d610bf2565b604052918252848201925083810185019188831115610c9b57600080fd5b938501935b82851015610cb957843584529385019392850192610ca0565b98975050505050505050565b600060208284031215610cd757600080fd5b5035919050565b60008060408385031215610cf157600080fd5b82356001600160401b0381168114610d0857600080fd5b9150610d1660208401610b99565b90509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008219821115610d7d57610d7d610d54565b500190565b634e487b7160e01b600052603260045260246000fd5b600061ffff80831681851681830481118215151615610db957610db9610d54565b02949350505050565b60006001600160401b03808316818516808303821115610de457610de4610d54565b01949350505050565b6000600019821415610e0157610e01610d54565b5060010190565b6000816000190483118215151615610e2257610e22610d54565b500290565b600082821015610e3957610e39610d54565b500390565b634e487b7160e01b600052601260045260246000fd5b600082610e7157634e487b7160e01b600052601260045260246000fd5b500490565b6020808252601390820152724e4f542052494654434f4e54524f4c4c45522160681b604082015260600190565b60006001600160401b0383811690831681811015610ec357610ec3610d54565b03939250505056fea2646970667358221220325c7f3d0826d9d4822fe988db328928dca31e943b12e88f59f47c99692742d064736f6c63430008090033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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