Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00
Cross-Chain Transactions
Loading...
Loading
Contract Name:
PXUETH
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {IBlast, IBlastPoints} from "./interfaces/IBlast.sol";
import {IPXUETH} from "./interfaces/IPXUETH.sol";
import {Tracker} from "./Tracker.sol";
/**
* @title PXUETH ERC20 contract
* @notice PXUETH a contract used to stake ETH and get PXUETH on a 1:1 ratio and claim yield
*/
contract PXUETH is AccessControlUpgradeable, ERC20Upgradeable, IPXUETH {
bytes32 public constant GAME_ROLE = keccak256("GAME_ROLE");
uint256 public constant YIELD_CLAIMABLE_AFTER = (1 days) / (2);
IBlast public blast;
uint256 public totalYield;
uint256 public minLastDeposit;
mapping(address => uint256) public lastDeposited;
/**
* @notice Initializes the contract and grants the admin role to the deployer
* @param _blast Blast yield contract
* @param _blastPoints Blast points contract
* @param _blastPointOperator An operator to receive the Blast points from the API
*/
function initialize(
address _blast,
address _blastPoints,
address _blastPointOperator
) public initializer {
blast = IBlast(_blast);
__AccessControl_init();
__ERC20_init("PXU Ether", "PXUETH");
blast.configureClaimableGas();
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
IBlastPoints(_blastPoints).configurePointsOperator(_blastPointOperator);
}
/**
* @notice Configures the yield to be claimable
* @dev Can only be called by the admin of the contract
*/
function configureYield() external onlyRole(DEFAULT_ADMIN_ROLE) {
blast.configureClaimableYield();
}
/**
* @notice Claim all gas by owner
* @param _recipient Recipient of the gas
*/
function claimAllGas(
address _recipient
) external onlyRole(DEFAULT_ADMIN_ROLE) {
blast.claimMaxGas(address(this), _recipient);
}
/**
* @notice Mints PXUETH on a 1:1 ratio with ETH and transfers past yields
* @param _account The address of the account
*/
function deposit(address _account) external payable onlyRole(GAME_ROLE) {
claimYield(_account);
_mint(_account, msg.value);
lastDeposited[_account] = block.timestamp;
checkMinLastDeposit(block.timestamp);
emit Deposit(_account, msg.sender, msg.value, block.timestamp);
}
/**
* @notice Burns PXUETH and transfers the same amount of ETH to the caller
* @param _account The holder of the PXUETH tokens
* @param _amount Amount of PXUETH a holder wants to burn
*/
function withdraw(
address _account,
uint256 _amount
) external onlyRole(GAME_ROLE) {
claimYield(_account);
_burn(_account, _amount);
(bool success, ) = _account.call{value: _amount}("");
lastDeposited[_account] = block.timestamp;
checkMinLastDeposit(block.timestamp);
if (!success) {
revert FailedToSendEther();
}
emit Withdraw(_account, msg.sender, _amount, block.timestamp);
}
/**
* @notice Withdraws the total amount of ETH in the contract in case of emergency
* @param _recipient Address of the recipient
* @return totalBalance Total amount of ETH transferred to the recipient
*/
function emergencyWithdraw(
address _recipient
) external onlyRole(DEFAULT_ADMIN_ROLE) returns (uint256 totalBalance) {
blast.claimAllYield(address(this), address(this));
totalBalance = address(this).balance;
(bool success, ) = _recipient.call{value: totalBalance}("");
if (!success) {
revert FailedToSendEther();
}
emit EmergencyWithdrawn(_recipient, totalBalance);
}
/**
* @notice Calculates the yield of the holder based on the amount and duration of staking and
* transfers it to the holder
* @param _account The holder of the PXUETH token
*/
function claimYield(address _account) public {
uint256 yieldReceived = blast.claimAllYield(
address(this),
address(this)
);
totalYield += yieldReceived;
uint256 yieldAmount = getClaimYield(_account);
uint256 duration = block.timestamp - lastDeposited[_account];
if (yieldAmount == 0) {
return;
}
lastDeposited[_account] = block.timestamp;
checkMinLastDeposit(block.timestamp);
totalYield -= yieldAmount;
(bool success, ) = _account.call{value: yieldAmount}("");
if (!success) {
revert FailedToSendEther();
}
emit YieldClaimed(
_account,
yieldAmount,
duration - YIELD_CLAIMABLE_AFTER
);
}
/**
* @notice Returns the claimable yield of a holder
* @param _account Holder of the PXUETH
* @return userShare The amount of yield in ETH
*/
function getClaimYield(address _account) public view returns (uint256) {
uint256 balance = balanceOf(_account);
if (lastDeposited[_account] + YIELD_CLAIMABLE_AFTER > block.timestamp) {
return 0;
}
if (balance > 0 && lastDeposited[_account] > 0) {
// Calculate the portion of time the user has been staking relative to all stakers
uint256 timeFraction = (block.timestamp -
(lastDeposited[_account] + YIELD_CLAIMABLE_AFTER)) /
(block.timestamp - getMinLastDeposit());
// Calculate user's share of the yield based on their balance and the total supply
uint256 userShare = (balance * totalYield * timeFraction) /
totalSupply();
if (userShare > totalYield) {
userShare = totalYield;
}
return userShare;
}
return 0;
// uint256 duration = block.timestamp - lastDeposited[_account];
//
// if (duration < YIELD_CLAIMABLE_AFTER) {
// return 0;
// }
//
// uint256 yearInterest = (balance * 30) / 1000;
// uint256 totalDuration = duration - YIELD_CLAIMABLE_AFTER;
//
// uint256 yieldAmount = (yearInterest * totalDuration) / (365 days);
//
//
// return yieldAmount;
}
function checkMinLastDeposit(uint256 _timestamp) internal {
if (minLastDeposit == 0) {
minLastDeposit = _timestamp;
} else if (minLastDeposit > _timestamp) {
minLastDeposit = _timestamp;
}
}
function getMinLastDeposit() internal view returns (uint256) {
if (minLastDeposit == 0) {
return block.timestamp;
}
return minLastDeposit;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/// @custom:storage-location erc7201:openzeppelin.storage.AccessControl
struct AccessControlStorage {
mapping(bytes32 role => RoleData) _roles;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800;
function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) {
assembly {
$.slot := AccessControlStorageLocation
}
}
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
AccessControlStorage storage $ = _getAccessControlStorage();
return $._roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
AccessControlStorage storage $ = _getAccessControlStorage();
return $._roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
AccessControlStorage storage $ = _getAccessControlStorage();
bytes32 previousAdminRole = getRoleAdmin(role);
$._roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
AccessControlStorage storage $ = _getAccessControlStorage();
if (!hasRole(role, account)) {
$._roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
AccessControlStorage storage $ = _getAccessControlStorage();
if (hasRole(role, account)) {
$._roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol";
import {IERC20Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*/
abstract contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20, IERC20Metadata, IERC20Errors {
/// @custom:storage-location erc7201:openzeppelin.storage.ERC20
struct ERC20Storage {
mapping(address account => uint256) _balances;
mapping(address account => mapping(address spender => uint256)) _allowances;
uint256 _totalSupply;
string _name;
string _symbol;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC20")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant ERC20StorageLocation = 0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00;
function _getERC20Storage() private pure returns (ERC20Storage storage $) {
assembly {
$.slot := ERC20StorageLocation
}
}
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
__ERC20_init_unchained(name_, symbol_);
}
function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
ERC20Storage storage $ = _getERC20Storage();
$._name = name_;
$._symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
ERC20Storage storage $ = _getERC20Storage();
return $._name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
ERC20Storage storage $ = _getERC20Storage();
return $._symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
ERC20Storage storage $ = _getERC20Storage();
return $._totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual returns (uint256) {
ERC20Storage storage $ = _getERC20Storage();
return $._balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
ERC20Storage storage $ = _getERC20Storage();
return $._allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
ERC20Storage storage $ = _getERC20Storage();
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
$._totalSupply += value;
} else {
uint256 fromBalance = $._balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
$._balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
$._totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
$._balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
* ```
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
ERC20Storage storage $ = _getERC20Storage();
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
$._allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @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 proxied contracts do not make use of 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.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* 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 prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reininitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._initialized = 1;
if (isTopLevelCall) {
$._initializing = true;
}
_;
if (isTopLevelCall) {
$._initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._initialized = version;
$._initializing = true;
_;
$._initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
assembly {
$.slot := INITIALIZABLE_STORAGE
}
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
enum YieldMode {
AUTOMATIC,
VOID,
CLAIMABLE
}
enum GasMode {
VOID,
CLAIMABLE
}
interface IERC20Rebasing {
function configure(YieldMode) external returns (uint256);
function claim(address recipient, uint256 amount) external returns (uint256);
function getClaimableAmount(address account) external view returns (uint256);
}
interface IBlast {
function configureClaimableYield() external;
function configureAutomaticYield() external;
function claimYield(address contractAddress, address recipientOfYield, uint256 amount) external returns (uint256);
function configureClaimableGas() external;
function claimAllYield(address contractAddress, address recipientOfYield) external returns (uint256);
function readClaimableYield(address contractAddress) external view returns (uint256);
function configureVoidYield() external;
function claimMaxGas(address contractAddress, address recipient) external returns (uint256);
function configureGovernor(address _governor) external;
}
interface IBlastPoints {
function configurePointsOperator(address operator) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title PXUETH ERC20 contract
* @notice PXUETH a contract used to stake ETH and get PXUETH on a 1:1 ratio and claim yield
*/
interface IPXUETH is IAccessControl, IERC20 {
/**
* @notice Emitted when the Game contracts call the deposit
* @param _amount Amount of ETH deposited
* @param _sender The caller of the game contract
* @param _game The address of the game contract
* @param _timestamp The block timestamp when deposit happened
*/
event Deposit(
address indexed _sender,
address indexed _game,
uint256 _amount,
uint256 _timestamp
);
/**
* @notice Emitted when the caller withdraws ETH and burns PXUETH
* @param _sender The caller of the contract
* @param _game The address of the game contract
* @param _amount Amount of PXUETH burned
* @param _timestamp The block timestamp when withdraw happened
*/
event Withdraw(
address indexed _sender,
address indexed _game,
uint256 _amount,
uint256 _timestamp
);
/**
* @notice Emitted when the admin of the contract calls emergency withdraw
* @param _recipient Recipient that receives the Ether
* @param _amount Total amount of ETH in the contract that is transferred to the recipient
*/
event EmergencyWithdrawn(address indexed _recipient, uint256 _amount);
/**
* @notice Emitted when a holder claims their ETH yield
* @param _account Holder of PXUETH tokens
* @param _amount Amount of yield transferred to the holder
* @param _duration Duration of the staked tokens minus the CLAIMABLE_AFTER
*/
event YieldClaimed(address _account, uint256 _amount, uint256 _duration);
/**
* @notice Thrown when the contract fails to send ETH to the user
*/
error FailedToSendEther();
/**
* @notice Configures the yield to be claimable
* @dev Can only be called by the admin of the contract
*/
function configureYield() external;
/**
* @notice Claim all gas by owner
* @param _recipient Recipient of the gas
*/
function claimAllGas(address _recipient) external;
/**
* @notice Mints PXUETH on a 1:1 ratio with ETH and transfers past yields
* @param _account The address of the account
*/
function deposit(address _account) external payable;
/**
* @notice Burns PXUETH and transfers the same amount of ETH to the caller
* @param _account The holder of the PXUETH tokens
* @param _amount Amount of PXUETH a holder wants to burn
*/
function withdraw(address _account, uint256 _amount) external;
/**
* @notice Withdraws the total amount of ETH in the contract in case of emergency
* @param _recipient Address of the recipient
* @return totalBalance Total amount of ETH transferred to the recipient
*/
function emergencyWithdraw(
address _recipient
) external returns (uint256 totalBalance);
/**
* @notice Calculates the yield of the holder based on the amount and duration of staking and
* transfers it to the holder
* @param _account The holder of the PXUETH token
*/
function claimYield(address _account) external;
/**
* @notice Returns the claimable yield of a holder
* @param _account Holder of the PXUETH
* @return The amount of yield in ETH
*/
function getClaimYield(address _account) external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
import {IBlast, IBlastPoints} from "./interfaces/IBlast.sol";
import {ITracker} from "./interfaces/ITracker.sol";
/**
* @notice Tracker contract for tracking gas usage and gas distribution
*/
contract Tracker is ITracker {
IBlast public blast;
address public wallet;
uint256 public totalGasUsed;
uint256 public totalGasBalance;
mapping(address => uint256) public gasUsed;
bool public isClaimAvailable = false;
constructor(address _blast, address _blastPoints, address _wallet, address _blastPointOperator) {
wallet = _wallet;
blast = IBlast(_blast);
blast.configureClaimableGas();
blast.configureClaimableYield();
IBlastPoints(_blastPoints).configurePointsOperator(_blastPointOperator);
}
modifier onlyWallet() {
if (msg.sender != wallet) {
revert NotAuthorized(msg.sender);
}
_;
}
/**
* @notice Tracks gas usage
*/
modifier trackGas() {
uint256 gas = gasleft();
_;
uint256 txGas = tx.gasprice * (gas - gasleft());
totalGasUsed += txGas;
gasUsed[tx.origin] += txGas;
}
/**
* @notice Can be called by the main wallet only, to claim all gas
*/
function claimAllGas() external onlyWallet {
if (!isClaimAvailable) {
uint256 balaceBefore = address(this).balance;
blast.claimMaxGas(address(this), address(this));
uint256 balanceAfter = address(this).balance;
totalGasBalance += balanceAfter - balaceBefore;
}
}
/**
* @notice Can be called by the main wallet only, to set the gas claim available
*/
function setAvailable() external onlyWallet {
isClaimAvailable = true;
}
/**
* @notice Claim gas portion of the total gas used by the user
*/
function claimGas() external {
if (gasUsed[tx.origin] == 0) {
revert NoGasUsed();
}
if (!isClaimAvailable) {
revert ClaimNotAvailable();
}
uint256 userBalance = gasUsed[tx.origin];
gasUsed[tx.origin] = 0;
(bool success,) = tx.origin.call{value: (userBalance * totalGasBalance) / totalGasUsed}("");
if (!success) {
revert FailedToSendEther();
}
}
receive() external payable {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @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.
*/
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 `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../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 {
}
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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165Upgradeable is Initializable, IERC165 {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
/**
* @notice Tracker
* @author k3rn3lpanic
*/
interface ITracker {
/**
* @notice Thrown when no gas used by the user and user attemps to claim the gas
*/
error NoGasUsed();
/**
* @notice Thrown when the game has not ended yet
*/
error GameNotEndedYet();
/**
* @notice Thrown when the gas is not available to claim
*/
error ClaimNotAvailable();
error NotAuthorized(address _caller);
error FailedToSendEther();
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @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);
}{
"remappings": [
"@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/",
"@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/",
"ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": false,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[],"name":"FailedToSendEther","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_sender","type":"address"},{"indexed":true,"internalType":"address","name":"_game","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"EmergencyWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_sender","type":"address"},{"indexed":true,"internalType":"address","name":"_game","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"YieldClaimed","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GAME_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YIELD_CLAIMABLE_AFTER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blast","outputs":[{"internalType":"contract IBlast","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"claimAllGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"claimYield","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"configureYield","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"emergencyWithdraw","outputs":[{"internalType":"uint256","name":"totalBalance","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getClaimYield","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_blast","type":"address"},{"internalType":"address","name":"_blastPoints","type":"address"},{"internalType":"address","name":"_blastPointOperator","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastDeposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minLastDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalYield","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b50611b9b806100206000396000f3fe6080604052600436106101cd5760003560e01c806370a08231116100f7578063ab40070611610095578063d547741f11610064578063d547741f14610543578063dd62ed3e14610563578063f340fa0114610583578063f3fef3a31461059657600080fd5b8063ab400706146104b9578063b9c3d9e1146104ed578063c0c53b8b14610503578063c299a7731461052357600080fd5b8063999927df116100d1578063999927df14610437578063a217fddf14610457578063a574dc4d1461046c578063a9059cbb1461049957600080fd5b806370a08231146103e257806391d148541461040257806395d89b411461042257600080fd5b806323b872dd1161016f578063313ce5671161013e578063313ce5671461037057806336568abe1461038c5780635a2a1537146103ac5780636ff1c9bc146103c257600080fd5b806323b872dd146102f0578063248a9ca314610310578063272b1323146103305780632f2ff15d1461035057600080fd5b8063095ea7b3116101ab578063095ea7b31461024d5780631552d01f1461026d578063175e1a7d1461028457806318160ddd146102bc57600080fd5b806301418205146101d257806301ffc9a7146101fb57806306fdde031461022b575b600080fd5b3480156101de57600080fd5b506101e860015481565b6040519081526020015b60405180910390f35b34801561020757600080fd5b5061021b610216366004611768565b6105b6565b60405190151581526020016101f2565b34801561023757600080fd5b506102406105ed565b6040516101f29190611799565b34801561025957600080fd5b5061021b610268366004611804565b6106b0565b34801561027957600080fd5b506102826106c8565b005b34801561029057600080fd5b506000546102a4906001600160a01b031681565b6040516001600160a01b0390911681526020016101f2565b3480156102c857600080fd5b507f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace02546101e8565b3480156102fc57600080fd5b5061021b61030b36600461182e565b61072f565b34801561031c57600080fd5b506101e861032b36600461186a565b610753565b34801561033c57600080fd5b5061028261034b366004611883565b610775565b34801561035c57600080fd5b5061028261036b36600461189e565b6107fb565b34801561037c57600080fd5b50604051601281526020016101f2565b34801561039857600080fd5b506102826103a736600461189e565b61081d565b3480156103b857600080fd5b506101e860025481565b3480156103ce57600080fd5b506101e86103dd366004611883565b610850565b3480156103ee57600080fd5b506101e86103fd366004611883565b610993565b34801561040e57600080fd5b5061021b61041d36600461189e565b6109bb565b34801561042e57600080fd5b506102406109f3565b34801561044357600080fd5b50610282610452366004611883565b610a32565b34801561046357600080fd5b506101e8600081565b34801561047857600080fd5b506101e8610487366004611883565b60036020526000908152604090205481565b3480156104a557600080fd5b5061021b6104b4366004611804565b610c11565b3480156104c557600080fd5b506101e87f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa8881565b3480156104f957600080fd5b506101e861a8c081565b34801561050f57600080fd5b5061028261051e3660046118ca565b610c1f565b34801561052f57600080fd5b506101e861053e366004611883565b610e56565b34801561054f57600080fd5b5061028261055e36600461189e565b610f87565b34801561056f57600080fd5b506101e861057e36600461190d565b610fa3565b610282610591366004611883565b610fed565b3480156105a257600080fd5b506102826105b1366004611804565b611099565b60006001600160e01b03198216637965db0b60e01b14806105e757506301ffc9a760e01b6001600160e01b03198316145b92915050565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace038054606091600080516020611b268339815191529161062c90611937565b80601f016020809104026020016040519081016040528092919081815260200182805461065890611937565b80156106a55780601f1061067a576101008083540402835291602001916106a5565b820191906000526020600020905b81548152906001019060200180831161068857829003601f168201915b505050505091505090565b6000336106be8185856111bd565b5060019392505050565b60006106d3816111ca565b600080546040805163784c3b3d60e11b815290516001600160a01b039092169263f098767a9260048084019382900301818387803b15801561071457600080fd5b505af1158015610728573d6000803e3d6000fd5b5050505050565b60003361073d8582856111d7565b61074885858561123c565b506001949350505050565b6000908152600080516020611b46833981519152602052604090206001015490565b6000610780816111ca565b60005460405163662aa11d60e01b81523060048201526001600160a01b0384811660248301529091169063662aa11d906044016020604051808303816000875af11580156107d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f69190611971565b505050565b61080482610753565b61080d816111ca565b610817838361129b565b50505050565b6001600160a01b03811633146108465760405163334bd91960e11b815260040160405180910390fd5b6107f68282611340565b60008061085c816111ca565b60005460405163430021db60e11b8152306004820181905260248201526001600160a01b039091169063860043b6906044016020604051808303816000875af11580156108ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d19190611971565b504791506000836001600160a01b03168360405160006040518083038185875af1925050503d8060008114610922576040519150601f19603f3d011682016040523d82523d6000602084013e610927565b606091505b505090508061094957604051630dcf35db60e41b815260040160405180910390fd5b836001600160a01b03167f2e39961a70a10f4d46383948095ac2752b3ee642a7c76aa827410aaff08c2e518460405161098491815260200190565b60405180910390a25050919050565b6001600160a01b03166000908152600080516020611b26833981519152602052604090205490565b6000918252600080516020611b46833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace048054606091600080516020611b268339815191529161062c90611937565b6000805460405163430021db60e11b8152306004820181905260248201526001600160a01b039091169063860043b6906044016020604051808303816000875af1158015610a84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa89190611971565b90508060016000828254610abc91906119a0565b9091555060009050610acd83610e56565b6001600160a01b03841660009081526003602052604081205491925090610af490426119b3565b905081600003610b045750505050565b6001600160a01b03841660009081526003602052604090204290819055610b2a906113bc565b8160016000828254610b3c91906119b3565b90915550506040516000906001600160a01b0386169084908381818185875af1925050503d8060008114610b8c576040519150601f19603f3d011682016040523d82523d6000602084013e610b91565b606091505b5050905080610bb357604051630dcf35db60e41b815260040160405180910390fd5b7f10d8dedfc0745b8c25ba10b06e304138b251c18dcaadf2d71c7f3214719dc4d18584610be261a8c0866119b3565b604080516001600160a01b03909416845260208401929092529082015260600160405180910390a15050505050565b6000336106be81858561123c565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff16600081158015610c655750825b905060008267ffffffffffffffff166001148015610c825750303b155b905081158015610c90575080155b15610cae5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610cd857845460ff60401b1916600160401b1785555b600080546001600160a01b0319166001600160a01b038a16179055610cfb6113da565b610d4460405180604001604052806009815260200168282c2a9022ba3432b960b91b815250604051806040016040528060068152602001650a0b0aa8aa8960d31b8152506113e4565b6000805460408051634e606c4760e01b815290516001600160a01b0390921692634e606c479260048084019382900301818387803b158015610d8557600080fd5b505af1158015610d99573d6000803e3d6000fd5b50505050610daa6000801b3361129b565b506040516336b91f2b60e01b81526001600160a01b0387811660048301528816906336b91f2b90602401600060405180830381600087803b158015610dee57600080fd5b505af1158015610e02573d6000803e3d6000fd5b505050508315610e4c57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050565b600080610e6283610993565b6001600160a01b0384166000908152600360205260409020549091504290610e8d9061a8c0906119a0565b1115610e9c5750600092915050565b600081118015610ec357506001600160a01b03831660009081526003602052604090205415155b15610f7e576000610ed26113fa565b610edc90426119b3565b6001600160a01b038516600090815260036020526040902054610f029061a8c0906119a0565b610f0c90426119b3565b610f1691906119c6565b90506000610f427f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace025490565b8260015485610f5191906119e8565b610f5b91906119e8565b610f6591906119c6565b9050600154811115610f7657506001545b949350505050565b50600092915050565b610f9082610753565b610f99816111ca565b6108178383611340565b6001600160a01b0391821660009081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace016020908152604080832093909416825291909152205490565b7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa88611017816111ca565b61102082610a32565b61102a8234611412565b6001600160a01b03821660009081526003602052604090204290819055611050906113bc565b6040805134815242602082015233916001600160a01b038516917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a35050565b7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa886110c3816111ca565b6110cc83610a32565b6110d68383611448565b6000836001600160a01b03168360405160006040518083038185875af1925050503d8060008114611123576040519150601f19603f3d011682016040523d82523d6000602084013e611128565b606091505b50506001600160a01b03851660009081526003602052604090204290819055909150611153906113bc565b8061117157604051630dcf35db60e41b815260040160405180910390fd5b6040805184815242602082015233916001600160a01b038716917ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb56791015b60405180910390a350505050565b6107f6838383600161147e565b6111d48133611565565b50565b60006111e38484610fa3565b90506000198114610817578181101561122d57604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b6108178484848403600061147e565b6001600160a01b03831661126657604051634b637e8f60e11b815260006004820152602401611224565b6001600160a01b0382166112905760405163ec442f0560e01b815260006004820152602401611224565b6107f683838361159e565b6000600080516020611b468339815191526112b684846109bb565b611336576000848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556112ec3390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019150506105e7565b60009150506105e7565b6000600080516020611b4683398151915261135b84846109bb565b15611336576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a460019150506105e7565b6002546000036113cb57600255565b8060025411156111d457600255565b6113e26116ce565b565b6113ec6116ce565b6113f68282611717565b5050565b600060025460000361140b57504290565b5060025490565b6001600160a01b03821661143c5760405163ec442f0560e01b815260006004820152602401611224565b6113f66000838361159e565b6001600160a01b03821661147257604051634b637e8f60e11b815260006004820152602401611224565b6113f68260008361159e565b600080516020611b268339815191526001600160a01b0385166114b75760405163e602df0560e01b815260006004820152602401611224565b6001600160a01b0384166114e157604051634a1406b160e11b815260006004820152602401611224565b6001600160a01b0380861660009081526001830160209081526040808320938816835292905220839055811561072857836001600160a01b0316856001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258560405161155691815260200190565b60405180910390a35050505050565b61156f82826109bb565b6113f65760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401611224565b600080516020611b268339815191526001600160a01b0384166115da57818160020160008282546115cf91906119a0565b9091555061164c9050565b6001600160a01b0384166000908152602082905260409020548281101561162d5760405163391434e360e21b81526001600160a01b03861660048201526024810182905260448101849052606401611224565b6001600160a01b03851660009081526020839052604090209083900390555b6001600160a01b03831661166a576002810180548390039055611689565b6001600160a01b03831660009081526020829052604090208054830190555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516111af91815260200190565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166113e257604051631afcd79f60e31b815260040160405180910390fd5b61171f6116ce565b600080516020611b268339815191527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace036117598482611a65565b50600481016108178382611a65565b60006020828403121561177a57600080fd5b81356001600160e01b03198116811461179257600080fd5b9392505050565b60006020808352835180602085015260005b818110156117c7578581018301518582016040015282016117ab565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146117ff57600080fd5b919050565b6000806040838503121561181757600080fd5b611820836117e8565b946020939093013593505050565b60008060006060848603121561184357600080fd5b61184c846117e8565b925061185a602085016117e8565b9150604084013590509250925092565b60006020828403121561187c57600080fd5b5035919050565b60006020828403121561189557600080fd5b611792826117e8565b600080604083850312156118b157600080fd5b823591506118c1602084016117e8565b90509250929050565b6000806000606084860312156118df57600080fd5b6118e8846117e8565b92506118f6602085016117e8565b9150611904604085016117e8565b90509250925092565b6000806040838503121561192057600080fd5b611929836117e8565b91506118c1602084016117e8565b600181811c9082168061194b57607f821691505b60208210810361196b57634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561198357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156105e7576105e761198a565b818103818111156105e7576105e761198a565b6000826119e357634e487b7160e01b600052601260045260246000fd5b500490565b80820281158282048414176105e7576105e761198a565b634e487b7160e01b600052604160045260246000fd5b601f8211156107f6576000816000526020600020601f850160051c81016020861015611a3e5750805b601f850160051c820191505b81811015611a5d57828155600101611a4a565b505050505050565b815167ffffffffffffffff811115611a7f57611a7f6119ff565b611a9381611a8d8454611937565b84611a15565b602080601f831160018114611ac85760008415611ab05750858301515b600019600386901b1c1916600185901b178555611a5d565b600085815260208120601f198616915b82811015611af757888601518255948401946001909101908401611ad8565b5085821015611b155787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fe52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0002dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800a26469706673582212204446635420f1b2b4282ff2320986d3fecda3bf93ff257d28b477542e1919a1d964736f6c63430008170033
Deployed Bytecode
0x6080604052600436106101cd5760003560e01c806370a08231116100f7578063ab40070611610095578063d547741f11610064578063d547741f14610543578063dd62ed3e14610563578063f340fa0114610583578063f3fef3a31461059657600080fd5b8063ab400706146104b9578063b9c3d9e1146104ed578063c0c53b8b14610503578063c299a7731461052357600080fd5b8063999927df116100d1578063999927df14610437578063a217fddf14610457578063a574dc4d1461046c578063a9059cbb1461049957600080fd5b806370a08231146103e257806391d148541461040257806395d89b411461042257600080fd5b806323b872dd1161016f578063313ce5671161013e578063313ce5671461037057806336568abe1461038c5780635a2a1537146103ac5780636ff1c9bc146103c257600080fd5b806323b872dd146102f0578063248a9ca314610310578063272b1323146103305780632f2ff15d1461035057600080fd5b8063095ea7b3116101ab578063095ea7b31461024d5780631552d01f1461026d578063175e1a7d1461028457806318160ddd146102bc57600080fd5b806301418205146101d257806301ffc9a7146101fb57806306fdde031461022b575b600080fd5b3480156101de57600080fd5b506101e860015481565b6040519081526020015b60405180910390f35b34801561020757600080fd5b5061021b610216366004611768565b6105b6565b60405190151581526020016101f2565b34801561023757600080fd5b506102406105ed565b6040516101f29190611799565b34801561025957600080fd5b5061021b610268366004611804565b6106b0565b34801561027957600080fd5b506102826106c8565b005b34801561029057600080fd5b506000546102a4906001600160a01b031681565b6040516001600160a01b0390911681526020016101f2565b3480156102c857600080fd5b507f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace02546101e8565b3480156102fc57600080fd5b5061021b61030b36600461182e565b61072f565b34801561031c57600080fd5b506101e861032b36600461186a565b610753565b34801561033c57600080fd5b5061028261034b366004611883565b610775565b34801561035c57600080fd5b5061028261036b36600461189e565b6107fb565b34801561037c57600080fd5b50604051601281526020016101f2565b34801561039857600080fd5b506102826103a736600461189e565b61081d565b3480156103b857600080fd5b506101e860025481565b3480156103ce57600080fd5b506101e86103dd366004611883565b610850565b3480156103ee57600080fd5b506101e86103fd366004611883565b610993565b34801561040e57600080fd5b5061021b61041d36600461189e565b6109bb565b34801561042e57600080fd5b506102406109f3565b34801561044357600080fd5b50610282610452366004611883565b610a32565b34801561046357600080fd5b506101e8600081565b34801561047857600080fd5b506101e8610487366004611883565b60036020526000908152604090205481565b3480156104a557600080fd5b5061021b6104b4366004611804565b610c11565b3480156104c557600080fd5b506101e87f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa8881565b3480156104f957600080fd5b506101e861a8c081565b34801561050f57600080fd5b5061028261051e3660046118ca565b610c1f565b34801561052f57600080fd5b506101e861053e366004611883565b610e56565b34801561054f57600080fd5b5061028261055e36600461189e565b610f87565b34801561056f57600080fd5b506101e861057e36600461190d565b610fa3565b610282610591366004611883565b610fed565b3480156105a257600080fd5b506102826105b1366004611804565b611099565b60006001600160e01b03198216637965db0b60e01b14806105e757506301ffc9a760e01b6001600160e01b03198316145b92915050565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace038054606091600080516020611b268339815191529161062c90611937565b80601f016020809104026020016040519081016040528092919081815260200182805461065890611937565b80156106a55780601f1061067a576101008083540402835291602001916106a5565b820191906000526020600020905b81548152906001019060200180831161068857829003601f168201915b505050505091505090565b6000336106be8185856111bd565b5060019392505050565b60006106d3816111ca565b600080546040805163784c3b3d60e11b815290516001600160a01b039092169263f098767a9260048084019382900301818387803b15801561071457600080fd5b505af1158015610728573d6000803e3d6000fd5b5050505050565b60003361073d8582856111d7565b61074885858561123c565b506001949350505050565b6000908152600080516020611b46833981519152602052604090206001015490565b6000610780816111ca565b60005460405163662aa11d60e01b81523060048201526001600160a01b0384811660248301529091169063662aa11d906044016020604051808303816000875af11580156107d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f69190611971565b505050565b61080482610753565b61080d816111ca565b610817838361129b565b50505050565b6001600160a01b03811633146108465760405163334bd91960e11b815260040160405180910390fd5b6107f68282611340565b60008061085c816111ca565b60005460405163430021db60e11b8152306004820181905260248201526001600160a01b039091169063860043b6906044016020604051808303816000875af11580156108ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d19190611971565b504791506000836001600160a01b03168360405160006040518083038185875af1925050503d8060008114610922576040519150601f19603f3d011682016040523d82523d6000602084013e610927565b606091505b505090508061094957604051630dcf35db60e41b815260040160405180910390fd5b836001600160a01b03167f2e39961a70a10f4d46383948095ac2752b3ee642a7c76aa827410aaff08c2e518460405161098491815260200190565b60405180910390a25050919050565b6001600160a01b03166000908152600080516020611b26833981519152602052604090205490565b6000918252600080516020611b46833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace048054606091600080516020611b268339815191529161062c90611937565b6000805460405163430021db60e11b8152306004820181905260248201526001600160a01b039091169063860043b6906044016020604051808303816000875af1158015610a84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa89190611971565b90508060016000828254610abc91906119a0565b9091555060009050610acd83610e56565b6001600160a01b03841660009081526003602052604081205491925090610af490426119b3565b905081600003610b045750505050565b6001600160a01b03841660009081526003602052604090204290819055610b2a906113bc565b8160016000828254610b3c91906119b3565b90915550506040516000906001600160a01b0386169084908381818185875af1925050503d8060008114610b8c576040519150601f19603f3d011682016040523d82523d6000602084013e610b91565b606091505b5050905080610bb357604051630dcf35db60e41b815260040160405180910390fd5b7f10d8dedfc0745b8c25ba10b06e304138b251c18dcaadf2d71c7f3214719dc4d18584610be261a8c0866119b3565b604080516001600160a01b03909416845260208401929092529082015260600160405180910390a15050505050565b6000336106be81858561123c565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff16600081158015610c655750825b905060008267ffffffffffffffff166001148015610c825750303b155b905081158015610c90575080155b15610cae5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610cd857845460ff60401b1916600160401b1785555b600080546001600160a01b0319166001600160a01b038a16179055610cfb6113da565b610d4460405180604001604052806009815260200168282c2a9022ba3432b960b91b815250604051806040016040528060068152602001650a0b0aa8aa8960d31b8152506113e4565b6000805460408051634e606c4760e01b815290516001600160a01b0390921692634e606c479260048084019382900301818387803b158015610d8557600080fd5b505af1158015610d99573d6000803e3d6000fd5b50505050610daa6000801b3361129b565b506040516336b91f2b60e01b81526001600160a01b0387811660048301528816906336b91f2b90602401600060405180830381600087803b158015610dee57600080fd5b505af1158015610e02573d6000803e3d6000fd5b505050508315610e4c57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050565b600080610e6283610993565b6001600160a01b0384166000908152600360205260409020549091504290610e8d9061a8c0906119a0565b1115610e9c5750600092915050565b600081118015610ec357506001600160a01b03831660009081526003602052604090205415155b15610f7e576000610ed26113fa565b610edc90426119b3565b6001600160a01b038516600090815260036020526040902054610f029061a8c0906119a0565b610f0c90426119b3565b610f1691906119c6565b90506000610f427f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace025490565b8260015485610f5191906119e8565b610f5b91906119e8565b610f6591906119c6565b9050600154811115610f7657506001545b949350505050565b50600092915050565b610f9082610753565b610f99816111ca565b6108178383611340565b6001600160a01b0391821660009081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace016020908152604080832093909416825291909152205490565b7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa88611017816111ca565b61102082610a32565b61102a8234611412565b6001600160a01b03821660009081526003602052604090204290819055611050906113bc565b6040805134815242602082015233916001600160a01b038516917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a35050565b7f6a64baf327d646d1bca72653e2a075d15fd6ac6d8cbd7f6ee03fc55875e0fa886110c3816111ca565b6110cc83610a32565b6110d68383611448565b6000836001600160a01b03168360405160006040518083038185875af1925050503d8060008114611123576040519150601f19603f3d011682016040523d82523d6000602084013e611128565b606091505b50506001600160a01b03851660009081526003602052604090204290819055909150611153906113bc565b8061117157604051630dcf35db60e41b815260040160405180910390fd5b6040805184815242602082015233916001600160a01b038716917ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb56791015b60405180910390a350505050565b6107f6838383600161147e565b6111d48133611565565b50565b60006111e38484610fa3565b90506000198114610817578181101561122d57604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b6108178484848403600061147e565b6001600160a01b03831661126657604051634b637e8f60e11b815260006004820152602401611224565b6001600160a01b0382166112905760405163ec442f0560e01b815260006004820152602401611224565b6107f683838361159e565b6000600080516020611b468339815191526112b684846109bb565b611336576000848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556112ec3390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019150506105e7565b60009150506105e7565b6000600080516020611b4683398151915261135b84846109bb565b15611336576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a460019150506105e7565b6002546000036113cb57600255565b8060025411156111d457600255565b6113e26116ce565b565b6113ec6116ce565b6113f68282611717565b5050565b600060025460000361140b57504290565b5060025490565b6001600160a01b03821661143c5760405163ec442f0560e01b815260006004820152602401611224565b6113f66000838361159e565b6001600160a01b03821661147257604051634b637e8f60e11b815260006004820152602401611224565b6113f68260008361159e565b600080516020611b268339815191526001600160a01b0385166114b75760405163e602df0560e01b815260006004820152602401611224565b6001600160a01b0384166114e157604051634a1406b160e11b815260006004820152602401611224565b6001600160a01b0380861660009081526001830160209081526040808320938816835292905220839055811561072857836001600160a01b0316856001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258560405161155691815260200190565b60405180910390a35050505050565b61156f82826109bb565b6113f65760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401611224565b600080516020611b268339815191526001600160a01b0384166115da57818160020160008282546115cf91906119a0565b9091555061164c9050565b6001600160a01b0384166000908152602082905260409020548281101561162d5760405163391434e360e21b81526001600160a01b03861660048201526024810182905260448101849052606401611224565b6001600160a01b03851660009081526020839052604090209083900390555b6001600160a01b03831661166a576002810180548390039055611689565b6001600160a01b03831660009081526020829052604090208054830190555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516111af91815260200190565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166113e257604051631afcd79f60e31b815260040160405180910390fd5b61171f6116ce565b600080516020611b268339815191527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace036117598482611a65565b50600481016108178382611a65565b60006020828403121561177a57600080fd5b81356001600160e01b03198116811461179257600080fd5b9392505050565b60006020808352835180602085015260005b818110156117c7578581018301518582016040015282016117ab565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146117ff57600080fd5b919050565b6000806040838503121561181757600080fd5b611820836117e8565b946020939093013593505050565b60008060006060848603121561184357600080fd5b61184c846117e8565b925061185a602085016117e8565b9150604084013590509250925092565b60006020828403121561187c57600080fd5b5035919050565b60006020828403121561189557600080fd5b611792826117e8565b600080604083850312156118b157600080fd5b823591506118c1602084016117e8565b90509250929050565b6000806000606084860312156118df57600080fd5b6118e8846117e8565b92506118f6602085016117e8565b9150611904604085016117e8565b90509250925092565b6000806040838503121561192057600080fd5b611929836117e8565b91506118c1602084016117e8565b600181811c9082168061194b57607f821691505b60208210810361196b57634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561198357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156105e7576105e761198a565b818103818111156105e7576105e761198a565b6000826119e357634e487b7160e01b600052601260045260246000fd5b500490565b80820281158282048414176105e7576105e761198a565b634e487b7160e01b600052604160045260246000fd5b601f8211156107f6576000816000526020600020601f850160051c81016020861015611a3e5750805b601f850160051c820191505b81811015611a5d57828155600101611a4a565b505050505050565b815167ffffffffffffffff811115611a7f57611a7f6119ff565b611a9381611a8d8454611937565b84611a15565b602080601f831160018114611ac85760008415611ab05750858301515b600019600386901b1c1916600185901b178555611a5d565b600085815260208120601f198616915b82811015611af757888601518255948401946001909101908401611ad8565b5085821015611b155787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fe52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0002dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800a26469706673582212204446635420f1b2b4282ff2320986d3fecda3bf93ff257d28b477542e1919a1d964736f6c63430008170033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.